zmodem: K&R -> ANSI C function declaration
Change-Id: Id3dbd2e39563cb399da9ad86bdd0024676f9d728
This commit is contained in:
parent
3df19a0671
commit
38bb8cec91
6 changed files with 83 additions and 159 deletions
|
@ -126,8 +126,7 @@ static long cr3tab[] = { /* CRC polynomial 0xedb88320 */
|
||||||
|
|
||||||
#ifdef NFGM
|
#ifdef NFGM
|
||||||
long
|
long
|
||||||
UPDC32(b, c)
|
UPDC32(int b, long c)
|
||||||
long c;
|
|
||||||
{
|
{
|
||||||
return (cr3tab[((int)c ^ b) & 0xff] ^ ((c >> 8) & 0x00FFFFFF));
|
return (cr3tab[((int)c ^ b) & 0xff] ^ ((c >> 8) & 0x00FFFFFF));
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ int Twostop; /* Use two stop bits */
|
||||||
/*
|
/*
|
||||||
* Return non 0 iff something to read from io descriptor f
|
* Return non 0 iff something to read from io descriptor f
|
||||||
*/
|
*/
|
||||||
int rdchk(f)
|
int rdchk(int f)
|
||||||
{
|
{
|
||||||
static long lf;
|
static long lf;
|
||||||
|
|
||||||
|
@ -138,8 +138,7 @@ int rdchk(f)
|
||||||
|
|
||||||
|
|
||||||
static unsigned
|
static unsigned
|
||||||
getspeed(code)
|
getspeed(int code)
|
||||||
int code;
|
|
||||||
{
|
{
|
||||||
register int n;
|
register int n;
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,7 @@ extern int errno;
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <utime.h>
|
#include <utime.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
#define OK 0
|
#define OK 0
|
||||||
#define FALSE 0
|
#define FALSE 0
|
||||||
|
@ -125,6 +126,10 @@ void ackbibi(void);
|
||||||
void bttyout(int c );
|
void bttyout(int c );
|
||||||
int sys2(char *s );
|
int sys2(char *s );
|
||||||
void exec2(char *s );
|
void exec2(char *s );
|
||||||
|
/*
|
||||||
|
* Debugging information output interface routine
|
||||||
|
*/
|
||||||
|
void vfile(const char *s, ...);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Max value for HOWMANY is 255.
|
* Max value for HOWMANY is 255.
|
||||||
|
@ -242,8 +247,7 @@ int sig;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* called by signal interrupt or terminate to clean things up */
|
/* called by signal interrupt or terminate to clean things up */
|
||||||
void bibi(n)
|
void bibi(int n)
|
||||||
int n;
|
|
||||||
{
|
{
|
||||||
if (Zmodem)
|
if (Zmodem)
|
||||||
zmputs(Attn);
|
zmputs(Attn);
|
||||||
|
@ -253,9 +257,7 @@ int n;
|
||||||
exit(128+n);
|
exit(128+n);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(argc, argv)
|
int main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
register char *cp;
|
register char *cp;
|
||||||
register int npats;
|
register int npats;
|
||||||
|
@ -394,16 +396,14 @@ int usage()
|
||||||
fprintf(stderr, "\t\t\042The High Reliability Software\042\n");
|
fprintf(stderr, "\t\t\042The High Reliability Software\042\n");
|
||||||
exit(SS_NORMAL);
|
exit(SS_NORMAL);
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* Debugging information output interface routine
|
|
||||||
*/
|
|
||||||
/* VARARGS1 */
|
|
||||||
void vfile(f, a, b, c)
|
|
||||||
register char *f,*a,*b,*c;
|
|
||||||
|
|
||||||
|
void vfile(const char *string, ...)
|
||||||
{
|
{
|
||||||
if (Verbose > 2) {
|
if (Verbose > 2) {
|
||||||
fprintf(stderr, f, a, b, c);
|
va_list args;
|
||||||
|
va_start(args, string);
|
||||||
|
vfprintf(stderr, string, args);
|
||||||
|
va_end(args);
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -415,9 +415,7 @@ register char *f,*a,*b,*c;
|
||||||
char *rbmsg =
|
char *rbmsg =
|
||||||
"%s ready. To begin transfer, type \"%s file ...\" to your modem program\r\n\n";
|
"%s ready. To begin transfer, type \"%s file ...\" to your modem program\r\n\n";
|
||||||
|
|
||||||
int wcreceive(argc, argp)
|
int wcreceive(int argc, char **argp)
|
||||||
int argc;
|
|
||||||
char **argp;
|
|
||||||
{
|
{
|
||||||
register int c;
|
register int c;
|
||||||
|
|
||||||
|
@ -479,9 +477,10 @@ fubar:
|
||||||
* Fetch a pathname from the other end as a C ctyle ASCIZ string.
|
* Fetch a pathname from the other end as a C ctyle ASCIZ string.
|
||||||
* Length is indeterminate as long as less than Blklen
|
* Length is indeterminate as long as less than Blklen
|
||||||
* A null string represents no more files (YMODEM)
|
* A null string represents no more files (YMODEM)
|
||||||
|
*
|
||||||
|
* Parameter rpn is for receiving a pathname
|
||||||
*/
|
*/
|
||||||
int wcrxpn(rpn)
|
int wcrxpn(char *rpn)
|
||||||
char *rpn; /* receive a pathname */
|
|
||||||
{
|
{
|
||||||
register int c;
|
register int c;
|
||||||
|
|
||||||
|
@ -567,9 +566,7 @@ int wcrx()
|
||||||
* (Caller must do that when he is good and ready to get next sector)
|
* (Caller must do that when he is good and ready to get next sector)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int wcgetsec(rxbuf, maxtime)
|
int wcgetsec(char *rxbuf, int maxtime)
|
||||||
char *rxbuf;
|
|
||||||
int maxtime;
|
|
||||||
{
|
{
|
||||||
register int checksum, wcj, firstch;
|
register int checksum, wcj, firstch;
|
||||||
register unsigned short oldcrc;
|
register unsigned short oldcrc;
|
||||||
|
@ -668,8 +665,7 @@ humbug:
|
||||||
*
|
*
|
||||||
* timeout is in tenths of seconds
|
* timeout is in tenths of seconds
|
||||||
*/
|
*/
|
||||||
int readline(timeout)
|
int readline(int timeout)
|
||||||
int timeout;
|
|
||||||
{
|
{
|
||||||
register int n;
|
register int n;
|
||||||
static char *cdq; /* pointer for removing chars from linbuf */
|
static char *cdq; /* pointer for removing chars from linbuf */
|
||||||
|
@ -730,8 +726,7 @@ void purgeline()
|
||||||
/*
|
/*
|
||||||
* Process incoming file information header
|
* Process incoming file information header
|
||||||
*/
|
*/
|
||||||
int procheader(name)
|
int procheader(char *name)
|
||||||
char *name;
|
|
||||||
{
|
{
|
||||||
register char *openmode, *p;
|
register char *openmode, *p;
|
||||||
|
|
||||||
|
@ -846,8 +841,7 @@ char *name;
|
||||||
* it's because some required directory was not present, and if
|
* it's because some required directory was not present, and if
|
||||||
* so, create all required dirs.
|
* so, create all required dirs.
|
||||||
*/
|
*/
|
||||||
int make_dirs(pathname)
|
int make_dirs(char *pathname)
|
||||||
register char *pathname;
|
|
||||||
{
|
{
|
||||||
register char *p; /* Points into path */
|
register char *p; /* Points into path */
|
||||||
int madeone = 0; /* Did we do anything yet? */
|
int madeone = 0; /* Did we do anything yet? */
|
||||||
|
@ -890,9 +884,7 @@ register char *pathname;
|
||||||
/*
|
/*
|
||||||
* Make a directory. Compatible with the mkdir() system call on 4.2BSD.
|
* Make a directory. Compatible with the mkdir() system call on 4.2BSD.
|
||||||
*/
|
*/
|
||||||
int makedir(dpath, dmode)
|
int makedir(char *dpath, int dmode)
|
||||||
char *dpath;
|
|
||||||
int dmode;
|
|
||||||
{
|
{
|
||||||
int cpid, status;
|
int cpid, status;
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
|
@ -941,9 +933,7 @@ int dmode;
|
||||||
* If not in binary mode, carriage returns, and all characters
|
* If not in binary mode, carriage returns, and all characters
|
||||||
* starting with CPMEOF are discarded.
|
* starting with CPMEOF are discarded.
|
||||||
*/
|
*/
|
||||||
int putsec(buf, n)
|
int putsec(char *buf, int n)
|
||||||
char *buf;
|
|
||||||
register int n;
|
|
||||||
{
|
{
|
||||||
register char *p;
|
register char *p;
|
||||||
|
|
||||||
|
@ -972,8 +962,7 @@ register int n;
|
||||||
/*
|
/*
|
||||||
* Send a character to modem. Small is beautiful.
|
* Send a character to modem. Small is beautiful.
|
||||||
*/
|
*/
|
||||||
void sendline(c)
|
void sendline(int c)
|
||||||
int c;
|
|
||||||
{
|
{
|
||||||
char d;
|
char d;
|
||||||
|
|
||||||
|
@ -991,8 +980,7 @@ void flushmo() {}
|
||||||
|
|
||||||
|
|
||||||
/* make string s lower case */
|
/* make string s lower case */
|
||||||
void uncaps(s)
|
void uncaps(char *s)
|
||||||
register char *s;
|
|
||||||
{
|
{
|
||||||
for ( ; *s; ++s)
|
for ( ; *s; ++s)
|
||||||
if (isupper(*s))
|
if (isupper(*s))
|
||||||
|
@ -1001,8 +989,7 @@ register char *s;
|
||||||
/*
|
/*
|
||||||
* IsAnyLower returns TRUE if string s has lower case letters.
|
* IsAnyLower returns TRUE if string s has lower case letters.
|
||||||
*/
|
*/
|
||||||
int IsAnyLower(s)
|
int IsAnyLower(char *s)
|
||||||
register char *s;
|
|
||||||
{
|
{
|
||||||
for ( ; *s; ++s)
|
for ( ; *s; ++s)
|
||||||
if (islower(*s))
|
if (islower(*s))
|
||||||
|
@ -1015,8 +1002,7 @@ register char *s;
|
||||||
* returns pointer to token within string if found, NULL otherwise
|
* returns pointer to token within string if found, NULL otherwise
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
substr(s, t)
|
substr(char *s, char *t)
|
||||||
register char *s,*t;
|
|
||||||
{
|
{
|
||||||
register char *ss,*tt;
|
register char *ss,*tt;
|
||||||
/* search for first char of token */
|
/* search for first char of token */
|
||||||
|
@ -1036,8 +1022,7 @@ register char *s,*t;
|
||||||
* Log an error
|
* Log an error
|
||||||
*/
|
*/
|
||||||
/*VARARGS1*/
|
/*VARARGS1*/
|
||||||
void zperr(s,p,u)
|
void zperr(char *s, char *p, char *u)
|
||||||
char *s, *p, *u;
|
|
||||||
{
|
{
|
||||||
if (Verbose <= 0)
|
if (Verbose <= 0)
|
||||||
return;
|
return;
|
||||||
|
@ -1064,8 +1049,7 @@ void canit()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void report(sct)
|
void report(int sct)
|
||||||
int sct;
|
|
||||||
{
|
{
|
||||||
if (Verbose>1)
|
if (Verbose>1)
|
||||||
fprintf(stderr,"%03d%c",sct,sct%10? ' ' : '\r');
|
fprintf(stderr,"%03d%c",sct,sct%10? ' ' : '\r');
|
||||||
|
@ -1077,8 +1061,7 @@ int sct;
|
||||||
* If called as [-][dir/../]rzCOMMAND set the pipe flag
|
* If called as [-][dir/../]rzCOMMAND set the pipe flag
|
||||||
* If called as rb use YMODEM protocol
|
* If called as rb use YMODEM protocol
|
||||||
*/
|
*/
|
||||||
void chkinvok(s)
|
void chkinvok(char *s)
|
||||||
char *s;
|
|
||||||
{
|
{
|
||||||
register char *p;
|
register char *p;
|
||||||
|
|
||||||
|
@ -1106,8 +1089,7 @@ char *s;
|
||||||
/*
|
/*
|
||||||
* Totalitarian Communist pathname processing
|
* Totalitarian Communist pathname processing
|
||||||
*/
|
*/
|
||||||
void checkpath(name)
|
void checkpath(char *name)
|
||||||
char *name;
|
|
||||||
{
|
{
|
||||||
if (Restricted) {
|
if (Restricted) {
|
||||||
if (fopen(name, "r") != NULL) {
|
if (fopen(name, "r") != NULL) {
|
||||||
|
@ -1436,8 +1418,7 @@ moredata:
|
||||||
* Send a string to the modem, processing for \336 (sleep 1 sec)
|
* Send a string to the modem, processing for \336 (sleep 1 sec)
|
||||||
* and \335 (break signal)
|
* and \335 (break signal)
|
||||||
*/
|
*/
|
||||||
void zmputs(s)
|
void zmputs(char *s)
|
||||||
char *s;
|
|
||||||
{
|
{
|
||||||
register int c;
|
register int c;
|
||||||
|
|
||||||
|
@ -1516,8 +1497,7 @@ void ackbibi()
|
||||||
/*
|
/*
|
||||||
* Local console output simulation
|
* Local console output simulation
|
||||||
*/
|
*/
|
||||||
void bttyout(c)
|
void bttyout(int c)
|
||||||
int c;
|
|
||||||
{
|
{
|
||||||
if (Verbose || Fromcu)
|
if (Verbose || Fromcu)
|
||||||
putc(c, stderr);
|
putc(c, stderr);
|
||||||
|
@ -1527,8 +1507,7 @@ int c;
|
||||||
/*
|
/*
|
||||||
* Strip leading ! if present, do shell escape.
|
* Strip leading ! if present, do shell escape.
|
||||||
*/
|
*/
|
||||||
int sys2(s)
|
int sys2(char *s)
|
||||||
register char *s;
|
|
||||||
{
|
{
|
||||||
if (*s == '!')
|
if (*s == '!')
|
||||||
++s;
|
++s;
|
||||||
|
@ -1537,8 +1516,7 @@ register char *s;
|
||||||
/*
|
/*
|
||||||
* Strip leading ! if present, do exec.
|
* Strip leading ! if present, do exec.
|
||||||
*/
|
*/
|
||||||
void exec2(s)
|
void exec2(char *s)
|
||||||
register char *s;
|
|
||||||
{
|
{
|
||||||
if (*s == '!')
|
if (*s == '!')
|
||||||
++s;
|
++s;
|
||||||
|
|
|
@ -95,6 +95,7 @@ extern int errno;
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <utime.h>
|
#include <utime.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
#define PATHLEN 256
|
#define PATHLEN 256
|
||||||
#define OK 0
|
#define OK 0
|
||||||
|
@ -252,8 +253,7 @@ void countem(int argc , char **argv );
|
||||||
void chartest(int m );
|
void chartest(int m );
|
||||||
|
|
||||||
/* called by signal interrupt or terminate to clean things up */
|
/* called by signal interrupt or terminate to clean things up */
|
||||||
void bibi(n)
|
void bibi(int n)
|
||||||
int n;
|
|
||||||
{
|
{
|
||||||
canit(); fflush(stdout); mode(0);
|
canit(); fflush(stdout); mode(0);
|
||||||
fprintf(stderr, "sz: caught signal %d; exiting\n", n);
|
fprintf(stderr, "sz: caught signal %d; exiting\n", n);
|
||||||
|
@ -265,8 +265,7 @@ int n;
|
||||||
exit(128+n);
|
exit(128+n);
|
||||||
}
|
}
|
||||||
/* Called when ZMODEM gets an interrupt (^X) */
|
/* Called when ZMODEM gets an interrupt (^X) */
|
||||||
void onintr(sig)
|
void onintr(int sig)
|
||||||
int sig;
|
|
||||||
{
|
{
|
||||||
signal(SIGINT, SIG_IGN);
|
signal(SIGINT, SIG_IGN);
|
||||||
longjmp(intrjmp, -1);
|
longjmp(intrjmp, -1);
|
||||||
|
@ -279,9 +278,7 @@ int Zrwindow = 1400; /* RX window size (controls garbage count) */
|
||||||
#include "zm.c"
|
#include "zm.c"
|
||||||
|
|
||||||
|
|
||||||
int main(argc, argv)
|
int main(int argc, char *argv[])
|
||||||
int argc;
|
|
||||||
char *argv[];
|
|
||||||
{
|
{
|
||||||
register char *cp;
|
register char *cp;
|
||||||
register int npats;
|
register int npats;
|
||||||
|
@ -490,9 +487,7 @@ char *argv[];
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
}
|
}
|
||||||
|
|
||||||
int wcsend(argc, argp)
|
int wcsend(int argc, char *argp[])
|
||||||
int argc;
|
|
||||||
char *argp[];
|
|
||||||
{
|
{
|
||||||
register int n;
|
register int n;
|
||||||
|
|
||||||
|
@ -530,8 +525,7 @@ char *argp[];
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wcs(oname)
|
int wcs(char *oname)
|
||||||
char *oname;
|
|
||||||
{
|
{
|
||||||
register int c;
|
register int c;
|
||||||
register char *p;
|
register char *p;
|
||||||
|
@ -593,8 +587,7 @@ char *oname;
|
||||||
* as provided by the Unix fstat call.
|
* as provided by the Unix fstat call.
|
||||||
* N.B.: modifies the passed name, may extend it!
|
* N.B.: modifies the passed name, may extend it!
|
||||||
*/
|
*/
|
||||||
int wctxpn(name)
|
int wctxpn(char *name)
|
||||||
char *name;
|
|
||||||
{
|
{
|
||||||
register char *p, *q;
|
register char *p, *q;
|
||||||
char name2[PATHLEN];
|
char name2[PATHLEN];
|
||||||
|
@ -695,8 +688,7 @@ int getnak()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int wctx(flen)
|
int wctx(long flen)
|
||||||
long flen;
|
|
||||||
{
|
{
|
||||||
register int thisblklen;
|
register int thisblklen;
|
||||||
register int sectnum, attempts, firstch;
|
register int sectnum, attempts, firstch;
|
||||||
|
@ -742,11 +734,10 @@ long flen;
|
||||||
else
|
else
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
int wcputsec(buf, sectnum, cseclen)
|
* @param cseclen :data length of this sector to send
|
||||||
char *buf;
|
*/
|
||||||
int sectnum;
|
int wcputsec(char *buf, int sectnum, int cseclen)
|
||||||
int cseclen; /* data length of this sector to send */
|
|
||||||
{
|
{
|
||||||
register int checksum, wcj;
|
register int checksum, wcj;
|
||||||
register char *cp;
|
register char *cp;
|
||||||
|
@ -822,9 +813,7 @@ cancan:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fill buf with count chars padding with ^Z for CPM */
|
/* fill buf with count chars padding with ^Z for CPM */
|
||||||
int filbuf(buf, count)
|
int filbuf(char *buf, int count)
|
||||||
register char *buf;
|
|
||||||
int count;
|
|
||||||
{
|
{
|
||||||
register int c, m;
|
register int c, m;
|
||||||
|
|
||||||
|
@ -888,9 +877,7 @@ int zfilbuf()
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TXBSIZE
|
#ifdef TXBSIZE
|
||||||
int fooseek(fptr, pos, whence)
|
int fooseek(FILE *fptr, long pos, int whence)
|
||||||
FILE *fptr;
|
|
||||||
long pos;
|
|
||||||
{
|
{
|
||||||
int m, n;
|
int m, n;
|
||||||
|
|
||||||
|
@ -947,20 +934,19 @@ long pos;
|
||||||
#define fseek fooseek
|
#define fseek fooseek
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void vfile(const char *string, ...)
|
||||||
/* VARARGS1 */
|
|
||||||
void vfile(f, a, b, c)
|
|
||||||
register char *f,*a,*b,*c;
|
|
||||||
{
|
{
|
||||||
if (Verbose > 2) {
|
if (Verbose > 2) {
|
||||||
fprintf(stderr, f, a, b, c);
|
va_list args;
|
||||||
|
va_start(args, string);
|
||||||
|
vfprintf(stderr, string, args);
|
||||||
|
va_end(args);
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void alrm(sig)
|
void alrm(int sig)
|
||||||
int sig;
|
|
||||||
{
|
{
|
||||||
longjmp(tohere, -1);
|
longjmp(tohere, -1);
|
||||||
}
|
}
|
||||||
|
@ -971,8 +957,7 @@ int sig;
|
||||||
* readline(timeout) reads character(s) from file descriptor 0
|
* readline(timeout) reads character(s) from file descriptor 0
|
||||||
* timeout is in tenths of seconds
|
* timeout is in tenths of seconds
|
||||||
*/
|
*/
|
||||||
int readline(timeout)
|
int readline(int timeout)
|
||||||
int timeout;
|
|
||||||
{
|
{
|
||||||
register int c;
|
register int c;
|
||||||
static char byt[1];
|
static char byt[1];
|
||||||
|
@ -1035,8 +1020,7 @@ void canit()
|
||||||
* Log an error
|
* Log an error
|
||||||
*/
|
*/
|
||||||
/*VARARGS1*/
|
/*VARARGS1*/
|
||||||
void zperr(s,p,u)
|
void zperr(char *s, char *p, char *u)
|
||||||
char *s, *p, *u;
|
|
||||||
{
|
{
|
||||||
if (Verbose <= 0)
|
if (Verbose <= 0)
|
||||||
return;
|
return;
|
||||||
|
@ -1050,8 +1034,7 @@ char *s, *p, *u;
|
||||||
* returns pointer to token within string if found, NULL otherwise
|
* returns pointer to token within string if found, NULL otherwise
|
||||||
*/
|
*/
|
||||||
char *
|
char *
|
||||||
substr(s, t)
|
substr(char *s, char *t)
|
||||||
register char *s,*t;
|
|
||||||
{
|
{
|
||||||
register char *ss,*tt;
|
register char *ss,*tt;
|
||||||
/* search for first char of token */
|
/* search for first char of token */
|
||||||
|
@ -1266,9 +1249,7 @@ int sendzsinit()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send file name and related info */
|
/* Send file name and related info */
|
||||||
int zsendfile(buf, blen)
|
int zsendfile(char *buf, int blen)
|
||||||
char *buf;
|
|
||||||
int blen;
|
|
||||||
{
|
{
|
||||||
register int c;
|
register int c;
|
||||||
register UNSL long crc;
|
register UNSL long crc;
|
||||||
|
@ -1530,8 +1511,7 @@ gotack:
|
||||||
/*
|
/*
|
||||||
* Respond to receiver's complaint, get back in sync with receiver
|
* Respond to receiver's complaint, get back in sync with receiver
|
||||||
*/
|
*/
|
||||||
int getinsync(flag)
|
int getinsync(int flag)
|
||||||
int flag;
|
|
||||||
{
|
{
|
||||||
register int c;
|
register int c;
|
||||||
|
|
||||||
|
@ -1599,17 +1579,14 @@ void saybibi()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Local screen character display function */
|
/* Local screen character display function */
|
||||||
void bttyout(c)
|
void bttyout(int c)
|
||||||
int c;
|
|
||||||
{
|
{
|
||||||
if (Verbose)
|
if (Verbose)
|
||||||
putc(c, stderr);
|
putc(c, stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send command and related info */
|
/* Send command and related info */
|
||||||
int zsendcmd(buf, blen)
|
int zsendcmd(char *buf, int blen)
|
||||||
char *buf;
|
|
||||||
int blen;
|
|
||||||
{
|
{
|
||||||
register int c;
|
register int c;
|
||||||
long cmdnum;
|
long cmdnum;
|
||||||
|
@ -1663,8 +1640,7 @@ listen:
|
||||||
/*
|
/*
|
||||||
* If called as sb use YMODEM protocol
|
* If called as sb use YMODEM protocol
|
||||||
*/
|
*/
|
||||||
void chkinvok(s)
|
void chkinvok(char *s)
|
||||||
char *s;
|
|
||||||
{
|
{
|
||||||
#ifdef vax11c
|
#ifdef vax11c
|
||||||
Progname = "sz";
|
Progname = "sz";
|
||||||
|
@ -1690,9 +1666,7 @@ char *s;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void countem(argc, argv)
|
void countem(int argc, char **argv)
|
||||||
int argc;
|
|
||||||
register char **argv;
|
|
||||||
{
|
{
|
||||||
register int c;
|
register int c;
|
||||||
struct stat f;
|
struct stat f;
|
||||||
|
@ -1717,8 +1691,7 @@ register char **argv;
|
||||||
Filesleft, Totalleft);
|
Filesleft, Totalleft);
|
||||||
}
|
}
|
||||||
|
|
||||||
void chartest(m)
|
void chartest(int m)
|
||||||
int m;
|
|
||||||
{
|
{
|
||||||
register int n;
|
register int n;
|
||||||
|
|
||||||
|
|
|
@ -73,9 +73,7 @@ static char *frametypes[] = {
|
||||||
static char badcrc[] = "Bad CRC";
|
static char badcrc[] = "Bad CRC";
|
||||||
|
|
||||||
/* Send ZMODEM binary header hdr of type type */
|
/* Send ZMODEM binary header hdr of type type */
|
||||||
void zsbhdr(type, hdr)
|
void zsbhdr(int type, char *hdr)
|
||||||
int type;
|
|
||||||
register char *hdr;
|
|
||||||
{
|
{
|
||||||
register int n;
|
register int n;
|
||||||
register unsigned short crc;
|
register unsigned short crc;
|
||||||
|
@ -106,9 +104,7 @@ register char *hdr;
|
||||||
|
|
||||||
|
|
||||||
/* Send ZMODEM binary header hdr of type type */
|
/* Send ZMODEM binary header hdr of type type */
|
||||||
void zsbh32(hdr, type)
|
void zsbh32(char *hdr, int type)
|
||||||
register char *hdr;
|
|
||||||
int type;
|
|
||||||
{
|
{
|
||||||
register int n;
|
register int n;
|
||||||
register UNSL long crc;
|
register UNSL long crc;
|
||||||
|
@ -128,9 +124,7 @@ int type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send ZMODEM HEX header hdr of type type */
|
/* Send ZMODEM HEX header hdr of type type */
|
||||||
void zshhdr(type, hdr)
|
void zshhdr(int type, char *hdr)
|
||||||
int type;
|
|
||||||
register char *hdr;
|
|
||||||
{
|
{
|
||||||
register int n;
|
register int n;
|
||||||
register unsigned short crc;
|
register unsigned short crc;
|
||||||
|
@ -162,10 +156,7 @@ register char *hdr;
|
||||||
*/
|
*/
|
||||||
static char *Zendnames[] = { "ZCRCE", "ZCRCG", "ZCRCQ", "ZCRCW"};
|
static char *Zendnames[] = { "ZCRCE", "ZCRCG", "ZCRCQ", "ZCRCW"};
|
||||||
|
|
||||||
void zsdata(buf, length, frameend)
|
void zsdata(char *buf, int length, int frameend)
|
||||||
register char *buf;
|
|
||||||
int length;
|
|
||||||
int frameend;
|
|
||||||
{
|
{
|
||||||
register unsigned short crc;
|
register unsigned short crc;
|
||||||
|
|
||||||
|
@ -188,10 +179,7 @@ int frameend;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void zsda32(buf, length, frameend)
|
void zsda32(char *buf, int length, int frameend)
|
||||||
register char *buf;
|
|
||||||
int length;
|
|
||||||
int frameend;
|
|
||||||
{
|
{
|
||||||
register int c;
|
register int c;
|
||||||
register UNSL long crc;
|
register UNSL long crc;
|
||||||
|
@ -219,9 +207,7 @@ int frameend;
|
||||||
* and CRC. Returns the ending character or error code.
|
* and CRC. Returns the ending character or error code.
|
||||||
* NB: On errors may store length+1 bytes!
|
* NB: On errors may store length+1 bytes!
|
||||||
*/
|
*/
|
||||||
int zrdata(buf, length)
|
int zrdata(char *buf, int length)
|
||||||
register char *buf;
|
|
||||||
int length;
|
|
||||||
{
|
{
|
||||||
register int c;
|
register int c;
|
||||||
register unsigned short crc;
|
register unsigned short crc;
|
||||||
|
@ -273,9 +259,7 @@ crcfoo:
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
int zrdat32(buf, length)
|
int zrdat32(char *buf, int length)
|
||||||
register char *buf;
|
|
||||||
int length;
|
|
||||||
{
|
{
|
||||||
register int c;
|
register int c;
|
||||||
register UNSL long crc;
|
register UNSL long crc;
|
||||||
|
@ -342,9 +326,7 @@ crcfoo:
|
||||||
* Otherwise return negative on error.
|
* Otherwise return negative on error.
|
||||||
* Return ERROR instantly if ZCRCW sequence, for fast error recovery.
|
* Return ERROR instantly if ZCRCW sequence, for fast error recovery.
|
||||||
*/
|
*/
|
||||||
int zgethdr(hdr, eflag)
|
int zgethdr(char *hdr, int eflag)
|
||||||
char *hdr;
|
|
||||||
int eflag;
|
|
||||||
{
|
{
|
||||||
register int c, n, cancount;
|
register int c, n, cancount;
|
||||||
|
|
||||||
|
@ -461,8 +443,7 @@ fifi:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Receive a binary style header (type and position) */
|
/* Receive a binary style header (type and position) */
|
||||||
int zrbhdr(hdr)
|
int zrbhdr(char *hdr)
|
||||||
register char *hdr;
|
|
||||||
{
|
{
|
||||||
register int c, n;
|
register int c, n;
|
||||||
register unsigned short crc;
|
register unsigned short crc;
|
||||||
|
@ -496,8 +477,7 @@ register char *hdr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Receive a binary style header (type and position) with 32 bit FCS */
|
/* Receive a binary style header (type and position) with 32 bit FCS */
|
||||||
int zrbhdr32(hdr)
|
int zrbhdr32(char *hdr)
|
||||||
register char *hdr;
|
|
||||||
{
|
{
|
||||||
register int c, n;
|
register int c, n;
|
||||||
register UNSL long crc;
|
register UNSL long crc;
|
||||||
|
@ -540,8 +520,7 @@ register char *hdr;
|
||||||
|
|
||||||
|
|
||||||
/* Receive a hex style header (type and position) */
|
/* Receive a hex style header (type and position) */
|
||||||
int zrhhdr(hdr)
|
int zrhhdr(char *hdr)
|
||||||
char *hdr;
|
|
||||||
{
|
{
|
||||||
register int c;
|
register int c;
|
||||||
register unsigned short crc;
|
register unsigned short crc;
|
||||||
|
@ -585,8 +564,7 @@ char *hdr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send a byte as two hex digits */
|
/* Send a byte as two hex digits */
|
||||||
void zputhex(c)
|
void zputhex(int c)
|
||||||
register int c;
|
|
||||||
{
|
{
|
||||||
static char digits[] = "0123456789abcdef";
|
static char digits[] = "0123456789abcdef";
|
||||||
|
|
||||||
|
@ -600,8 +578,7 @@ register int c;
|
||||||
* Send character c with ZMODEM escape sequence encoding.
|
* Send character c with ZMODEM escape sequence encoding.
|
||||||
* Escape XON, XOFF. Escape CR following @ (Telenet net escape)
|
* Escape XON, XOFF. Escape CR following @ (Telenet net escape)
|
||||||
*/
|
*/
|
||||||
void zsendline(c)
|
void zsendline(int c)
|
||||||
int c;
|
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Quick check for non control characters */
|
/* Quick check for non control characters */
|
||||||
|
@ -763,8 +740,7 @@ int noxrd7()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Store long integer pos in Txhdr */
|
/* Store long integer pos in Txhdr */
|
||||||
void stohdr(pos)
|
void stohdr(long pos)
|
||||||
long pos;
|
|
||||||
{
|
{
|
||||||
Txhdr[ZP0] = pos;
|
Txhdr[ZP0] = pos;
|
||||||
Txhdr[ZP1] = pos>>8;
|
Txhdr[ZP1] = pos>>8;
|
||||||
|
@ -774,8 +750,7 @@ long pos;
|
||||||
|
|
||||||
/* Recover a long integer from a header */
|
/* Recover a long integer from a header */
|
||||||
long
|
long
|
||||||
rclhdr(hdr)
|
rclhdr(char *hdr)
|
||||||
register char *hdr;
|
|
||||||
{
|
{
|
||||||
register long l;
|
register long l;
|
||||||
|
|
||||||
|
|
|
@ -155,7 +155,7 @@ long rclhdr(char *hdr );
|
||||||
|
|
||||||
/* rz.c sz.c */
|
/* rz.c sz.c */
|
||||||
|
|
||||||
void vfile();
|
void vfile(const char *s, ...);
|
||||||
void bibi(int n );
|
void bibi(int n );
|
||||||
|
|
||||||
/* End of ZMODEM.H */
|
/* End of ZMODEM.H */
|
||||||
|
|
Loading…
Reference in a new issue