rbsb.c - Rev This file contains Unix specific code for...

This preview shows page 1 - 4 out of 8 pages.

/* * * Rev 05-05-1988 * This file contains Unix specific code for setting terminal modes, * very little is specific to ZMODEM or YMODEM per se (that code is in * sz.c and rz.c). The CRC-16 routines used by XMODEM, YMODEM, and ZMODEM * are also in this file, a fast table driven macro version * * V7/BSD HACKERS: SEE NOTES UNDER mode(2) !!! * * This file is #included so the main file can set parameters such as HOWMANY. * See the main files (rz.c/sz.c) for compile instructions. */ #ifdef V7 #include <sys/types.h> #include <sys/stat.h> #include <sgtty.h> #define OS "V7/BSD" #ifdef LLITOUT long Locmode; /* Saved "local mode" for 4.x BSD "new driver" */ long Locbit = LLITOUT; /* Bit SUPPOSED to disable output translations */ #include <strings.h> #endif #endif #ifdef POSIX #include <sys/types.h> #include <sys/stat.h> #include <termios.h> #define OS "POSIX" #endif #ifndef OS #ifndef USG #define USG #endif #endif #ifdef USG #include <sys/types.h> #include <sys/stat.h> #include <termio.h> #include <sys/ioctl.h> #define OS "SYS III/V" #define MODE2OK #include <string.h> #endif #include "zmodem.h" _PROTOTYPE(static unsigned getspeed , (int code )); #if HOWMANY > 255 Howmany must be 255 or less #endif /* * return 1 iff stdout and stderr are different devices
* indicating this program operating with a modem on a * different line */ int Fromcu; /* Were called from cu or yam */ void from_cu() { struct stat a, b; fstat(1, &a); fstat(2, &b); Fromcu = a.st_rdev != b.st_rdev; return; } void cucheck() { if (Fromcu) fprintf(stderr,"Please read the manual page BUGS chapter!\r\n"); } struct { unsigned baudr; int speedcode; } speeds[] = { 110, B110, 300, B300, #ifdef B600 600, B600, #endif 1200, B1200, 2400, B2400, 4800, B4800, 9600, B9600, #ifdef EXTA 19200, EXTA, 38400, EXTB, #endif 0, }; int Twostop; /* Use two stop bits */ #ifndef READCHECK #ifdef FIONREAD #define READCHECK /* * Return non 0 iff something to read from io descriptor f */ int rdchk(f) { static long lf; ioctl(f, FIONREAD, &lf); return ((int) lf); } #endif #ifdef SV
#define READCHECK #include <fcntl.h>

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture