home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 May / Chip_2000-05_cd2.bin / dosutils / gtar109 / patches.os2 < prev    next >
Text File  |  1991-01-14  |  24KB  |  854 lines

  1. diff -cbBw orig/buffer.c tar/buffer.c
  2. *** orig/buffer.c    Tue Nov 06 19:00:30 1990
  3. --- tar/buffer.c    Sat Oct 27 21:07:38 1990
  4. ***************
  5. *** 31,37 ****
  6.   #include <sys/stat.h>
  7.   #include <signal.h>
  8.   
  9. ! #ifndef MSDOS
  10.   #include <sys/ioctl.h>
  11.   #if !defined(USG) || defined(HAVE_MTIO)
  12.   #include <sys/mtio.h>
  13. --- 31,39 ----
  14.   #include <sys/stat.h>
  15.   #include <signal.h>
  16.   
  17. ! #ifdef MSDOS
  18. ! #include <io.h>
  19. ! #else
  20.   #include <sys/ioctl.h>
  21.   #if !defined(USG) || defined(HAVE_MTIO)
  22.   #include <sys/mtio.h>
  23. ***************
  24. *** 48,54 ****
  25. --- 50,58 ----
  26.   # include <sys/file.h>
  27.   #endif
  28.   
  29. + #ifndef MSDOS
  30.   extern int errno;
  31. + #endif
  32.   
  33.   #include "tar.h"
  34.   #include "port.h"
  35. ***************
  36. *** 139,145 ****
  37.   /*
  38.    * Have we hit EOF yet?
  39.    */
  40. ! static int    eof;
  41.   
  42.   /* JF we're reading, but we just read the last record and its time to update */
  43.   extern time_to_start_writing;
  44. --- 143,149 ----
  45.   /*
  46.    * Have we hit EOF yet?
  47.    */
  48. ! static int      _eof;
  49.   
  50.   /* JF we're reading, but we just read the last record and its time to update */
  51.   extern time_to_start_writing;
  52. ***************
  53. *** 167,174 ****
  54.   void
  55.   reset_eof()
  56.   {
  57. !     if(eof) {
  58. !         eof=0;
  59.           ar_record=ar_block;
  60.           ar_last=ar_block+blocking;
  61.           ar_reading=0;
  62. --- 171,178 ----
  63.   void
  64.   reset_eof()
  65.   {
  66. !     if(_eof) {
  67. !         _eof=0;
  68.           ar_record=ar_block;
  69.           ar_last=ar_block+blocking;
  70.           ar_reading=0;
  71. ***************
  72. *** 184,194 ****
  73.   findrec()
  74.   {
  75.       if (ar_record == ar_last) {
  76. !         if (eof)
  77.               return (union record *)NULL;    /* EOF */
  78.           flush_archive();
  79.           if (ar_record == ar_last) {
  80. !             eof++;
  81.               return (union record *)NULL;    /* EOF */
  82.           }
  83.       }
  84. --- 188,198 ----
  85.   findrec()
  86.   {
  87.       if (ar_record == ar_last) {
  88. !                 if (_eof)
  89.               return (union record *)NULL;    /* EOF */
  90.           flush_archive();
  91.           if (ar_record == ar_last) {
  92. !                         _eof++;
  93.               return (union record *)NULL;    /* EOF */
  94.           }
  95.       }
  96. ***************
  97. *** 1201,1206 ****
  98. --- 1205,1214 ----
  99.           system(info_script);
  100.       else for(;;) {
  101.           fprintf(msg_file,"Prepare volume #%d and hit return: ",volno);
  102. + #ifdef MSDOS
  103. +                 while (kbhit())
  104. +                   getch();
  105. + #endif
  106.           if(fgets(inbuf,sizeof(inbuf),read_file)==0 || inbuf[0]=='\n')
  107.               break;
  108.           switch(inbuf[0]) {
  109. diff -cbBw orig/create.c tar/create.c
  110. *** orig/create.c    Tue Nov 06 19:00:32 1990
  111. --- tar/create.c    Sat Oct 27 21:24:24 1990
  112. ***************
  113. *** 26,32 ****
  114. --- 26,34 ----
  115.    */
  116.   #include <sys/types.h>
  117.   #include <sys/stat.h>
  118. + #ifndef MSDOS
  119.   #include <sys/file.h>
  120. + #endif
  121.   #include <stdio.h>
  122.   
  123.   /* JF: this one is my fault */
  124. ***************
  125. *** 245,255 ****
  126. --- 247,259 ----
  127.           return;
  128.       }
  129.   
  130. + #ifndef MSDOS
  131.       /* See if we are trying to dump the archive */
  132.       if(ar_dev && hstat.st_dev==ar_dev && hstat.st_ino==ar_ino) {
  133.           msg("%s is the archive; not dumped",p);
  134.           return;
  135.       }
  136. + #endif
  137.       /*
  138.        * Check for multiple links.
  139.        *
  140. diff -cbBw orig/diffarch.c tar/diffarch.c
  141. *** orig/diffarch.c    Tue Nov 06 19:01:54 1990
  142. --- tar/diffarch.c    Sat Oct 27 21:37:02 1990
  143. ***************
  144. *** 45,50 ****
  145. --- 45,54 ----
  146.   #include <fcntl.h>
  147.   #endif
  148.   
  149. + #ifdef MSDOS
  150. + #include <fcntl.h>
  151. + #endif
  152.   /* Some systems don't have these #define's -- we fake it here. */
  153.   #ifndef O_RDONLY
  154.   #define    O_RDONLY    0
  155. ***************
  156. *** 57,63 ****
  157. --- 61,69 ----
  158.   #define lstat stat
  159.   #endif
  160.   
  161. + #ifndef MSDOS
  162.   extern int errno;            /* From libc.a */
  163. + #endif
  164.   extern char *valloc();            /* From libc.a */
  165.   
  166.   #include "tar.h"
  167. ***************
  168. *** 187,193 ****
  169.               goto quit;
  170.           }
  171.   
  172. !         diff_fd = open(head->header.name, O_NDELAY|O_RDONLY);
  173.   
  174.           if (diff_fd < 0 && !f_absolute_paths) {
  175.               char tmpbuf[NAMSIZ+2];
  176. --- 193,199 ----
  177.               goto quit;
  178.           }
  179.   
  180. !         diff_fd = open(head->header.name, O_NDELAY|O_RDONLY|O_BINARY);
  181.   
  182.           if (diff_fd < 0 && !f_absolute_paths) {
  183.               char tmpbuf[NAMSIZ+2];
  184. ***************
  185. *** 194,200 ****
  186.   
  187.               tmpbuf[0]='/';
  188.               strcpy(&tmpbuf[1],head->header.name);
  189. !             diff_fd=open(tmpbuf, O_NDELAY|O_RDONLY);
  190.           }
  191.           if (diff_fd < 0) {
  192.               msg_perror("cannot open %s",head->header.name);
  193. --- 200,206 ----
  194.   
  195.               tmpbuf[0]='/';
  196.               strcpy(&tmpbuf[1],head->header.name);
  197. !             diff_fd=open(tmpbuf, O_NDELAY|O_RDONLY|O_BINARY);
  198.           }
  199.           if (diff_fd < 0) {
  200.               msg_perror("cannot open %s",head->header.name);
  201. ***************
  202. *** 353,359 ****
  203.               break;
  204.           }
  205.   
  206. !         diff_fd = open(head->header.name, O_NDELAY|O_RDONLY);
  207.   
  208.           if (diff_fd < 0) {
  209.               msg_perror("cannot open file %s",head->header.name);
  210. --- 359,365 ----
  211.               break;
  212.           }
  213.   
  214. !         diff_fd = open(head->header.name, O_NDELAY|O_RDONLY|O_BINARY);
  215.   
  216.           if (diff_fd < 0) {
  217.               msg_perror("cannot open file %s",head->header.name);
  218. diff -cbBw orig/extract.c tar/extract.c
  219. *** orig/extract.c    Tue Nov 06 19:00:40 1990
  220. --- tar/extract.c    Sun Oct 28 14:53:02 1990
  221. ***************
  222. *** 62,68 ****
  223. --- 62,70 ----
  224.   #include "open3.h"
  225.   #endif
  226.   
  227. + #ifndef MSDOS
  228.   extern int errno;            /* From libc.a */
  229. + #endif
  230.   extern time_t time();            /* From libc.a */
  231.   extern char *index();            /* From libc.a or port.c */
  232.   
  233. ***************
  234. *** 173,178 ****
  235. --- 175,185 ----
  236.           }
  237.       }
  238.   
  239. + #ifdef MSDOS
  240. +         if ( IsFileSystemFAT(head->header.name + skipcrud) )
  241. +           ChangeNameForFAT(head->header.name + skipcrud);
  242. + #endif
  243.       switch (head->header.linkflag) {
  244.   
  245.       default:
  246. ***************
  247. *** 486,495 ****
  248.                   acc_upd_times[0]=hstat.st_atime;
  249.               else acc_upd_times[0] = now;             /* Accessed now */
  250.               acc_upd_times[1] = hstat.st_mtime; /* Mod'd */
  251. !             if (utime(skipcrud+head->header.name,
  252. !                 acc_upd_times) < 0) {
  253.                   msg_perror("couldn't change access and modification times of %s",skipcrud+head->header.name);
  254. !             }
  255.           }
  256.   
  257.       quit:
  258. --- 493,507 ----
  259.                   acc_upd_times[0]=hstat.st_atime;
  260.               else acc_upd_times[0] = now;             /* Accessed now */
  261.               acc_upd_times[1] = hstat.st_mtime; /* Mod'd */
  262. ! #ifdef MSDOS
  263. !                         chmod(skipcrud+head->header.name, S_IWRITE);
  264. !                         if (utime(skipcrud+head->header.name, acc_upd_times) < 0)
  265. !                           msg_perror("couldn't change modification time of %s",skipcrud+head->header.name);
  266. !                         chmod(skipcrud+head->header.name, (int)hstat.st_mode);
  267. ! #else
  268. !                         if (utime(skipcrud+head->header.name, acc_upd_times) < 0)
  269.                   msg_perror("couldn't change access and modification times of %s",skipcrud+head->header.name);
  270. ! #endif
  271.           }
  272.   
  273.       quit:
  274. ***************
  275. *** 593,599 ****
  276. --- 605,616 ----
  277.                 skipcrud+head->header.name);
  278.           }
  279.   
  280. + #ifdef MSDOS
  281. +                 goto quit;  /* no chmod() and chown() allowed on directories
  282. +                                under MS-DOS and OS/2 1.1 */
  283. + #else
  284.           goto set_filestat;
  285. + #endif
  286.           /* FIXME, Remember timestamps for after files created? */
  287.           /* FIXME, change mode after files created (if was R/O dir) */
  288.       case LF_VOLHDR:
  289. diff -cbBw orig/getdate.y tar/getdate.y
  290. *** orig/getdate.y    Tue Nov 06 19:00:40 1990
  291. --- tar/getdate.y    Sat Oct 27 20:43:42 1990
  292. ***************
  293. *** 58,63 ****
  294. --- 58,65 ----
  295.   static time_t timeconv();
  296.   static time_t daylcorr();
  297.   static lookup();
  298. + static yylex();
  299. + static yyerror();
  300.   
  301.   static int yylex ();
  302.   #define yyparse getdate_yyparse
  303. diff -cbBw orig/getopt.c tar/getopt.c
  304. *** orig/getopt.c    Tue Nov 06 19:00:42 1990
  305. --- tar/getopt.c    Sat Oct 27 23:04:34 1990
  306. ***************
  307. *** 15,25 ****
  308.      along with this program; if not, write to the Free Software
  309.      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  310.   
  311. ! #ifdef __STDC__
  312.   #define CONST const
  313.   #else
  314.   #define CONST
  315.   #endif
  316.   
  317.   /* This version of `getopt' appears to the caller like standard Unix `getopt'
  318.      but it behaves differently for the user, since it allows the user
  319. --- 15,28 ----
  320.      along with this program; if not, write to the Free Software
  321.      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  322.   
  323. ! #if defined(__STDC__) || defined(MSDOS)
  324.   #define CONST const
  325.   #else
  326.   #define CONST
  327.   #endif
  328. + #ifdef MSDOS
  329. + #define STDC_HEADERS
  330. + #endif
  331.   
  332.   /* This version of `getopt' appears to the caller like standard Unix `getopt'
  333.      but it behaves differently for the user, since it allows the user
  334. ***************
  335. *** 44,51 ****
  336. --- 47,58 ----
  337.   #ifdef sparc
  338.   #include <alloca.h>
  339.   #else
  340. + #ifdef MSDOS
  341. + #include <malloc.h>
  342. + #else
  343.   char *alloca ();
  344.   #endif
  345. + #endif
  346.   #endif /* not __GNUC__ */
  347.   
  348.   #if defined(STDC_HEADERS) || defined(__GNU_LIBRARY__)
  349. ***************
  350. *** 68,73 ****
  351. --- 75,82 ----
  352.   char *malloc ();
  353.   #endif
  354.   
  355. + static void exchange (char **);
  356.   /* For communication from `getopt' to the caller.
  357.      When `getopt' finds an option that takes an argument,
  358.      the argument value is returned here.
  359. ***************
  360. *** 372,378 ****
  361.          p++, option_index++)
  362.       if (!strncmp (p->name, nextchar, s - nextchar))
  363.         {
  364. !         if (s - nextchar == strlen (p->name))
  365.             {
  366.           /* Exact match found.  */
  367.           pfound = p;
  368. --- 381,387 ----
  369.          p++, option_index++)
  370.       if (!strncmp (p->name, nextchar, s - nextchar))
  371.         {
  372. !         if (s - nextchar == (int) strlen (p->name))
  373.             {
  374.           /* Exact match found.  */
  375.           pfound = p;
  376. diff -cbBw orig/getopt.h tar/getopt.h
  377. *** orig/getopt.h    Tue Nov 06 19:00:42 1990
  378. --- tar/getopt.h    Sat Oct 27 23:04:34 1990
  379. ***************
  380. *** 70,76 ****
  381.     int val;
  382.   };
  383.   
  384. ! #ifdef __STDC__
  385.   extern const struct option *_getopt_long_options;
  386.   #else
  387.   extern struct option *_getopt_long_options;
  388. --- 70,76 ----
  389.     int val;
  390.   };
  391.   
  392. ! #if defined(__STDC__) || defined(MSDOS)
  393.   extern const struct option *_getopt_long_options;
  394.   #else
  395.   extern struct option *_getopt_long_options;
  396. ***************
  397. *** 87,93 ****
  398.   
  399.   extern int option_index;
  400.   
  401. ! #ifdef __STDC__
  402.   int getopt (int argc, char **argv, const char *shortopts);
  403.   int getopt_long (int argc, char **argv, const char *shortopts,
  404.            const struct option *longopts, int *longind);
  405. --- 87,93 ----
  406.   
  407.   extern int option_index;
  408.   
  409. ! #if defined(__STDC__) || defined(MSDOS)
  410.   int getopt (int argc, char **argv, const char *shortopts);
  411.   int getopt_long (int argc, char **argv, const char *shortopts,
  412.            const struct option *longopts, int *longind);
  413. diff -cbBw orig/getopt1.c tar/getopt1.c
  414. *** orig/getopt1.c    Tue Nov 06 19:00:44 1990
  415. --- tar/getopt1.c    Sat Oct 27 23:04:36 1990
  416. ***************
  417. *** 17,23 ****
  418.   
  419.   #include "getopt.h"
  420.   
  421. ! #ifdef __STDC__
  422.   #define CONST const
  423.   #else
  424.   #define CONST
  425. --- 17,23 ----
  426.   
  427.   #include "getopt.h"
  428.   
  429. ! #if defined(__STDC__) || defined(MSDOS)
  430.   #define CONST const
  431.   #else
  432.   #define CONST
  433. ***************
  434. *** 38,43 ****
  435. --- 38,44 ----
  436.     int val;
  437.   
  438.     _getopt_long_options = long_options;
  439. +   _getopt_long_only = 0;
  440.     val = getopt (argc, argv, options);
  441.     if (val == 0 && opt_index != NULL)
  442.       *opt_index = option_index;
  443. diff -cbBw orig/gnu.c tar/gnu.c
  444. *** orig/gnu.c    Tue Nov 06 19:00:46 1990
  445. --- tar/gnu.c    Tue Nov 06 19:28:16 1990
  446. ***************
  447. *** 30,35 ****
  448. --- 30,39 ----
  449.   #endif
  450.   #endif
  451.   
  452. + #ifndef S_IFLNK
  453. + #define lstat stat
  454. + #endif
  455.   #ifndef DP_NAMELEN
  456.   #define DP_NAMELEN(x)    (x)->d_namlen
  457.   #endif
  458. ***************
  459. *** 166,171 ****
  460. --- 170,177 ----
  461.       return 0;
  462.   }
  463.   
  464. + static void add_dir_name();
  465.   
  466.   /* Collect all the names from argv[] (or whatever), then expand them into
  467.      a directory tree, and put all the directories at the beginning. */
  468. diff -cbBw orig/list.c tar/list.c
  469. *** orig/list.c    Tue Nov 06 19:00:46 1990
  470. --- tar/list.c    Sat Oct 27 20:43:46 1990
  471. ***************
  472. *** 487,492 ****
  473. --- 487,494 ----
  474.           /* Timestamp */
  475.           longie = hstat.st_mtime;
  476.           timestamp = ctime(&longie);
  477. +                 if (timestamp==NULL)
  478. +                   timestamp="--- --- -- --:--:-- ----\n";
  479.           timestamp[16] = '\0';
  480.           timestamp[24] = '\0';
  481.   
  482. ***************
  483. *** 577,587 ****
  484.               break;
  485.   
  486.           case LF_VOLHDR:
  487. !             fprintf(msg_file, "--Volume Header--\n");
  488.               break;
  489.   
  490.           case LF_MULTIVOL:
  491. !             fprintf(msg_file, "--Continued at byte %ld--\n",from_oct(1+12,head->header.offset));
  492.               break;
  493.           }
  494.       }
  495. --- 579,589 ----
  496.               break;
  497.   
  498.           case LF_VOLHDR:
  499. !                         fprintf(msg_file, "  (Volume Header)\n");
  500.               break;
  501.   
  502.           case LF_MULTIVOL:
  503. !                         fprintf(msg_file, "  (Continued at byte %ld)\n",from_oct(1+12,head->header.offset));
  504.               break;
  505.           }
  506.       }
  507. diff -cbBw orig/port.c tar/port.c
  508. *** orig/port.c    Tue Nov 06 19:00:48 1990
  509. --- tar/port.c    Sat Oct 27 20:48:26 1990
  510. ***************
  511. *** 113,118 ****
  512. --- 113,119 ----
  513.   #define WANT_MKNOD
  514.   #define WANT_UTILS
  515.   #define WANT_VALLOC
  516. + #define STDC_MSG
  517.   
  518.   #if (!defined(STDC_MSG) && !defined(DOPRNT_MSG) && !defined(VARARGS_MSG) && !defined(LOSING_MSG))
  519.   #ifdef __STDC__
  520. ***************
  521. *** 159,165 ****
  522.      into a time_t .  Its not well tested or anything. . .  */
  523.   /* In general, you should use the getdate() supplied in getdate.y */
  524.   
  525. ! #define OFF_FROM GMT 18000        /* Change for your time zone! */
  526.   
  527.   time_t
  528.   getdate(str)
  529. --- 160,167 ----
  530.      into a time_t .  Its not well tested or anything. . .  */
  531.   /* In general, you should use the getdate() supplied in getdate.y */
  532.   
  533. ! /* #define OFF_FROM_GMT 18000              /* Change for your time zone! */
  534. ! #define OFF_FROM_GMT 0                     /* Change for your time zone! */
  535.   
  536.   time_t
  537.   getdate(str)
  538. ***************
  539. *** 255,261 ****
  540. --- 257,265 ----
  541.   {
  542.       int cpid, status;
  543.       struct stat statbuf;
  544. + #ifndef MSDOS
  545.       extern int errno;
  546. + #endif
  547.   
  548.       if (stat(dpath,&statbuf) == 0) {
  549.           errno = EEXIST;        /* Stat worked, so it already exists */
  550. ***************
  551. *** 649,655 ****
  552. --- 653,661 ----
  553.       unsigned short    mode;
  554.       dev_t        dev;
  555.   {
  556. + #ifndef MSDOS
  557.       extern int    errno;
  558. + #endif
  559.       int        fd;
  560.   
  561.       errno = ENXIO;        /* No such device or address */
  562. ***************
  563. *** 1156,1162 ****
  564. --- 1162,1170 ----
  565.   {
  566.       va_list args;
  567.       int save_e;
  568. + #ifndef MSDOS
  569.       extern int errno;
  570. + #endif
  571.   
  572.       save_e=errno;
  573.       fflush(msg_file);
  574. diff -cbBw orig/rmt.h tar/rmt.h
  575. *** orig/rmt.h    Tue Nov 06 19:00:48 1990
  576. --- tar/rmt.h    Sat Oct 27 20:43:48 1990
  577. ***************
  578. *** 36,43 ****
  579. --- 36,45 ----
  580.   extern long lseek();
  581.   #else
  582.   #ifndef USG
  583. + #ifndef MSDOS
  584.   #define strchr index
  585.   #endif
  586. + #endif
  587.   
  588.   #define __REM_BIAS    128
  589.   #define RMTIOCTL
  590. ***************
  591. *** 45,60 ****
  592.   #ifndef O_CREAT
  593.   #define O_CREAT    01000
  594.   #endif
  595. - extern char *__rmt_path;
  596.   extern char *strchr();
  597.   
  598. ! #define _remdev(path)    ((__rmt_path=strchr(path, ':')) && strncmp(__rmt_path, ":/dev/", 6)==0)
  599.   #define _isrmt(fd)        ((fd) >= __REM_BIAS)
  600.   
  601. ! #define rmtopen(path,oflag,mode) (_remdev(path) ? __rmt_open(path, oflag, mode, __REM_BIAS) : open(path, oflag, mode))
  602.   #define rmtaccess(path, amode)    (_remdev(path) ? 0 : access(path, amode))
  603.   #define rmtstat(path, buf)    (_remdev(path) ? (errno = EOPNOTSUPP), -1 : stat(path, buf))
  604. ! #define rmtcreat(path, mode)    (_remdev(path) ? __rmt_open (path, 1 | O_CREAT, mode, __REM_BIAS) : creat(path, mode))
  605.   #define rmtlstat(path,buf)    (_remdev(path) ? (errno = EOPNOTSUPP), -1 : lstat(path,buf))
  606.   
  607.   #define rmtread(fd, buf, n)    (_isrmt(fd) ? __rmt_read(fd - __REM_BIAS, buf, n) : read(fd, buf, n))
  608. --- 47,61 ----
  609.   #ifndef O_CREAT
  610.   #define O_CREAT    01000
  611.   #endif
  612.   extern char *strchr();
  613.   
  614. ! #define _remdev(path)           ((path[1] == ':' && path[2] == 0))
  615.   #define _isrmt(fd)        ((fd) >= __REM_BIAS)
  616.   
  617. ! #define rmtopen(path,oflag,mode) (_remdev(path) ? __rmt_open(path, oflag, mode) + __REM_BIAS : open(path, oflag, mode))
  618.   #define rmtaccess(path, amode)    (_remdev(path) ? 0 : access(path, amode))
  619.   #define rmtstat(path, buf)    (_remdev(path) ? (errno = EOPNOTSUPP), -1 : stat(path, buf))
  620. ! #define rmtcreat(path, mode)    (_remdev(path) ? __rmt_open (path, 1 | O_CREAT, mode) + __REM_BIAS : creat(path, mode))
  621.   #define rmtlstat(path,buf)    (_remdev(path) ? (errno = EOPNOTSUPP), -1 : lstat(path,buf))
  622.   
  623.   #define rmtread(fd, buf, n)    (_isrmt(fd) ? __rmt_read(fd - __REM_BIAS, buf, n) : read(fd, buf, n))
  624. diff -cbBw orig/tar.c tar/tar.c
  625. *** orig/tar.c    Tue Nov 06 19:00:52 1990
  626. --- tar/tar.c    Tue Nov 06 18:57:56 1990
  627. ***************
  628. *** 237,244 ****
  629. --- 237,254 ----
  630.           read_and(diff_archive);
  631.           break;
  632.       case CMD_NONE:
  633. + #ifdef MSDOS
  634. +                 if ( argc > 1 )
  635. +                 {
  636. +             msg("you must specify exactly one of the r, c, t, x, or d options\n");
  637. +            fprintf(stderr,"For more information, type ``%s +help''.\n",tar);
  638. +                 }
  639. +                 else
  640. +           describe();
  641. + #else
  642.           msg("you must specify exactly one of the r, c, t, x, or d options\n");
  643.            fprintf(stderr,"For more information, type ``%s +help''.\n",tar);
  644. + #endif
  645.           exit(EX_ARGSBAD);
  646.       }
  647.       exit(0);
  648. ***************
  649. *** 312,317 ****
  650. --- 322,336 ----
  651.   
  652.           case '0':
  653.           case '1':
  654. + #ifdef MSDOS
  655. +             {
  656. +                           static char buf[8];
  657. +                           sprintf(buf,"%c:",c);
  658. +                           ar_file=buf;
  659. +                         }
  660. +                         break;
  661. + #else
  662.           case '2':
  663.           case '3':
  664.           case '4':
  665. ***************
  666. *** 343,348 ****
  667. --- 362,368 ----
  668.                   ar_file=buf;
  669.               }
  670.               break;
  671. + #endif
  672.   
  673.           case 'A':            /* Arguments are tar files,
  674.                              just cat them onto the end
  675. ***************
  676. *** 558,564 ****
  677. --- 578,637 ----
  678.   void
  679.   describe()
  680.   {
  681. +         extern char version_string[];
  682. + #ifdef MSDOS
  683. +   fprintf(stdout,"\n%s\n\n",version_string);
  684. + #endif
  685.       msg("choose one of the following:");
  686. + #ifdef MSDOS
  687. +   fputs("  -A, +catenate           append tar files to an archive\n"
  688. +         "  -c, +create             create a new archive\n"
  689. +         "  -d, +diff               find differences between archive and file system\n"
  690. +         "      +delete             delete from the archive (not for use on mag tapes!)\n",stdout);
  691. +   fputs("  -r, +append             append files to the end of an archive\n"
  692. +         "  -t, +list               list the contents of an archive\n"
  693. +         "  -u, +update             only append files that are newer than copy in archive\n"
  694. +         "  -x, +extract            extract files from an archive\n",stdout);
  695. +   fputs("\nOther options:\n"
  696. +         "  -b, +block-size N       block size of Nx512 bytes\n"
  697. +         "  -B, +read-full-blocks   reblock as we read (for reading 4.2BSD pipes)\n"
  698. +         "  -C, +directory DIR      change to directory DIR\n", stdout);
  699. +   fputs("  -f, +file F             use archive file or device F (or hostname:/dev/file)\n"
  700. +         "  -G, +incremental F      create/list/extract GNU-format incremental backup\n"
  701. +         "  -h, +dereference        don't dump symlinks; dump the files they point to\n"
  702. +         "  -i, +ignore-zeros       ignore blocks of zeros in archive (normally mean EOF)\n", stdout);
  703. +   fputs("  -k, +keep-old-files     keep existing files; don't overwrite from archive\n"
  704. +         "  -K, +starting-file F    begin at file F in the archive\n"
  705. +         "  -l, +one-file-system    stay in local file system when creating an archive\n", stdout);
  706. +   fputs("  -m, +modification-time  don't extract file modified time\n"
  707. +         "  -M, +multi-volume       create/list/extract multi-volume archive\n"
  708. +         "  -N, +after-date DATE    only store files newer than DATE\n"
  709. +         "  -o, +old-archive        write a  V7 format archive, rather than ANSI format\n"
  710. +         "  -O, +to-stdout          extract files to standard output\n"
  711. +         "  -p, +same-permissions   extract all protection information\n"
  712. +         "  -P, +absolute-paths     don't strip leading \"/\"es from file names\n", stdout);
  713. +   fputs("      +preserve           like -p -s\n"
  714. +         "  -R, +record-number      show record number within archive with each message\n"
  715. +         "  -s, +same-order         list of names to extract is sorted to match archive\n"
  716. +         "  -S, +sparse             handle sparse files specially\n", stdout);
  717. +   fputs("  -T, +files-from F       get names to extract or create from file F\n"
  718. +         "  -v, +verbose            verbosely list files processed\n"
  719. +         "  -V, +volume VNAM        create archive with volume name VNAM\n"
  720. +         "      +version            print tar program version number\n"
  721. +         "  -w, +interactive        ask for confirmation for every action\n"
  722. +         "  -W, +verify             attempt to verify the archive after writing it\n"
  723. +         "  -X, +exclude F          exclude files listed in file F\n", stdout);
  724. +   fputs(
  725. +         "  -[01]                   specify disk drive for \"tape on a disk\"\n"
  726. +         "                          (density selfdetected)\n"
  727. +         , stdout);
  728. + #else
  729.       fputs("\
  730.   -A, +catenate        append tar files to an archive\n\
  731.   -c, +create        create a new archive\n\
  732. ***************
  733. *** 605,610 ****
  734. --- 678,684 ----
  735.   -z, -Z, +compress          filter the archive through compress\n\
  736.   -[0-7][lmh]        specify drive and density\n\
  737.   ", stderr);
  738. + #endif
  739.   }
  740.   
  741.   name_add(name)
  742. ***************
  743. *** 612,618 ****
  744.   {
  745.       if(n_indalloc==n_indused) {
  746.           n_indalloc+=10;
  747. !         n_ind=(char **)(n_indused ? ck_realloc(n_ind,n_indalloc*sizeof(int)) : ck_malloc(n_indalloc*sizeof(int)));
  748.       }
  749.       n_ind[n_indused++]=name;
  750.   }
  751. --- 686,692 ----
  752.   {
  753.       if(n_indalloc==n_indused) {
  754.           n_indalloc+=10;
  755. !         n_ind=(char **)(n_indused ? ck_realloc(n_ind,n_indalloc*sizeof(char *)) : ck_malloc(n_indalloc*sizeof(char *)));
  756.       }
  757.       n_ind[n_indused++]=name;
  758.   }
  759. ***************
  760. *** 779,785 ****
  761. --- 853,861 ----
  762.       register struct name    *p;    /* Current struct pointer */
  763.       static char *chdir_name;
  764.       char *new_name();
  765. + #ifndef MAXPATHLEN
  766.   #define MAXPATHLEN 1024
  767. + #endif
  768.   
  769.       if(name[0]=='-' && name[1]=='C' && name[2]=='\0') {
  770.           chdir_name=name_next(0);
  771. diff -cbBw orig/tar.h tar/tar.h
  772. *** orig/tar.h    Tue Nov 06 19:00:52 1990
  773. --- tar/tar.h    Sat Oct 27 20:43:54 1990
  774. ***************
  775. *** 27,32 ****
  776. --- 27,37 ----
  777.    * Created 25 August 1985 by John Gilmore, ihnp4!hoptoad!gnu.
  778.    */
  779.   
  780. + #ifdef MSDOS
  781. + #define NONAMES
  782. + #define DEF_AR_FILE  "archive.tar"
  783. + #endif
  784.   /*
  785.    * Kludge for handling systems that can't cope with multiple
  786.    * external definitions of a variable.  In ONE routine (tar.c),
  787. diff -cbBw orig/update.c tar/update.c
  788. *** orig/update.c    Tue Nov 06 19:00:54 1990
  789. --- tar/update.c    Sat Oct 27 20:43:54 1990
  790. ***************
  791. *** 34,40 ****
  792.   #include <fcntl.h>
  793.   #endif
  794.   
  795. ! #ifndef    MSDOS
  796.   #include <pwd.h>
  797.   #include <grp.h>
  798.   #endif
  799. --- 34,42 ----
  800.   #include <fcntl.h>
  801.   #endif
  802.   
  803. ! #ifdef    MSDOS
  804. ! #include <io.h>
  805. ! #else
  806.   #include <pwd.h>
  807.   #include <grp.h>
  808.   #endif
  809. ***************
  810. *** 501,507 ****
  811. --- 503,511 ----
  812.   move_arch(n)
  813.   {
  814.       long cur;
  815. + #ifndef MSDOS
  816.       extern int errno;
  817. + #endif
  818.   
  819.   #ifdef MTIOCTOP
  820.       struct mtop t;
  821. diff -cbBw orig/version.c tar/version.c
  822. *** orig/version.c    Tue Nov 06 19:00:56 1990
  823. --- tar/version.c    Sat Oct 27 21:00:18 1990
  824. ***************
  825. *** 17,23 ****
  826.   along with GNU Tar; see the file COPYING.  If not, write to
  827.   the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  828.   
  829. ! char version_string[] = "GNU tar version 1.09";
  830.   
  831.   /* Version 1.00:  This file added.  -version option added */
  832.   
  833. --- 17,23 ----
  834.   along with GNU Tar; see the file COPYING.  If not, write to
  835.   the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  836.   
  837. ! char version_string[] = "GNU tar version 1.09 (for DOS and OS/2)";
  838.   
  839.   /* Version 1.00:  This file added.  -version option added */
  840.   
  841.