Tar and absolute pathnames

Edward Wilkinson edward at csvaxa.UUCP
Tue Mar 8 10:31:16 AEST 1988


I, too, have had this problem.  So I wrote a small  fix to the  PD tar
floating around. Not very fancy, but it seems to work:

----------cut-here-------------cut-here-------------cut-here----------

*** tar.c      Thu Mar  3 15:50:30 1988
--- tar.c~     Mon Oct 26 18:33:19 1987
***************
*** 102,108
               ar_file = DEF_AR_FILE;  /* From Makefile */

       /* Parse options */
!      while ((c = getoldopt(argc, argv, "b:BcdDf:ahikmopstT:vxzZ")
               ) != EOF) {
               switch (c) {


--- 102,108 -----
               ar_file = DEF_AR_FILE;  /* From Makefile */

       /* Parse options */
!      while ((c = getoldopt(argc, argv, "b:BcdDf:hikmopstT:vxzZ")
               ) != EOF) {
               switch (c) {

***************
*** 179,188
                       f_namefile++;
                       break;

-              case 'a':
-                      f_crunch_slash++;
-                      break;
-
               case 'v':
                       f_verbose++;
                       break;

--- 179,184 -----
                       f_namefile++;
                       break;

               case 'v':
                       f_verbose++;
                       break;
***************
*** 215,221
  {

       fputs("tar: valid options:\n\
- -a   remove any leading / from absolute pathnames when extracting\n\
  -b N blocking factor N (block size = Nx512 bytes)\n\
  -B   reblock as we read (for reading 4.2BSD pipes)\n\
  -c   create an archive\n\

--- 211,216 -----
  {

       fputs("tar: valid options:\n\
  -b N blocking factor N (block size = Nx512 bytes)\n\
  -B   reblock as we read (for reading 4.2BSD pipes)\n\
  -c   create an archive\n\
*** tar.h      Thu Mar  3 14:56:04 1988
--- tar.h~     Mon Oct 26 18:33:22 1987
***************
*** 109,115
  TAR_EXTERN char      f_verbose;              /* -v */
  TAR_EXTERN char      f_extract;              /* -x */
  TAR_EXTERN char      f_compress;             /* -z */
- TAR_EXTERN char      f_crunch_slash;         /* -a */

  /*
   * We now default to Unix Standard format rather than 4.2BSD tar format.

--- 109,114 -----
  TAR_EXTERN char      f_verbose;              /* -v */
  TAR_EXTERN char      f_extract;              /* -x */
  TAR_EXTERN char      f_compress;             /* -z */

  /*
   * We now default to Unix Standard format rather than 4.2BSD tar format.
*** extract.c  Thu Mar  3 15:38:37 1988
--- extract.c~ Mon Oct 26 18:33:19 1987
***************
*** 106,120
       if (f_verbose)
               print_header(stdout);

-      /* if -a then crunch initial / on pathname */
-      if (f_crunch_slash)
-        if (head->header.name[0] == '/') {
-          char tmp[4096];
-
-          strcpy(tmp, head->header.name + 1);
-          strcpy(head->header.name, tmp);
-        }
-
       switch (head->header.linkflag) {

       default:

--- 106,111 -----
       if (f_verbose)
               print_header(stdout);

       switch (head->header.linkflag) {

       d



More information about the Comp.unix.wizards mailing list