home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / shar349.zip / os2 / patches.os2 < prev    next >
Text File  |  1993-05-14  |  18KB  |  806 lines

  1. Only in new: makefile.os2
  2. Only in new: notes.os2
  3. Only in new: readme.os2
  4. Only in new: shar-emx.def
  5. diff -c old/shar.c new/shar.c
  6. *** old/shar.c    Sat Feb 22 21:42:42 1992
  7. --- new/shar.c    Fri May 14 06:06:30 1993
  8. ***************
  9. *** 176,209 ****
  10.   #define strrchr    rindex
  11.   #endif
  12.   
  13. ! #ifdef MSDOS
  14.   #include <stdlib.h>
  15.   #include <string.h>
  16.   #include <errno.h>
  17.   #include <stdarg.h>
  18.   #include <process.h>
  19. ! #include <direct.h>
  20.   #include <io.h>
  21.   
  22.   /* We will use some GNUish MS-DOS stuff */
  23. - #include <getopt.h>
  24.   #include <gnulib.h>
  25.   char *program_name;
  26.   
  27. - /* Unkown to MS-DOS */
  28. - #define S_ISUID 0x00
  29. - #define S_ISGID 0x00
  30. - #define S_ISVTX 0x00
  31.   
  32.   /* Nobody ever waits for MS-DOS ... */
  33.   #define wait(foo) (-1)
  34.   
  35. - #define who_where(buf) \
  36. -   {                            \
  37. -     char *user = getenv ("USER");            \
  38. -     strcpy (buf, user ? user : "anonymous@any.net");    \
  39. -   }
  40.   
  41.   #define getcwd(buf, len)  msdos_format_filename (getcwd (buf, len))
  42.   
  43. --- 176,217 ----
  44.   #define strrchr    rindex
  45.   #endif
  46.   
  47. ! #if MSDOS || OS2
  48.   #include <stdlib.h>
  49. + /* Unkown to MS-DOS */
  50. + #define S_ISUID 0x00
  51. + #define S_ISGID 0x00
  52. + #define S_ISVTX 0x00
  53. + #define who_where(buf) \
  54. +   {                            \
  55. +     char *user = getenv ("USER");            \
  56. +     strcpy (buf, user ? user : "anonymous@any.net");    \
  57. +   }
  58.   #include <string.h>
  59.   #include <errno.h>
  60.   #include <stdarg.h>
  61.   #include <process.h>
  62. ! #ifndef EMX
  63. ! # include <direct.h>
  64. ! #endif
  65.   #include <io.h>
  66. + #include <getopt.h>
  67. + #ifdef MSC
  68. + # define popen _popen
  69. + # define pclose _pclose
  70. + #endif
  71.   
  72. + #ifdef MSDOS
  73.   /* We will use some GNUish MS-DOS stuff */
  74.   #include <gnulib.h>
  75.   char *program_name;
  76.   
  77.   
  78.   /* Nobody ever waits for MS-DOS ... */
  79.   #define wait(foo) (-1)
  80.   
  81.   
  82.   #define getcwd(buf, len)  msdos_format_filename (getcwd (buf, len))
  83.   
  84. ***************
  85. *** 216,240 ****
  86.   extern char *_pipe_file (int n);
  87.   extern int filter_through_command (char *infile, char *outfile,
  88.                      char *command, ...);
  89. ! /* From uuchar.c */
  90. ! extern void encode (FILE *in, FILE *out);
  91. ! extern void main (int argc, char **argv);
  92. ! static char *mode_map (unsigned short mode, char *mode_str);
  93. ! static void setTOUCH (void);
  94. ! static int walkdown (int (*rtn) (char *, char *), char *file, int filelen,
  95. !              char *rname);
  96. ! static int walktree (int (*rtn) (char *, char *), char *rootname);
  97. ! static int onecheck (char *file, char *rname);
  98. ! static int oneheader (char *file, char *rname);
  99. ! static int header (int argc, char **argv);
  100. ! static void gen_mkdir (char *path);
  101. ! static void gen_mkdir_script (char *path);
  102. ! static int shar (char *file, char *RstrName);
  103. ! static int helpuser (void);
  104.   
  105. ! #else /* not MSDOS */
  106.   
  107.   char *strchr();
  108.   char *strrchr();
  109. --- 224,232 ----
  110.   extern char *_pipe_file (int n);
  111.   extern int filter_through_command (char *infile, char *outfile,
  112.                      char *command, ...);
  113. ! #endif
  114.   
  115. ! #else /* not (MSDOS || OS2) */
  116.   
  117.   char *strchr();
  118.   char *strrchr();
  119. ***************
  120. *** 246,253 ****
  121.   FILE *fdopen();
  122.   FILE *popen();
  123.   
  124. ! #endif /* not MSDOS */
  125.   
  126.   #define    DELIM        "SHAR_EOF"/* put after each file */
  127.   #define PREFIX1        'X'    /* goes in front of each line */
  128.   #define PREFIX2        'Y'    /* goes in front of each line if Delim[0] == PREFIX1 */
  129. --- 238,272 ----
  130.   FILE *fdopen();
  131.   FILE *popen();
  132.   
  133. ! #endif /* not (MSDOS || OS2) */
  134. ! #ifdef __STDC__
  135. ! # define _P(x) x
  136. ! # define VOID void
  137. ! #else
  138. ! # define _P(x) ()
  139. ! # define VOID 
  140. ! #endif
  141.   
  142. + #ifndef OS2
  143. + /* From uuchar.c */
  144. + extern VOID encode _P((FILE *in, FILE *out));
  145. + #endif
  146. + extern VOID main _P((int argc, char **argv));
  147. + static char *mode_map _P((unsigned short mode, char *mode_str));
  148. + static VOID setTOUCH _P((VOID));
  149. + static int walkdown (int (*rtn) (char *, char *), char *file, int filelen,
  150. +              char *rname);
  151. + static int walktree _P((int (*rtn) (char *, char *), char *rootname));
  152. + static int onecheck _P((char *file, char *rname));
  153. + static int oneheader _P((char *file, char *rname));
  154. + static int header _P((int argc, char **argv));
  155. + static VOID gen_mkdir _P((char *path));
  156. + static VOID gen_mkdir_script _P((char *path));
  157. + static int shar _P((char *file, char *RstrName));
  158. + static int helpuser _P((VOID));
  159.   #define    DELIM        "SHAR_EOF"/* put after each file */
  160.   #define PREFIX1        'X'    /* goes in front of each line */
  161.   #define PREFIX2        'Y'    /* goes in front of each line if Delim[0] == PREFIX1 */
  162. ***************
  163. *** 282,288 ****
  164.   #endif
  165.   
  166.   FILE *fpout = stdout;
  167. - int shar();
  168.   unsigned limit = 0;
  169.   int Split = 0;            /* Split files in the middle */
  170.   long ftell();
  171. --- 301,306 ----
  172. ***************
  173. *** 295,301 ****
  174.   int filenum = 0;        /* output file # */
  175.   struct stat fst;        /* check file type, access */
  176.   
  177. ! #ifdef MSDOS
  178.   void
  179.   main (int argc, char **argv)
  180.   #else
  181. --- 313,319 ----
  182.   int filenum = 0;        /* output file # */
  183.   struct stat fst;        /* check file type, access */
  184.   
  185. ! #ifdef __STDC__
  186.   void
  187.   main (int argc, char **argv)
  188.   #else
  189. ***************
  190. *** 310,319 ****
  191. --- 328,346 ----
  192.   extern int optind;
  193.   extern char *optarg;
  194.   
  195. + #ifdef EMX
  196. +     _wildcard (&argc, &argv);
  197. + #endif
  198.   #ifdef MSDOS
  199.       program_name = argv[0];
  200.   #endif
  201. + #ifdef _GETOPT_H
  202. +     while((c = getopt(argc,argv,"+VmSvwd:BTCb:xXcfMpPFas:n:l:L:o:h")) != -1)
  203. + #else
  204.       while((c = getopt(argc,argv,"VmSvwd:BTCb:xXcfMpPFas:n:l:L:o:h")) != -1)
  205. + #endif
  206.       {
  207.           switch(c)
  208.           {
  209. ***************
  210. *** 629,635 ****
  211.   {
  212.       if(Touch)
  213.       {
  214. !         fputs("if touch 2>&1 | fgrep 'amc' > /dev/null\n",fpout);
  215.           fputs(" then TOUCH=touch\n",fpout);
  216.           fputs(" else TOUCH=true\n",fpout);
  217.           fputs("fi\n",fpout);
  218. --- 656,662 ----
  219.   {
  220.       if(Touch)
  221.       {
  222. !         fputs("if touch 2>&1 | grep acm > /dev/null\n",fpout);
  223.           fputs(" then TOUCH=touch\n",fpout);
  224.           fputs(" else TOUCH=true\n",fpout);
  225.           fputs("fi\n",fpout);
  226. ***************
  227. *** 700,706 ****
  228.   #endif /* not MSDOS */
  229.   
  230.   int
  231. ! #ifdef MSDOS
  232.   walkdown (int (*rtn)(char *, char *), char *file, int filelen, char *rname)
  233.   #else
  234.   walkdown(rtn,file,filelen,rname)
  235. --- 727,733 ----
  236.   #endif /* not MSDOS */
  237.   
  238.   int
  239. ! #ifdef __STDC__
  240.   walkdown (int (*rtn)(char *, char *), char *file, int filelen, char *rname)
  241.   #else
  242.   walkdown(rtn,file,filelen,rname)
  243. ***************
  244. *** 762,768 ****
  245.   }
  246.   
  247.   int
  248. ! #ifdef MSDOS
  249.   walktree (int (*rtn)(char *, char *), char *rootname)
  250.   #else
  251.   walktree(rtn,rootname)                /* real walktree */
  252. --- 789,795 ----
  253.   }
  254.   
  255.   int
  256. ! #ifdef __STDC__
  257.   walktree (int (*rtn)(char *, char *), char *rootname)
  258.   #else
  259.   walktree(rtn,rootname)                /* real walktree */
  260. ***************
  261. *** 780,786 ****
  262.           return(1);
  263.       }
  264.       strcpy(file,rootname);
  265.       if(FileStrip)
  266.       { /* use just the filename */
  267.           rname = file + filelen;
  268. --- 807,816 ----
  269.           return(1);
  270.       }
  271.       strcpy(file,rootname);
  272. ! #ifdef OS2
  273. !     for (rname = file; *rname; rname++)
  274. !         if (*rname == '\\') *rname = '/';
  275. ! #endif
  276.       if(FileStrip)
  277.       { /* use just the filename */
  278.           rname = file + filelen;
  279. ***************
  280. *** 821,827 ****
  281.       return(0);
  282.   }
  283.   
  284. ! #ifdef MSDOS
  285.   int
  286.   header (int argc, char **argv)
  287.   #else
  288. --- 851,857 ----
  289.       return(0);
  290.   }
  291.   
  292. ! #ifdef __STDC__
  293.   int
  294.   header (int argc, char **argv)
  295.   #else
  296. ***************
  297. *** 830,836 ****
  298.   #endif
  299.   {
  300.   int i;
  301. - FILE *fpsource;    /* pipe temp */
  302.   char s128[128];
  303.   long now;
  304.   struct tm *utc;
  305. --- 860,865 ----
  306. ***************
  307. *** 886,901 ****
  308.           submitter);
  309.   
  310.   
  311. ! #ifdef MSDOS
  312.       /* Get current directory (w/ cosmetics) */
  313.       getcwd (s128, 127);
  314.   #else /* not MSDOS */
  315.   #if defined(SYS5)
  316.       if(!(fpsource = popen("/bin/pwd","r")))
  317.           return(-1);
  318.       fgets(s128,sizeof(s128),fpsource);
  319.       s128[strlen(s128) - 1] = 0;
  320.       fclose(fpsource);
  321.   #else
  322.   #if defined(BSD42) || defined(sun)
  323.       getwd(s128);
  324. --- 915,933 ----
  325.           submitter);
  326.   
  327.   
  328. ! #if MSDOS || OS2
  329.       /* Get current directory (w/ cosmetics) */
  330.       getcwd (s128, 127);
  331.   #else /* not MSDOS */
  332.   #if defined(SYS5)
  333. +     {
  334. +     FILE *fpsource;    /* pipe temp */
  335.       if(!(fpsource = popen("/bin/pwd","r")))
  336.           return(-1);
  337.       fgets(s128,sizeof(s128),fpsource);
  338.       s128[strlen(s128) - 1] = 0;
  339.       fclose(fpsource);
  340. +     }
  341.   #else
  342.   #if defined(BSD42) || defined(sun)
  343.       getwd(s128);
  344. ***************
  345. *** 1136,1143 ****
  346.       }
  347.   
  348.       if(Binary)
  349. - #ifdef MSDOS
  350.       {
  351.           FILE *outptr;
  352.   
  353.           fflush (fpout);
  354. --- 1168,1175 ----
  355.       }
  356.   
  357.       if(Binary)
  358.       {
  359. + #ifdef MSDOS
  360.           FILE *outptr;
  361.   
  362.           fflush (fpout);
  363. ***************
  364. *** 1161,1168 ****
  365.   
  366.           fpsource = freopen (pipe_file2, "r", fpsource);
  367.           filetype = (Compress ? "Compressed" : "Binary");
  368. !     }
  369.   #else /* not MSDOS */
  370.       { /* fork a uuencode process */
  371.           static int pid,pipex[2];
  372.   
  373. --- 1193,1210 ----
  374.   
  375.           fpsource = freopen (pipe_file2, "r", fpsource);
  376.           filetype = (Compress ? "Compressed" : "Binary");
  377.   #else /* not MSDOS */
  378. + #ifdef OS2
  379. +         fflush(fpout);
  380. +         filetype = (Compress ? "Compressed" : "Binary");
  381. +         if ( Compress )
  382. +             sprintf(line, "compress -b%d < \"%s\" | uuencode _shar_cmp_.tmp", CompressBits, file);
  383. +         else
  384. +         sprintf (line, "uuencode \"%s\" \"%s\"", file, RstrName);
  385. +         fpsource = popen (line, "r");
  386. + #else
  387.       { /* fork a uuencode process */
  388.           static int pid,pipex[2];
  389.   
  390. ***************
  391. *** 1186,1192 ****
  392. --- 1228,1238 ----
  393.   
  394.               if(Compress)
  395.               {
  396. + #ifdef OS2
  397. +                 sprintf(line, "compress -b%d < %s", CompressBits, file);
  398. + #else
  399.                   sprintf(line, "compress -b%d < '%s'", CompressBits, file);
  400. + #endif
  401.                   fpsource = popen(line, "r");
  402.               }
  403.               else
  404. ***************
  405. *** 1205,1211 ****
  406. --- 1251,1259 ----
  407.               exit(0);
  408.           }
  409.       }
  410. + #endif /* not OS2 */
  411.   #endif /* not MSDOS */
  412. +     }
  413.       else
  414.       {
  415.           fpsource = fopen(file,"r");
  416. ***************
  417. *** 1300,1307 ****
  418. --- 1348,1357 ----
  419.                   DeBug("Newfile, remaining %ld, ",remaining);
  420.                   DeBug("limit still %d\n",limit);
  421.   
  422. + #ifndef OS2     /* bugfix, not OS/2-specific */
  423.                   if(line[strlen(line) - 1] != '\n')
  424.                       fputc('\n',fpout);
  425. + #endif
  426.   
  427.                   fprintf(fpout,"%s\n",Delim);
  428.   
  429. ***************
  430. *** 1398,1409 ****
  431.               }
  432.           }
  433.   
  434.           (void) fclose(fpsource);
  435.           while(wait((int *)0) >= 0)
  436.               ;
  437.           if(line[strlen(line) - 1] != '\n')
  438.               fputc('\n',fpout);
  439.   
  440.           fprintf(fpout,"%s\n",Delim);
  441.           if(split && Verbose)
  442. --- 1448,1465 ----
  443.               }
  444.           }
  445.   
  446. + #ifdef OS2
  447. +         if (Binary)
  448. +             pclose(fpsource);
  449. +         else
  450. + #endif
  451.           (void) fclose(fpsource);
  452.           while(wait((int *)0) >= 0)
  453.               ;
  454. ! #ifndef OS2         /* bugfix, not OS/2-specific */
  455.           if(line[strlen(line) - 1] != '\n')
  456.               fputc('\n',fpout);
  457. + #endif
  458.   
  459.           fprintf(fpout,"%s\n",Delim);
  460.           if(split && Verbose)
  461. ***************
  462. *** 1464,1470 ****
  463. --- 1520,1530 ----
  464.                               "wc", "-c", NULL);
  465.                   if (pfp = fopen (pipe_file1, "r"))
  466.   #else
  467. + #ifdef OS2
  468. +                 sprintf(command,"%s \"%s\"",WC,file);
  469. + #else
  470.                   sprintf(command,"%s '%s'",WC,file);
  471. + #endif
  472.                   if((pfp = popen(command,"r")))
  473.   #endif
  474.                   {
  475. Only in new: shar.def
  476. Only in new: shar.exe
  477. diff -c old/unshar.c new/unshar.c
  478. *** old/unshar.c    Sat Feb 22 21:42:40 1992
  479. --- new/unshar.c    Fri May 14 05:54:48 1993
  480. ***************
  481. *** 54,73 ****
  482.   #include <stdio.h>
  483.   #define EOL '\n'
  484.   
  485. ! #ifdef MSDOS
  486. ! #define VOID void
  487.   #include <stdlib.h>
  488.   #include <string.h>
  489. ! #include <direct.h>
  490.   #include <errno.h>
  491.   #include <process.h>
  492.   #include <io.h>
  493.   #ifdef USE_GNU_GETOPT
  494. ! #include <getopt.h>
  495.   #endif
  496.   
  497.   #include <gnulib.h>
  498.   char *program_name;
  499. --- 54,77 ----
  500.   #include <stdio.h>
  501.   #define EOL '\n'
  502.   
  503. ! #if OS2 || MSDOS
  504.   #include <stdlib.h>
  505.   #include <string.h>
  506. ! #ifndef EMX
  507. ! # include <direct.h>
  508. ! #endif
  509.   #include <errno.h>
  510.   #include <process.h>
  511.   #include <io.h>
  512.   #ifdef USE_GNU_GETOPT
  513. ! # include <getopt.h>
  514.   #endif
  515. + #define VOID void
  516. + #define USE_GETCWD
  517. + #endif
  518. + #ifdef MSDOS
  519.   
  520.   #include <gnulib.h>
  521.   char *program_name;
  522. ***************
  523. *** 81,99 ****
  524.   extern int filter_through_command (char *infile, char *outfile,
  525.                      char *command, ...);
  526.   
  527. - extern void main (int argc, char **argv);
  528. - static void process (char *name, FILE * in);
  529. - static int position (char *fn, FILE * fil, long start);
  530. - static int stlmatch (char *big, char *small);
  531. - static int smatch (char *dat, char *pat, char **res);
  532. - static void quit (int status, char *message);
  533. - #define USE_GETCWD
  534.   #define getcwd(buf, len)  msdos_format_filename (getcwd (buf, len))
  535.   
  536.   #else /* not MSDOS */
  537.   
  538. ! #define VOID
  539.   
  540.   char *strchr();
  541.   #if (defined(pyr) || defined(sun) || defined(BSD42) || \
  542. --- 85,101 ----
  543.   extern int filter_through_command (char *infile, char *outfile,
  544.                      char *command, ...);
  545.   
  546.   #define getcwd(buf, len)  msdos_format_filename (getcwd (buf, len))
  547.   
  548.   #else /* not MSDOS */
  549.   
  550. ! #ifdef OS2
  551. ! #ifdef MSC
  552. ! # define popen     _popen
  553. ! # define pclose    _pclose
  554. ! #endif
  555. ! #else /* not (MSDOS || OS2) */
  556.   
  557.   char *strchr();
  558.   #if (defined(pyr) || defined(sun) || defined(BSD42) || \
  559. ***************
  560. *** 105,110 ****
  561. --- 107,113 ----
  562.   #define USE_GETCWD
  563.   char *getcwd();
  564.   #endif
  565. + #endif
  566.   
  567.   #endif /* not MSDOS */
  568.   
  569. ***************
  570. *** 111,116 ****
  571. --- 114,132 ----
  572.   extern char *optarg;
  573.   extern int optind;
  574.   
  575. + #ifdef __STDC__
  576. + # define _P(x) x
  577. + #else
  578. + # define _P(x) ()
  579. + #endif
  580. + static VOID process     _P((char *name, FILE * in));
  581. + static int position     _P((char *fn, FILE * fil, long start));
  582. + static int stlmatch     _P((char *big, char *small));
  583. + static int smatch        _P((char *dat, char *pat, char **res));
  584. + static VOID quit        _P((int status, char *message));
  585. + static VOID usage        _P((VOID));
  586.   int c_flag = 0;
  587.   int continue_reading = 0;
  588.   char *exit_string = "exit 0";
  589. ***************
  590. *** 125,137 ****
  591.       int i,ch;
  592.       FILE *in;
  593.       char s1024[1024];
  594.   
  595.   #ifdef MSDOS
  596.       program_name = argv[0];
  597.   #endif
  598.   
  599. !     setbuf(stdout,NULL);
  600.       setbuf(stderr,NULL);
  601.   
  602.   #ifdef USE_GETCWD
  603.       if(!getcwd(argvdir,sizeof(argvdir)))
  604. --- 141,162 ----
  605.       int i,ch;
  606.       FILE *in;
  607.       char s1024[1024];
  608. + #ifdef OS2
  609. +     char    drive[_MAX_DRIVE], path[_MAX_PATH], *p;
  610. + #endif
  611.   
  612. + #ifdef EMX
  613. +     _wildcard (&argc, &argv);
  614. + #endif
  615.   #ifdef MSDOS
  616.       program_name = argv[0];
  617.   #endif
  618.   
  619. ! #ifndef OS2            
  620. !     setbuf(stdout,NULL);     /* Does anyone really want these? */
  621.       setbuf(stderr,NULL);
  622. + #endif
  623.   
  624.   #ifdef USE_GETCWD
  625.       if(!getcwd(argvdir,sizeof(argvdir)))
  626. ***************
  627. *** 175,181 ****
  628.               exit_string_length = strlen(exit_string);
  629.               break;
  630.           default:
  631. !             quit(2,"Usage: unshar [-c] [-e | -E exit_line] [-d directory] [file ...]\n");
  632.           }
  633.       }
  634.   
  635. --- 200,206 ----
  636.               exit_string_length = strlen(exit_string);
  637.               break;
  638.           default:
  639. !             usage();
  640.           }
  641.       }
  642.   
  643. ***************
  644. *** 183,189 ****
  645.       {
  646.           for(i= optind; i < argc; ++i)
  647.           {
  648. !             if(argv[i][0] == '/') {
  649.                   strcpy(s1024,argv[i]);
  650.               } else {
  651.                   strcpy(s1024,argvdir);
  652. --- 208,220 ----
  653.       {
  654.           for(i= optind; i < argc; ++i)
  655.           {
  656. ! #ifdef OS2
  657. !             _splitpath(argv[i], drive, NULL, NULL, NULL);
  658. !             if (*drive || argv[i][0] == '\\' ||
  659. ! #else                
  660. !             if(
  661. ! #endif
  662. !                 argv[i][0] == '/') {
  663.                   strcpy(s1024,argv[i]);
  664.               } else {
  665.                   strcpy(s1024,argvdir);
  666. ***************
  667. *** 190,196 ****
  668. --- 221,233 ----
  669.                   strcat(s1024,"/");
  670.                   strcat(s1024,argv[i]);
  671.               }
  672. + #ifdef OS2
  673. +             while (p = strchr(s1024, '\\'))
  674. +                 *p = '/';
  675. +             if(!(in = fopen(s1024,"rb")))
  676. + #else
  677.               if(!(in = fopen(s1024,"r")))
  678. + #endif
  679.               {
  680.                   perror(s1024);
  681.                   exit(1);
  682. ***************
  683. *** 201,221 ****
  684.       }
  685.       else
  686.       {
  687.           sprintf(s1024,"/tmp/unsh.%05d",getpid());
  688.           unlink(s1024);
  689.           if(!(in = fopen(s1024,"w+")))
  690.           {
  691.               fprintf(stderr,"cannot open temp file '%s'\n",s1024);
  692.               exit(1);
  693.           }
  694.           unlink(s1024);    /* don't try this with MSDOS, sports fans */
  695.           while(i = fread(s1024,1,sizeof(s1024),stdin))
  696.               fwrite(s1024,i,1,in);
  697.           rewind(in);
  698.           process("standard input",in);
  699.           fclose(in);
  700.       }
  701.       exit(0);
  702.   }
  703.   
  704. --- 238,276 ----
  705.       }
  706.       else
  707.       {
  708. + #ifdef OS2
  709. +         if (isatty(fileno(stdin)))
  710. +             usage();
  711. +         if ((p = tempnam("/tmp", "unsh")) == NULL) {
  712. +             fprintf(stderr,"cannot open temp file");
  713. +             exit(1);
  714. +         }
  715. +         else {
  716. +             strcpy(path, p);
  717. +               strcpy(s1024, p);
  718. +         }
  719. + #else
  720.           sprintf(s1024,"/tmp/unsh.%05d",getpid());
  721.           unlink(s1024);
  722. + #endif
  723.           if(!(in = fopen(s1024,"w+")))
  724.           {
  725.               fprintf(stderr,"cannot open temp file '%s'\n",s1024);
  726.               exit(1);
  727.           }
  728. + #ifndef OS2
  729.           unlink(s1024);    /* don't try this with MSDOS, sports fans */
  730. + #endif
  731.           while(i = fread(s1024,1,sizeof(s1024),stdin))
  732.               fwrite(s1024,i,1,in);
  733.           rewind(in);
  734.           process("standard input",in);
  735.           fclose(in);
  736. + #ifdef OS2
  737. +         unlink(path);
  738. +         free(p);
  739. + #endif
  740.       }
  741.       exit(0);
  742.   }
  743.   
  744. ***************
  745. *** 238,244 ****
  746. --- 293,303 ----
  747.           if ((shpr = fopen (pipe_file, "w")) == NULL)
  748.             error (1, 0, "pipe error: %s", pipe_file);
  749.   #else
  750. + #ifdef OS2
  751. +         if(!(shpr = popen((c_flag ? "sh -s -c" : "sh"),"wb")))
  752. + #else
  753.           if(!(shpr = popen((c_flag ? "sh -s -c" : "sh"),"w")))
  754. + #endif
  755.               quit(1,"unshar: cannot open 'sh' process\n");
  756.   #endif
  757.           if (!continue_reading) {
  758. ***************
  759. *** 459,464 ****
  760. --- 518,536 ----
  761.   {
  762.       fprintf(stderr,message);
  763.       exit(status);
  764. + }
  765. + VOID
  766. + usage(VOID)
  767. + {
  768. +     fprintf(stderr, "unshar 3.49\n\n");
  769. +     fprintf(stderr, "Usage: unshar [-c] [-e | -E exit_line] [-d directory] [file ...]\n");
  770. +     fprintf(stderr, "\t-c  passed to sh\n");
  771. +     fprintf(stderr, "\t-e  \"exit 0\" separates files\n");
  772. +     fprintf(stderr, "\t-E  exit_line separates files (-e == -E \"exit 0\")\n");
  773. +     fprintf(stderr, "\t-d  change directory before unshar'ing\n");
  774. +     quit(2,"");
  775.   }
  776.   
  777.   #ifndef USE_GNU_GETOPT
  778. Only in new: unshar.exe
  779.