home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume23 / xmodem3.9 / part01 / README < prev    next >
Encoding:
Text File  |  1991-01-08  |  21.0 KB  |  641 lines

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