home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Product / Product.zip / sc621_3.zip / src / patches.os2 < prev    next >
Text File  |  1994-05-14  |  30KB  |  1,214 lines

  1. Only in orig: bugs.msg
  2. diff -c orig/cmds.c src/cmds.c
  3. *** orig/cmds.c    Mon Jun 01 07:35:52 1992
  4. --- src/cmds.c    Mon Mar 21 09:48:16 1994
  5. ***************
  6. *** 19,24 ****
  7. --- 19,40 ----
  8.   #endif
  9.   #endif
  10.   
  11. + /* emx and MSC can produce bound versions, but the usual popen is only
  12. +    available in OS2_MODE. For bound versions, both __OS2__ and MSDOS 
  13. +    will be defined. PDCurses can "#undef MSDOS", so keep this before 
  14. +    the curses.h include. */
  15. + #if defined(MSDOS) || defined(__OS2__)
  16. + #include <stdlib.h>
  17. + #if defined(MSDOS)
  18. + #include "popen.h"
  19. + #define popen os_popen
  20. + #define pclose os_pclose
  21. + #elif defined(_MSC_VER)
  22. + #define popen _popen
  23. + #define pclose _pclose
  24. + #endif
  25. + #endif
  26.   #include <curses.h>
  27.   #if defined(BSD42) || defined(BSD43) || defined(VMS)
  28.   #include <sys/file.h>
  29. ***************
  30. *** 28,38 ****
  31.   #include "sc.h"
  32.   #include <signal.h>
  33.   #include <errno.h>
  34. ! #ifdef SYSV3
  35. ! extern void exit();
  36. ! #else
  37. ! extern int exit();
  38.   #endif
  39.   
  40.   void    openrow();
  41. --- 44,51 ----
  42.   #include "sc.h"
  43.   #include <signal.h>
  44.   #include <errno.h>
  45. ! #if !defined(__OS2__) && !defined(MSDOS)
  46. ! extern    int    errno;
  47.   #endif
  48.   
  49.   void    openrow();
  50. ***************
  51. *** 39,46 ****
  52.   void    syncref();
  53.   void    unspecial();
  54.   
  55. - extern    int    errno;
  56.   /* a linked list of free [struct ent]'s, uses .next as the pointer */
  57.   extern    struct ent *freeents;
  58.   
  59. --- 52,57 ----
  60. ***************
  61. *** 687,692 ****
  62. --- 698,860 ----
  63.       (void) fprintf(f, "\n");
  64.   }
  65.   
  66. + /* The Jun-92 updates included default filenames for listings, with
  67. +    a 14-char limit on names. IsHPFSFileSystem(), getname(), add_ext(),
  68. +    and mangle() provide the necessary changes for OS/2 and DOS. */
  69. + #if defined(__OS2__)
  70. + int IsHPFSFileSystem (char *directory)
  71. + {
  72. +     ULONG        lMap;
  73. +     BYTE        bData[128];
  74. +     BYTE        bName[3];
  75. +     int            i;
  76. +     char        *FName;
  77. + #if defined (_MSC_VER)
  78. +     USHORT        cbData;
  79. +     USHORT        nDrive;
  80. + #define DosQueryCurrentDisk DosQCurDisk
  81. + #else
  82. +     ULONG        cbData;
  83. +     ULONG        nDrive;
  84. +     PFSQBUFFER2        pFSQ = (PFSQBUFFER2)bData;
  85. + #endif
  86. +     if ( _osmode == DOS_MODE )
  87. +     return FALSE;
  88. +     if (isalpha (directory[0]) && (directory[1] == ':'))
  89. +     nDrive = toupper (directory[0]) - '@';
  90. +     else
  91. +     DosQueryCurrentDisk (&nDrive, &lMap);
  92. + /* Set up the drive name */
  93. +     bName[0] = (char) (nDrive + '@');
  94. +     bName[1] = ':';
  95. +     bName[2] = 0;
  96. +     cbData = sizeof (bData);
  97. + #if defined(_MSC_VER)
  98. +     if (DosQFSAttach (bName, 0, FSAIL_QUERYNAME, bData, &cbData, 0L))
  99. + #else
  100. +     if (DosQueryFSAttach (bName, 0, FSAIL_QUERYNAME, pFSQ, &cbData))
  101. + #endif
  102. +       return FALSE;
  103. + #if defined(_MSC_VER)
  104. +     FName = bData + (*((USHORT *) (bData + 2)) + 7);
  105. + #else
  106. +     FName = pFSQ->szName + pFSQ->cbName + 1;
  107. + #endif
  108. +     if (strcmp(FName, "HPFS"))
  109. +       return FALSE;
  110. +     return(TRUE);
  111. + }
  112. + #endif
  113. + #if defined(__OS2__) || defined(MSDOS)
  114. + char *getshell(shellbuf *shell)
  115. + {
  116. +   static char *sname[] = {"cmd", "command", "4os2", "4dos", NULL};
  117. +   char cmd[_MAX_PATH], *shl, *opt;
  118. +   int i;
  119. +   opt = "-c";
  120. +   if ((shl = getenv("SHELL")) == NULL)
  121. +     shl = getenv("COMSPEC");
  122. +   if (shl) {
  123. +     _splitpath(shl, NULL, NULL, cmd, NULL);
  124. +     for (i = 0; sname[i]; i++)
  125. +       if (stricmp(cmd, sname[i]) == 0) {
  126. +     opt = "/c"; break;
  127. +       }
  128. +   }
  129. +   else
  130. +     shl = "/bin/sh";
  131. +   if (shell) {
  132. +     strcpy(shell->name, shl);
  133. +     strcpy(shell->opt, opt);
  134. +   }
  135. +   return(shl);
  136. + }
  137. + #endif
  138. + char *
  139. + getname(path)
  140. + char *path;
  141. + {
  142. +   char *tpp;
  143. + #if defined(__EMX__)
  144. +   tpp = _getname(path);
  145. + #elif defined(__OS2__) || defined(MSDOS)
  146. +   for (tpp = path + strlen(path); tpp > path; tpp--)
  147. +     if (strchr(":/\\", *(tpp-1))) break;
  148. + #else
  149. +   if ((tpp = strrchr(path, '/'))  == NULL)
  150. +     tpp = path;
  151. +   else
  152. +     tpp++;
  153. + #endif
  154. +   return(tpp);
  155. + }
  156. + char *
  157. + mangle(filename)
  158. + char *filename;
  159. + {
  160. + #if defined(__OS2__) || defined(MSDOS)
  161. +   char drive[_MAX_DRIVE], dir[_MAX_DIR], fname[_MAX_FNAME], ext[_MAX_EXT];
  162. +   char *p;
  163. +   int i, j;
  164. + #if defined(__OS2__)
  165. +   if (IsHPFSFileSystem(filename)) 
  166. +     return(filename);
  167. + #endif
  168. +   /* Simple mangling tries to get most of the filename characters. */
  169. +   _splitpath(filename, drive, dir, fname, ext);
  170. +   if ((i = strlen(fname)) > 8) {   /* try to put chars in extension */
  171. +     if (*ext == '\0') sprintf(ext, ".%.3s", fname + 8);
  172. +   }
  173. +   else if ((j = strlen(ext)) > 4) {  /* try to put chars in fname portion */
  174. +     if (i < 7) {
  175. +       j = (7-i < j-4) ? 7-i : j-4;
  176. +       sprintf(fname + i, "_%*s", j, ext+1);
  177. +       strcpy(ext + 1, ext + 1 + j);
  178. +     }
  179. +   }
  180. +   fname[8] = '\0'; ext[4] = '\0';
  181. +   while (p = strchr(fname, '.')) *p = '_';
  182. +   _makepath(filename, drive, dir, fname, ext);
  183. + #else                   /* put 14-char limit on filename */
  184. +   if (strlen(filename) > 14) filename[14] = '\0';
  185. + #endif
  186. +   return(filename);
  187. + }
  188. + char *
  189. + add_ext(path, ext)
  190. + char *path, *ext;
  191. + {
  192. +   char *fname;
  193. +   if (ext == NULL || *ext == '\0') return path;
  194. + #if defined(__OS2__) || defined(MSDOS)
  195. +   mangle(strcat(path, ext));
  196. + #else    /* filename is limited to 14 characters */
  197. +   fname = getname(path);
  198. +   fname[10] = '\0';
  199. +   strcat(fname, ext);
  200. + #endif
  201. +   return(path);
  202. + }
  203.   void
  204.   printfile (fname, r0, c0, rn, cn)
  205.   char *fname;
  206. ***************
  207. *** 700,723 ****
  208.       int fieldlen, nextcol;
  209.       register row, col;
  210.       register struct ent **pp;
  211. -     char file[32];
  212.       char path[256];
  213. -     char *tpp;
  214.   
  215. -     /* printfile will be the [path/]file ---> [path/]file.out,
  216. -      * file is limited to 14 characters.
  217. -      */
  218.       if (*fname == '\0') {
  219. !     strcpy(path, curfile);
  220. !     if ((tpp = strrchr(path, '/'))  == NULL)
  221. !         tpp = path;
  222. !     else
  223. !         tpp++;
  224. !     strcpy(file, tpp);
  225. !     file[10] = '\0';
  226. !     sprintf(tpp, "%s.asc", file);
  227. !     fname = path;
  228.       }
  229.   
  230.       if ((strcmp(fname, curfile) == 0) &&
  231. --- 868,881 ----
  232.       int fieldlen, nextcol;
  233.       register row, col;
  234.       register struct ent **pp;
  235.       char path[256];
  236.   
  237.       if (*fname == '\0') {
  238. !       /* printfile will be the [path/]file ---> [path/]file.out,
  239. !        * possibly with some mangling by add_ext().
  240. !        */
  241. !       strcpy(path, curfile);
  242. !       add_ext(fname = path, ".asc");
  243.       }
  244.   
  245.       if ((strcmp(fname, curfile) == 0) &&
  246. ***************
  247. *** 886,915 ****
  248.       register row, col;
  249.       register struct ent **pp;
  250.       char coldelim = DEFCOLDELIM;
  251. -     char file[32];
  252.       char path[256];
  253. -     char *tpp;
  254.   
  255. -     /* tblprintfile will be the [path/]file ---> [path/]file.out,
  256. -      * file is limited to 14 characters.
  257. -      */
  258.       if (*fname == '\0') {
  259. !     strcpy(path, curfile);
  260. !     if ((tpp = strrchr(path, '/'))  == NULL)
  261. !       tpp = path;
  262. !     else
  263. !       tpp++;
  264. !     strcpy(file, tpp);
  265. !     file[10] = '\0';
  266. !     if (tbl_style == 0)
  267. !       sprintf(tpp, "%s.cln", file);
  268. !     else if (tbl_style == TBL)
  269. !       sprintf(tpp, "%s.tbl", file);
  270. !     else if (tbl_style == LATEX)
  271. !       sprintf(tpp, "%s.lat", file);
  272. !     else if (tbl_style == TEX)
  273. !       sprintf(tpp, "%s.tex", file);
  274. !     fname = path;
  275.       }
  276.   
  277.       if ((strcmp(fname, curfile) == 0) &&
  278. --- 1044,1065 ----
  279.       register row, col;
  280.       register struct ent **pp;
  281.       char coldelim = DEFCOLDELIM;
  282.       char path[256];
  283.   
  284.       if (*fname == '\0') {
  285. !       /* tblprintfile will be the [path/]file ---> [path/]file.out,
  286. !        * possibly with some mangling by add_ext().
  287. !        */
  288. !       strcpy(path, curfile);
  289. !       if (tbl_style == 0)
  290. !     add_ext(path, ".cln");
  291. !       else if (tbl_style == TBL)
  292. !     add_ext(path, ".tbl");
  293. !       else if (tbl_style == LATEX)
  294. !     add_ext(path, ".lat");
  295. !       else if (tbl_style == TEX)
  296. !     add_ext(path, ".tex");
  297. !       fname = path;
  298.       }
  299.   
  300.       if ((strcmp(fname, curfile) == 0) &&
  301. ***************
  302. *** 1306,1316 ****
  303.       return(fopen(efname, "w"));
  304.       }
  305.   
  306. - #if defined(MSDOS)
  307. -     error("Piping not available under MS-DOS\n");
  308. -     return(0);
  309. - #else
  310.       fname++;                /* Skip | */
  311.       if ( pipe (pipefd) < 0) {
  312.       error("Can't make pipe to child");
  313.       *rpid = 0;
  314. --- 1456,1481 ----
  315.       return(fopen(efname, "w"));
  316.       }
  317.   
  318.       fname++;                /* Skip | */
  319. + #if defined(MSDOS) || defined(__OS2__) 
  320. +     { 
  321. +       shellbuf shell;
  322. +       char cmd[256];
  323. +       getshell(&shell);
  324. +       sprintf(cmd, "%s %s %s", shell.name, shell.opt, fname);
  325. +       if ((f = popen(cmd, "w")) == NULL) {
  326. +     error ("Can't popen output");
  327. +     *rpid = 0;
  328. +     return(0);
  329. +       }
  330. +       else
  331. +     *rpid = -1;
  332. +     }
  333. + #else
  334.       if ( pipe (pipefd) < 0) {
  335.       error("Can't make pipe to child");
  336.       *rpid = 0;
  337. ***************
  338. *** 1343,1351 ****
  339.           return(0);
  340.       }
  341.       }
  342. ! #endif /* VMS */
  343.       return(f);
  344. - #endif /* MSDOS */
  345.   }
  346.   
  347.   /* close a file opened by openout(), if process wait for return */
  348. --- 1508,1516 ----
  349.           return(0);
  350.       }
  351.       }
  352. ! #endif
  353. ! #endif
  354.       return(f);
  355.   }
  356.   
  357.   /* close a file opened by openout(), if process wait for return */
  358. ***************
  359. *** 1356,1363 ****
  360.   {
  361.       int temp;
  362.   
  363.       (void) fclose (f);
  364. - #if !defined(MSDOS)
  365.       if (pid) {
  366.            while (pid != wait(&temp)) /**/;
  367.        (void) printf("Press RETURN to continue ");
  368. --- 1521,1538 ----
  369.   {
  370.       int temp;
  371.   
  372. + #if defined(MSDOS) || defined(__OS2__)
  373. +     if (pid == -1) {
  374. +       pclose(f);
  375. +       (void) printf("Press RETURN to continue ");
  376. +       (void) fflush(stdout);
  377. +       (void) nmgetch();
  378. +       goraw();
  379. +     }
  380. +     else
  381. +       fclose(f);
  382. + #else
  383.       (void) fclose (f);
  384.       if (pid) {
  385.            while (pid != wait(&temp)) /**/;
  386.        (void) printf("Press RETURN to continue ");
  387. ***************
  388. *** 1365,1371 ****
  389.        (void) nmgetch();
  390.        goraw();
  391.       }
  392. ! #endif /* MSDOS */
  393.   }
  394.   
  395.   void
  396. --- 1540,1546 ----
  397.        (void) nmgetch();
  398.        goraw();
  399.       }
  400. ! #endif
  401.   }
  402.   
  403.   void
  404. ***************
  405. *** 1466,1472 ****
  406.       (void) strcpy(save,fname);
  407.   
  408.       if ((f= openout(fname, &pid)) == (FILE *)0)
  409. !     {    error ("Can't create file \"%s\"", fname);
  410.       return (-1);
  411.       }
  412.   
  413. --- 1641,1647 ----
  414.       (void) strcpy(save,fname);
  415.   
  416.       if ((f= openout(fname, &pid)) == (FILE *)0)
  417. !     { error ("Can't create file \"%s\"", fname);
  418.       return (-1);
  419.       }
  420.   
  421. ***************
  422. *** 1772,1778 ****
  423.   }
  424.   
  425.   /* expand a ~ in a path to your home directory */
  426. ! #if !defined(MSDOS) && !defined(VMS)
  427.   #include <pwd.h>
  428.   #endif
  429.   char    *
  430. --- 1947,1953 ----
  431.   }
  432.   
  433.   /* expand a ~ in a path to your home directory */
  434. ! #if !defined(MSDOS) && !defined(__OS2__) && !defined(VMS)
  435.   #include <pwd.h>
  436.   #endif
  437.   char    *
  438. ***************
  439. *** 1795,1801 ****
  440.           if ((*pathptr == '/') || (*pathptr == '\0'))
  441.           {    strcpy(tmppath, HomeDir);
  442.           }
  443. ! #if !defined(MSDOS) && !defined(VMS)
  444.           else
  445.           {    struct    passwd *pwent;
  446.               extern    struct    passwd *getpwnam();
  447. --- 1970,1976 ----
  448.           if ((*pathptr == '/') || (*pathptr == '\0'))
  449.           {    strcpy(tmppath, HomeDir);
  450.           }
  451. ! #if !defined(MSDOS) && !defined(__OS2__) && !defined(VMS)
  452.           else
  453.           {    struct    passwd *pwent;
  454.               extern    struct    passwd *getpwnam();
  455. ***************
  456. *** 1846,1857 ****
  457.   
  458.       /* tpath will be the [path/]file ---> [path/]#file~ */
  459.       strcpy(tpath, path);
  460. !     if ((tpp = strrchr(tpath, '/')) == NULL)
  461. !         tpp = tpath;
  462. !     else
  463. !         tpp++;
  464. !     strcpy(fname, tpp);
  465.       (void) sprintf(tpp, "#%s~", fname);
  466.   
  467.       if (stat(path, &statbuf) == 0)
  468.       {
  469. --- 2021,2029 ----
  470.   
  471.       /* tpath will be the [path/]file ---> [path/]#file~ */
  472.       strcpy(tpath, path);
  473. !     strcpy(fname, tpp = getname(tpath));
  474.       (void) sprintf(tpp, "#%s~", fname);
  475. +     mangle(tpath);
  476.   
  477.       if (stat(path, &statbuf) == 0)
  478.       {
  479. ***************
  480. *** 1895,1913 ****
  481.   }
  482.   #endif
  483.   
  484. - static int day_month_starts[12] = {0,31,59,90,120,151,181,212,243,273,304,334};
  485.   double convert_date(d, m, y)
  486.   int d;
  487.   int m;
  488.   int y;
  489.   {
  490. !   /* Convert to years since 1970. (or 2000, fix by 2070) */
  491. !   if (y > 1970) y -= 1970;    /* Full year given */
  492. !   else if (y >= 70) y -= 70;    /* Years since 1900 */
  493. !   else y += 30;            /* Years since 2000 */
  494. !   /* Use quarter days to compensate for leap years. */
  495. !   return (double)((y * (365 * 4 + 1) + day_month_starts[m-1] * 4 + d * 4 - 2) *
  496. !           6 * 60 * 60);
  497.   }
  498.   
  499. --- 2067,2080 ----
  500.   }
  501.   #endif
  502.   
  503.   double convert_date(d, m, y)
  504.   int d;
  505.   int m;
  506.   int y;
  507.   {
  508. !   /* Convert to yyyy (if y<70 then assume 2000+y, fix by 2070) */
  509. !   if (y < 70) y += 2000;
  510. !   else if (y < 100) y += 1900;
  511. !   return dodts(m,d,y);
  512.   }
  513.   
  514. Only in src: COPYING
  515. Only in src: COPYING.EMX
  516. diff -c orig/format.c src/format.c
  517. *** orig/format.c    Mon Jun 01 07:35:54 1992
  518. --- src/format.c    Tue Nov 09 19:02:04 1993
  519. ***************
  520. *** 95,103 ****
  521.   #define EOS    '\0'
  522.   #define MAXBUF    256
  523.   
  524. ! extern char
  525. !   *strcpy(),
  526. !   *strcat();
  527.   
  528.   static char
  529.     *fmt_int(),
  530. --- 95,106 ----
  531.   #define EOS    '\0'
  532.   #define MAXBUF    256
  533.   
  534. ! #if defined(__OS2__)
  535. ! # include <string.h>
  536. ! #else
  537. ! extern char *strcpy();
  538. ! extern char *strcat();
  539. ! #endif
  540.   
  541.   static char
  542.     *fmt_int(),
  543. ***************
  544. *** 578,584 ****
  545.     }
  546.     if (fmt == REFMTDATE) {
  547.       int i;
  548. !     char *time;
  549.       long int secs;
  550.   
  551.       if (buflen < 9) {
  552. --- 581,587 ----
  553.     }
  554.     if (fmt == REFMTDATE) {
  555.       int i;
  556. !     char *time_of_day;
  557.       long int secs;
  558.   
  559.       if (buflen < 9) {
  560. ***************
  561. *** 587,602 ****
  562.       }
  563.       else {
  564.         secs = (time_t)val;
  565. !       time = ctime(&secs);
  566. !       buf[0] = time[8];
  567. !       buf[1] = time[9];
  568.         buf[2] = ' ';
  569. !       buf[3] = time[4];
  570. !       buf[4] = time[5];
  571. !       buf[5] = time[6];
  572.         buf[6] = ' ';
  573. !       buf[7] = time[22];
  574. !       buf[8] = time[23];
  575.         for (i = 9; i < width; i++) buf[i] = ' ';
  576.         buf[i] = '\0';
  577.       }
  578. --- 590,605 ----
  579.       }
  580.       else {
  581.         secs = (time_t)val;
  582. !       time_of_day = ctime(&secs);
  583. !       buf[0] = time_of_day[8];
  584. !       buf[1] = time_of_day[9];
  585.         buf[2] = ' ';
  586. !       buf[3] = time_of_day[4];
  587. !       buf[4] = time_of_day[5];
  588. !       buf[5] = time_of_day[6];
  589.         buf[6] = ' ';
  590. !       buf[7] = time_of_day[22];
  591. !       buf[8] = time_of_day[23];
  592.         for (i = 9; i < width; i++) buf[i] = ' ';
  593.         buf[i] = '\0';
  594.       }
  595. Only in src: getopt.c
  596. Only in src: gram.c
  597. Only in src: gram.err
  598. diff -c orig/help.c src/help.c
  599. *** orig/help.c    Mon Jun 01 07:35:54 1992
  600. --- src/help.c    Wed Nov 10 21:28:58 1993
  601. ***************
  602. *** 610,619 ****
  603.       while (*pagep)
  604.       {
  605.   #ifndef TROFF
  606. !     (void) fputs(SCNAME, stdout);
  607. !     (void) fputs(header);
  608. !     (void) printf("\n");
  609. !     (void) puts(revision);
  610.   #endif
  611.   
  612.       for (lineno = 0; (*pagep)[lineno]; lineno++) {
  613. --- 610,616 ----
  614.       while (*pagep)
  615.       {
  616.   #ifndef TROFF
  617. !     (void) printf("%s%s\n%s", SCNAME, header, revision);
  618.   #endif
  619.   
  620.       for (lineno = 0; (*pagep)[lineno]; lineno++) {
  621. diff -c orig/interp.c src/interp.c
  622. *** orig/interp.c    Mon Jun 01 07:38:50 1992
  623. --- src/interp.c    Sat Nov 20 09:24:10 1993
  624. ***************
  625. *** 26,33 ****
  626.   #include <setjmp.h>
  627.   #include <stdio.h>
  628.   #include <ctype.h>
  629.   extern int errno;        /* set by math functions */
  630.   #ifdef BSD42
  631.   #include <strings.h>
  632.   #include <sys/time.h>
  633. --- 26,36 ----
  634.   #include <setjmp.h>
  635.   #include <stdio.h>
  636.   #include <ctype.h>
  637. ! #include <errno.h>
  638. ! #if !defined(__OS2__) && !defined(MSDOS)
  639.   extern int errno;        /* set by math functions */
  640. + #endif
  641.   #ifdef BSD42
  642.   #include <strings.h>
  643.   #include <sys/time.h>
  644. ***************
  645. *** 41,46 ****
  646. --- 44,65 ----
  647.   #endif
  648.   #endif
  649.   
  650. + /* emx and MSC can produce bound versions, but the usual popen is only
  651. +    available in OS2_MODE. For bound versions, both __OS2__ and MSDOS 
  652. +    will be defined. PDCurses can "#undef MSDOS", so keep this before 
  653. +    the curses.h include. */
  654. + #if defined(MSDOS) || defined(__OS2__)
  655. + #include <stdlib.h>
  656. + #if defined(MSDOS)
  657. + #include "popen.h"
  658. + #define popen os_popen
  659. + #define pclose os_pclose
  660. + #elif defined(_MSC_VER)
  661. + #define popen _popen
  662. + #define pclose _pclose
  663. + #endif
  664. + #endif
  665.   #include <curses.h>
  666.   #include "sc.h"
  667.   
  668. ***************
  669. *** 551,557 ****
  670. --- 570,578 ----
  671.   int which;
  672.   double when;
  673.   {
  674. + #if !defined(__OS2__)
  675.       long time();
  676. + #endif
  677.   
  678.       static long t_cache;
  679.       static struct tm tm_cache;
  680. ***************
  681. *** 1023,1029 ****
  682.    * written to files, etc.
  683.    */
  684.   
  685. ! #if defined(VMS) || defined(MSDOS)
  686.   char *
  687.   doext(command, value)
  688.   char *command;
  689. --- 1044,1050 ----
  690.    * written to files, etc.
  691.    */
  692.   
  693. ! #if defined(VMS)
  694.   char *
  695.   doext(command, value)
  696.   char *command;
  697. ***************
  698. *** 1336,1348 ****
  699.       for (i=0; i<=maxrow; i++)
  700.           for (j=0; j<=maxcol; j++)
  701.           if ((p = *ATBL(tbl,i,j)) && !(p->flags&is_locked) && p->expr) RealEvalOne(p,i,j,&chgct);
  702. !     }
  703.       else if ( calc_order == BYCOLS ) {
  704. !     for (j=0; j<=maxcol; j++)
  705.       {   for (i=0; i<=maxrow; i++)
  706.           if ((p = *ATBL(tbl,i,j)) && !(p->flags&is_locked) && p->expr) RealEvalOne(p,i,j,&chgct);
  707.       }
  708. !     }
  709.       else error("Internal error calc_order");
  710.    
  711.       return(chgct);
  712. --- 1357,1369 ----
  713.       for (i=0; i<=maxrow; i++)
  714.           for (j=0; j<=maxcol; j++)
  715.           if ((p = *ATBL(tbl,i,j)) && !(p->flags&is_locked) && p->expr) RealEvalOne(p,i,j,&chgct);
  716. !     } 
  717.       else if ( calc_order == BYCOLS ) {
  718. !     for (j=0; j<=maxcol; j++) 
  719.       {   for (i=0; i<=maxrow; i++)
  720.           if ((p = *ATBL(tbl,i,j)) && !(p->flags&is_locked) && p->expr) RealEvalOne(p,i,j,&chgct);
  721.       }
  722. !     } 
  723.       else error("Internal error calc_order");
  724.    
  725.       return(chgct);
  726. diff -c orig/lex.c src/lex.c
  727. *** orig/lex.c    Mon Jun 01 07:38:50 1992
  728. --- src/lex.c    Wed Nov 10 21:25:28 1993
  729. ***************
  730. *** 544,550 ****
  731.   
  732.   #endif
  733.   
  734. ! #if defined(SYSV2) || defined(SYSV3) || defined(MSDOS)
  735.   
  736.   void
  737.   initkbd()
  738. --- 544,550 ----
  739.   
  740.   #endif
  741.   
  742. ! #if defined(SYSV2) || defined(SYSV3) || defined(MSDOS) || defined(__OS2__)
  743.   
  744.   void
  745.   initkbd()
  746. Only in src: Makefile.os2
  747. Only in src: popen.c
  748. Only in src: popen.h
  749. diff -c orig/psc.c src/psc.c
  750. *** orig/psc.c    Mon Jun 01 07:38:50 1992
  751. --- src/psc.c    Sun Nov 21 11:09:10 1993
  752. ***************
  753. *** 35,46 ****
  754.   char    *progname;
  755.   int    getrow(), getcol(), scan();
  756.   
  757. - #ifdef SYSV3
  758. - extern void exit();
  759. - #else
  760. - extern int exit();
  761. - #endif
  762.   int *fwidth;
  763.   int *precision;
  764.   int maxcols;
  765. --- 35,40 ----
  766. Only in src: regex.c
  767. Only in src: regex.h
  768. Only in src: sc-32.def
  769. diff -c orig/sc.c src/sc.c
  770. *** orig/sc.c    Mon Jun 01 07:38:50 1992
  771. --- src/sc.c    Sun Nov 21 11:07:10 1993
  772. ***************
  773. *** 27,32 ****
  774. --- 27,36 ----
  775.   
  776.   #include <stdio.h>
  777.   #include "sc.h"
  778. + #if defined(MSDOS) || defined(__OS2__)
  779. + #include <stdlib.h>    /* Use _splitpath to get progname */
  780. + #include <process.h>   /* use spawn instead of fork     */
  781. + #endif
  782.   
  783.   extern    char    *getenv();
  784.   extern    void    startdisp(), stopdisp();
  785. ***************
  786. *** 177,182 ****
  787. --- 181,197 ----
  788.       to_fix = NULL;
  789.   }
  790.   
  791. + void *
  792. + default_file_is(filename, ext)
  793. + char *filename, *ext;
  794. + {
  795. +   extern char *add_ext();
  796. +   char path[256];
  797. +   strcpy(path, filename);
  798. +   error ("Default file is \"%s\"",add_ext(path, ext));
  799. + }
  800.   char    *progname;
  801.   
  802.   int
  803. ***************
  804. *** 206,213 ****
  805.   
  806.       int tempx, tempy;     /* Temp versions of curx, cury */
  807.   
  808. ! #if defined(MSDOS)
  809. !     if ((revi = strrchr(argv[0], '\\')) != NULL)
  810.   #else
  811.   #ifdef VMS
  812.       if ((revi = strrchr(argv[0], ']')) != NULL)
  813. --- 221,229 ----
  814.   
  815.       int tempx, tempy;     /* Temp versions of curx, cury */
  816.   
  817. ! #if defined(MSDOS) || defined(__OS2__)
  818. !     static char fname[_MAX_FNAME];
  819. !     _splitpath(argv[0], NULL, NULL, progname = fname, NULL);
  820.   #else
  821.   #ifdef VMS
  822.       if ((revi = strrchr(argv[0], ']')) != NULL)
  823. ***************
  824. *** 214,223 ****
  825.   #else
  826.       if ((revi = strrchr(argv[0], '/')) != NULL)
  827.   #endif
  828. - #endif
  829.       progname = revi+1;
  830.       else
  831.       progname = argv[0];
  832.   
  833.       while (argc > 1 && argv[1][0] == '-') {
  834.       argv++;
  835. --- 230,239 ----
  836.   #else
  837.       if ((revi = strrchr(argv[0], '/')) != NULL)
  838.   #endif
  839.       progname = revi+1;
  840.       else
  841.       progname = argv[0];
  842. + #endif
  843.   
  844.       while (argc > 1 && argv[1][0] == '-') {
  845.       argv++;
  846. ***************
  847. *** 736,752 ****
  848.                *  "!"    forks a shell
  849.                *  "!!" repeats last command
  850.                */
  851. ! #if VMS || MSDOS
  852. !             error("Not implemented on VMS or MS-DOS");
  853.   #else /* VMS */
  854. !             char *shl;
  855.               int pid, temp;
  856.               char cmd[MAXCMD];
  857.               static char lastcmd[MAXCMD];
  858.   
  859.               if (!(shl = getenv("SHELL")))
  860.               shl = "/bin/sh";
  861.               deraw();
  862.               (void) fputs("! ", stdout);
  863.               (void) fflush(stdout);
  864. --- 752,775 ----
  865.                *  "!"    forks a shell
  866.                *  "!!" repeats last command
  867.                */
  868. ! #if defined(VMS)
  869. !             error("Not implemented");
  870.   #else /* VMS */
  871. !             char *shl, *opt;
  872.               int pid, temp;
  873.               char cmd[MAXCMD];
  874.               static char lastcmd[MAXCMD];
  875.   
  876. + #if defined(MSDOS) || defined(__OS2__)
  877. +             shellbuf shell;
  878. +             shl = getshell(&shell);
  879. +             opt = shell.opt;
  880. + #else
  881.               if (!(shl = getenv("SHELL")))
  882.               shl = "/bin/sh";
  883. !             opt = "-c";
  884. ! #endif
  885.               deraw();
  886.               (void) fputs("! ", stdout);
  887.               (void) fflush(stdout);
  888. ***************
  889. *** 763,773 ****
  890.               (void) fflush (stdout);
  891.               }
  892.   
  893.               if (!(pid = fork()))
  894.               {
  895.               (void) signal (SIGINT, SIG_DFL);  /* reset */
  896.               if(strlen(cmd))
  897. !                 (void)execl(shl,shl,"-c",cmd,(char *)0);
  898.               else
  899.                   (void) execl(shl, shl, (char *)0);
  900.               exit(-127);
  901. --- 786,802 ----
  902.               (void) fflush (stdout);
  903.               }
  904.   
  905. + #if defined(MSDOS) || defined(__OS2__)
  906. +             if(strlen(cmd))
  907. +               (void) spawnl(P_WAIT, shl, shl, opt, cmd, (char *)0);
  908. +             else
  909. +               (void) spawnl(P_WAIT, shl, shl, (char *)0);
  910. + #else
  911.               if (!(pid = fork()))
  912.               {
  913.               (void) signal (SIGINT, SIG_DFL);  /* reset */
  914.               if(strlen(cmd))
  915. !                 (void)execl(shl,shl,opt,cmd,(char *)0);
  916.               else
  917.                   (void) execl(shl, shl, (char *)0);
  918.               exit(-127);
  919. ***************
  920. *** 774,780 ****
  921.               }
  922.   
  923.               while (pid != wait(&temp));
  924.               (void) printf("Press RETURN to continue ");
  925.               fflush(stdout);
  926.               (void)nmgetch();
  927. --- 803,809 ----
  928.               }
  929.   
  930.               while (pid != wait(&temp));
  931. ! #endif
  932.               (void) printf("Press RETURN to continue ");
  933.               fflush(stdout);
  934.               (void)nmgetch();
  935. ***************
  936. *** 1131,1137 ****
  937.           case 'W':
  938.               (void) sprintf (line, "write [\"dest\" range] \"");
  939.               if (*curfile)
  940. !                        error ("Default file is \"%s.asc\"",curfile);
  941.               linelim = strlen (line);
  942.               insert_mode();
  943.               break;
  944. --- 1160,1166 ----
  945.           case 'W':
  946.               (void) sprintf (line, "write [\"dest\" range] \"");
  947.               if (*curfile)
  948. !                        default_file_is(curfile, ".asc");
  949.               linelim = strlen (line);
  950.               insert_mode();
  951.               break;
  952. ***************
  953. *** 1144,1158 ****
  954.           case 'T':    /* tbl output */
  955.               (void) sprintf (line, "tbl [\"dest\" range] \"");
  956.               if (*curfile && tbl_style == 0)
  957. !                        error ("Default file is \"%s.cln\"",curfile);
  958.                       else if (*curfile && tbl_style == TBL)
  959. !                        error ("Default file is \"%s.tbl\"",curfile);
  960.                       else if (*curfile && tbl_style == LATEX)
  961. !                        error ("Default file is \"%s.lat\"",curfile);
  962.                       else if (*curfile && tbl_style == SLATEX)
  963. !                        error ("Default file is \"%s.stx\"",curfile);
  964.                       else if (*curfile && tbl_style == TEX)
  965. !                        error ("Default file is \"%s.tex\"",curfile);
  966.               linelim = strlen (line);
  967.               insert_mode();
  968.               break;
  969. --- 1173,1187 ----
  970.           case 'T':    /* tbl output */
  971.               (void) sprintf (line, "tbl [\"dest\" range] \"");
  972.               if (*curfile && tbl_style == 0)
  973. !                        default_file_is(curfile, ".cln");
  974.                       else if (*curfile && tbl_style == TBL)
  975. !                        default_file_is(curfile, ".tbl");
  976.                       else if (*curfile && tbl_style == LATEX)
  977. !                        default_file_is(curfile, ".lat");
  978.                       else if (*curfile && tbl_style == SLATEX)
  979. !                        default_file_is(curfile, ".stx");
  980.                       else if (*curfile && tbl_style == TEX)
  981. !                        default_file_is(curfile, ".tex");
  982.               linelim = strlen (line);
  983.               insert_mode();
  984.               break;
  985. ***************
  986. *** 1330,1336 ****
  987.   #endif
  988.   
  989.       (void) signal(SIGINT, SIG_IGN);
  990. ! #if !defined(MSDOS)
  991.       (void) signal(SIGQUIT, dump_me);
  992.       (void) signal(SIGPIPE, doquit);
  993.       (void) signal(SIGALRM, time_out);
  994. --- 1359,1365 ----
  995.   #endif
  996.   
  997.       (void) signal(SIGINT, SIG_IGN);
  998. ! #if !defined(MSDOS) && !defined(__OS2__)
  999.       (void) signal(SIGQUIT, dump_me);
  1000.       (void) signal(SIGPIPE, doquit);
  1001.       (void) signal(SIGALRM, time_out);
  1002. ***************
  1003. *** 1385,1391 ****
  1004.   {   char    path[PATHLEN];
  1005.   
  1006.       if (modcheck(" before Spreadsheet dies") == 1)
  1007. !     {    (void) sprintf(path, "~/%s", SAVENAME);
  1008.       if (writefile(path, 0, 0, maxrow, maxcol) < 0)
  1009.       {
  1010.           (void) sprintf(path, "/tmp/%s", SAVENAME);
  1011. --- 1414,1425 ----
  1012.   {   char    path[PATHLEN];
  1013.   
  1014.       if (modcheck(" before Spreadsheet dies") == 1)
  1015. !     {
  1016. ! #if defined(MSDOS) || defined(__OS2__)
  1017. !     (void) sprintf(path, "%s", SAVENAME);
  1018. ! #else
  1019. !         (void) sprintf(path, "~/%s", SAVENAME);
  1020. ! #endif
  1021.       if (writefile(path, 0, 0, maxrow, maxcol) < 0)
  1022.       {
  1023.           (void) sprintf(path, "/tmp/%s", SAVENAME);
  1024. Only in src: sc.def
  1025. diff -c orig/sc.h src/sc.h
  1026. *** orig/sc.h    Mon Jun 01 07:38:50 1992
  1027. --- src/sc.h    Mon Mar 21 09:49:56 1994
  1028. ***************
  1029. *** 10,17 ****
  1030.    *
  1031.    */
  1032.   
  1033. ! #if defined(MSDOS)
  1034. ! #include <stdio.h>
  1035.   #endif
  1036.   
  1037.   #define    ATBL(tbl, row, col)    (*(tbl + row) + (col))
  1038. --- 10,19 ----
  1039.    *
  1040.    */
  1041.   
  1042. ! #if defined(MSDOS) || defined(__OS2__)
  1043. ! #define STDC_HEADERS 1
  1044. ! # include <stdio.h>
  1045. ! # include <stdlib.h>
  1046.   #endif
  1047.   
  1048.   #define    ATBL(tbl, row, col)    (*(tbl + row) + (col))
  1049. ***************
  1050. *** 267,272 ****
  1051. --- 269,280 ----
  1052.   extern    struct ent *to_fix;
  1053.   extern    int showsc, showsr;
  1054.   
  1055. + #ifdef __STDC__
  1056. + #define P(x) x
  1057. + #else
  1058. + #define P(x) ()
  1059. + #endif
  1060.   extern    FILE *openout();
  1061.   extern    FILE *fdopen(), *fopen();
  1062.   extern    char *coltoa();
  1063. ***************
  1064. *** 385,390 ****
  1065. --- 393,421 ----
  1066.   extern    int backup_file();
  1067.   #endif
  1068.   
  1069. + /* Fox's 6.18 dd_mm_yy input change was broken (did it ever work?).
  1070. +    See CHANGES and convert_date in gram.y and cmds.c. */
  1071. + extern double dodts P((int mo, int day, int yr));
  1072. + extern double convert_date P((int day, int mo, int yr));
  1073. + #if defined(SYSV3)
  1074. + extern void exit();
  1075. + #elif !defined(__OS2__) && !defined(MSDOS)
  1076. + extern int exit();
  1077. + #endif
  1078. + char *mangle P((char *filename));
  1079. + char *getname P((char *path));
  1080. + char *add_ext P((char *path, char *ext));
  1081. + #if defined(__OS2__) || defined(MSDOS)
  1082. + typedef struct {
  1083. +   char name[_MAX_PATH];
  1084. +   char opt[3];
  1085. + } shellbuf;
  1086. + char *getshell(shellbuf *);
  1087. + #endif
  1088.   extern    int modflg;
  1089.   #if !defined(VMS) && !defined(MSDOS) && defined(CRYPT_PATH)
  1090.   extern    int Crypt;
  1091. ***************
  1092. *** 419,426 ****
  1093.   #endif
  1094.   
  1095.   #if defined(BSD42) || defined(BSD43) && !defined(ultrix)
  1096. ! #define    memcpy(dest, source, len)    bcopy(source, dest, (unsigned int)len);
  1097. ! #define    memset(dest, zero, len)        bzero((dest), (unsigned int)(len));
  1098.   #else
  1099.   #include <memory.h>
  1100.   #endif
  1101. --- 450,457 ----
  1102.   #endif
  1103.   
  1104.   #if defined(BSD42) || defined(BSD43) && !defined(ultrix)
  1105. ! # define memcpy(dest, source, len)    bcopy(source, dest, (unsigned int)len);
  1106. ! # define memset(dest, zero, len)    bzero((dest), (unsigned int)(len));
  1107.   #else
  1108.   #include <memory.h>
  1109.   #endif
  1110. Only in orig: sc621.format.bugfix
  1111. diff -c orig/screen.c src/screen.c
  1112. *** orig/screen.c    Mon Jun 01 07:38:50 1992
  1113. --- src/screen.c    Sun Nov 14 20:31:46 1993
  1114. ***************
  1115. *** 445,452 ****
  1116.           if (p1 -> flags & is_valid) {
  1117.               /* has value or num expr */
  1118.               if ((! (p1 -> expr)) || (p1 -> flags & is_strexpr))
  1119.               (void) sprintf (line, "%.15g", p1 -> v);
  1120.               (void) addch ('[');
  1121.               (void) addstr (line);
  1122.               (void) addch (']');
  1123. --- 445,455 ----
  1124.           if (p1 -> flags & is_valid) {
  1125.               /* has value or num expr */
  1126.               if ((! (p1 -> expr)) || (p1 -> flags & is_strexpr))
  1127. + #if defined(__EMX__)
  1128. +             (void) sprintf (line, "%.13g", p1 -> v);
  1129. + #else
  1130.               (void) sprintf (line, "%.15g", p1 -> v);
  1131. ! #endif
  1132.               (void) addch ('[');
  1133.               (void) addstr (line);
  1134.               (void) addch (']');
  1135. Only in src: SUMS
  1136. Only in src: time.c
  1137. diff -c orig/VMS_NOTES src/VMS_NOTES
  1138. *** orig/VMS_NOTES    Mon Jun 10 08:17:40 1991
  1139. --- src/VMS_NOTES    Tue Mar 15 20:39:04 1994
  1140. ***************
  1141. *** 78,83 ****
  1142. --- 78,84 ----
  1143.    */
  1144.   
  1145.   #include <stdio.h>
  1146. + #include <string.h>
  1147.   
  1148.   char    *optarg;        /* Global argument pointer. */
  1149.   int     optind = 0;     /* Global argv index. */
  1150. diff -c orig/xmalloc.c src/xmalloc.c
  1151. *** orig/xmalloc.c    Mon Jun 01 07:38:52 1992
  1152. --- src/xmalloc.c    Sun Nov 21 11:57:12 1993
  1153. ***************
  1154. *** 7,15 ****
  1155. --- 7,19 ----
  1156.   #include <curses.h>
  1157.   #include "sc.h"
  1158.   
  1159. + #if defined(STDC_HEADERS)
  1160. + #include <stdlib.h>
  1161. + #else
  1162.   extern    char *malloc();
  1163.   extern    char *realloc();
  1164.   extern    void free();
  1165. + #endif
  1166.   void    fatal();
  1167.   
  1168.   #ifdef SYSV3
  1169. Only in src: y_tab.h
  1170.