From: utzoo!decvax!harpo!eagle!mhuxt!mhuxa!houxm!5941ux!machaids!hocda!spanky!ihnp4!stolaf!borman Newsgroups: net.unix-wizards Title: tar "t" option Article-I.D.: stolaf.887 Posted: Tue Apr 19 20:29:23 1983 Received: Fri Apr 22 07:50:15 1983 Ah, yes, the missing code for the "t" option of tar(1). We are running V7, and this past summer on of my fellow workers complained about the "t" option not working. I went in, found out that the code didn't exist, so I wrote the stuff. It's not that much to add, my fixes follow. We have been running for months and no one has complained. -Dave Borman, ihnp4!stolaf!borman *** tar.org Tue Apr 19 20:10:58 1983 --- tar.c Fri May 21 16:54:17 1982 *************** *** 4,9 * tar - tape archiver */ #include #include --- 4,12 ----- * tar - tape archiver */ + #define T_FIX /* Modification so that the t flag will only print */ + /* the entries of the files listed, and all the files */ + /* if none are listed. DAB 5-21-81 */ #include #include *************** *** 194,199 fprintf(stderr, "tar: cannot open %s\n", usefile); done(1); } dotable(); } else --- 197,205 ----- fprintf(stderr, "tar: cannot open %s\n", usefile); done(1); } + #ifdef T_FIX + dotable(argv); + #else dotable(); + #endif T_FIX } *************** *** 524,529 } } dotable() { register char **cp; --- 531,540 ----- } } + #ifdef T_FIX + dotable(argv) + char **argv; + #else dotable() + #endif T_FIX { register char **cp; for (;;) { *************** *** 531,536 getdir(); if (endtape()) break; if (vflag) longt(&stbuf); printf("%s", dblock.dbuf.name); --- 543,559 ----- getdir(); if (endtape()) break; + #ifdef T_FIX + if( *argv != 0 ){ + for( cp = argv; *cp; cp++) + if( prefix( *cp, dblock.dbuf.name) ) + break; + if ( !*cp ){ + passtape(); + continue; + } + } + #endif T_FIX if (vflag) longt(&stbuf); printf("%s", dblock.dbuf.name);