home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Libraries / xmodem 3.10 / README < prev    next >
Encoding:
Text File  |  1994-05-10  |  21.3 KB  |  649 lines  |  [TEXT/MPS ]

  1. This is version 3.10.
  2.  
  3. --------------------------------------------------------------------------------
  4.  
  5. This is version 3.9 (circa 11/90) of the xmodem program which incorporates
  6. a few bugfixes (one important!) and some enhancements: 1) status messages
  7. when running xmodem through Sun's tip program ("p" flag); 2) delayed
  8. startup (via the "w" flag); 3) ability to turn off EOT verification (via
  9. "e" flag); 4) ability to allow CAN-CAN abort in the midst of a file
  10. transfer (via "n"  flag); 5) some help for MODEM-7 transfers (via the "cm" 
  11. flag combination and 6) YMODEM-G support (via the "g" flag).  See
  12. update.doc for details. 
  13.  
  14. --------------------------------------------------------------------------------
  15.  
  16. This is version 3.8 (circa 11/88) of the xmodem program which incorporates
  17. minor enhancements over version 3.7 which incoporates minor enhancements
  18. over version 3.6.  See update.doc. 
  19.  
  20. --------------------------------------------------------------------------------
  21.  
  22. This is version 3.6 (finished 4/88) of the xmodem program which includes a
  23. few bugfixes and some enhancements (requested by Macintosh users)
  24. stimulated by the xmodem release through comp.sources.unix.  See the file
  25. update.doc for details. 
  26.  
  27. --------------------------------------------------------------------------------
  28.  
  29. This is version 3.4 (finished 10/87) of the xmodem program, a full-featured
  30. XMODEM implementation for 4.3BSD.  Since the previous release (version
  31. 3.2, see volume 7 of the archives), substantial improvements have been
  32. made. See the file update.doc for details.  Also, some attempt has been
  33. made to support SysV Unix systems; see below.
  34.  
  35. As far as I am concerned, this program has reached the end of its evolution.
  36. Newer protocols (such as ZMODEM) will not be incorporated into xmodem.  Check
  37. out Chuck Forsberg's rz/sz programs if you are interested in ZMODEM.
  38.  
  39. --------------------------------------------------------------------------------
  40.  
  41. The xmodem program implements the Christensen (XMODEM) file transfer
  42. protocol for moving files between 4.2/4.3BSD Unix systems and microcomputers.
  43. The XMODEM/CRC protocol, the MODEM7 batch protocol, the XMODEM-1K
  44. block protocol and the YMODEM batch protocol are all supported by xmodem.
  45. For details of the protocols, see the document edited by Chuck Forsberg titled
  46. XMODEM/YMODEM Protocol Reference (the latest version is dated 6-18-88).
  47.  
  48. This program runs on 4.2/4.3BSD systems ONLY.  It has been tested on VAXes
  49. and Suns against the MEX-PC program from Niteowl Software and the ZCOMM and
  50. DSZ programs from Omen Technology.
  51.  
  52. I have tried to keep the 4.2isms (select system call, 4.2BSD/v7 tty structures,
  53. gettimeofday system call, etc.) confined to the source file getput.c; but I 
  54. make no guarantees.  Also, I have made no attempt to keep variable names 
  55. under 7 characters.  A version of getput.c that MAY work on Sys V Unix
  56. systems is included.
  57.  
  58. --------------------------------------------------------------------------------
  59.  
  60. Thanks to Emmet Gray (ihnp4!uiucuxc!fthood!egray) and John Rupley 
  61. (arizona!rupley!root) for the following notes about converting xmodem to Sys V.
  62. Since I don't have a Sys V system to test a Sys V version, I won't even try.
  63.  
  64. 1) Change the includes in xmodem.h from <sys/time.h> to <time.h>
  65.    and from <sgtty.h> to <termio.h>
  66.  
  67. 2) Convert the occurrences of rindex to strrchr in batch.c
  68.  
  69. 3) Substitute getput.sysv.c for getput.c
  70.  
  71. A further "gotcha" regarding Sys V is contained in the following message :
  72.  
  73. From: Bill Stubblebine <hplsdls!was@hp-lsd.UUCP>
  74. Date: Sat, 25 Jun 88 13:36:20 mdt
  75. To: grandi@noao.arizona.edu
  76. Subject: xmodem3.6 bug, fix and THANKS!!
  77.  
  78.                         1:30 PM MDT
  79.                         June 25, 1988
  80.  
  81. First, thanks for posting a really useful program, xmodem 3.6.
  82.  
  83. I installed the xmodem program on an HP 9000 Series 350 workstation,
  84. running HP-UX version 6.01 (AT&T System V compatible) to talk to my
  85. CP/M system at home.  MODEM7 batch is particularly useful.
  86.  
  87. I'd like to report a bug I found and the fix I developed in the source
  88. file getput.sysv.c so that you can include it in future releases.
  89.  
  90. I've reproduced the relevant portion of getput.sysv.c, modified to fix
  91. the bug, at the end of this file.  See the routine getspeed() starting
  92. at line 382.  Getspeed() derives the serial port speed from the
  93. c_cflag ioctl parameter, for use in estimating transmission times.
  94.  
  95. I suspected something was wrong when xmodem kept reporting 1200 baud
  96. modem connections as 1800 baud in the log file, but the transfers
  97. still worked OK at 1200 baud.  However, I also have a Courier HST 9600
  98. baud modem at home, and when I tried 9600 baud xmodem transfers,
  99. xmodem would core dump on the UNIX host.
  100.  
  101. On line 386 of getput.sysv.c, in the procedure getspeed(), an array is
  102. declared containing numerical constants representing the various baud
  103. rates supported by the host terminal interface.  The appropriate baud
  104. rate constant is selected by the statements in lines 392-394, which
  105. mask the c_cflag baud rate bitfield to index into the speedtbl[]
  106. array.
  107.  
  108. There are two problems here.  The first problem is that speedtbl[] is
  109. missing some valid baud rate entries, as the modified declaration
  110. shows.  I got the entries for the modified declaration from the
  111. termio(7) manpage in my System V user's manual.  The missing entries
  112. throw off the indexing arithmetic.  Notice, for example, that the
  113. missing entry 900 was responsible for mapping the c_cflag bits for
  114. 1200 baud to the 1800 baud constant.
  115.  
  116. Original declaration:
  117.   static int speedtbl[] = {0, 50, 75, 110, 134, 150, 200, 300, 600,
  118.   1200, 1800, 2400, 4800, 9600, 19200, 0};
  119.  
  120. Modified declaration:
  121.   static int speedtbl[] = {0, 50, 75, 110, 134, 150, 200, 300, 600,
  122.   900, 1200, 1800, 2400, 3600, 4800, 7200, 9600, 19200, 38400, 0};
  123.   ^^^                    ^^^^        ^^^^        ^^^^^  ^^^^^
  124.  
  125. The second problem didn't show up until I used 9600 baud.  The c_cflag
  126. bitfield value for 9600 baud is 16 decimal (020 octal).  The masking
  127. constant in lines 392-394 was originally 017 octal, which masked the
  128. 9600 baud bitfield to 0, indexing to the speedtbl[] value of 0.  Speed
  129. calculations using a baudrate of 0 caused floating point exceptions
  130. leading to the host core dumps at 9600 baud.
  131.  
  132. I changed the mask value from 017 octal to 037 octal (which is
  133. actually the size of the c_cflag baudrate field), and changed the
  134. limit test in line 392 from 14 to 18, the new correct number of
  135. elements in the speedtbl[] array.
  136.  
  137. I'm not familiar with 4.2BSD, but I noticed that getput.c, the 4.2BSD
  138. version of the I/O routines, contains virtually the same code for
  139. determining the baudrate as that in getput.sysv.c.  It may be OK for
  140. 4.2BSD, but definitely not for System V.
  141.  
  142. The modified code now works great at all baud rates!  Thanks again for
  143. posting the program.
  144.  
  145.                                 Bill Stubblebine
  146.                                 Hewlett-Packard Logic Systems Div.
  147.                 8245 N. Union Blvd.
  148.                                 Colorado Springs, Co. 80918
  149.                 ARPA: was%hp-lsd@hplabs.hp.com
  150.                 UUCP: {hplabs,hpfcla}!{hpldola,hp-lsd}!was
  151.  
  152. --------------------------------------------------------------------------------
  153.  
  154. A common request to me concerns running xmodem through tip in order to do
  155. XMODEM or YMODEM transfers.  I have discovered that SunOS has a nice
  156. feature in tip (accessed through ~C) that connects a named program to a
  157. remote machine.  It turns out that 4.3BSD tip has a similar (but
  158. undocumented) feature, but far less convenient: SunOS tip connects file
  159. descriptor 0 of the program to the remote line input and file descriptor 1
  160. to remote line output while 4.3BSD connects up file descriptors 3 and 4! 
  161.  
  162. If you would like to use xmodem through 4.3BSD tip, the following message
  163. should be of interest (note that the patches given below are against an old
  164. version of the source):
  165.  
  166. To: grandi@noao.edu (Steve Grandi CCS)
  167. Subject: Re: xmodem 
  168. Date: Tue, 02 Jan 90 12:34:58 -0500
  169. From: Benson I. Margulies <benson@odi.com>
  170.  
  171.  
  172.     Yes, I would like to receive the changes!
  173.  
  174.     Steve, grandi@noao.edu
  175.  
  176. OK, here are the diffs. I've tested them in receive mode,
  177. but I haven't been able to verify that they work for sending.
  178. The reason why is a long sob story.
  179.  
  180. It would be good to do two additional things:
  181.  
  182. 1) add some \r's to the messages printed.
  183. 2) when in tip mode, print more messages on stdout
  184. to report progress, like a . every 100 blocks.
  185.  
  186. RCS file: RCS/xmodem.c,v
  187. retrieving revision 1.1
  188. retrieving revision 1.2
  189. diff -c -r1.1 -r1.2
  190. *** /tmp/,RCSt1a02154    Tue Jan  2 12:33:12 1990
  191. --- /tmp/,RCSt2a02154    Tue Jan  2 12:33:12 1990
  192. ***************
  193. *** 52,57 ****
  194. --- 52,60 ----
  195.       MDM7BAT = FALSE;    /* no MODEM7 batch mode */
  196.       YMDMBAT = FALSE;    /* no YMODEM batch mode */
  197.       TOOBUSY = FALSE;    /* not too busy for sleeping in packet read */
  198. +     INFD = 0;
  199. +     OUTFD = 1;
  200. +     FDS_DISTINCT = 0;
  201.   
  202.       fprintf(stderr, "XMODEM Version %d.%d", VERSION/10, VERSION%10);
  203.       fprintf(stderr, " -- UNIX-Microcomputer Remote File Transfer Facility\n");
  204. ***************
  205. *** 101,106 ****
  206. --- 104,115 ----
  207.           case 's' : SENDFLAG = TRUE;  /* send file */
  208.                  XMITTYPE = gettype(argv[1][index++]);
  209.                  break;
  210. +         case 'p':  /* TIP */
  211. +         case 'P':
  212. +                    INFD = 3;
  213. +                OUTFD = 4;
  214. +                FDS_DISTINCT = TRUE;
  215. +                break;
  216.           default  : fprintf(stderr, "Invalid Flag %c ignored\n", flag);
  217.                  break;
  218.          }
  219. ***************
  220. *** 120,133 ****
  221.           LOGFP = fopen(fname, "w");  /* new LOG file */
  222.            if (!LOGFP)
  223.           error("Fatal - Can't Open Log File", FALSE);
  224.   
  225.            fprintf(LOGFP,"\n++++++++  %s", stamptime());
  226.            fprintf(LOGFP,"XMODEM Version %d.%d\n", VERSION/10, VERSION%10);
  227.            fprintf(LOGFP,"Command line: %s %s", argv[0], argv[1]);
  228. !          for (index=2; index<argc; ++index)
  229. !         fprintf(LOGFP, " %s", argv[index]);
  230.            fprintf(LOGFP, "\n");
  231. !        }
  232.   
  233.       getspeed();        /* get tty-speed for time estimates */
  234.   
  235. --- 129,147 ----
  236.           LOGFP = fopen(fname, "w");  /* new LOG file */
  237.            if (!LOGFP)
  238.           error("Fatal - Can't Open Log File", FALSE);
  239. +          setlinebuf(LOGFP);
  240.   
  241.            fprintf(LOGFP,"\n++++++++  %s", stamptime());
  242. +          
  243.            fprintf(LOGFP,"XMODEM Version %d.%d\n", VERSION/10, VERSION%10);
  244.            fprintf(LOGFP,"Command line: %s %s", argv[0], argv[1]);
  245. !          for (index=2; index<argc; ++index) {
  246. !          fprintf(LOGFP, " %s", argv[index]);
  247. !          }
  248.            fprintf(LOGFP, "\n");
  249. !      }
  250.   
  251.       getspeed();        /* get tty-speed for time estimates */
  252.   
  253. ===================================================================
  254. RCS file: RCS/xmodem.h,v
  255. retrieving revision 1.1
  256. retrieving revision 1.2
  257. diff -c -r1.1 -r1.2
  258. *** /tmp/,RCSt1a02154    Tue Jan  2 12:33:13 1990
  259. --- /tmp/,RCSt2a02154    Tue Jan  2 12:33:14 1990
  260. ***************
  261. *** 10,16 ****
  262.   #define  logit(string) if(LOGFLAG)fprintf(LOGFP,string)
  263.   #define  logitarg(string,argument) if(LOGFLAG)fprintf(LOGFP,string,argument)
  264.   
  265. ! #define         VERSION    36    /* Version Number */
  266.   #define      FALSE      0
  267.   #define      TRUE       1
  268.   
  269. --- 10,16 ----
  270.   #define  logit(string) if(LOGFLAG)fprintf(LOGFP,string)
  271.   #define  logitarg(string,argument) if(LOGFLAG)fprintf(LOGFP,string,argument)
  272.   
  273. ! #define         VERSION    37    /* Version Number */
  274.   #define      FALSE      0
  275.   #define      TRUE       1
  276.   
  277. ***************
  278. *** 73,78 ****
  279. --- 73,81 ----
  280.   int    YMDMBAT;    /* YMODEM batch protocol */
  281.   int    TOOBUSY;    /* turn off sleeping in packet read routine */
  282.   int    CHECKLENGTH;    /* Are we truncating a file to a YMODEM length? */
  283. + int     INFD;        /* file descriptor for protocol reading */
  284. + int    OUTFD;        /* file descriptor for protocol reading */
  285. + int     FDS_DISTINCT;   /* in,out fd's not 0 and 1 */
  286.   
  287.   
  288.   /*   CRC-16 constants.  From Usenet contribution by Mark G. Mendel, 
  289. ===================================================================
  290. RCS file: RCS/getput.c,v
  291. retrieving revision 1.1
  292. retrieving revision 1.2
  293. diff -c -r1.1 -r1.2
  294. *** /tmp/,RCSt1a02154    Tue Jan  2 12:33:14 1990
  295. --- /tmp/,RCSt2a02154    Tue Jan  2 12:33:15 1990
  296. ***************
  297. *** 4,9 ****
  298. --- 4,10 ----
  299.    */
  300.   
  301.   #include "xmodem.h"
  302. + #include <sys/types.h>
  303.   
  304.   /*
  305.    *
  306. ***************
  307. *** 103,113 ****
  308.   /* get a byte from data stream -- timeout if "seconds" elapses */
  309.   /* This routine is VERY 4.2 specific */
  310.   
  311.   int
  312.   readbyte(seconds)
  313.   int seconds;
  314.       {
  315. -     int readfd;
  316.       char c;
  317.       struct timeval tmout;
  318.   
  319. --- 104,122 ----
  320.   /* get a byte from data stream -- timeout if "seconds" elapses */
  321.   /* This routine is VERY 4.2 specific */
  322.   
  323. + int select_input (tmout)
  324. + struct timeval * tmout;
  325. + {
  326. +     fd_set readfd;        /* mask for select call */
  327. +     FD_ZERO(&readfd);
  328. +     FD_SET(INFD, &readfd);
  329. +     return select(getdtablesize(), &readfd, (int *)0, (int *)0, tmout);
  330. + }
  331.   int
  332.   readbyte(seconds)
  333.   int seconds;
  334.       {
  335.       char c;
  336.       struct timeval tmout;
  337.   
  338. ***************
  339. *** 114,125 ****
  340.       tmout.tv_sec = seconds;
  341.       tmout.tv_usec = 0;
  342.   
  343. -     readfd = 1<<0;
  344.   
  345. !     if ((select(1, &readfd, (int *)0, (int *)0, &tmout)) == 0)
  346. !         return(TIMEOUT);
  347.   
  348. !     read(0, &c, 1);
  349.   
  350.       if (DEBUG)
  351.           fprintf(LOGFP, "DEBUG: readbyte %02xh\n", c & 0xff);
  352. --- 123,133 ----
  353.       tmout.tv_sec = seconds;
  354.       tmout.tv_usec = 0;
  355.   
  356.   
  357. !     if (select_input(&tmout) == 0)
  358. !         return(TIMEOUT);
  359.   
  360. !     read(INFD, &c, 1);
  361.   
  362.       if (DEBUG)
  363.           fprintf(LOGFP, "DEBUG: readbyte %02xh\n", c & 0xff);
  364. ***************
  365. *** 138,151 ****
  366.       /* set up a usec timeout on stdin */
  367.       tmout.tv_sec = 0;
  368.       tmout.tv_usec = 1;
  369. !     readfd = 1<<0;
  370.   
  371.       /* any characters pending?; return if none */
  372. !     if ((select(1, &readfd, (int *)0, (int *)0, &tmout)) == 0)
  373. !         return;
  374.   
  375.       /* read the characters to flush them (assume there are fewer than BBUFSIZ */
  376. !     (void) read(0, inbuf, BBUFSIZ);
  377.       }
  378. --- 146,159 ----
  379.       /* set up a usec timeout on stdin */
  380.       tmout.tv_sec = 0;
  381.       tmout.tv_usec = 1;
  382. !     readfd = 1<<INFD;
  383.   
  384.       /* any characters pending?; return if none */
  385. !     if (select_input(&tmout) == 0)
  386. !         return;
  387.   
  388.       /* read the characters to flush them (assume there are fewer than BBUFSIZ */
  389. !     (void) read(INFD, inbuf, BBUFSIZ);
  390.       }
  391. ***************
  392. *** 170,181 ****
  393.   long recvsectcnt;    /* running sector count (128 byte sectors) */
  394.   
  395.   {
  396. -     int readfd;        /* mask for select call */
  397. -     struct timeval tmout;    /* timeout structure for select */
  398.       int numread;        /* number of chars read */
  399.       int left;        /* number of chars left to read */
  400.       int recfin = FALSE;        /* flag that EOF read */
  401.       char inbuf[BBUFSIZ];    /* buffer for incoming packet */
  402.       register unsigned char c;    /* character being processed */
  403.       register unsigned short chksm;    /* working copy of checksum */
  404.       register int bfctr;    /* working copy of bufctr */
  405. --- 178,188 ----
  406.   long recvsectcnt;    /* running sector count (128 byte sectors) */
  407.   
  408.   {
  409.       int numread;        /* number of chars read */
  410.       int left;        /* number of chars left to read */
  411.       int recfin = FALSE;        /* flag that EOF read */
  412.       char inbuf[BBUFSIZ];    /* buffer for incoming packet */
  413. +     struct timeval tmout;    /* timeout structure for select */
  414.       register unsigned char c;    /* character being processed */
  415.       register unsigned short chksm;    /* working copy of checksum */
  416.       register int bfctr;    /* working copy of bufctr */
  417. ***************
  418. *** 184,190 ****
  419.   
  420.       tmout.tv_sec = seconds;
  421.       tmout.tv_usec = 0;
  422. -     readfd = 1<<0;
  423.       chksm = 0;
  424.       bfctr = 0;
  425.   
  426. --- 191,196 ----
  427. ***************
  428. *** 192,201 ****
  429.   
  430.           /* read however many chars are waiting */
  431.   
  432. !         if ((select(1, &readfd, (int *)0, (int *)0, &tmout)) == 0)
  433. !             return(TIMEOUT);
  434.   
  435. !         numread = read(0, inbuf, left);
  436.           left -= numread;
  437.   
  438.           if (DEBUG)
  439. --- 198,207 ----
  440.   
  441.           /* read however many chars are waiting */
  442.   
  443. !         if (select_input(&tmout) == 0)
  444. !             return(TIMEOUT);
  445.   
  446. !         numread = read(INFD, inbuf, left);
  447.           left -= numread;
  448.   
  449.           if (DEBUG)
  450. ***************
  451. *** 275,281 ****
  452.       if (DEBUG)
  453.           fprintf(LOGFP, "DEBUG: sendbyte %02xh\n", data & 0xff);
  454.   
  455. !     if (write(1, &data, 1) != 1)      /* write the byte (assume it goes NOW; no flushing needed) */
  456.           error ("Write error on stream", TRUE);
  457.       return;
  458.       }
  459. --- 281,287 ----
  460.       if (DEBUG)
  461.           fprintf(LOGFP, "DEBUG: sendbyte %02xh\n", data & 0xff);
  462.   
  463. !     if (write(OUTFD, &data, 1) != 1)      /* write the byte (assume it goes NOW; no flushing needed) */
  464.           error ("Write error on stream", TRUE);
  465.       return;
  466.       }
  467. ***************
  468. *** 289,295 ****
  469.       if (DEBUG)
  470.           fprintf(LOGFP, "DEBUG: writebuf (%d bytes)\n", nbytes);
  471.   
  472. !     if (write(1, buffer, nbytes) != nbytes)        /* write the buffer (assume no TIOCFLUSH needed) */
  473.           error ("Write error on stream", TRUE);
  474.       return;
  475.       }
  476. --- 295,301 ----
  477.       if (DEBUG)
  478.           fprintf(LOGFP, "DEBUG: writebuf (%d bytes)\n", nbytes);
  479.   
  480. !     if (write(OUTFD, buffer, nbytes) != nbytes)        /* write the buffer (assume no TIOCFLUSH needed) */
  481.           error ("Write error on stream", TRUE);
  482.       return;
  483.       }
  484. ***************
  485. *** 302,308 ****
  486.   int    milliseconds;
  487.   {
  488.       struct    timeval    timeout;
  489. -     int readfd;
  490.   
  491.       if (milliseconds == 0)
  492.           return;
  493. --- 308,313 ----
  494. ***************
  495. *** 310,318 ****
  496.           fprintf (LOGFP, "DEBUG: napping for %d ms\n", milliseconds);
  497.       timeout.tv_sec = 0;
  498.       timeout.tv_usec = milliseconds * 1000;
  499. -     readfd = 0;
  500.   
  501. !     (void) select(1, &readfd, (int *)0, (int *)0, &timeout);
  502.   }
  503. --- 315,322 ----
  504.           fprintf (LOGFP, "DEBUG: napping for %d ms\n", milliseconds);
  505.       timeout.tv_sec = 0;
  506.       timeout.tv_usec = milliseconds * 1000;
  507.   
  508. !     (void) select(0, (int *)0, (int *)0, (int *)0, &timeout);
  509.   }
  510. ***************
  511. *** 335,344 ****
  512.       extern onintr();
  513.   
  514.       sleep(2);            /* let the output appear */
  515. !     if (ioctl(0,TIOCGETP,&ttys)<0)  /* get tty params [V7] */
  516.           error("Can't get TTY Parameters", TRUE);
  517.   
  518. !     tty = ttyname(0);  /* identify current tty */
  519.       
  520.       ttysnew.sg_ispeed = ttys.sg_ispeed;    /* copy input speed */
  521.       ttysnew.sg_ospeed = ttys.sg_ospeed;    /* copy input speed */
  522. --- 339,348 ----
  523.       extern onintr();
  524.   
  525.       sleep(2);            /* let the output appear */
  526. !     if (ioctl(INFD,TIOCGETP,&ttys)<0)  /* get tty params [V7] */
  527.           error("Can't get TTY Parameters", TRUE);
  528.   
  529. !     tty = ttyname(INFD);  /* identify current tty */
  530.       
  531.       ttysnew.sg_ispeed = ttys.sg_ispeed;    /* copy input speed */
  532.       ttysnew.sg_ospeed = ttys.sg_ospeed;    /* copy input speed */
  533. ***************
  534. *** 347,358 ****
  535.       ttysnew.sg_flags &= ~TANDEM;    /* turn off flow control */
  536.   
  537.       /* set new paramters */
  538. !     if (ioctl(0,TIOCSETP,&ttysnew) < 0)
  539.           error("Can't set new TTY Parameters", TRUE);
  540.   
  541.       /* Flush characters waiting for read or write */
  542.       n = 0;
  543. !     if (ioctl(0,TIOCFLUSH,&n) < 0)
  544.           error("Can't flush terminal queue", TRUE);
  545.   
  546.       /* get tty status */ 
  547. --- 351,362 ----
  548.       ttysnew.sg_flags &= ~TANDEM;    /* turn off flow control */
  549.   
  550.       /* set new paramters */
  551. !     if (ioctl(INFD,TIOCSETP,&ttysnew) < 0)
  552.           error("Can't set new TTY Parameters", TRUE);
  553.   
  554.       /* Flush characters waiting for read or write */
  555.       n = 0;
  556. !     if (ioctl(INFD,TIOCFLUSH,&n) < 0)
  557.           error("Can't flush terminal queue", TRUE);
  558.   
  559.       /* get tty status */ 
  560. ***************
  561. *** 381,387 ****
  562.       if (wason)
  563.           if (chmod(tty, (int)statbuf.st_mode | 022) < 0)
  564.               error("Can't change TTY mode", FALSE);
  565. !     if (ioctl(0,TIOCSETP,&ttys) < 0)
  566.           { if (!errcall)
  567.              error("RESET - Can't restore normal TTY Params", FALSE);
  568.           else
  569. --- 385,391 ----
  570.       if (wason)
  571.           if (chmod(tty, (int)statbuf.st_mode | 022) < 0)
  572.               error("Can't change TTY mode", FALSE);
  573. !     if (ioctl(INFD,TIOCSETP,&ttys) < 0)
  574.           { if (!errcall)
  575.              error("RESET - Can't restore normal TTY Params", FALSE);
  576.           else
  577. ***************
  578. *** 423,429 ****
  579.       {
  580.       static int speedtbl[] = {0, 50, 75, 110, 134, 150, 200, 300, 600, 
  581.          1200, 1800, 2400, 4800, 9600, 19200, 0};
  582. !     if (ioctl(0,TIOCGETP,&ttys) < 0)    /* get tty structure */
  583.           error("Can't get TTY parameters", FALSE);
  584.   
  585.       if (ttys.sg_ispeed >= 0 && ttys.sg_ispeed <= 14)
  586. --- 427,433 ----
  587.       {
  588.       static int speedtbl[] = {0, 50, 75, 110, 134, 150, 200, 300, 600, 
  589.          1200, 1800, 2400, 4800, 9600, 19200, 0};
  590. !     if (ioctl(INFD,TIOCGETP,&ttys) < 0)    /* get tty structure */
  591.           error("Can't get TTY parameters", FALSE);
  592.   
  593.       if (ttys.sg_ispeed >= 0 && ttys.sg_ispeed <= 14)
  594.  
  595. --------------------------------------------------------------------------------
  596.  
  597. xmodem Program history:
  598.  
  599. Descended from UMODEM 3.5 by Lauren Weinstein, Richard Conn, and others.
  600.  
  601. Based on XMODEM Version 1.0 by Brian Kantor, UCSD (3/84)  (Don't blame him 
  602.     in any way for what follows....)
  603.  
  604. Version 2.0 (CRC-16 and Modem7 batch file transfer) (5/85) (Thanks to D'Anne
  605.     Thompson for the batch transfer code).
  606.  
  607. Version 2.1 (1K packets) (7/85)
  608.  
  609. Version 2.2 (general clean-ups and multi-character read speed-ups) (9/85)
  610.  
  611. Version 2.3 (nap while reading packets; split into several source files) (1/86)
  612.  
  613. Version 3.0 (Ymodem batch receive; associated changes) (2/86)
  614.  
  615. Version 3.1 (Ymodem batch send; associated changes) (8/86)
  616.  
  617. Version 3.2 (general cleanups) (9/86) 
  618.     (Released to the world (comp.sources) 1/87)
  619.  
  620. Version 3.3 (general fixes and cleanups; see update.doc) (5/87)
  621.  
  622. Version 3.4 (general fixes and cleanups; see update.doc) (10/87) 
  623.     (Released to the world 3/88)
  624.  
  625. Version 3.5 (general fixes and cleanups; see update.doc) (3/88)
  626.  
  627. Version 3.6 (general fixes and cleanups; text file translation for Mac; 
  628.     see update.doc) (4/88) 
  629.     (Released to the world (comp.sources.unix) 4/88)
  630.  
  631. Version 3.7 (general fixes and cleanups; see update.doc) (5/88)
  632.  
  633. Version 3.8 (general fixes and cleanups; see update.doc) (11/88)
  634.  
  635. Version 3.9 (general fixes and cleanups; Sun tip support; YMODEM-G;
  636.     see update.doc) (11/90)
  637.     (Released to the world (comp.sources.unix) 11/90)
  638.  
  639. Version 3.10 (general fixes and cleanups; see update.doc) (in progress)
  640.  
  641. --------------------------------------------------------------------------------
  642.  
  643. Please send bug fixes, additions and comments to:
  644. Steve Grandi, National Optical Astronomy Observatories (Tucson, Arizona, USA)
  645.     grandi@noao.edu
  646.