home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / fj / question / unix / 686 < prev    next >
Encoding:
Text File  |  1993-01-11  |  2.0 KB  |  59 lines

  1. Newsgroups: fj.questions.unix
  2. Path: sparky!uunet!ccut!news.u-tokyo.ac.jp!wnoc-tyo-news!sranha!sranhd!sran230!utashiro
  3. From: utashiro@sran230.sra.co.jp (Kazumasa Utashiro)
  4. Subject: Re: recover over-written tar floppy
  5. References: <SHIBATA.93Jan4172938@tutuser.tut.ac.jp>
  6. Organization: Software Research Associates, Inc., Japan
  7. Date: Mon, 11 Jan 1993 08:03:21 GMT
  8. Message-ID: <C0oJpn.CLx@sran230.sra.co.jp>
  9. Distribution: fj
  10. Lines: 47
  11.  
  12. In article <SHIBATA.93Jan4172938@tutuser.tut.ac.jp>
  13.     shibata@tutuser.tut.ac.jp (SHIBATA Ryoichi) writes:
  14. >> $B$=$7$F!"$3$l$rFI$_$@$=$&$H$7$?$N$G$9$,!"(J
  15. >>   tar xvf /dev/rfh0a
  16. >> $B$H$7$J$1$l$P$J$i$J$$$H$3$m$r!"(J
  17. >>   tar cvf /dev/rhf0a
  18. >> $B$H$7$F$7$^$$!"@hF,$K2?$+$r>e=q$-$7$?>uBV$K$J$C$F$7$^$$$^$7$?!#(J
  19. >> $B$=$N$?$a!"(Jtar tvf $B$d(J tar xvf $B$7$F$b!"2?$bI=<($5$l$^$;$s!#(J
  20. >> 
  21. >> $B;O$a$KJ]B8$7$?FbMF$O?tI4(JKB$B$G$"$j!"$b$7%7!<%1%s%7%c%k$K(J
  22. >> $B>e=q$-$5$l$k$N$G$"$l$P!";D$j$r2?$H$+FI$_$@$7$?$$$H(J
  23. >> $B;W$C$F$$$^$9!#(J
  24. >> $B$J$*!"4D6-$O(J NWS-3260 + NEWS-0S4.2R $B$G$9!#(J
  25.  
  26. 1$BJ,$G:n$C$?!"L>A0$rIU$1$k5$$K$b$J$i$J$$4s$;=8$a$N%W%m%0%i%`(J
  27. $B$G$9$,!"$3$s$J$N$G$&$^$/$$$+$J$$$G$7$g$&$+!#(J
  28.  
  29. ----------------------------------------------------------------------
  30. #!/usr/local/bin/perl
  31.  
  32. $tar_header_format = "a100 a8 a8 a8 a12 a12 a8 a a100 a*";
  33. ($tar_name, $tar_mode, $tar_uid, $tar_gid, $tar_size,
  34.     $tar_mtime, $tar_chksum, $tar_linkflag, $tar_linkname, $tar_pad) = (0..9);
  35.  
  36. sub tarheader {
  37.     ($_[$tar_mode]  =~ /^[ 0-7]{7}\0$/)    &&
  38.     ($_[$tar_uid]   =~ /^ *\d+ *\0$/)    &&
  39.     ($_[$tar_gid]   =~ /^ *\d+ *\0$/)    &&
  40.     ($_[$tar_size]  =~ /^ *\d+ *\0?$/)    &&
  41.     ($_[$tar_mtime] =~ /^ *\d+ $/);    ## Is this enough?
  42. }
  43.  
  44. while (read(STDIN, $_, 512)) {
  45.     if (/\0/ && &tarheader(unpack($tar_header_format, $_))) {
  46.     printf STDERR "skipped %d block%s\n", $skip, 's' x ($skip > 1);
  47.     print;
  48.     last;
  49.     }
  50.     $skip++;
  51. }
  52.  
  53. print while read(STDIN, $_, 8192);
  54. ----------------------------------------------------------------------
  55.  
  56. $BBLL\$J$i!"%A%'%C%/$r$b$C$H87$7$/$7$F$_$k$H$$$$$H;W$$$^$9!#(J
  57.  
  58. --utashiro
  59.