#!/usr/bin/perl -w # # This is not the most effecient, but works for a small floppy disk # # It reads a 512-byte chunk of data, runs file on it and displays the # type # use strict; my $FILE = "/usr/local/task-1.60/bin/file"; if (scalar @ARGV != 1) { print "Missing Image\n"; exit(1); } my $img = shift (@ARGV); open (IN, "<$img") or die ("Error opening $img"); my $buf; my $cnt = 0; while (read (IN, $buf, 512)) { open (OUT,">/tmp/block") or die ("error opening /tmp/block"); print OUT $buf; close(OUT); my $out = ` $FILE -b /tmp/block`; chomp $out; $cnt++; next if ($out =~ /^data$/); next if ($out =~ /^ISO\-8859 text/); print "$cnt: $out\n"; }