koreth@ssyx.ucsc.edu (Steven Grimm) (03/03/89)
Submitted-by: sun.com!laidbak!katzung (Brian Katzung) Posting-number: Volume 2, Issue 19 Archive-name: uw/part01 **** Client-Side Information **** UW (Unix (tm) Windows) ST A Windowing Terminal Emulator for the Atari ST This program was written by Hans-Martin Mosner at the University of Dortmund in West Germany. It has since been enhanced by Brad Bosch and Brian Katzung at Lachman Associates, Inc., in Naperville, Illinois. We have added quite a lot, including o keyboard and mouse locking, o simple text capture, o kermit file transfer in a uw window, o subprocess execution, o function-key support, o RS232 configuration, o additional fonts, and o printer support. Limitations: o only supports monochrome systems o only supports adm31 emulation (but the emulation has been "enhanced"--see README) o only supports the minimum UW protocol We have spent a great deal of effort trying to work out or around bugs in GEM, HMM's code, and our code, but I'm sure some have succeeded in eluding us even though this code has been in use at Lachman Associates for over a year. **** Server Information **** The latest Unix(tm)-side server that we know of is version 4.1.2. The author and contact person is: John D. Bruner ARPANET/MILNET: jdb@s1-c.ARPA UUCP: {seismo,ut-sally,dual,lll-crg}!mordor!jdb -- Brian Katzung ...!laidbak!katzung Brad Bosch ...!laidbak!brad Lachman Associates, Inc. 1901 North Naper Blvd. Naperville, IL 60540 (312) 505-9100 [This contains the source code, as well as a uuencoded arcfile with resources, fonts, and so on. The binaries are being posted to the binaries group. -sg] #!/bin/sh # shar: Shell Archiver (v1.22) # # This is part 1 of a multipart archive # do not concatenate these parts, unpack them in order with /bin/sh # # Run the following text with /bin/sh to create: # BINARC.UUE # BLDMFORM.C # KERMIT.C # LASTCHG # LCKBLK1.ICN # MAKE.BAT # MAKEFILE # MFORM.C # README # RESETAUX.S # RMBBLK1.ICN # STARTGEM.S # UW.H # VERSION # WIN-.CNF # WIN.CNF # WIND.H # WINDEFS.H # WINHASH.C # WINIO.C # WINMAIN.C # WINPROC.C # WINPROTO.C # WINSUBR.C # if test -r s2_seq_.tmp then echo "Must unpack archives in sequence!" next=`cat s2_seq_.tmp`; echo "Please unpack part $next next" exit 1; fi sed 's/^X//' << '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>X%Z)R1*/GI'BW9(-FL2 XM#%(=.]2C,Q7F%V"#'<"!53!996R`#"U@:I@#B$;1ITV1P0\F;\*`!"'=`AH( XM5TE.1%1.62Y&3E0``)L!``!T"Z!&6QD`"```#``@02`0\,&!@/\"P@,"B2"0 XM@`M`@0KH`!0XBQ,A*0`"#A@8<`\A+0`$`@C)@`K`@`$""Q(`,"B!F`S8P&3# XMD!M!W(3($61`!AQ#/@!1$B*X@!)4HB0J$Q"@F*!V:@0"C.&`HU-!E02$50&X XMDB!`X00!QB)1E.```0N+TR0PB3B_EIRI\2(0B5WO@@)35.1#`"&!`J:[8"L0 XM$$8!8&T`Z##=C5H?QL7(->;%BQD5O'T+"AA4IV)1OFWHN:Y:IUW3`@,$:<!G XMNRCQ1G5=ER&!KCH)A-8H$1AGE*P+=+5XL?52XJ">UHUZ&ZU%UK0AMP8'<WE' XMB2C!-`Y;VBO#`K$A%:BN@+E/WM,OQA:K=[UMM',K:UQ-&GCCPX@U\FU(/FC# XM@O#$=!A%:UU$'G27\93<;@KH=)5%"J;57W*K*9?27FP!U]IO4P'VGT:($<4@ XM:+YE5E5#6#&`448,J(4=)$#!!=%F3D%4%E_YJ5BAC=MU)Q-(0%2G8FM"SA:8 XC;#^QEU%$.`8&DGP;W==83,99%5`"CCGV$Q0L@@.)`2@!&@!( X` Xend SHAR_EOF chmod 0600 BINARC.UUE || echo "restore of BINARC.UUE fails" sed 's/^X//' << 'SHAR_EOF' > BLDMFORM.C && X#include <stdio.h> X Xmain (ac, av) Xchar **av; X{ X char **ap, *cp; X int xhot, yhot, nplanes; X int maskcolor, datacolor; X char *datafn, *maskfn; X char *name; X short gemfmt = 0; X short rename = 0; X X if (ac < 2) X { X printf("usage: -xypMDmdnG xhot yhot planes mcolor dcolor\n"); X printf("\t\tmaskfn datafn mformname\n"); X printf("or: -dnR datafn newmformname\n"); X exit(0); X } X X xhot = 0; X yhot = 0; X nplanes = 1; X maskcolor = 0; X datacolor = 1; X maskfn = (char *) 0; X datafn = (char *) 0; X name = "mform"; X X for (ap = av + 1; *ap && **ap == '-'; ) X for (cp = *ap++ + 1; *cp; ++cp) X switch (*cp) X { X case 'x': X xhot = atoi(*ap++); X break; X case 'y': X yhot = atoi(*ap++); X break; X case 'p': X nplanes = atoi(*ap++); X break; X case 'M': X maskcolor = atoi(*ap++); X break; X case 'D': X datacolor = atoi(*ap++); X break; X case 'm': X maskfn = *ap++; X break; X case 'd': X datafn = *ap++; X break; X case 'n': X name = *ap++; X break; X case 'G': X ++gemfmt; X break; X case 'R': X ++rename; X break; X } X X if (rename) X chgname(datafn, name); X X if (gemfmt) X { X printf("/* GEM Icon Definition: */\n"); X printf("#define %s_W 0x0010\n", name); X printf("#define %s_H 0x0028\n", name); X printf("#define %sSIZE 0x0028\n", name); X printf("short %s[%sSIZE] =\n{ ", name, name); X hexw(5, xhot, yhot, nplanes, maskcolor, datacolor); X } X else X { X printf("#ifndef USER_DEF\n#include <gemdefs.h>\n#endif\n"); X printf("MFORM\t%s[1] = {\n\t%d,\t%d,\t%d,\t%d,\t%d,\n", X name, xhot, yhot, nplanes, maskcolor, datacolor); X } X X domask(maskfn, gemfmt); X if (!gemfmt) X fputs("\t },\n", stdout); X domask(datafn, gemfmt); X X if (gemfmt) X fputs("0x0000, 0x0000, 0x0000", stdout); X else X fputs("\t }", stdout); X fputs("\n};\n\n", stdout); X exit(0); X} X Xdomask (fn, gemfmt) Xchar *fn; X{ X char line[80]; X int h0, h1, h2, h3; X FILE *fd; X X if (fd = fopen(fn, "r")) X { X *line = '\0'; X while (fgets(line, sizeof(line), fd) && *line != '{'); X if (*line == '{') X { X do X if (gemfmt) X { X sscanf(line + 1, X " 0x%x, 0x%x, 0x%x, 0x%x", X &h0, &h1, &h2, &h3); X hexw(4, h0, h1, h2, h3); X } X else X printf("\t %s", line); X while (fgets(line, sizeof(line), fd) && *line != '}'); X } X fclose(fd); X } X} X Xhexw (count, h0) X{ X int *ap; X static int col; X X for (ap = &h0; --count >= 0; ) X printf("0x%04x,%s", *ap++, (++col % 4)? " ": "\n "); X} X Xchgname (datafn, name) Xchar *datafn, *name; X{ X FILE *fd; X char line[80]; X register char *cp; X X if (fd = fopen(datafn, "r")) X { X while (fgets(line, sizeof(line), fd) != NULL && X strncmp(line, "short", 5)) X fputs(line, stdout); X printf("short %s", name); X for (cp = line; *cp && *cp != '['; ++cp); X fputs(cp, stdout); X while (fgets(line, sizeof(line), fd) != NULL) X fputs(line, stdout); X fclose(fd); X } X X exit(0); X} SHAR_EOF chmod 0600 BLDMFORM.C || echo "restore of BLDMFORM.C fails" sed 's/^X//' << 'SHAR_EOF' > KERMIT.C && X#define EXTRADEBUG X/* X * K e r m i t File Transfer Utility seriously hacked for local use with uw X * X * Currently allows only one kermit session to exist in one window concurent. X * X * Adapted from UNIX Kermit, Columbia University, 1981, 1982, 1983 X * Bill Catchings, Bob Cattani, Chris Maio, Frank da Cruz, Alan Crosswell X * X * Also: Jim Guyton, Rand Corporation X * Walter Underwood, Ford Aerospace X * X */ X X/* X * March 28, 1988 X * Hacked into form usable in uw. Converted fsm's to be driven X * by received packet events. Rewrote rpack routine. X */ X X#include <obdefs.h> X#include <gemdefs.h> X#include <osbind.h> X#include <stdio.h> /* Standard UNIX definitions */ X#include <time.h> X#include "wind.h" X#include "windefs.h" X X#define error printmsg X#define chari int /* items of type chari should be char, but, mwc X insists on adjusting them to int anyway */ X/* Symbol Definitions */ X X#define MAXPACKSIZ 94 /* Maximum packet size */ X#define SOH 1 /* Start of header */ X#define CR 13 /* ASCII Carriage Return */ X#define SP 32 /* ASCII space */ X#define DEL 127 /* Delete (rubout) */ X X#define MAXTRY 10 /* Times to retry a packet */ X#define MYQUOTE '#' /* Quote character I will use */ X#define MYPAD 0 /* Number of padding characters I will need */ X#define MYPCHAR 0 /* Padding character I need (NULL) */ X X#define MYEOL '\r' /* End-Of-Line character I need */ X X#define MYTIME 10 /* Seconds after which I should be timed out */ X#define MAXTIM 60 /* Maximum timeout interval */ X#define MINTIM 10 /* Minumum timeout interval */ X X#ifndef TRUE X#define TRUE -1 /* Boolean constants */ X#endif X#define FALSE 0 X#define GETPACK 2 /* return constant */ X X/* Macro Definitions */ X X/* X * f l u s h i n p u t X * X * Dump all pending input to clear stacked up NACK's. X */ X X#define flushinput() /* no explicit call to flush needed for uw */ X X/* X * tochar: converts a control character to a printable one by adding a space. X * X * unchar: undoes tochar. X * X * ctl: converts between control characters and printable characters by X * toggling the control bit (ie. ^A becomes A and A becomes ^A). X */ X#define tochar(ch) ((ch) + ' ') X#define unchar(ch) ((ch) - ' ') X#define ctl(ch) ((ch) ^ 64 ) X#define abs(exp) (((exp) >= 0) ? (exp) : -(exp)) X X X/* Global Variables */ X Xextern int mouse; /* is mouse visible ? */ Xextern struct wi_str w[]; X Xint size, /* Size of present data */ X rpsiz, /* Maximum receive packet size */ X spsiz, /* Maximum send packet size */ X pad, /* How much padding to send */ X reqtimint, /* timeout interval I request */ X timint, /* Timeout for foreign host on sends */ X n, /* Packet number */ X numtry, /* Times this packet retried */ X oldtry, /* Times previous packet retried */ X image, /* -1 means 8-bit mode */ X debug, /* indicates level of debugging output (0=none) */ X filnamcnv, /* -1 means do file name case conversions */ X filecount, /* Number of files left to send */ X kermwdes, /* Window descripter for kermit window */ X kermport; /* port number for kermit window */ X Xclock_t timestamp; /* Time last packet was received */ X Xchar sflg, rflg; /* flags for RECEIVE, SEND */ Xchar state, /* Present state of the automaton */ X padchar, /* Padding character to send */ X eol, /* End-Of-Line character to send */ X quote, /* Quote character in incoming data */ X **filelist, /* List of files to be sent */ X *filnam, /* Current file name */ X recpkt[MAXPACKSIZ+1], /* Receive packet buffer */ X packet[MAXPACKSIZ+1]; /* Packet buffer */ X XFILE *fp, /* File pointer for current disk file */ X *log; /* File pointer for Logfile */ X X X/* X * kerminit X * X * initalization routine - initalize and dispatch to the appropriate routine. X */ X Xint kerminit(curwin) Xint curwin; X{ X OBJECT *obj_tmp; X static char path[40] = ".\*.*"; X static char file[40] = ""; X static char filename[80]; /* space for file and directory */ X int butt; X X/* Initialize these values and hope the first packet will get across OK */ X X if (kermwdes && w[kermwdes].kerm_act) return (-1); X kermwdes = curwin; X /* If kermit already active, return. */ X w[kermwdes].kerm_act = TRUE; /* mark current window to send output X to kermit instead of emulator */ X kermport = find_port(curwin); X eol = CR; /* EOL for outgoing packets */ X quote = '#'; /* Standard control-quote char "#" */ X pad = 0; /* No padding */ X padchar = '\0'; /* Use null if any padding wanted */ X timint = MYTIME; /* default timint */ X X X/* X * Set direction and paramaters debug, filnamcnv, image with dialog X */ X rsrc_gaddr(R_TREE, KERMPARM, &obj_tmp); X if (obj_tmp[ASCIIMOD].ob_state == NORMAL && X obj_tmp[IMAGEMOD].ob_state == NORMAL) X { /* initalize object and statics */ X objc_change(obj_tmp, ASCIIMOD, 0, 0, 0, 0, 0, SELECTED, 0); X objc_change(obj_tmp, CONVNAME, 0, 0, 0, 0, 0, SELECTED, 0); X objc_change(obj_tmp, RECFILE, 0, 0, 0, 0, 0, SELECTED, 0); X X path[0] = Dgetdrv() + 'a'; X path[1] = ':'; X Dgetpath(path+2, 0); X strcat(path, "\\*.*"); X } X if ((butt = s_dial(KERMPARM, 3)) == KERMEXIT) return(kermterm()); X if (obj_tmp[DEBUGENA].ob_state == SELECTED) X { X debug = obj_tmp[DEBUG1].ob_state + obj_tmp[DEBUG2].ob_state X + obj_tmp[DEBUG3].ob_state; X } X if (butt == RECFILE) obj_tmp[RECFILE].ob_state = SELECTED; X if (butt == SENDFILE) obj_tmp[SENDFILE].ob_state = SELECTED; X rflg = obj_tmp[RECFILE].ob_state; X sflg = obj_tmp[SENDFILE].ob_state; X image = (obj_tmp[IMAGEMOD].ob_state == SELECTED); X filnamcnv = obj_tmp[CONVNAME].ob_state; /* conversion for UNIX systems */ X X/* All set up, now execute the command that was given. */ X X if (debug) X { X printmsg("debuging level = %d\n",debug); X X if (sflg) printmsg("Send command\n"); X if (rflg) printmsg("Receive command\n"); X } X X if (sflg) /* Send command */ X { X extern char * rindex(); X X if (!mouse) X { X graf_mouse(M_ON, NULL); X ++mouse; X } X fsel_input(path, file, &butt); X if (! butt) return(kermterm()); X strcpy(filename, path); X if (debug > 2) printmsg("directory %s", filename); X filnam = rindex(filename, '\\'); X if (filnam) *(++filnam) = '\0'; X strcat(filename, file); X filnam = filename; /* Get file to send */ X if (debug > 2) printmsg("sending %s",filnam); X fp = NULL; /* Indicate no file open yet */ X filelist = NULL; /* Set up the rest of the file list */ X filecount = 0; /* Number of files left to send */ X state = 'S'; /* Send initiate is the start state */ X n = 0; /* Initialize message number */ X numtry = 0; /* Say no tries yet */ X w[kermwdes].kerm_act = TRUE; /* mark current window to send output X to kermit instead of emulator */ X timestamp = clock(); /* reset timer */ X sendsw(); X } X X if (rflg) /* Receive command */ X { X state = 'R'; /* Receive-Init is the start state */ X n = 0; /* Initialize message number */ X numtry = 0; /* Say no tries yet */ X timestamp = clock(); /* reset timer */ X } X X return(0); X} X X/* X * kermterm - Terminate kermit and tell uw not to call us again. X */ Xkermterm() X{ X sflg = rflg = 0; X w[kermwdes].kerm_act = FALSE; X kermwdes = 0; X} X Xkermtimchk() X{ X if (!w[kermwdes].kerm_act) /* is kermit active? */ X { X kermwdes = 0; X return; X } X if ((clock() - timestamp) / CLK_TCK > timint) /* timeout ? */ X { X rpack(NULL, "", ""); /* tell FSM about time out */ X } X} X X/* X * s e n d s w X * X * Sendsw is the state table switcher for sending files. It loops until X * either it finishes, or an error is encountered. The routines called X * by sendsw are responsible for changing the state. X * X */ X Xint sendsw() X{ X chari sinit(), sfile(), sdata(), seof(), sbreak(), nstate; X X nstate = state; X while(TRUE) /* Do this as long as necessary */ X { X if (debug) printmsg("sendsw state: %c nstate: %c\n",state,nstate); X while (nstate != 'I') X { X switch(nstate) X { X case 'S': nstate = sinit(); break; /* Send-Init */ X case 'F': nstate = sfile(); break; /* Send-File */ X case 'D': nstate = sdata(); break; /* Send-Data */ X case 'Z': nstate = seof(); break; /* Send-End-of-File */ X case 'B': nstate = sbreak(); break; /* Send-Break */ X } X switch(nstate) X { X case 'C': printmsg("\aDone.\a"); X return (TRUE); /* Complete */ X case 'A': printmsg("Send Failed."); X return (FALSE); /* "Abort" */ X } X if (nstate != 'I') X { X state = nstate; X if (numtry++ > MAXTRY) return(FALSE); /* If too many tries, give up */ X } X } X return(GETPACK); X } X} X X X/* X * s i n i t X * X * Send Initiate: send this host's parameters and get other side's back. X */ X Xchari sinit() X{ X int num, len; /* Packet number, length */ X static int sent = 0; X X if (! sent) { X reqtimint = MYTIME; X spar(packet); /* Fill up init info packet */ X flushinput(); /* Flush pending input */ X spack('S',n,6,packet); /* Send an S packet */ X X sent = 1; X return('I'); /* get packet to read */ X } X sent = 0; X switch(rpack(&len,&num,recpkt)) /* What was the reply? */ X { X case 'N': return(state); /* NAK, try it again */ X X case 'Y': /* ACK */ X if (n != num) /* If wrong ACK, stay in S state */ X return(state); /* and try again */ X rpar(recpkt); /* Get other side's init info */ X X if (eol == 0) eol = '\n'; /* Check and set defaults */ X if (quote == 0) quote = '#'; X if(abs(timint - reqtimint) < 3) timint = reqtimint + 3; X /* guarentee diference of > 3 for sounds for timint */ X X numtry = 0; /* Reset try counter */ X n = (n+1)%64; /* Bump packet count */ X return('F'); /* OK, switch state to F */ X X case 'E': /* Error packet received */ X prerrpkt(recpkt); /* Print it out and */ X return('A'); /* abort */ X X case FALSE: return(state); /* Receive failure, try again */ X X default: return('A'); /* Anything else, just "abort" */ X } X } X X X/* X * s f i l e X * X * Send File Header. X */ X Xchari sfile() X{ X int num, len; /* Packet number, length */ X char filnam1[50], /* Converted file name */ X *newfilnam, /* Pointer to file name to send */ X *cp; /* char pointer */ X static int sent = 0; X X if (! sent) { X if (fp == NULL) /* If not already open, */ X { if (debug) printmsg(" Opening %s for sending.\n",filnam); X fp = fopen(filnam, image ? "rb" : "r"); /* open the file to be sent */ X if (fp == NULL) /* If bad file pointer, give up */ X { X error("Cannot open file %s",filnam); X return('A'); X } X } X X strcpy(filnam1, filnam); /* Copy file name */ X newfilnam = cp = filnam1; X while (*cp != '\0') /* Strip off all leading directory */ X if (*cp++ == '\\') /* names (ie. up to the last /). */ X newfilnam = cp; X X if (filnamcnv) /* Convert lower case to upper */ X for (cp = newfilnam; *cp != '\0'; cp++) X if (*cp >= 'a' && *cp <= 'z') X *cp ^= 040; X X len = cp - newfilnam; /* Compute length of new filename */ X X printmsg("Sending %s as %s",filnam,newfilnam); X X spack('F',n,len,newfilnam); /* Send an F packet */ X sent = 1; X X return('I'); /* get packet to read */ X } X sent = 0; X switch(rpack(&len,&num,recpkt)) /* What was the reply? */ X { X case 'N': /* NAK, just stay in this state, */ X num = (--num<0 ? 63:num); /* unless it's NAK for next packet */ X if (n != num) /* which is just like an ACK for */ X return(state); /* this packet so fall thru to... */ X X case 'Y': /* ACK */ X if (n != num) return(state); /* If wrong ACK, stay in F state */ X numtry = 0; /* Reset try counter */ X n = (n+1)%64; /* Bump packet count */ X size = bufill(packet); /* Get first data from file */ X return('D'); /* Switch state to D */ X X case 'E': /* Error packet received */ X prerrpkt(recpkt); /* Print it out and */ X return('A'); /* abort */ X X case FALSE: return(state); /* Receive failure, stay in F state */ X X default: return('A'); /* Something else, just "abort" */ X } X} X X X/* X * s d a t a X * X * Send File Data X */ X Xchari sdata() X{ X int num, len; /* Packet number, length */ X static int sent = 0; X X if (! sent) { X spack('D',n,size,packet); /* Send a D packet */ X sent = 1; X return('I'); /* get packet to read */ X } X sent = 0; X switch(rpack(&len,&num,recpkt)) /* What was the reply? */ X { X case 'N': /* NAK, just stay in this state, */ X num = (--num<0 ? 63:num); /* unless it's NAK for next packet */ X if (n != num) /* which is just like an ACK for */ X return(state); /* this packet so fall thru to... */ X X case 'Y': /* ACK */ X if (n != num) return(state); /* If wrong ACK, fail */ X numtry = 0; /* Reset try counter */ X n = (n+1)%64; /* Bump packet count */ X if ((size = bufill(packet)) == EOF) /* Get data from file */ X return('Z'); /* If EOF set state to that */ X return('D'); /* Got data, stay in state D */ X X case 'E': /* Error packet received */ X prerrpkt(recpkt); /* Print it out and */ X return('A'); /* abort */ X X case FALSE: return(state); /* Receive failure, stay in D */ X X default: return('A'); /* Anything else, "abort" */ X } X} X X X/* X * s e o f X * X * Send End-Of-File. X */ X Xchari seof() X{ X int num, len; /* Packet number, length */ X static int sent = 0; X X if (! sent) { X spack('Z',n,0,packet); /* Send a 'Z' packet */ X X sent = 1; X return('I'); /* get packet to read */ X } X sent = 0; X switch(rpack(&len,&num,recpkt)) /* What was the reply? */ X { X case 'N': /* NAK, just stay in this state, */ X num = (--num<0 ? 63:num); /* unless it's NAK for next packet, */ X if (n != num) /* which is just like an ACK for */ X return(state); /* this packet so fall thru to... */ X X case 'Y': /* ACK */ X if (n != num) return(state); /* If wrong ACK, hold out */ X numtry = 0; /* Reset try counter */ X n = (n+1)%64; /* and bump packet count */ X if (debug) printmsg(" Closing input file %s, ",filnam); X fclose(fp); /* Close the input file */ X fp = NULL; /* Set flag indicating no file open */ X X if (debug) printmsg("looking for next file...\n"); X if (gnxtfl() == FALSE) /* No more files go? */ X return('B'); /* if not, break, EOT, all done */ X if (debug) printmsg(" New file is %s\n",filnam); X return('F'); /* More files, switch state to F */ X X case 'E': /* Error packet received */ X prerrpkt(recpkt); /* Print it out and */ X return('A'); /* abort */ X X case FALSE: return(state); /* Receive failure, stay in Z */ X X default: return('A'); /* Something else, "abort" */ X } X} X X X/* X * s b r e a k X * X * Send Break (EOT) X */ X Xchari sbreak() X{ X int num, len; /* Packet number, length */ X static int sent = 0; X X if (! sent) { X spack('B',n,0,packet); /* Send a B packet */ X X sent = 1; X return('I'); /* get packet to read */ X } X sent = 0; X switch (rpack(&len,&num,recpkt)) /* What was the reply? */ X { X case 'N': /* NAK, just stay in this state, */ X num = (--num<0 ? 63:num); /* unless NAK for previous packet, */ X if (n != num) /* which is just like an ACK for */ X return(state); /* this packet so fall thru to... */ X X case 'Y': /* ACK */ X if (n != num) return(state); /* If wrong ACK, fail */ X numtry = 0; /* Reset try counter */ X n = (n+1)%64; /* and bump packet count */ X return('C'); /* Switch state to Complete */ X X case 'E': /* Error packet received */ X prerrpkt(recpkt); /* Print it out and */ X return('A'); /* abort */ X X case FALSE: return(state); /* Receive failure, stay in B */ X X default: return ('A'); /* Other, "abort" */ X } X} X X X/* X * r e c s w X * X * This is the state table switcher for receiving files. X */ X X X X Xrecsw() X{ X chari rinit(), rfile(), rdata(); /* Use these procedures */ X X if (debug) printmsg(" recsw state: %c\n",state); X switch(state) /* Do until done */ X { X case 'R': state = rinit(); break; /* Receive-Init */ X case 'F': state = rfile(); break; /* Receive-File */ X case 'D': state = rdata(); break; /* Receive-Data */ X } X if (numtry++ > MAXTRY) return(FALSE); /* If too many tries, give up */ X switch(state) /* Do until done */ X { X case 'C': printmsg("\aDone.\a"); X return(TRUE); /* Complete state */ X case 'A': printmsg("Receive Failed."); X return(FALSE); /* "Abort" state */ X } X return(GETPACK); /* get the next packet */ X} X X X/* X * r i n i t X * X * Receive Initialization X */ X Xchari rinit() X{ X int len, num; /* Packet length, number */ X X switch(rpack(&len,&num,packet)) /* Get a packet */ X { X case 'S': /* Send-Init */ X rpar(packet); /* Get the other side's init data */ X if (timint > MYTIME + 3) reqtimint = timint - 4; X else reqtimint = timint + 4; X spar(packet); /* Fill up packet with my init info */ X flushinput(); /* get rid of unwanted nak's */ X spack('Y',n,6,packet); /* ACK with my parameters */ X oldtry = numtry; /* Save old try count */ X numtry = 0; /* Start a new counter */ X n = (n+1)%64; /* Bump packet number, mod 64 */ X return('F'); /* Enter File-Receive state */ X X case 'E': /* Error packet received */ X prerrpkt(recpkt); /* Print it out and */ X return('A'); /* abort */ X X case FALSE: /* Didn't get packet */ X spack('N',n,0,NULL); /* Return a NAK */ X return(state); /* Keep trying */ X X default: return('A'); /* Some other packet type, "abort" */ X } X} X X X/* X * r f i l e X * X * Receive File Header X */ X Xchari rfile() X{ X int num, len; /* Packet number, length */ X char filnam1[50]; /* Holds the converted file name */ X X switch(rpack(&len,&num,packet)) /* Get a packet */ X { X case 'S': /* Send-Init, maybe our ACK lost */ X if (oldtry++ > MAXTRY) return('A'); /* If too many tries "abort" */ X if (num == ((n==0) ? 63:n-1)) /* Previous packet, mod 64? */ X { /* Yes, ACK it again with */ X spar(packet); /* our Send-Init parameters */ X spack('Y',num,6,packet); X numtry = 0; /* Reset try counter */ X return(state); /* Stay in this state */ X } X else return('A'); /* Not previous packet, "abort" */ X X case 'Z': /* End-Of-File */ X if (oldtry++ > MAXTRY) return('A'); X if (num == ((n==0) ? 63:n-1)) /* Previous packet, mod 64? */ X { /* Yes, ACK it again. */ X spack('Y',num,0,NULL); X numtry = 0; X return(state); /* Stay in this state */ X } X else return('A'); /* Not previous packet, "abort" */ X X case 'F': /* File Header (just what we want) */ X if (num != n) return('A'); /* The packet number must be right */ X strcpy(filnam1, packet); /* Copy the file name */ X X if (filnamcnv) /* Convert upper case to lower */ X for (filnam=filnam1; *filnam != '\0'; filnam++) X if (*filnam >= 'A' && *filnam <= 'Z') X *filnam |= 040; X X if ((fp=fopen(filnam1, image ? "wb" : "w"))==NULL) /* Try to open a new file */ X { X error("Cannot create %s",filnam1); /* Give up if can't */ X return('A'); X } X else /* OK, give message */ X X printmsg("Receiving %s as %s",packet,filnam1); X X spack('Y',n,0,NULL); /* Acknowledge the file header */ X oldtry = numtry; /* Reset try counters */ X numtry = 0; /* ... */ X n = (n+1)%64; /* Bump packet number, mod 64 */ X return('D'); /* Switch to Data state */ X X case 'B': /* Break transmission (EOT) */ X if (num != n) return ('A'); /* Need right packet number here */ X spack('Y',n,0,NULL); /* Say OK */ X return('C'); /* Go to complete state */ X X case 'E': /* Error packet received */ X prerrpkt(recpkt); /* Print it out and */ X return('A'); /* abort */ X X case FALSE: /* Didn't get packet */ X spack('N',n,0,NULL); /* Return a NAK */ X return(state); /* Keep trying */ X X default: return ('A'); /* Some other packet, "abort" */ X } X} X X X/* X * r d a t a X * X * Receive Data X */ X Xchari rdata() X{ X int num, len; /* Packet number, length */ X X switch(rpack(&len,&num,packet)) /* Get packet */ X { X case 'D': /* Got Data packet */ X#ifdef EXTRADEBUG X if (debug > 2) printmsg("Got Data Packet"); X#endif X if (num != n) /* Right packet? */ X { /* No */ X if (oldtry++ > MAXTRY) X return('A'); /* If too many tries, abort */ X if (num == ((n==0) ? 63:n-1)) /* Else check packet number */ X { /* Previous packet again? */ X spack('Y',num,6,packet); /* Yes, re-ACK it */ X numtry = 0; /* Reset try counter */ X return(state); /* Don't write out data! */ X } X else return('A'); /* sorry, wrong number */ X } X /* Got data with right packet number */ X spack('Y',n,0,NULL); /* Acknowledge the packet */ X#ifdef EXTRADEBUG X if (debug > 2) printmsg("Calling bufemp"); X#endif X bufemp(packet,len); /* Write the data to the file */ X oldtry = numtry; /* Reset the try counters */ X numtry = 0; /* ... */ X n = (n+1)%64; /* Bump packet number, mod 64 */ X return('D'); /* Remain in data state */ X X case 'F': /* Got a File Header */ X if (oldtry++ > MAXTRY) X return('A'); /* If too many tries, "abort" */ X if (num == ((n==0) ? 63:n-1)) /* Else check packet number */ X { /* It was the previous one */ X spack('Y',num,0,NULL); /* ACK it again */ SHAR_EOF echo "End of part 1, continue with part 2" echo "2" > s2_seq_.tmp exit 0