home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / os2 / sl / src / patches.os2 < prev    next >
Encoding:
Text File  |  1993-11-21  |  28.1 KB  |  1,157 lines

  1. Only in sc-6.21: bugs.msg
  2. diff -c sc-6.21/cmds.c new/cmds.c
  3. *** sc-6.21/cmds.c    Mon Jun 01 07:35:52 1992
  4. --- new/cmds.c    Sun Nov 21 11:01:14 1993
  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. diff -c sc-6.21/format.c new/format.c
  480. *** sc-6.21/format.c    Mon Jun 01 07:35:54 1992
  481. --- new/format.c    Tue Nov 09 19:02:04 1993
  482. ***************
  483. *** 95,103 ****
  484.   #define EOS    '\0'
  485.   #define MAXBUF    256
  486.   
  487. ! extern char
  488. !   *strcpy(),
  489. !   *strcat();
  490.   
  491.   static char
  492.     *fmt_int(),
  493. --- 95,106 ----
  494.   #define EOS    '\0'
  495.   #define MAXBUF    256
  496.   
  497. ! #if defined(__OS2__)
  498. ! # include <string.h>
  499. ! #else
  500. ! extern char *strcpy();
  501. ! extern char *strcat();
  502. ! #endif
  503.   
  504.   static char
  505.     *fmt_int(),
  506. ***************
  507. *** 578,584 ****
  508.     }
  509.     if (fmt == REFMTDATE) {
  510.       int i;
  511. !     char *time;
  512.       long int secs;
  513.   
  514.       if (buflen < 9) {
  515. --- 581,587 ----
  516.     }
  517.     if (fmt == REFMTDATE) {
  518.       int i;
  519. !     char *time_of_day;
  520.       long int secs;
  521.   
  522.       if (buflen < 9) {
  523. ***************
  524. *** 587,602 ****
  525.       }
  526.       else {
  527.         secs = (time_t)val;
  528. !       time = ctime(&secs);
  529. !       buf[0] = time[8];
  530. !       buf[1] = time[9];
  531.         buf[2] = ' ';
  532. !       buf[3] = time[4];
  533. !       buf[4] = time[5];
  534. !       buf[5] = time[6];
  535.         buf[6] = ' ';
  536. !       buf[7] = time[22];
  537. !       buf[8] = time[23];
  538.         for (i = 9; i < width; i++) buf[i] = ' ';
  539.         buf[i] = '\0';
  540.       }
  541. --- 590,605 ----
  542.       }
  543.       else {
  544.         secs = (time_t)val;
  545. !       time_of_day = ctime(&secs);
  546. !       buf[0] = time_of_day[8];
  547. !       buf[1] = time_of_day[9];
  548.         buf[2] = ' ';
  549. !       buf[3] = time_of_day[4];
  550. !       buf[4] = time_of_day[5];
  551. !       buf[5] = time_of_day[6];
  552.         buf[6] = ' ';
  553. !       buf[7] = time_of_day[22];
  554. !       buf[8] = time_of_day[23];
  555.         for (i = 9; i < width; i++) buf[i] = ' ';
  556.         buf[i] = '\0';
  557.       }
  558. Only in new: getopt.c
  559. Only in new: getopt.h
  560. Only in new: gram.c
  561. Only in new: gram.err
  562. diff -c sc-6.21/help.c new/help.c
  563. *** sc-6.21/help.c    Mon Jun 01 07:35:54 1992
  564. --- new/help.c    Wed Nov 10 21:28:58 1993
  565. ***************
  566. *** 610,619 ****
  567.       while (*pagep)
  568.       {
  569.   #ifndef TROFF
  570. !     (void) fputs(SCNAME, stdout);
  571. !     (void) fputs(header);
  572. !     (void) printf("\n");
  573. !     (void) puts(revision);
  574.   #endif
  575.   
  576.       for (lineno = 0; (*pagep)[lineno]; lineno++) {
  577. --- 610,616 ----
  578.       while (*pagep)
  579.       {
  580.   #ifndef TROFF
  581. !     (void) printf("%s%s\n%s", SCNAME, header, revision);
  582.   #endif
  583.   
  584.       for (lineno = 0; (*pagep)[lineno]; lineno++) {
  585. diff -c sc-6.21/interp.c new/interp.c
  586. *** sc-6.21/interp.c    Mon Jun 01 07:38:50 1992
  587. --- new/interp.c    Sat Nov 20 09:24:10 1993
  588. ***************
  589. *** 26,33 ****
  590.   #include <setjmp.h>
  591.   #include <stdio.h>
  592.   #include <ctype.h>
  593.   extern int errno;        /* set by math functions */
  594.   #ifdef BSD42
  595.   #include <strings.h>
  596.   #include <sys/time.h>
  597. --- 26,36 ----
  598.   #include <setjmp.h>
  599.   #include <stdio.h>
  600.   #include <ctype.h>
  601. ! #include <errno.h>
  602. ! #if !defined(__OS2__) && !defined(MSDOS)
  603.   extern int errno;        /* set by math functions */
  604. + #endif
  605.   #ifdef BSD42
  606.   #include <strings.h>
  607.   #include <sys/time.h>
  608. ***************
  609. *** 41,46 ****
  610. --- 44,65 ----
  611.   #endif
  612.   #endif
  613.   
  614. + /* emx and MSC can produce bound versions, but the usual popen is only
  615. +    available in OS2_MODE. For bound versions, both __OS2__ and MSDOS 
  616. +    will be defined. PDCurses can "#undef MSDOS", so keep this before 
  617. +    the curses.h include. */
  618. + #if defined(MSDOS) || defined(__OS2__)
  619. + #include <stdlib.h>
  620. + #if defined(MSDOS)
  621. + #include "popen.h"
  622. + #define popen os_popen
  623. + #define pclose os_pclose
  624. + #elif defined(_MSC_VER)
  625. + #define popen _popen
  626. + #define pclose _pclose
  627. + #endif
  628. + #endif
  629.   #include <curses.h>
  630.   #include "sc.h"
  631.   
  632. ***************
  633. *** 551,557 ****
  634. --- 570,578 ----
  635.   int which;
  636.   double when;
  637.   {
  638. + #if !defined(__OS2__)
  639.       long time();
  640. + #endif
  641.   
  642.       static long t_cache;
  643.       static struct tm tm_cache;
  644. ***************
  645. *** 1023,1029 ****
  646.    * written to files, etc.
  647.    */
  648.   
  649. ! #if defined(VMS) || defined(MSDOS)
  650.   char *
  651.   doext(command, value)
  652.   char *command;
  653. --- 1044,1050 ----
  654.    * written to files, etc.
  655.    */
  656.   
  657. ! #if defined(VMS)
  658.   char *
  659.   doext(command, value)
  660.   char *command;
  661. ***************
  662. *** 1336,1348 ****
  663.       for (i=0; i<=maxrow; i++)
  664.           for (j=0; j<=maxcol; j++)
  665.           if ((p = *ATBL(tbl,i,j)) && !(p->flags&is_locked) && p->expr) RealEvalOne(p,i,j,&chgct);
  666. !     }
  667.       else if ( calc_order == BYCOLS ) {
  668. !     for (j=0; j<=maxcol; j++)
  669.       {   for (i=0; i<=maxrow; i++)
  670.           if ((p = *ATBL(tbl,i,j)) && !(p->flags&is_locked) && p->expr) RealEvalOne(p,i,j,&chgct);
  671.       }
  672. !     }
  673.       else error("Internal error calc_order");
  674.    
  675.       return(chgct);
  676. --- 1357,1369 ----
  677.       for (i=0; i<=maxrow; i++)
  678.           for (j=0; j<=maxcol; j++)
  679.           if ((p = *ATBL(tbl,i,j)) && !(p->flags&is_locked) && p->expr) RealEvalOne(p,i,j,&chgct);
  680. !     } 
  681.       else if ( calc_order == BYCOLS ) {
  682. !     for (j=0; j<=maxcol; j++) 
  683.       {   for (i=0; i<=maxrow; i++)
  684.           if ((p = *ATBL(tbl,i,j)) && !(p->flags&is_locked) && p->expr) RealEvalOne(p,i,j,&chgct);
  685.       }
  686. !     } 
  687.       else error("Internal error calc_order");
  688.    
  689.       return(chgct);
  690. diff -c sc-6.21/lex.c new/lex.c
  691. *** sc-6.21/lex.c    Mon Jun 01 07:38:50 1992
  692. --- new/lex.c    Wed Nov 10 21:25:28 1993
  693. ***************
  694. *** 544,550 ****
  695.   
  696.   #endif
  697.   
  698. ! #if defined(SYSV2) || defined(SYSV3) || defined(MSDOS)
  699.   
  700.   void
  701.   initkbd()
  702. --- 544,550 ----
  703.   
  704.   #endif
  705.   
  706. ! #if defined(SYSV2) || defined(SYSV3) || defined(MSDOS) || defined(__OS2__)
  707.   
  708.   void
  709.   initkbd()
  710. Only in new: Makefile.os2
  711. Only in new: popen.c
  712. Only in new: popen.h
  713. diff -c sc-6.21/psc.c new/psc.c
  714. *** sc-6.21/psc.c    Mon Jun 01 07:38:50 1992
  715. --- new/psc.c    Sun Nov 21 11:09:10 1993
  716. ***************
  717. *** 35,46 ****
  718.   char    *progname;
  719.   int    getrow(), getcol(), scan();
  720.   
  721. - #ifdef SYSV3
  722. - extern void exit();
  723. - #else
  724. - extern int exit();
  725. - #endif
  726.   int *fwidth;
  727.   int *precision;
  728.   int maxcols;
  729. --- 35,40 ----
  730. Only in new: regex.c
  731. Only in new: regex.h
  732. Only in new: sc-32.def
  733. diff -c sc-6.21/sc.c new/sc.c
  734. *** sc-6.21/sc.c    Mon Jun 01 07:38:50 1992
  735. --- new/sc.c    Sun Nov 21 11:07:10 1993
  736. ***************
  737. *** 27,32 ****
  738. --- 27,36 ----
  739.   
  740.   #include <stdio.h>
  741.   #include "sc.h"
  742. + #if defined(MSDOS) || defined(__OS2__)
  743. + #include <stdlib.h>    /* Use _splitpath to get progname */
  744. + #include <process.h>   /* use spawn instead of fork     */
  745. + #endif
  746.   
  747.   extern    char    *getenv();
  748.   extern    void    startdisp(), stopdisp();
  749. ***************
  750. *** 177,182 ****
  751. --- 181,197 ----
  752.       to_fix = NULL;
  753.   }
  754.   
  755. + void *
  756. + default_file_is(filename, ext)
  757. + char *filename, *ext;
  758. + {
  759. +   extern char *add_ext();
  760. +   char path[256];
  761. +   strcpy(path, filename);
  762. +   error ("Default file is \"%s\"",add_ext(path, ext));
  763. + }
  764.   char    *progname;
  765.   
  766.   int
  767. ***************
  768. *** 206,213 ****
  769.   
  770.       int tempx, tempy;     /* Temp versions of curx, cury */
  771.   
  772. ! #if defined(MSDOS)
  773. !     if ((revi = strrchr(argv[0], '\\')) != NULL)
  774.   #else
  775.   #ifdef VMS
  776.       if ((revi = strrchr(argv[0], ']')) != NULL)
  777. --- 221,229 ----
  778.   
  779.       int tempx, tempy;     /* Temp versions of curx, cury */
  780.   
  781. ! #if defined(MSDOS) || defined(__OS2__)
  782. !     static char fname[_MAX_FNAME];
  783. !     _splitpath(argv[0], NULL, NULL, progname = fname, NULL);
  784.   #else
  785.   #ifdef VMS
  786.       if ((revi = strrchr(argv[0], ']')) != NULL)
  787. ***************
  788. *** 214,223 ****
  789.   #else
  790.       if ((revi = strrchr(argv[0], '/')) != NULL)
  791.   #endif
  792. - #endif
  793.       progname = revi+1;
  794.       else
  795.       progname = argv[0];
  796.   
  797.       while (argc > 1 && argv[1][0] == '-') {
  798.       argv++;
  799. --- 230,239 ----
  800.   #else
  801.       if ((revi = strrchr(argv[0], '/')) != NULL)
  802.   #endif
  803.       progname = revi+1;
  804.       else
  805.       progname = argv[0];
  806. + #endif
  807.   
  808.       while (argc > 1 && argv[1][0] == '-') {
  809.       argv++;
  810. ***************
  811. *** 736,752 ****
  812.                *  "!"    forks a shell
  813.                *  "!!" repeats last command
  814.                */
  815. ! #if VMS || MSDOS
  816. !             error("Not implemented on VMS or MS-DOS");
  817.   #else /* VMS */
  818. !             char *shl;
  819.               int pid, temp;
  820.               char cmd[MAXCMD];
  821.               static char lastcmd[MAXCMD];
  822.   
  823.               if (!(shl = getenv("SHELL")))
  824.               shl = "/bin/sh";
  825.               deraw();
  826.               (void) fputs("! ", stdout);
  827.               (void) fflush(stdout);
  828. --- 752,775 ----
  829.                *  "!"    forks a shell
  830.                *  "!!" repeats last command
  831.                */
  832. ! #if defined(VMS)
  833. !             error("Not implemented");
  834.   #else /* VMS */
  835. !             char *shl, *opt;
  836.               int pid, temp;
  837.               char cmd[MAXCMD];
  838.               static char lastcmd[MAXCMD];
  839.   
  840. + #if defined(MSDOS) || defined(__OS2__)
  841. +             shellbuf shell;
  842. +             shl = getshell(&shell);
  843. +             opt = shell.opt;
  844. + #else
  845.               if (!(shl = getenv("SHELL")))
  846.               shl = "/bin/sh";
  847. !             opt = "-c";
  848. ! #endif
  849.               deraw();
  850.               (void) fputs("! ", stdout);
  851.               (void) fflush(stdout);
  852. ***************
  853. *** 763,773 ****
  854.               (void) fflush (stdout);
  855.               }
  856.   
  857.               if (!(pid = fork()))
  858.               {
  859.               (void) signal (SIGINT, SIG_DFL);  /* reset */
  860.               if(strlen(cmd))
  861. !                 (void)execl(shl,shl,"-c",cmd,(char *)0);
  862.               else
  863.                   (void) execl(shl, shl, (char *)0);
  864.               exit(-127);
  865. --- 786,802 ----
  866.               (void) fflush (stdout);
  867.               }
  868.   
  869. + #if defined(MSDOS) || defined(__OS2__)
  870. +             if(strlen(cmd))
  871. +               (void) spawnl(P_WAIT, shl, shl, opt, cmd, (char *)0);
  872. +             else
  873. +               (void) spawnl(P_WAIT, shl, shl, (char *)0);
  874. + #else
  875.               if (!(pid = fork()))
  876.               {
  877.               (void) signal (SIGINT, SIG_DFL);  /* reset */
  878.               if(strlen(cmd))
  879. !                 (void)execl(shl,shl,opt,cmd,(char *)0);
  880.               else
  881.                   (void) execl(shl, shl, (char *)0);
  882.               exit(-127);
  883. ***************
  884. *** 774,780 ****
  885.               }
  886.   
  887.               while (pid != wait(&temp));
  888.               (void) printf("Press RETURN to continue ");
  889.               fflush(stdout);
  890.               (void)nmgetch();
  891. --- 803,809 ----
  892.               }
  893.   
  894.               while (pid != wait(&temp));
  895. ! #endif
  896.               (void) printf("Press RETURN to continue ");
  897.               fflush(stdout);
  898.               (void)nmgetch();
  899. ***************
  900. *** 1131,1137 ****
  901.           case 'W':
  902.               (void) sprintf (line, "write [\"dest\" range] \"");
  903.               if (*curfile)
  904. !                        error ("Default file is \"%s.asc\"",curfile);
  905.               linelim = strlen (line);
  906.               insert_mode();
  907.               break;
  908. --- 1160,1166 ----
  909.           case 'W':
  910.               (void) sprintf (line, "write [\"dest\" range] \"");
  911.               if (*curfile)
  912. !                        default_file_is(curfile, ".asc");
  913.               linelim = strlen (line);
  914.               insert_mode();
  915.               break;
  916. ***************
  917. *** 1144,1158 ****
  918.           case 'T':    /* tbl output */
  919.               (void) sprintf (line, "tbl [\"dest\" range] \"");
  920.               if (*curfile && tbl_style == 0)
  921. !                        error ("Default file is \"%s.cln\"",curfile);
  922.                       else if (*curfile && tbl_style == TBL)
  923. !                        error ("Default file is \"%s.tbl\"",curfile);
  924.                       else if (*curfile && tbl_style == LATEX)
  925. !                        error ("Default file is \"%s.lat\"",curfile);
  926.                       else if (*curfile && tbl_style == SLATEX)
  927. !                        error ("Default file is \"%s.stx\"",curfile);
  928.                       else if (*curfile && tbl_style == TEX)
  929. !                        error ("Default file is \"%s.tex\"",curfile);
  930.               linelim = strlen (line);
  931.               insert_mode();
  932.               break;
  933. --- 1173,1187 ----
  934.           case 'T':    /* tbl output */
  935.               (void) sprintf (line, "tbl [\"dest\" range] \"");
  936.               if (*curfile && tbl_style == 0)
  937. !                        default_file_is(curfile, ".cln");
  938.                       else if (*curfile && tbl_style == TBL)
  939. !                        default_file_is(curfile, ".tbl");
  940.                       else if (*curfile && tbl_style == LATEX)
  941. !                        default_file_is(curfile, ".lat");
  942.                       else if (*curfile && tbl_style == SLATEX)
  943. !                        default_file_is(curfile, ".stx");
  944.                       else if (*curfile && tbl_style == TEX)
  945. !                        default_file_is(curfile, ".tex");
  946.               linelim = strlen (line);
  947.               insert_mode();
  948.               break;
  949. ***************
  950. *** 1330,1336 ****
  951.   #endif
  952.   
  953.       (void) signal(SIGINT, SIG_IGN);
  954. ! #if !defined(MSDOS)
  955.       (void) signal(SIGQUIT, dump_me);
  956.       (void) signal(SIGPIPE, doquit);
  957.       (void) signal(SIGALRM, time_out);
  958. --- 1359,1365 ----
  959.   #endif
  960.   
  961.       (void) signal(SIGINT, SIG_IGN);
  962. ! #if !defined(MSDOS) && !defined(__OS2__)
  963.       (void) signal(SIGQUIT, dump_me);
  964.       (void) signal(SIGPIPE, doquit);
  965.       (void) signal(SIGALRM, time_out);
  966. ***************
  967. *** 1385,1391 ****
  968.   {   char    path[PATHLEN];
  969.   
  970.       if (modcheck(" before Spreadsheet dies") == 1)
  971. !     {    (void) sprintf(path, "~/%s", SAVENAME);
  972.       if (writefile(path, 0, 0, maxrow, maxcol) < 0)
  973.       {
  974.           (void) sprintf(path, "/tmp/%s", SAVENAME);
  975. --- 1414,1425 ----
  976.   {   char    path[PATHLEN];
  977.   
  978.       if (modcheck(" before Spreadsheet dies") == 1)
  979. !     {
  980. ! #if defined(MSDOS) || defined(__OS2__)
  981. !     (void) sprintf(path, "%s", SAVENAME);
  982. ! #else
  983. !         (void) sprintf(path, "~/%s", SAVENAME);
  984. ! #endif
  985.       if (writefile(path, 0, 0, maxrow, maxcol) < 0)
  986.       {
  987.           (void) sprintf(path, "/tmp/%s", SAVENAME);
  988. Only in new: sc.def
  989. diff -c sc-6.21/sc.h new/sc.h
  990. *** sc-6.21/sc.h    Mon Jun 01 07:38:50 1992
  991. --- new/sc.h    Sun Nov 21 11:58:38 1993
  992. ***************
  993. *** 10,17 ****
  994.    *
  995.    */
  996.   
  997. ! #if defined(MSDOS)
  998. ! #include <stdio.h>
  999.   #endif
  1000.   
  1001.   #define    ATBL(tbl, row, col)    (*(tbl + row) + (col))
  1002. --- 10,19 ----
  1003.    *
  1004.    */
  1005.   
  1006. ! #if defined(MSDOS) || defined(__OS2__)
  1007. ! #define STDC_HEADERS 1
  1008. ! # include <stdio.h>
  1009. ! # include <stdlib.h>
  1010.   #endif
  1011.   
  1012.   #define    ATBL(tbl, row, col)    (*(tbl + row) + (col))
  1013. ***************
  1014. *** 267,272 ****
  1015. --- 269,280 ----
  1016.   extern    struct ent *to_fix;
  1017.   extern    int showsc, showsr;
  1018.   
  1019. + #ifdef __STDC__
  1020. + #define P(x) x
  1021. + #else
  1022. + #define P(x) ()
  1023. + #endif
  1024.   extern    FILE *openout();
  1025.   extern    FILE *fdopen(), *fopen();
  1026.   extern    char *coltoa();
  1027. ***************
  1028. *** 385,390 ****
  1029. --- 393,416 ----
  1030.   extern    int backup_file();
  1031.   #endif
  1032.   
  1033. + #if defined(SYSV3)
  1034. + extern void exit();
  1035. + #elif !defined(__OS2__) && !defined(MSDOS)
  1036. + extern int exit();
  1037. + #endif
  1038. + char *mangle P((char *filename));
  1039. + char *getname P((char *path));
  1040. + char *add_ext P((char *path, char *ext));
  1041. + #if defined(__OS2__) || defined(MSDOS)
  1042. + typedef struct {
  1043. +   char name[_MAX_PATH];
  1044. +   char opt[3];
  1045. + } shellbuf;
  1046. + char *getshell(shellbuf *);
  1047. + #endif
  1048.   extern    int modflg;
  1049.   #if !defined(VMS) && !defined(MSDOS) && defined(CRYPT_PATH)
  1050.   extern    int Crypt;
  1051. ***************
  1052. *** 419,426 ****
  1053.   #endif
  1054.   
  1055.   #if defined(BSD42) || defined(BSD43) && !defined(ultrix)
  1056. ! #define    memcpy(dest, source, len)    bcopy(source, dest, (unsigned int)len);
  1057. ! #define    memset(dest, zero, len)        bzero((dest), (unsigned int)(len));
  1058.   #else
  1059.   #include <memory.h>
  1060.   #endif
  1061. --- 445,452 ----
  1062.   #endif
  1063.   
  1064.   #if defined(BSD42) || defined(BSD43) && !defined(ultrix)
  1065. ! # define memcpy(dest, source, len)    bcopy(source, dest, (unsigned int)len);
  1066. ! # define memset(dest, zero, len)    bzero((dest), (unsigned int)(len));
  1067.   #else
  1068.   #include <memory.h>
  1069.   #endif
  1070. diff -c sc-6.21/screen.c new/screen.c
  1071. *** sc-6.21/screen.c    Mon Jun 01 07:38:50 1992
  1072. --- new/screen.c    Sun Nov 14 20:31:46 1993
  1073. ***************
  1074. *** 445,452 ****
  1075.           if (p1 -> flags & is_valid) {
  1076.               /* has value or num expr */
  1077.               if ((! (p1 -> expr)) || (p1 -> flags & is_strexpr))
  1078.               (void) sprintf (line, "%.15g", p1 -> v);
  1079.               (void) addch ('[');
  1080.               (void) addstr (line);
  1081.               (void) addch (']');
  1082. --- 445,455 ----
  1083.           if (p1 -> flags & is_valid) {
  1084.               /* has value or num expr */
  1085.               if ((! (p1 -> expr)) || (p1 -> flags & is_strexpr))
  1086. + #if defined(__EMX__)
  1087. +             (void) sprintf (line, "%.13g", p1 -> v);
  1088. + #else
  1089.               (void) sprintf (line, "%.15g", p1 -> v);
  1090. ! #endif
  1091.               (void) addch ('[');
  1092.               (void) addstr (line);
  1093.               (void) addch (']');
  1094. Only in new: SUMS
  1095. diff -c sc-6.21/xmalloc.c new/xmalloc.c
  1096. *** sc-6.21/xmalloc.c    Mon Jun 01 07:38:52 1992
  1097. --- new/xmalloc.c    Sun Nov 21 11:57:12 1993
  1098. ***************
  1099. *** 7,15 ****
  1100. --- 7,19 ----
  1101.   #include <curses.h>
  1102.   #include "sc.h"
  1103.   
  1104. + #if defined(STDC_HEADERS)
  1105. + #include <stdlib.h>
  1106. + #else
  1107.   extern    char *malloc();
  1108.   extern    char *realloc();
  1109.   extern    void free();
  1110. + #endif
  1111.   void    fatal();
  1112.   
  1113.   #ifdef SYSV3
  1114. Only in new: y_tab.h
  1115.