home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / PAX20.ZIP / PATCHES.OS2 < prev    next >
Text File  |  1990-11-12  |  23KB  |  832 lines

  1. diff -cbBw orig/buffer.c ./buffer.c
  2. *** orig/buffer.c    Tue Jan 16 19:23:22 1990
  3. --- ./buffer.c    Sat Dec 30 15:48:42 1989
  4. ***************
  5. *** 673,679 ****
  6.           bufend += got;
  7.           } else if (got < 0) {
  8.           failed = -1;
  9. !         warnarch(strerror(), (OFFSET) 0 - (bufend - bufidx));
  10.           } else {
  11.           ++areof;
  12.           }
  13. --- 673,679 ----
  14.           bufend += got;
  15.           } else if (got < 0) {
  16.           failed = -1;
  17. !         warnarch(strerror(), (OFFSET) 0L - (OFFSET) (bufend - bufidx));
  18.           } else {
  19.           ++areof;
  20.           }
  21. diff -cbBw orig/cpio.c ./cpio.c
  22. *** orig/cpio.c    Tue Jan 16 19:23:22 1990
  23. --- ./cpio.c    Tue Jan 16 18:19:14 1990
  24. ***************
  25. *** 244,251 ****
  26. --- 244,267 ----
  27.   #endif
  28.   {
  29.       DBUG_ENTER("usage");
  30. + #ifdef MSDOS
  31. +     printf("\r\nPAX version 2.0 - POSIX conforming tar and cpio archiver for DOS and OS/2\r\n");
  32. +     printf("\r\nUsage: %s -o[Bacv]\r\n", myname);
  33. +     printf("       %s -i[Bcdmrtuvf] [pattern...]\r\n", myname);
  34. +     printf("       %s -p[adlmruv] directory\r\n", myname);
  35. +     printf("\r\nUse the nonstandard option \"-D file\" for files as input/output archives."
  36. +            "\r\nRename CPIO.EXE to PAX.EXE or TAR.EXE to get the PAX or TAR user interface.\r\n");
  37. + #ifdef DISKACC
  38. +     printf("\r\nUse the option -D with the special device names 0: and 1: to access Unix floppy"
  39. +            "\r\ndisks with cpio archives. The disk type is automatically detected.\r\n");
  40. + #endif
  41. + #else
  42.       fprintf(stderr, "Usage: %s -o[Bacv]\n", myname);
  43.       fprintf(stderr, "       %s -i[Bcdmrtuvf] [pattern...]\n", myname);
  44.       fprintf(stderr, "       %s -p[adlmruv] directory\n", myname);
  45. + #endif
  46.       exit(1);
  47.   }
  48. diff -cbBw orig/fileio.c ./fileio.c
  49. *** orig/fileio.c    Tue Jan 16 19:23:24 1990
  50. --- ./fileio.c    Sat Dec 30 18:07:00 1989
  51. ***************
  52. *** 99,110 ****
  53.       bufend = bufidx = bufstart;    /* set up for initial read */
  54.       }
  55.   
  56. ! #ifndef MSDOS
  57. !     if (archivefd < 0) {
  58. !     warnarch(strerror(), (OFFSET) 0);
  59. !     DBUG_RETURN(-1);
  60. !     }
  61. ! #else /* MSDOS */
  62.       if (dio_open_check(ar_file) < 0) {
  63.       if (archivefd >= 0) {
  64.           warnarch(strerror(), (OFFSET) 0);
  65. --- 99,105 ----
  66.       bufend = bufidx = bufstart;    /* set up for initial read */
  67.       }
  68.   
  69. ! #if defined(MSDOS) && defined(DIO)
  70.       if (dio_open_check(ar_file) < 0) {
  71.       if (archivefd >= 0) {
  72.           warnarch(strerror(), (OFFSET) 0);
  73. ***************
  74. *** 119,124 ****
  75. --- 114,124 ----
  76.       if (dio_to_binary(archivefd) < 0) {
  77.           DBUG_RETURN(-1);
  78.       }
  79. + #else
  80. +     if (archivefd < 0) {
  81. +     warnarch(strerror(), (OFFSET) 0);
  82. +     DBUG_RETURN(-1);
  83. +     }
  84.   #endif /* MSDOS */
  85.   
  86.       ++arvolume;
  87. ***************
  88. *** 256,261 ****
  89. --- 256,262 ----
  90.       perm = asb->sb_mode & S_IPERM;
  91.       switch (asb->sb_mode & S_IFMT) {
  92.   
  93. + #ifndef MSDOS
  94.   #ifdef S_IFBLK
  95.       case S_IFBLK:
  96.   #endif /* S_IFBLK */
  97. ***************
  98. *** 296,301 ****
  99. --- 297,303 ----
  100.       DBUG_RETURN(0);
  101.       break;
  102.   #endif /* S_IFCHR */
  103. + #endif
  104.   
  105.       case S_IFDIR:
  106.       if (exists) {
  107. diff -cbBw orig/func.h ./func.h
  108. *** orig/func.h    Tue Jan 16 19:23:24 1990
  109. --- ./func.h    Sat Dec 30 19:46:32 1989
  110. ***************
  111. *** 79,91 ****
  112.   struct group   *getgrgid();
  113.   struct group   *getgrnam();
  114.   struct passwd  *getpwuid();
  115. ! char           *getenv(char *);
  116.   Link           *islink(char *, Stat *);
  117.   char           *finduname(UIDTYPE);
  118.   char           *findgname(GIDTYPE);
  119.   GIDTYPE     findgid(char *);
  120.   UIDTYPE     finduid(char *);
  121. ! char           *malloc();
  122.   char           *index(char *, char);
  123.   char           *rindex(char *, char);
  124.   
  125. --- 79,91 ----
  126.   struct group   *getgrgid();
  127.   struct group   *getgrnam();
  128.   struct passwd  *getpwuid();
  129. ! char           *getenv(const char *);
  130.   Link           *islink(char *, Stat *);
  131.   char           *finduname(UIDTYPE);
  132.   char           *findgname(GIDTYPE);
  133.   GIDTYPE     findgid(char *);
  134.   UIDTYPE     finduid(char *);
  135. ! void           *malloc();
  136.   char           *index(char *, char);
  137.   char           *rindex(char *, char);
  138.   
  139. ***************
  140. *** 99,105 ****
  141.   int                 (*signal()) ();
  142.   #endif /* VOIDSIG */
  143.   
  144. ! #ifdef MSDOS
  145.   extern  int dio_write(int drive,char *from_buf,unsigned int from_cnt);
  146.   extern  int dio_read(int drive,char *to_buf,unsigned int to_cnt);
  147.   extern  int dio_open_check(char *s);
  148. --- 99,105 ----
  149.   int                 (*signal()) ();
  150.   #endif /* VOIDSIG */
  151.   
  152. ! #if defined(MSDOS) && defined(DIO)
  153.   extern  int dio_write(int drive,char *from_buf,unsigned int from_cnt);
  154.   extern  int dio_read(int drive,char *to_buf,unsigned int to_cnt);
  155.   extern  int dio_open_check(char *s);
  156. ***************
  157. *** 110,115 ****
  158. --- 110,123 ----
  159.   extern    void dio_str(char *s);
  160.   #endif /* MSDOS */
  161.   
  162. + #if defined(MSDOS) && defined(DISKACC)
  163. + int dsk_open (char *path, int oflag, int mode);
  164. + int dsk_close(int fildes);
  165. + int dsk_read(int fildes, char *buf, unsigned nbyte);
  166. + int dsk_write(int fildes, char *buf, unsigned nbyte);
  167. + long dsk_lseek(int fildes, long offset, int whence);
  168. + #endif /* MSDOS */
  169.   #else /* !__STDC__ */
  170.   
  171.   extern Link        *linkfrom();
  172. ***************
  173. *** 181,187 ****
  174.   extern int          (*signal()) ();
  175.   #endif
  176.   
  177. ! #ifdef MSDOS
  178.   extern  int dio_write();
  179.   extern  int dio_read();
  180.   extern  int dio_open_check();
  181. --- 189,195 ----
  182.   extern int          (*signal()) ();
  183.   #endif
  184.   
  185. ! #if defined(MSDOS) && defined(DIO)
  186.   extern  int dio_write();
  187.   extern  int dio_read();
  188.   extern  int dio_open_check();
  189. ***************
  190. *** 192,197 ****
  191. --- 200,213 ----
  192.   extern    void dio_str();
  193.   #endif /* MSDOS */
  194.   
  195. + #if defined(MSDOS) && defined(DISKACC)
  196. + int dsk_open ();
  197. + int dsk_close();
  198. + int dsk_read();
  199. + int dsk_write();
  200. + long dsk_lseek();
  201. + #endif /* MSDOS */
  202.   #ifndef /* STRTOK */
  203.   extern    char *strtok();
  204.   #endif /* STRTOK */
  205. diff -cbBw orig/limits.h ./limits.h
  206. *** orig/limits.h    Tue Jan 16 19:23:24 1990
  207. --- ./limits.h    Sat Dec 30 22:52:48 1989
  208. ***************
  209. *** 51,57 ****
  210.   
  211.   #ifndef NAME_MAX
  212.   /* This should be 32 for BSD systems */
  213. ! #define NAME_MAX    14    /* Max number of bytes in a filename */
  214.   #endif /* NAME_MAX */
  215.   
  216.   #endif /* _PAX_LIMITS_H */
  217. --- 51,57 ----
  218.   
  219.   #ifndef NAME_MAX
  220.   /* This should be 32 for BSD systems */
  221. ! #define NAME_MAX    32    /* Max number of bytes in a filename */
  222.   #endif /* NAME_MAX */
  223.   
  224.   #endif /* _PAX_LIMITS_H */
  225. diff -cbBw orig/list.c ./list.c
  226. *** orig/list.c    Tue Jan 16 19:23:24 1990
  227. --- ./list.c    Sat Dec 30 20:13:30 1989
  228. ***************
  229. *** 462,468 ****
  230.       if (f_verbose) {
  231.           atm = localtime(&asb->sb_mtime);
  232.           pr_mode(asb->sb_mode);
  233. !         fprintf(msgfile, " %d/%d %6ld %3s %2d %02d:%02d %4d %s",
  234.               asb->sb_uid, asb->sb_gid, asb->sb_size,
  235.               monnames[atm->tm_mon], atm->tm_mday, atm->tm_hour,
  236.               atm->tm_min, atm->tm_year + 1900, name);
  237. --- 462,468 ----
  238.       if (f_verbose) {
  239.           atm = localtime(&asb->sb_mtime);
  240.           pr_mode(asb->sb_mode);
  241. !             fprintf(msgfile, " %3d/%-3d %6ld %3s %2d %02d:%02d %4d %s",
  242.               asb->sb_uid, asb->sb_gid, asb->sb_size,
  243.               monnames[atm->tm_mon], atm->tm_mday, atm->tm_hour,
  244.               atm->tm_min, atm->tm_year + 1900, name);
  245. ***************
  246. *** 538,543 ****
  247. --- 538,544 ----
  248.       pr_mode(asb->sb_mode);
  249.       fprintf(msgfile, " %3d", asb->sb_nlink);
  250.           atm = localtime(&asb->sb_mtime);
  251. + #ifndef MSDOS
  252.       if (pwp = getpwuid((UIDTYPE) USH(asb->sb_uid))) {
  253.           fprintf(msgfile, " %-8s", pwp->pw_name);
  254.       } else {
  255. ***************
  256. *** 548,553 ****
  257. --- 549,555 ----
  258.       } else {
  259.           fprintf(msgfile, " %-8u", USH(asb->sb_gid));
  260.           }
  261. + #endif
  262.       switch (asb->sb_mode & S_IFMT) {
  263.   
  264.   #ifdef S_IFBLK
  265. diff -cbBw orig/msdos.c ./msdos.c
  266. *** orig/msdos.c    Tue Jan 16 19:23:26 1990
  267. --- ./msdos.c    Sat Dec 30 18:09:18 1989
  268. ***************
  269. *** 57,72 ****
  270.   /* Headers */
  271.   
  272.   #include "pax.h"
  273.   #ifdef MSDOS
  274.   #include <sys/types.h>
  275.   #include <stdio.h>
  276.   #include <stdlib.h>
  277.   #include <ctype.h>
  278. - #include <string.h>
  279.   #include <errno.h>
  280.   #include <dos.h>
  281.   
  282.   
  283.   /* Function Prototypes */
  284.   
  285.   #ifdef __STDC__
  286. --- 57,74 ----
  287.   /* Headers */
  288.   
  289.   #include "pax.h"
  290.   #ifdef MSDOS
  291.   #include <sys/types.h>
  292.   #include <stdio.h>
  293.   #include <stdlib.h>
  294.   #include <ctype.h>
  295.   #include <errno.h>
  296.   #include <dos.h>
  297.   
  298.   
  299. + #ifdef DIO
  300.   /* Function Prototypes */
  301.   
  302.   #ifdef __STDC__
  303. ***************
  304. *** 108,114 ****
  305.   static union REGS   reg;
  306.   static union REGS   rreg;
  307.   
  308. ! #ifdef M_I86LM
  309.   static struct SREGS sreg;
  310.   #endif /* !M_I86LM */
  311.   
  312. --- 110,116 ----
  313.   static union REGS   reg;
  314.   static union REGS   rreg;
  315.   
  316. ! #if defined(M_I86LM) || defined(M_I86CM)
  317.   static struct SREGS sreg;
  318.   #endif /* !M_I86LM */
  319.   
  320. ***************
  321. *** 142,148 ****
  322.       reg.x.ax = drive;
  323.       reg.x.dx = secnum;
  324.       reg.x.cx = secknt;
  325. ! #ifdef M_I86LM
  326.       reg.x.bx = FP_OFF(buf);
  327.       sreg.ds = FP_SEG(buf);
  328.       int86x(0x26, ®, &rreg, &sreg);
  329. --- 144,150 ----
  330.       reg.x.ax = drive;
  331.       reg.x.dx = secnum;
  332.       reg.x.cx = secknt;
  333. ! #if defined(M_I86LM) || defined(M_I86CM)
  334.       reg.x.bx = FP_OFF(buf);
  335.       sreg.ds = FP_SEG(buf);
  336.       int86x(0x26, ®, &rreg, &sreg);
  337. ***************
  338. *** 165,171 ****
  339.       unsigned int        secnum;
  340.       unsigned int        secknt;
  341.       unsigned int       *err;
  342. !     unsigned int       *buf;
  343.   {
  344.       DBUG_ENTER("dio_adr");
  345.       rwsec = secnum;
  346. --- 167,173 ----
  347.       unsigned int        secnum;
  348.       unsigned int        secknt;
  349.       unsigned int       *err;
  350. !     char               *buf;
  351.   {
  352.       DBUG_ENTER("dio_adr");
  353.       rwsec = secnum;
  354. ***************
  355. *** 172,178 ****
  356.       reg.x.ax = drive;
  357.       reg.x.dx = secnum;
  358.       reg.x.cx = secknt;
  359. ! #ifdef M_I86LM
  360.       reg.x.bx = FP_OFF(buf);
  361.       sreg.ds = FP_SEG(buf);
  362.       int86x(0x25, ®, &rreg, &sreg);
  363. --- 174,180 ----
  364.       reg.x.ax = drive;
  365.       reg.x.dx = secnum;
  366.       reg.x.cx = secknt;
  367. ! #if defined(M_I86LM) || defined(M_I86CM)
  368.       reg.x.bx = FP_OFF(buf);
  369.       sreg.ds = FP_SEG(buf);
  370.       int86x(0x25, ®, &rreg, &sreg);
  371. ***************
  372. *** 344,350 ****
  373.                        * written */
  374.       unsigned int        from_cnt;    /* number of bytes to write */
  375.   {
  376. !     unsigned int        amt:
  377.       unsigned int        err;
  378.       unsigned int        nn;
  379.       unsigned int        fquo;
  380. --- 346,352 ----
  381.                        * written */
  382.       unsigned int        from_cnt;    /* number of bytes to write */
  383.   {
  384. !     unsigned int        amt;
  385.       unsigned int        err;
  386.       unsigned int        nn;
  387.       unsigned int        fquo;
  388. ***************
  389. *** 637,642 ****
  390. --- 639,645 ----
  391.       DBUG_RETURN (fptr);
  392.   }
  393.   
  394. + #endif
  395.   
  396.   static struct passwd npwd = {"", "", 0, 0, 0, "", "", "", ""};
  397.   static char gmem1[] = "";
  398. diff -cbBw orig/namelist.c ./namelist.c
  399. *** orig/namelist.c    Tue Jan 16 19:23:26 1990
  400. --- ./namelist.c    Sat Dec 30 18:07:22 1989
  401. ***************
  402. *** 126,132 ****
  403.   
  404.       DBUG_ENTER("add_name");
  405.   
  406. ! #ifdef MSDOS
  407.       dio_str(name);
  408.   #endif /* MSDOS */
  409.   
  410. --- 126,132 ----
  411.   
  412.       DBUG_ENTER("add_name");
  413.   
  414. ! #if defined(MSDOS) && defined(DIO)
  415.       dio_str(name);
  416.   #endif /* MSDOS */
  417.   
  418. ***************
  419. *** 432,438 ****
  420.       }
  421.       } while (err < 0);
  422.   
  423. ! #ifdef MSDOS
  424.       dio_str(name);
  425.   #endif /* MSDOS */
  426.   
  427. --- 432,438 ----
  428.       }
  429.       } while (err < 0);
  430.   
  431. ! #if defined(MSDOS) && defined(DIO)
  432.       dio_str(name);
  433.   #endif /* MSDOS */
  434.   
  435. diff -cbBw orig/pass.c ./pass.c
  436. *** orig/pass.c    Tue Jan 16 19:23:26 1990
  437. --- ./pass.c    Sat Dec 30 16:09:30 1989
  438. ***************
  439. *** 141,147 ****
  440.       char                to[PATH_MAX + 1];
  441.   
  442.       DBUG_ENTER("passitem");
  443. !     if (nameopt(strcat(strcat(strcpy(to, dir), "/"), from)) < 0) {
  444.       DBUG_RETURN(-1);
  445.       }
  446.       if (asb->sb_nlink > 1) {
  447. --- 141,151 ----
  448.       char                to[PATH_MAX + 1];
  449.   
  450.       DBUG_ENTER("passitem");
  451. !     strcpy(to, dir);
  452. !     strcat(to, "/");
  453. !     strcat(to, from);
  454. !     if (nameopt(to) < 0) {
  455.       DBUG_RETURN(-1);
  456.       }
  457.       if (asb->sb_nlink > 1) {
  458. diff -cbBw orig/pax.c ./pax.c
  459. *** orig/pax.c    Tue Jan 16 19:23:26 1990
  460. --- ./pax.c    Tue Jan 16 18:19:46 1990
  461. ***************
  462. *** 162,168 ****
  463.   {
  464.   #ifdef MSDOS
  465.       char            *tmp;
  466. -     extern int         _fmode;
  467.   #endif /* MSDOS */
  468.   
  469.       DBUG_ENTER("main");
  470. --- 162,167 ----
  471. ***************
  472. *** 173,179 ****
  473. --- 172,180 ----
  474.       setmode(fileno(stdin), O_BINARY);
  475.       setmode(fileno(stdout), O_BINARY);
  476.       /* strip the pathname off of the name of the executable */
  477. + #ifdef DIO
  478.       dio_str(argv[0]);
  479. + #endif
  480.       if ((myname = strrchr(argv[0], '/')) != (char *)NULL) {
  481.        myname++;
  482.       } else if ((myname = strrchr(argv[0], '\\')) != (char *)NULL) {
  483. ***************
  484. *** 181,187 ****
  485.       } else {
  486.       myname = argv[0];
  487.       }
  488. !     if ((tmp = strrchr(myname, '.')) != (char *) NULL)
  489.       *tmp = '\0';
  490.       }
  491.   #else /* !MSDOS */
  492. --- 182,188 ----
  493.       } else {
  494.       myname = argv[0];
  495.       }
  496. !     if ((tmp = strrchr(myname, '.')) != (char *) NULL) {
  497.       *tmp = '\0';
  498.       }
  499.   #else /* !MSDOS */
  500. ***************
  501. *** 205,214 ****
  502.       /* open terminal for interactive queries */
  503.       ttyf = open_tty();
  504.   
  505. !     if (strcmp(myname, "tar") == 0) {
  506.       tar_interface = 1;
  507.       do_tar(argc, argv);
  508. !     } else if (strcmp(myname, "cpio") == 0) {
  509.       cpio_interface = 1;
  510.       do_cpio(argc, argv);
  511.       } else {
  512. --- 206,215 ----
  513.       /* open terminal for interactive queries */
  514.       ttyf = open_tty();
  515.   
  516. !     if (stricmp(myname, "tar") == 0) {
  517.       tar_interface = 1;
  518.       do_tar(argc, argv);
  519. !     } else if (stricmp(myname, "cpio") == 0) {
  520.       cpio_interface = 1;
  521.       do_cpio(argc, argv);
  522.       } else {
  523. ***************
  524. *** 375,383 ****
  525.           break;
  526.   
  527.       case 'x':
  528. !         if (strcmp(optarg, "ustar") == 0) {
  529.           ar_format = TAR;
  530. !         } else if (strcmp(optarg, "cpio") == 0) {
  531.           ar_format = CPIO;
  532.           } else {
  533.           usage();
  534. --- 376,384 ----
  535.           break;
  536.   
  537.       case 'x':
  538. !             if (stricmp(optarg, "ustar") == 0) {
  539.           ar_format = TAR;
  540. !             } else if (stricmp(optarg, "cpio") == 0) {
  541.           ar_format = CPIO;
  542.           } else {
  543.           usage();
  544. ***************
  545. *** 393,398 ****
  546. --- 394,404 ----
  547.       }
  548.       }
  549.   
  550. +     if ( strcmp(ar_file, "-") == 0
  551. +          && isatty(fileno(stdin))
  552. +          && isatty(fileno(stdout)) )
  553. +       usage();
  554.   #ifdef MSDOS
  555.       setmode(fileno(msgfile), O_TEXT);
  556.   #endif /* MSDOS */
  557. ***************
  558. *** 622,634 ****
  559.   #endif
  560.   {
  561.       DBUG_ENTER("usage");
  562.       fprintf(stderr, "Usage: %s -[cimopuvy] [-f archive] [-s replstr] [-t device] [pattern...]\n",
  563.           myname);
  564.       fprintf(stderr, "       %s -r [-cimopuvy] [-f archive] [-s replstr] [-t device] [pattern...]\n",
  565.           myname);
  566. !     fprintf(stderr, "       %s -w [-adimuvy] [-b blocking] [-f archive] [-s replstr]\n              [-t device] [-x format] [pathname...]\n",
  567.           myname);
  568.       fprintf(stderr, "       %s -r -w [-ilmopuvy] [-s replstr] [pathname...] directory\n",
  569.           myname);
  570.       exit(1);
  571.   }
  572. --- 628,658 ----
  573.   #endif
  574.   {
  575.       DBUG_ENTER("usage");
  576. + #ifdef MSDOS
  577. +     printf("\r\nPAX version 2.0 - POSIX conforming tar and cpio archiver for DOS and OS/2\r\n");
  578. +     printf("\r\nUsage: %s -[cimopuvy] [-f archive] [-s replstr] [-t device] [pattern...]\r\n", myname);
  579. +     printf("       %s -r [-cimopuvy] [-f archive] [-s replstr] [-t device] [pattern...]\r\n", myname);
  580. +     printf("       %s -w [-adimuvy] [-b blocking] [-f archive] [-s replstr]\r\n"
  581. +            "              [-t device] [-x format] [pathname...]\r\n", myname);
  582. +     printf("       %s -r -w [-ilmopuvy] [-s replstr] [pathname...] directory\r\n", myname);
  583. +     printf("\r\nRename PAX.EXE to TAR.EXE or CPIO.EXE to get the TAR or CPIO user interface.\r\n");
  584. + #ifdef DISKACC
  585. +     printf("\r\nUse the option -t with the special device names 0: and 1: to access Unix floppy"
  586. +            "\r\ndisks with tar or cpio archives. The disk type is automatically detected.\r\n");
  587. + #endif
  588. + #else
  589.       fprintf(stderr, "Usage: %s -[cimopuvy] [-f archive] [-s replstr] [-t device] [pattern...]\n",
  590.           myname);
  591.       fprintf(stderr, "       %s -r [-cimopuvy] [-f archive] [-s replstr] [-t device] [pattern...]\n",
  592.           myname);
  593. !     fprintf(stderr, "       %s -w [-adimuvy] [-b blocking] [-f archive] [-s replstr]\n"
  594. !                     "              [-t device] [-x format] [pathname...]\n",
  595.           myname);
  596.       fprintf(stderr, "       %s -r -w [-ilmopuvy] [-s replstr] [pathname...] directory\n",
  597.               myname);
  598. + #endif
  599.       exit(1);
  600.   }
  601. diff -cbBw orig/pax.h ./pax.h
  602. *** orig/pax.h    Tue Jan 16 19:23:26 1990
  603. --- ./pax.h    Sat Dec 30 18:57:48 1989
  604. ***************
  605. *** 43,58 ****
  606.   #include <sys/stat.h>
  607.   #include "regexp.h"
  608.   #include "dbug.h"
  609.   #ifdef __STDC_
  610.   #  include <string.h>
  611.   #  include <strlib.h>
  612.   #endif /* __STDC__ */
  613. ! #ifdef MSDOS
  614.   #  include <sys/ioctl.h>
  615.   #endif /* MSDOS */
  616.   
  617.   #define DEF_TAR_FILE    "/dev/rmt0"
  618.   #define TTY            "/dev/tty"
  619.   
  620.   #ifdef IOCTL
  621.   #  include <sys/ioctl.h>
  622. --- 43,65 ----
  623.   #include <sys/stat.h>
  624.   #include "regexp.h"
  625.   #include "dbug.h"
  626.   #ifdef __STDC_
  627.   #  include <string.h>
  628.   #  include <strlib.h>
  629.   #endif /* __STDC__ */
  630. ! /* #ifdef MSDOS
  631.   #  include <sys/ioctl.h>
  632.   #endif /* MSDOS */
  633.   
  634. + #ifdef MSDOS
  635. + #define DEF_TAR_FILE    "archive.pax"
  636. + #define TTY        "con"
  637. + #else
  638.   #define DEF_TAR_FILE    "/dev/rmt0"
  639.   #define TTY            "/dev/tty"
  640. + #endif
  641.   
  642.   #ifdef IOCTL
  643.   #  include <sys/ioctl.h>
  644. ***************
  645. *** 78,84 ****
  646. --- 85,93 ----
  647.   #endif /* MSDOS */
  648.   
  649.   #ifndef XENIX_286
  650. + #ifndef MSDOS
  651.   #  include <sys/file.h>
  652. + #endif
  653.   #endif /* XENIX_286 */
  654.   
  655.   /* Defines */
  656. ***************
  657. *** 347,354 ****
  658. --- 356,368 ----
  659.   
  660.   extern char        *optarg;
  661.   extern int          optind;
  662. + #ifdef MSDOS
  663. + #include <stdlib.h>
  664. + #else
  665.   extern int          sys_nerr;
  666.   extern char        *sys_errlist[];
  667.   extern int          errno;
  668. + #endif
  669.   
  670.   #endif /* _PAX_H */
  671. diff -cbBw orig/port.h ./port.h
  672. *** orig/port.h    Tue Jan 16 19:23:26 1990
  673. --- ./port.h    Sat Dec 30 20:28:26 1989
  674. ***************
  675. *** 78,83 ****
  676. --- 78,85 ----
  677.   
  678.   #ifdef MSDOS
  679.   
  680. + #if defined(DIO)
  681.   #define OPEN2(p,f) \
  682.       ( (dio_open_check(p) < 0) ? dio_open2(p,f) : open(p,f) )
  683.   #define OPEN3(p,f,m) \
  684. ***************
  685. *** 91,98 ****
  686.   #define LSEEK(h,o,r) \
  687.       ( (h < 0) ? dio_lseek(h,o,r) : lseek(h,o,r) )
  688.   
  689. ! #else /* !MSDOS */
  690.   
  691.   #define OPEN2(p,f) open(p,f)
  692.   #define OPEN3(p,f,m) open(p,f,m)
  693.   #define CLOSE(h) close(h)
  694. --- 93,114 ----
  695.   #define LSEEK(h,o,r) \
  696.       ( (h < 0) ? dio_lseek(h,o,r) : lseek(h,o,r) )
  697.   
  698. ! #elif defined(DISKACC)
  699. ! #define _DSKBIAS                128
  700. ! #define dskdev(path)            ((path[1] == ':' && path[2] == 0))
  701. ! #define isdsk(fd)               ((fd) >= _DSKBIAS)
  702. ! #define OPEN2(path,oflag)       (dskdev(path) ? dsk_open(path, oflag, 0) + _DSKBIAS : open(path, oflag))
  703. ! #define OPEN3(path,oflag,mode)  (dskdev(path) ? dsk_open(path, oflag, mode) + _DSKBIAS : open(path, oflag, mode))
  704. ! #define READ(fd, buf, n)        (isdsk(fd) ? dsk_read(fd - _DSKBIAS, buf, n) : read(fd, buf, n))
  705. ! #define WRITE(fd, buf, n)       (isdsk(fd) ? dsk_write(fd - _DSKBIAS, buf, n) : write(fd, buf, n))
  706. ! #define LSEEK(fd, off, wh)      (isdsk(fd) ? dsk_lseek(fd - _DSKBIAS, off, wh) : lseek(fd, off, wh))
  707. ! #define CLOSE(fd)               (isdsk(fd) ? dsk_close(fd - _DSKBIAS) : close(fd))
  708.   
  709. + #else
  710.   #define OPEN2(p,f) open(p,f)
  711.   #define OPEN3(p,f,m) open(p,f,m)
  712.   #define CLOSE(h) close(h)
  713. ***************
  714. *** 100,104 ****
  715. --- 116,124 ----
  716.   #define WRITE(h,b,c) write(h,b,c)
  717.   #define LSEEK(h,o,r) lseek(h,o,r)
  718.   
  719. + #endif
  720.   #endif /* MSDOS */
  721.   #endif /* _PAX_PORT_H */
  722. diff -cbBw orig/tar.c ./tar.c
  723. *** orig/tar.c    Tue Jan 16 19:23:28 1990
  724. --- ./tar.c    Tue Jan 16 18:19:20 1990
  725. ***************
  726. *** 195,203 ****
  727. --- 195,209 ----
  728.   
  729.       /* check command line argument sanity */
  730.       if (f_create + f_extract + f_list + f_append + f_newer != 1) {
  731. + #ifdef MSDOS
  732. +         printf(
  733. +         "\r\n%s: you must specify exactly one of the c, t, r, u or x options\r\n",
  734. +                        myname);
  735. + #else
  736.       (void) fprintf(stderr,
  737.       "%s: you must specify exactly one of the c, t, r, u or x options\n",
  738.                          myname);
  739. + #endif
  740.       usage();
  741.       exit(EX_ARGSBAD);
  742.       }
  743. ***************
  744. *** 347,356 ****
  745. --- 353,379 ----
  746.   #endif
  747.   {
  748.       DBUG_ENTER("usage");
  749. + #ifdef MSDOS
  750. +     printf("\r\nPAX version 2.0 - POSIX conforming tar and cpio archiver for DOS and OS/2\r\n");
  751. +     printf("\r\nUsage: %s -c[bfvw] device block filename..\r\n", myname);
  752. +     printf("       %s -r[bvw] device block [filename...]\r\n", myname);
  753. +     printf("       %s -t[vf] device\r\n", myname);
  754. +     printf("       %s -u[bvw] device block [filename...]\r\n", myname);
  755. +     printf("       %s -x[flmovw] device [filename...]\r\n", myname);
  756. +     printf("\r\nRename TAR.EXE to PAX.EXE or CPIO.EXE to get the PAX or CPIO user interface.\r\n");
  757. + #ifdef DISKACC
  758. +     printf("\r\nUse the option f with the special device names 0: and 1: to access Unix floppy"
  759. +            "\r\ndisks with tar archives. The disk type is automatically detected.\r\n");
  760. + #endif
  761. + #else
  762.       fprintf(stderr, "Usage: %s -c[bfvw] device block filename..\n", myname);
  763.       fprintf(stderr, "       %s -r[bvw] device block [filename...]\n", myname);
  764.       fprintf(stderr, "       %s -t[vf] device\n", myname);
  765.       fprintf(stderr, "       %s -u[bvw] device block [filename...]\n", myname);
  766.       fprintf(stderr, "       %s -x[flmovw] device [filename...]\n", myname);
  767. + #endif
  768.       exit(1);
  769.   }
  770. diff -cbBw orig/ttyio.c ./ttyio.c
  771. *** orig/ttyio.c    Tue Jan 16 19:23:28 1990
  772. --- ./ttyio.c    Sat Dec 30 19:05:54 1989
  773. ***************
  774. *** 170,175 ****
  775. --- 170,176 ----
  776.           answer[idx++] = c;
  777.       }
  778.       }
  779. +     write(ttyf, "\r\n", 2);
  780.       if (got == 0) {        /* got an EOF */
  781.       DBUG_RETURN(-1);
  782.       }
  783. ***************
  784. *** 270,279 ****
  785.           myname, arvolume + 1, myname);
  786.       for (;;) {
  787.       ret = nextask(msg, answer, sizeof(answer));
  788. !     if (ret == -1 || strcmp(answer, "quit") == 0) {
  789.           fatal("Aborted");
  790.       }
  791. !     if (strcmp(answer, "go") == 0 && open_archive(mode) == 0) {
  792.           break;
  793.       }
  794.       }
  795. --- 271,280 ----
  796.           myname, arvolume + 1, myname);
  797.       for (;;) {
  798.       ret = nextask(msg, answer, sizeof(answer));
  799. !     if (ret == -1 || stricmp(answer, "quit") == 0) {
  800.           fatal("Aborted");
  801.       }
  802. !     if (stricmp(answer, "go") == 0 && open_archive(mode) == 0) {
  803.           break;
  804.       }
  805.       }
  806.