[comp.os.minix] "smart" tar memory fix

phil@unicorn.WWU.EDU (Phil Nelson) (04/10/90)

Well, since I asked the original question about memory problems with tar,
here is my cents worth.  As mentioned by other people, the problem was due
to the memory taken by remembering all names included into the tar file
for detection of linked files.  Someone mentioned that you should keep
only the file names that have a link count greater than 1.  Well, here is
my one line fix that allowed me to dump my 10meg hard disk using tar and
vol.  It changes tar to "remember" only files with a link count greater
than 1.   (OK, only files with a link count not equal to 1.)  

There are two other fixes that would help with this problem.  (They are 
not done in my fix that follows.)

  1)  Delete a name when tar has encountered all link names.  (suggested
      by someone else.)

  2)  Change the routine that saves the name to save only the number of
      characters used in the path name instead of a static array as it
      currently does.


So here is my fix that makes tar keep track only file names with multiple
links.  This is relative to the 1.5.5 tar.c original.

-------------------cut here-------------------
begin 664 tar.c.cdif
M*BHJ('1A<BYC+F]R:6<)1G)I($%P<B`@-B`Q,3HU.3HP.2`Q.3DP"BTM+2!T
M87(N8PE&<FD@07!R("`V(#$T.C,Q.C4U(#$Y.3`**BHJ*BHJ*BHJ*BHJ*BHJ
M"BHJ*B`W,SDL-S0U("HJ*BH*("`@('-T<G5C="!L:6YK("IN97<["B`@("!C
M:&%R("IM86QL;V,H*3L*("`*(2`@(&EF("@J9FEL92`]/2`P*2!R971U<FX[
M"B`@("!N97<@/2`H<W1R=6-T(&QI;FL@*BD@;6%L;&]C*'-I>F5O9BAS=')U
M8W0@;&EN:RDI.PH@("`@:68@*&YE=R`]/2!.54Q,*2!["B`@"7!R:6YT*")/
M=70@;V8@;65M;W)Y7&XB*3L*+2TM(#<S.2PW-#4@+2TM+0H@("`@<W1R=6-T
M(&QI;FL@*FYE=SL*("`@(&-H87(@*FUA;&QO8R@I.PH@(`HA("`@:68@*"@J
M9FEL92`]/2`P*2!\?"`H<W0M/G-T7VYL:6YK(#T](#$I*2!R971U<FX["B`@
M("!N97<@/2`H<W1R=6-T(&QI;FL@*BD@;6%L;&]C*'-I>F5O9BAS=')U8W0@
M;&EN:RDI.PH@("`@:68@*&YE=R`]/2!.54Q,*2!["B`@"7!R:6YT*")/=70@
/;V8@;65M;W)Y7&XB*3L*
`
end