home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / g / cpm68k.diff < prev    next >
Text File  |  2020-01-01  |  18KB  |  716 lines

  1. *** gcmdline.c    Sun Dec 26 20:05:38 1999
  2. --- ../gkermit68/GCMDLINE.C    Tue Mar 12 23:10:51 2002
  3. ***************
  4. *** 35,41 ****
  5.   
  6.   extern int nfils, parity, text, backup, rpsiz, urpsiz, timint;
  7.   extern int literal, quiet, keep, streamok, nomodes, manual, xonxoff, noxonxoff;
  8. ! extern char ttname[], *cmerrp, *cmarg, *cmarg2;
  9.   extern FILE * db;
  10.   
  11.   /* Variables exported from this module */
  12. --- 35,41 ----
  13.   
  14.   extern int nfils, parity, text, backup, rpsiz, urpsiz, timint;
  15.   extern int literal, quiet, keep, streamok, nomodes, manual, xonxoff, noxonxoff;
  16. ! extern char ttname[], *cmarg, *cmarg2;
  17.   extern FILE * db;
  18.   
  19.   /* Variables exported from this module */
  20. ***************
  21. *** 193,198 ****
  22. --- 193,202 ----
  23.           text = 0;
  24.           break;
  25.   
  26. + #ifdef CPM68K
  27. +       /* CP/M doesn't support case-sensitive args so allow 't' */
  28. +       case 't':
  29. + #endif
  30.         case 'T':            /* Text file transfer */
  31.           manual = 1;
  32.           text = 1;
  33. ***************
  34. *** 228,235 ****
  35.           }
  36.           if (db) {
  37.           extern char * versio, * build;
  38. !         if (!versio) versio = "";
  39. !         if (!build) build = "";
  40.           debug = 1;
  41.           setbuf(db,NULL);
  42.           fprintf(db,"%s: %s\n",
  43. --- 232,239 ----
  44.           }
  45.           if (db) {
  46.           extern char * versio, * build;
  47. !         if (versio == (char *)NULL) versio = "";
  48. !         if (build == (char *)NULL) build = "";
  49.           debug = 1;
  50.           setbuf(db,NULL);
  51.           fprintf(db,"%s: %s\n",
  52. ***************
  53. *** 237,243 ****
  54. --- 241,249 ----
  55.               (*build ? build : "BUILD UNKNOWN")
  56.               );
  57.           fprintf(db,"MAXPATHLEN = %d\n",MAXPATHLEN);
  58. + #ifndef NOGETENV
  59.           if (gptr) fprintf(db,"GKERMIT=\"%s\"\n",gptr);
  60. + #endif
  61.           }
  62.           break;
  63.   
  64. ***************
  65. *** 334,344 ****
  66.   VOID
  67.   usage() {
  68.       extern char * versio, * build, * url, * email;
  69. !     if (!versio) versio = "";
  70.       if (!*versio) versio = "gkermit UNKNOWN VERSION";
  71. !     if (!build) build = "UNKNOWN BUILD";
  72. !     if (!url) url = "";
  73. !     if (!email) email = "";
  74.       fprintf(stderr,"%s: %s.\n",versio,build);
  75.       fprintf(stderr,"Usage:  gkermit [ options ]\n");
  76.       fprintf(stderr,"Options:\n");
  77. --- 340,350 ----
  78.   VOID
  79.   usage() {
  80.       extern char * versio, * build, * url, * email;
  81. !     if (versio == (char *)NULL) versio = "";
  82.       if (!*versio) versio = "gkermit UNKNOWN VERSION";
  83. !     if (build == (char *)NULL) build = "UNKNOWN BUILD";
  84. !     if (url == (char *)NULL) url = "";
  85. !     if (email == (char *)NULL) email = "";
  86.       fprintf(stderr,"%s: %s.\n",versio,build);
  87.       fprintf(stderr,"Usage:  gkermit [ options ]\n");
  88.       fprintf(stderr,"Options:\n");
  89. *** gkermit.h    Sun Dec 26 21:25:52 1999
  90. --- ../gkermit68/GKERMIT.H    Thu Mar 14 22:03:37 2002
  91. ***************
  92. *** 27,36 ****
  93.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  94.   */
  95.   
  96. ! #ifndef _GKERMIT_H
  97. ! #define _GKERMIT_H
  98.   
  99.   #include <stdio.h>
  100.   
  101.   /* Kermit protocol definitions */
  102.   
  103. --- 27,39 ----
  104.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  105.   */
  106.   
  107. ! #ifndef _GKERM_H
  108. ! #define _GKERM_H
  109.   
  110. + /* avoid including stdio twice on CP/M-68K */
  111. + #ifndef CPM68K
  112.   #include <stdio.h>
  113. + #endif
  114.   
  115.   /* Kermit protocol definitions */
  116.   
  117. ***************
  118. *** 90,96 ****
  119. --- 93,101 ----
  120.   #ifdef __STDC__
  121.   #define VOID void
  122.   #else
  123. + #ifndef CPM68K        /* CP/M-68K 1.3 has void */
  124.   #define VOID int
  125. + #endif
  126.   #endif /* __STDC__ */
  127.   
  128.   /* SVORPOSIX = System V or POSIX */
  129. ***************
  130. *** 231,236 ****
  131. --- 236,248 ----
  132.   _MYPROTOTYPE( VOID usage, (void) );    /* Give usage message */
  133.   _MYPROTOTYPE( int gwart, (void) );    /* State table switcher */
  134.   
  135. + #ifdef CPM68K
  136. + /* function prototypes for CP/M-68K */
  137. + _MYPROTOTYPE( FILE *fopen, (void) );
  138. + _MYPROTOTYPE( FILE *fopenb, (void) );
  139. + _MYPROTOTYPE( char *malloc, (void) );
  140. + #endif
  141.   /* Externs */
  142.   
  143.   extern int errno;
  144. ***************
  145. *** 238,243 ****
  146.   extern int debug;
  147.   #endif /* _GKERMIT_C */
  148.   
  149. ! #endif /* _GKERMIT_H */
  150.   
  151.   /* End gkermit.h */
  152. --- 250,255 ----
  153.   extern int debug;
  154.   #endif /* _GKERMIT_C */
  155.   
  156. ! #endif /* _GKERM_H */
  157.   
  158.   /* End gkermit.h */
  159. *** gproto.w    Sun Dec 26 20:05:38 1999
  160. --- ../gkermit68/GPROTO.W    Thu Mar 14 22:05:11 2002
  161. ***************
  162. *** 33,39 ****
  163.   _MYPROTOTYPE( int closof, (void) );    /* Close output file */
  164.   _MYPROTOTYPE( VOID errpkt, (char *) );    /* Send Error packet */
  165.   
  166. ! extern char * xdata, *rdatap, **cmlist, *cmarg, *rpar(), strbuf[], filnam[];
  167.   extern int start, bctu, bctr, delay, cx, cz, failure, attributes, datalen;
  168.   extern int streamok, streaming, timint;
  169.   extern FILE * db;
  170. --- 33,39 ----
  171.   _MYPROTOTYPE( int closof, (void) );    /* Close output file */
  172.   _MYPROTOTYPE( VOID errpkt, (char *) );    /* Send Error packet */
  173.   
  174. ! extern char * xdata, *rdatap, **cmlist, *cmarg, *rpar(), filnam[];
  175.   extern int start, bctu, bctr, delay, cx, cz, failure, attributes, datalen;
  176.   extern int streamok, streaming, timint;
  177.   extern FILE * db;
  178. ***************
  179. *** 41,47 ****
  180.   static int x;
  181.   
  182.   static VOID
  183. ! streamon() {                /* Start streaming if negotiated */
  184.       x = 0;
  185.       if (streamok > 0) {
  186.       streaming = 1;
  187. --- 41,47 ----
  188.   static int x;
  189.   
  190.   static VOID
  191. ! stremon() {                /* Start streaming if negotiated */
  192.       x = 0;
  193.       if (streamok > 0) {
  194.       streaming = 1;
  195. ***************
  196. *** 72,78 ****
  197.           if (sfile() < 0) {        /* Yes, open it, send F packet, */
  198.           errpkt("sfile");
  199.       } else {            /* No error */
  200. !         streamon();
  201.           BEGIN ssfil;
  202.       }
  203.       } else {                /* No files to send, */
  204. --- 72,78 ----
  205.           if (sfile() < 0) {        /* Yes, open it, send F packet, */
  206.           errpkt("sfile");
  207.       } else {            /* No error */
  208. !         stremon();
  209.           BEGIN ssfil;
  210.       }
  211.       } else {                /* No files to send, */
  212. ***************
  213. *** 148,154 ****
  214.       spar(rdatap);            /* Set parameters from it */
  215.       ack1(rpar());            /* ACK with our parameters */
  216.       bctu = bctr;            /* Switch to negotiated block check */
  217. !     streamon();
  218.       BEGIN srfil;            /* Wait for file or EOT */
  219.   }
  220.   
  221. --- 148,154 ----
  222.       spar(rdatap);            /* Set parameters from it */
  223.       ack1(rpar());            /* ACK with our parameters */
  224.       bctu = bctr;            /* Switch to negotiated block check */
  225. !     stremon();
  226.       BEGIN srfil;            /* Wait for file or EOT */
  227.   }
  228.   
  229. ***************
  230. *** 160,166 ****
  231.       } else {
  232.       encstr(filnam);
  233.       ack1(xdata);
  234. !     streamon();
  235.       BEGIN sratt;
  236.       }
  237.   }
  238. --- 160,166 ----
  239.       } else {
  240.       encstr(filnam);
  241.       ack1(xdata);
  242. !     stremon();
  243.       BEGIN sratt;
  244.       }
  245.   }
  246. *** gunixio.c    Sun Dec 26 23:32:26 1999
  247. --- ../gkermit68/GUNIXIO.C    Tue Mar 12 23:10:51 2002
  248. ***************
  249. *** 70,79 ****
  250. --- 70,83 ----
  251.   #endif /* POSIX */
  252.   
  253.   #include <ctype.h>            /* Character types */
  254. + #ifndef CPM68K
  255.   #include <sys/types.h>            /* Needed e.g. by <stat.h> */
  256. + #endif
  257.   #include <signal.h>            /* Interrupts */
  258.   #include <setjmp.h>            /* Longjumps */
  259. + #ifndef CPM68K
  260.   #include <sys/stat.h>            /* File exist, file size */
  261. + #endif
  262.   #include <errno.h>            /* Error symbols */
  263.   #include "gkermit.h"            /* gkermit definitions */
  264.   
  265. ***************
  266. *** 142,147 ****
  267. --- 146,175 ----
  268.   #endif /* USE_GETCHAR */
  269.   #endif /* DUMBIO */
  270.   
  271. + #ifdef CPM68K
  272. + /* extracted from <osif.h> (including it in full results in name clashes) */
  273. + #define __OSIF(fn,arg) __BDOS((fn),(LONG)(arg))    /* CPM68K does it this way  */
  274. + #define EXIT        0    /* Exit to BDOS             */
  275. + #define CONIN        1    /* direct echoing con input */
  276. + #define CONOUT        2    /* Direct console output    */
  277. + #define LSTOUT        5    /* Direct list device output*/
  278. + #define CONIO        6    /* Direct console I/O       */
  279. + #define C_WRITESTR    9    /* Console string output    */
  280. + #define CONBUF        10    /* Read console buffer      */
  281. + #define C_STAT        11    /* Get console status       */
  282. + #define S_BDOSVER    12    /* Get System BDOS Ver Num  */
  283. + /* end of extract from <osif.h> */
  284. + #define SCOUNT    163000        /* sleep time constant for a 33MHz 68020 */
  285. + #define ACOUNT    10000        /* alarm time constant */
  286. + static int atime;
  287. + static long acount;
  288. + extern int text;        /* 0=binary, 1=text */
  289. + #endif /* CPM68K */
  290.   /* Header file deficiencies section... */
  291.   
  292.   #ifndef R_OK
  293. ***************
  294. *** 271,277 ****
  295.   
  296.   VOID
  297.   logerr(s) char * s; {            /* Log text and errno */
  298. !     if (!s) s = "";
  299.       if (!debug) return;
  300.       if (db) fprintf(db,"%s: errno = %d\n",s,errno);
  301.   }
  302. --- 299,305 ----
  303.   
  304.   VOID
  305.   logerr(s) char * s; {            /* Log text and errno */
  306. !     if (s == (char *)NULL) s = "";
  307.       if (!debug) return;
  308.       if (db) fprintf(db,"%s: errno = %d\n",s,errno);
  309.   }
  310. ***************
  311. *** 473,480 ****
  312. --- 501,512 ----
  313.       }
  314.   #else
  315.       if (xonxoff) {
  316. + #ifdef CPM68K
  317. +     if (debug) fprintf(db,"ttpkt CPM68K can't do Xon/Xoff!\n");
  318. + #else
  319.       ttraw.sg_flags |= TANDEM;
  320.       if (debug) fprintf(db,"ttpkt BSD Xon/Xoff\n");
  321. + #endif /* CPM68K */
  322.       }
  323.   #endif /* SETXONXOFF */
  324.       ttraw.sg_flags &= ~(ECHO|CRMOD);    /* No echo, etc */
  325. ***************
  326. *** 550,556 ****
  327. --- 582,590 ----
  328.       x = ioctl(0,TCFLSH,0);
  329.   #else
  330.   #ifdef BSD
  331. + #ifndef CPM68K
  332.       x = ioctl(0,TIOCFLUSH,&n);
  333. + #endif /* CPM68K */
  334.   #endif /* BSD */
  335.   #endif /* SYSV */
  336.   #endif /* POSIX */
  337. ***************
  338. *** 569,575 ****
  339.   
  340.    Call with:
  341.      dest - where to put it
  342. !    max  - maximum length
  343.      timo - timeout (seconds, 0 = none)
  344.      eol  - packet terminator
  345.      turn - half-duplex line turnaround character to wait for, 0 = none
  346. --- 603,609 ----
  347.   
  348.    Call with:
  349.      dest - where to put it
  350. !    maxl - maximum length
  351.      timo - timeout (seconds, 0 = none)
  352.      eol  - packet terminator
  353.      turn - half-duplex line turnaround character to wait for, 0 = none
  354. ***************
  355. *** 582,590 ****
  356.   
  357.   int
  358.   #ifdef __STDC__
  359. ! ttinl(char * dest, int max, int timo, char eol, char soh, int turn)
  360.   #else
  361. ! ttinl(dest,max,timo,eol,soh,turn) int max, timo, turn; char eol, soh, *dest;
  362.   #endif /* __STDC__ */
  363.   {
  364.       int n = 0, x = 0, flag = 0, rc = 0, ccn = 0; /* Local variables */
  365. --- 616,624 ----
  366.   
  367.   int
  368.   #ifdef __STDC__
  369. ! ttinl(char * dest, int maxl, int timo, char eol, char soh, int turn)
  370.   #else
  371. ! ttinl(dest,maxl,timo,eol,soh,turn) int maxl, timo, turn; char eol, soh, *dest;
  372.   #endif /* __STDC__ */
  373.   {
  374.       int n = 0, x = 0, flag = 0, rc = 0, ccn = 0; /* Local variables */
  375. ***************
  376. *** 607,617 ****
  377. --- 641,665 ----
  378.       } else {                /* Otherwise... */
  379.       while (1) {            /* Read until we have a packet */
  380.   #ifdef DUMBIO
  381. + #ifdef CPM68K
  382. +         /* use direct console I/O in order to implement a
  383. +          * timeout counter
  384. +          */
  385. +         if (timo) {
  386. +             if (__OSIF(CONIO, 0xfe) == 0) {
  387. +             /* no char ready, decrement timeout counter */
  388. +             tttimo();
  389. +             continue;
  390. +         }
  391. +         }
  392. +         c = (char)__OSIF(CONIO, 0xff);    /* blocking read */
  393. + #else
  394.           x = read(0,&c,1);        /* Dumb blocking read byte loop */
  395.           if (x < 0) {
  396.           logerr("ttinl XX read 1");
  397.           rc = -2;
  398.           }
  399. + #endif CPM68K
  400.   #else
  401.   #ifdef USE_GETCHAR
  402.           errno = 0;
  403. ***************
  404. *** 710,716 ****
  405.             continue;            /* Skip stuff between packets */
  406.           flag = 1;            /* Have SOH */
  407.   
  408. !         if (n >= max) {
  409.           if (debug) fprintf(db,"ttinl overflow\n");
  410.           rc = -2;
  411.           goto xttinl;
  412. --- 758,764 ----
  413.             continue;            /* Skip stuff between packets */
  414.           flag = 1;            /* Have SOH */
  415.   
  416. !         if (n >= maxl) {
  417.           if (debug) fprintf(db,"ttinl overflow\n");
  418.           rc = -2;
  419.           goto xttinl;
  420. ***************
  421. *** 822,829 ****
  422. --- 870,879 ----
  423.       while (n > 0) {            /* Send the packet with write() */
  424.       i = write(1,&s[m],n);        /* Allowing for partial results */
  425.       if (i < 0) {
  426. + #ifdef EWOULDBLOCK
  427.           if (errno == EWOULDBLOCK)    /* and even no results at all.. */
  428.             continue;
  429. + #endif
  430.           logerr("ttol write");
  431.           return(-1);
  432.       }
  433. ***************
  434. *** 853,858 ****
  435. --- 903,933 ----
  436.   
  437.   long
  438.   zchki(fn) char * fn; {            /* Check if file is readable */
  439. + #ifdef CPM68K
  440. +     int fd;
  441. +     long fsize, _filesz();
  442. +     /* CP/M-68K doesn't have stat().
  443. +      * Instead, we have to open the file and then use _filesz().
  444. +      */
  445. +     if (fn == (char *)NULL)
  446. +     return(-1);
  447. +     errno = 0;
  448. +     if (text)
  449. +     fd = open(fn,0);        /* text mode */
  450. +     else
  451. +     fd = openb(fn,0);        /* binary mode */
  452. +     if (fd == -1) {
  453. +     if (debug)
  454. +       fprintf(db,"zchki open %s errno = %d\n",fn,errno);
  455. +     return(-1);
  456. +     }
  457. +     fsize = _filesz(fd);
  458. +     close(fd);
  459. +     if (debug)
  460. +       fprintf(db,"zchki fsize = %ld\n",fsize);    /* GH */
  461. +     return(fsize);
  462. + #else    /* CPM68K */
  463.       struct stat buf;
  464.       if (!fn) return(-1);
  465.       if (stat(fn,&buf) < 0)
  466. ***************
  467. *** 869,874 ****
  468. --- 944,950 ----
  469.       return(-2);
  470.       }
  471.       return(buf.st_size);
  472. + #endif    /* CPM68K */
  473.   }
  474.   
  475.   int
  476. ***************
  477. *** 876,882 ****
  478.       int i, x;
  479.       char * s;
  480.   
  481. !     if (!fn)                /* Defend against empty name */
  482.         fn = "";
  483.       if (!*fn)
  484.         return(-1);
  485. --- 952,958 ----
  486.       int i, x;
  487.       char * s;
  488.   
  489. !     if (fn == (char *)NULL)        /* Defend against empty name */
  490.         fn = "";
  491.       if (!*fn)
  492.         return(-1);
  493. ***************
  494. *** 899,912 ****
  495. --- 975,1004 ----
  496.         s = ".";
  497.       }
  498.       errno = 0;
  499. + #ifdef CPM68K
  500. +     /* checking for write access to '.' is meaningless */
  501. +     if (*s == '.') {
  502. +     x = 0;
  503. +     } else {
  504. +         x = access(s,W_OK);        /* Check access of path. */
  505. +     }
  506. + #else
  507.       x = access(s,W_OK);            /* Check access of path. */
  508. + #endif
  509.       if (debug) fprintf(db,"zchko(%s) x = %d errno = %d\n",s,x,errno);
  510.       return((x < 0) ? -1 : 0);           /* and return. */
  511.   }
  512.   
  513.   int
  514.   zopeni(name) char *name; {        /* Open existing file for input */
  515. + #ifdef CPM68K
  516. +     if (text)
  517. +     ifp = fopen(name,"r");        /* open in text mode */
  518. +     else
  519. +     ifp = fopenb(name,"r");        /* open in binary mode */
  520. + #else
  521.       ifp = fopen(name,"r");
  522. + #endif
  523.       if (debug) fprintf(db,"zopeni %s: %d\n",name, ifp ? 0 : errno);
  524.       filelength = zchki(name);
  525.       if (filelength < 0)
  526. ***************
  527. *** 919,925 ****
  528. --- 1011,1024 ----
  529.   int
  530.   zopeno(name) char *name; {        /* Open new file for output */
  531.       errno = 0;
  532. + #ifdef CPM68K
  533. +     if (text)
  534. +     ofp = fopen(name,"w");        /* text mode */
  535. +     else
  536. +     ofp = fopenb(name,"w");        /* binary mode */
  537. + #else
  538.       ofp = fopen(name,"w");
  539. + #endif
  540.       if (debug) fprintf(db,"zopeno %s: %d\n",name, ofp ? 0 : errno);
  541.       if (ofp) {
  542.       strncpy(ofile,name,MAXPATHLEN);
  543. ***************
  544. *** 998,1013 ****
  545.   
  546.   int
  547.   zbackup(fn) char * fn; {        /* Back up existing file */
  548.       struct stat buf;
  549.       int i, j, k, x, state, flag;
  550.       char *p, newname[MAXPATHLEN+12];
  551.   
  552. !     if (!fn)                /* Watch out for null pointers. */
  553.         return(-1);
  554.       if (!*fn)                /* And empty names. */
  555.         return(-1);
  556.       if (stat(fn,&buf) < 0)        /* If file doesn't exist */
  557.         return(0);            /* no need to back it up. */
  558.   
  559.       i = strlen(fn);            /* Get length */
  560.       if (i > MAXPATHLEN)            /* Guard buffer */
  561. --- 1097,1120 ----
  562.   
  563.   int
  564.   zbackup(fn) char * fn; {        /* Back up existing file */
  565. + #ifndef CPM68K
  566.       struct stat buf;
  567. + #endif
  568.       int i, j, k, x, state, flag;
  569.       char *p, newname[MAXPATHLEN+12];
  570.   
  571. !     if (fn == (char *)NULL)        /* Watch out for null pointers. */
  572.         return(-1);
  573.       if (!*fn)                /* And empty names. */
  574.         return(-1);
  575. + #ifdef CPM68K
  576. +     /* CP/M-68K doesn't have stat(), use access() instead */
  577. +     if (access(fn,0) < 0)
  578. +     return(0);
  579. + #else
  580.       if (stat(fn,&buf) < 0)        /* If file doesn't exist */
  581.         return(0);            /* no need to back it up. */
  582. + #endif
  583.   
  584.       i = strlen(fn);            /* Get length */
  585.       if (i > MAXPATHLEN)            /* Guard buffer */
  586. ***************
  587. *** 1057,1064 ****
  588. --- 1164,1183 ----
  589.       if ((x + k + 3) > MAXPATHLEN)
  590.         x = MAXPATHLEN - k - 3;
  591.       sprintf(&newname[x],".~%d~",i); /* Make a backup name */
  592. + #ifdef CPM68K
  593. +     if (access(newname,0) < 0) {
  594. + #else
  595.       if (stat(newname,&buf) < 0) {    /* If it doesn't exist */
  596. + #endif
  597.           errno = 0;
  598. + #ifdef CPM68K
  599. +     /* CP/M-68K doesn' have link(), use rename() instead */
  600. +         if (rename(fn,newname) < 0) {
  601. +         if (debug)
  602. +           fprintf(db,"zbackup failed: rename(%s,%s): %d\n",fn,newname,errno);
  603. +         return(-1);
  604. + #else
  605.           if (link(fn,newname) <  0) { /* Rename old file to backup name */
  606.           if (debug)
  607.             fprintf(db,"zbackup failed: link(%s): %d\n",newname,errno);
  608. ***************
  609. *** 1067,1072 ****
  610. --- 1186,1192 ----
  611.           if (debug)
  612.             fprintf(db,"zbackup failed: unlink(%s): %d\n",fn,errno);
  613.           return(-1);
  614. + #endif
  615.           } else {
  616.           if (debug)
  617.             fprintf(db,"zbackup %s: OK\n",newname);
  618. ***************
  619. *** 1084,1089 ****
  620. --- 1204,1211 ----
  621.       int acase = 0, flag = 0, n = 0;
  622.       char * p;
  623.   
  624. +     if (debug)
  625. +       fprintf(db, "zrtol pktnam=%s\n", pktnam);    /* GH */
  626.       if (literal) {
  627.       strncpy(lclnam,pktnam,maxlen);
  628.       } else {
  629. ***************
  630. *** 1170,1172 ****
  631. --- 1292,1348 ----
  632.       zincnt--;                /* Return first byte. */
  633.       return(*zinptr++ & 0xff);
  634.   }
  635. + #ifdef CPM68K
  636. + /*
  637. +  * a crude sleep()
  638. +  */
  639. + sleep(sec) int sec;
  640. + {
  641. +     int i, a, b, c;
  642. +     long j;
  643. +     a = 101;
  644. +     b = 101;
  645. +     for (i = 0; i < sec; i++) {
  646. +         for (j = 0; j < SCOUNT; j++) {
  647. +             c = a * b;    /* compiles to 'muls' */
  648. +             b = c / a;    /* compiles to 'divs' */
  649. +         }
  650. +     }
  651. +     return(0);
  652. + }
  653. + /*
  654. +  * CP/M-68K has no timers so doesn't support a real alarm()
  655. +  * function. This just sets the timeout for tttimo()
  656. +  */
  657. + alarm(sec) int sec;
  658. + {
  659. +     atime = sec;
  660. +     acount = ACOUNT;
  661. +     return(0);
  662. + }
  663. + /*
  664. +  * timer for ttinl()
  665. +  */
  666. + tttimo()
  667. + {
  668. +     int a, b, c;
  669. +     if (atime == 0) {
  670. +     return(0);        /* no alarm set */
  671. +     }
  672. +     a = 101;
  673. +     b = 101;
  674. +     c = a * b;            /* compiles to 'muls' */
  675. +     b = c / a;            /* compiles to 'divs' */
  676. +     if (--acount == 0) {
  677. +         if (--atime == 0) {
  678. +         timerh(0);        /* timeout */
  679. +     }
  680. +     acount = ACOUNT;    /* reload timer */
  681. +     }
  682. +     return(0);
  683. + }
  684. + #endif /* CPM68K */
  685. *** gwart.c    Fri Dec 17 17:04:22 1999
  686. --- ../gkermit68/GWART.C    Thu Mar 14 22:08:30 2002
  687. ***************
  688. *** 437,443 ****
  689.           fprintf(stderr,"Can't open %s\n",argv[1]);
  690.           fatal("unreadable input file");
  691.       }
  692. !     } else infile = stdin;
  693.   
  694.       if (argc > 2) {
  695.       if ((outfile = fopen(argv[2],"w")) == NULL) {
  696. --- 437,443 ----
  697.           fprintf(stderr,"Can't open %s\n",argv[1]);
  698.           fatal("unreadable input file");
  699.       }
  700. !     } else infile = (FILE *)stdin;
  701.   
  702.       if (argc > 2) {
  703.       if ((outfile = fopen(argv[2],"w")) == NULL) {
  704.