wht@tridom.uucp (Warren Tucker) (10/10/89)
---- Cut Here and unpack ---- #!/bin/sh # this is part 24 of a multipart archive # do not concatenate these parts, unpack them in order with /bin/sh # file help/helpgen.c continued # CurArch=24 if test ! -r s2_seq_.tmp then echo "Please unpack part 1 first!" exit 1; fi ( read Scheck if test "$Scheck" != $CurArch then echo "Please unpack part $Scheck next!" exit 1; else exit 0; fi ) < s2_seq_.tmp || exit 1 echo "x - Continuing file help/helpgen.c" sed 's/^X//' << 'SHAR_EOF' >> help/helpgen.c Xregister char *cmd; X{ Xregister P_CMD *cmd_list = icmd_cmds; X X while(cmd_list->token != -1) X { X if(strcmp(cmd_list->cmd,cmd) == 0) X break; X cmd_list++; X } X if(cmd_list->token == -1) X return((P_CMD *)0); X else X return(cmd_list); X X} /* end of search_cmd_list */ X X/*+------------------------------------------------------------------------- X show_cmds() Xcommands with null descriptions are "undocumented" X--------------------------------------------------------------------------*/ Xvoid Xshow_cmds() X{ Xregister int itmp; Xregister P_CMD *pcmd = icmd_cmds; Xregister int longest_cmd = 0; Xregister int longest_descr = 0; Xregister int cmd_count = 0; Xregister int nl_flag = 0; Xchar s80[80]; XP_CMD *longest_cmd_p = 0; XP_CMD *longest_descr_p = 0; X X while(pcmd->token != -1) X { X if(!*pcmd->descr) X { X pcmd++; X continue; X } X itmp = strlen(pcmd->cmd); X if(itmp > longest_cmd) X { X longest_cmd = itmp; X longest_cmd_p = pcmd; X } X itmp = strlen(pcmd->descr); X if(itmp > longest_descr) X { X longest_descr = itmp; X longest_descr_p = pcmd; X } X pcmd++; X } X pcmd = icmd_cmds; X while(pcmd->token != -1) X { X if((!pcmd->min) || (!*pcmd->descr)) X { X pcmd++; X continue; X } X strcpy(s80,pcmd->cmd); X pad_zstr_to_len(s80,longest_cmd + 2); X for(itmp = 0; itmp < pcmd->min; itmp++) X s80[itmp] = to_upper(s80[itmp]); X fputs(s80,stderr); X X strcpy(s80,pcmd->descr); X pad_zstr_to_len(s80,longest_descr + 1); X fputs(s80,stderr); X X if(nl_flag) X fputs("\r\n",stderr); X else X fputs("| ",stderr); X nl_flag = (nl_flag) ? 0 : 1; X X pcmd++; X } X if(nl_flag) X fputs("\r\n",stderr); X X itmp = longest_cmd + longest_descr + 5; X sprintf(s80,"recwidth = %d\r\n",itmp); X fprintf(stderr,s80); X pcmd = longest_cmd_p; X sprintf(s80,"longest cmd: %s: %s\r\n",pcmd->cmd,pcmd->descr); X fprintf(stderr,s80); X pcmd = longest_descr_p; X sprintf(s80,"longest dsc: %s: %s\r\n",pcmd->cmd,pcmd->descr); X fprintf(stderr,s80); X X} /* end of show_cmds */ X X/*+------------------------------------------------------------------------- X build_ecuhelp() X--------------------------------------------------------------------------*/ Xvoid Xbuild_ecuhelp() X{ Xregister int itmp; Xregister char *cptr; X printf("\nBuilding %s\n",PDAT); X for(itmp = 0; itmp < TOKEN_QUAN; itmp++) X { X start_pos[itmp] = 0L; X token_line[itmp] = 0; X } X X if((fpsrc = fopen(PSRC,"r")) == NULL) X { X perror(PSRC); X exit(1); X } X X if((fpdat = fopen(PDAT,"w")) == NULL) X { X perror(PDAT); X exit(1); X } X X fwrite((char *)start_pos,sizeof(long), /* write null table */ X TOKEN_QUAN,fpdat); X X while(fgets(buf,sizeof(buf),fpsrc) != NULL) X { X src_line++; X itmp = strlen(buf); X buf[--itmp] = 0; /* kill trailing nl */ X if((buf[0] == '#') || (buf[0] == '/')) /* ignore comments */ X continue; X if(buf[0] == '%') /* command indication */ X { XSEARCH_CMD_LIST: X if(!(pcmd = search_cmd_list(&buf[1]))) X { X printf("line %d: '%s' not in command table\n", X src_line,&buf[1]); X while(fgets(buf,sizeof(buf),fpsrc) != NULL) X { X src_line++; X itmp = strlen(buf); X buf[--itmp] = 0; /* kill trailing nl */ X if(buf[0] == '%') /* command indication */ X goto SEARCH_CMD_LIST; X } X break; X } X if(start_pos[pcmd->token]) X { X printf("line %d: '%s' already found on line %d\n", X src_line,&buf[1],token_line[pcmd->token]); X exit(1); X } X fputs("\n",fpdat); /* terminate previous command description */ X start_pos[pcmd->token] = ftell(fpdat); X token_line[pcmd->token] = src_line; X fputs(" ",fpdat); X cptr = &buf[1]; /* command text */ X itmp = 0; X while(*cptr) /* show cmd and min chars required */ X { X if(itmp < pcmd->min) X fputc(to_upper(*cptr++),fpdat); X else X fputc(to_lower(*cptr++),fpdat); X itmp++; X } X if(*pcmd->descr) /* if description present */ X fprintf(fpdat," : %s\n \n",pcmd->descr); X else X fputs("\n \n",fpdat); X continue; X } X fprintf(fpdat," %s\n",buf); X } X X fseek(fpdat,0L,0); /* back to position table */ X fwrite((char *)start_pos,sizeof(long), /* write actual table */ X TOKEN_QUAN,fpdat); X fclose(fpsrc); X fputs("\n",fpdat); /* terminate last command */ X fclose(fpdat); X} /* end of build_ecuhelp */ X X/*+------------------------------------------------------------------------- X build_ecudoc() X--------------------------------------------------------------------------*/ Xvoid Xbuild_ecudoc() X{ Xregister int itmp; Xregister char *cptr; X X printf("\nBuilding %s\n",PDOC); X if((fpdat = fopen(PDAT,"r")) == NULL) X { X perror(PDAT); X exit(1); X } X if((fpdoc = fopen(PDOC,"w")) == NULL) X { X perror(PDOC); X exit(1); X } X fprintf(fpdoc, X "\n ECU Command Help Documentation (PRELIMINARY)\n\n"); X fprintf(fpdoc, X "Commands are accessed by pressing the HOME key followed by one\n"); X fprintf(fpdoc, X "of the following commands (capitalized portions are sufficient\n"); X fprintf(fpdoc, X "to invoke the command):\n"); X fprintf(fpdoc,"\n"); X fprintf(fpdoc, X"---------------------------------------------------------------------\n"); X fread((char *)start_pos,sizeof(long),TOKEN_QUAN,fpdat); X pcmd = icmd_cmds; X while(pcmd->token != -1) X { X if(!pcmd->token) X { X pcmd++; X continue; X } X if(pcmd->min && !start_pos[pcmd->token]) X { X printf("no help available for '%s'\n",pcmd->cmd); X pcmd++; X continue; X } X fseek(fpdat,start_pos[pcmd->token],0); X while(fgets(buf,sizeof(buf),fpdat) != NULL) X { X itmp = strlen(buf); X buf[--itmp] = 0; X if(itmp == 0) X break; X fprintf(fpdoc,"%s\n",buf); X } X fprintf(fpdoc, X"---------------------------------------------------------------------\n"); X pcmd++; X } X fclose(fpdat); X fclose(fpdoc); X} /* end of build_ecudoc */ X X/*+------------------------------------------------------------------------- X build_ecutxt() X--------------------------------------------------------------------------*/ Xvoid Xbuild_ecutxt() X{ Xregister int itmp; Xregister char *cptr; X X printf("\nBuilding %s\n",PTXT); X if((fpdat = fopen(PDAT,"r")) == NULL) X { X perror(PDAT); X exit(1); X } X if((fptxt = fopen(PTXT,"w")) == NULL) X { X perror(PTXT); X exit(1); X } X X fread((char *)start_pos,sizeof(long),TOKEN_QUAN,fpdat); X pcmd = icmd_cmds; X while(pcmd->token != -1) X { X if(!pcmd->token) X { X pcmd++; X continue; X } X if(pcmd->min && !start_pos[pcmd->token]) X { X printf("no help available for '%s'\n",pcmd->cmd); X pcmd++; X continue; X } X fseek(fpdat,start_pos[pcmd->token],0); X if(fgets(buf,sizeof(buf),fpdat) != NULL) X itmp = strlen(buf); X buf[--itmp] = 0; X cptr = buf; X while(*cptr) X if(*cptr == ' ') X cptr++; X else X break; X fprintf(fptxt,".*s 2 \"%s\"\n.(b L",cptr); X while(fgets(buf,sizeof(buf),fpdat) != NULL) X { X itmp = strlen(buf); X buf[--itmp] = 0; X if(itmp == 0) X break; X fprintf(fptxt,"%s\n",buf); X } X fprintf(fptxt,"\n.)b\n\n"); X pcmd++; X } X fclose(fpdat); X fclose(fptxt); X} /* end of build_ecutxt */ X X/*+------------------------------------------------------------------------- X test_help() X--------------------------------------------------------------------------*/ Xvoid Xtest_help() X{ Xregister int itmp; Xregister char *cptr; X X/* test code */ X printf("\nNow to test\n"); X if((fpdat = fopen(PDAT,"r")) == NULL) X { X perror(PDAT); X exit(1); X } X fread((char *)start_pos,sizeof(long),TOKEN_QUAN,fpdat); X while(1) X { X printf("\ncommand: "); X fgets(buf,sizeof(buf),stdin); X itmp = strlen(buf); X buf[--itmp] = 0; X if(itmp == 0) X break; X if(!(pcmd = search_cmd_list(buf))) X { X printf("'%s' not found in ecu cmd table\n",buf); X continue; X } X if(pcmd->min && !start_pos[pcmd->token]) X { X printf("no help available for '%s'\n",buf); X continue; X } X fseek(fpdat,start_pos[pcmd->token],0); X while(fgets(buf,sizeof(buf),fpdat) != NULL) X { X itmp = strlen(buf); X buf[--itmp] = 0; X if(itmp == 0) X break; X printf("%s\n",buf); X } X } X} /* end of test_help */ X X/*+------------------------------------------------------------------------- X main(argc,argv,envp) X--------------------------------------------------------------------------*/ Xmain(argc,argv,envp) Xint argc; Xchar **argv; Xchar **envp; X{ Xregister int itmp; Xregister char *cptr; Xint iargv; Xint b_flag = 0; Xint s_flag = 0; Xint t_flag = 0; Xint f_flag = 0; Xint d_flag = 0; Xint n_flag = 0; X X setbuf(stdout,NULL); X setbuf(stderr,NULL); X X if(argc < 1) X usage(); X for(iargv = 1; iargv < argc; iargv++) X { X if(argv[iargv][0] == '-') X { X switch(itmp = (argv[iargv][1])) X { X case 'b': b_flag = 1; break; X case 's': s_flag = 1; break; X case 't': t_flag = 1; break; X case 'd': d_flag = 1; break; X case 'n': n_flag = 1; break; X default: X usage(); X break; X } X } X else X usage(); X } X if(!b_flag && !s_flag && !t_flag && !d_flag && !n_flag && !f_flag) X usage(); X X if(b_flag) X build_ecuhelp(); X if(d_flag) X build_ecudoc(); X if(n_flag) X build_ecutxt(); X if(s_flag) X show_cmds(); X if(t_flag) X test_help(); X X exit(0); X} /* end of main */ X/* end of helpgen.c */ X/* vi: set tabstop=4 shiftwidth=4: */ SHAR_EOF echo "File help/helpgen.c is complete" chmod 0644 help/helpgen.c || echo "restore of help/helpgen.c fails" echo "x - extracting help/util.c (Text)" sed 's/^X//' << 'SHAR_EOF' > help/util.c && X/* CHK=0x464E */ X/*+------------------------------------------------------------------------- X util.c X Copyright 1986,1989 Warren H. Tucker, III. All Rights Reserved X--------------------------------------------------------------------------*/ X/*+:EDITS:*/ X/*:07-03-1989-22:58-wht------------- ecu 2.00 ---------------- */ X/*:05-08-1989-15:52-wht-creation */ X X#include "lint_args.h" X X/*+------------------------------------------------------------------------- X all touuper/tolower not created equally, so this works! X--------------------------------------------------------------------------*/ Xchar to_upper(ch) Xregister char ch; X{ return( ((ch >= 'a') && (ch <= 'z')) ? ch - 0x20 : ch); X} /* end of to_upper() */ X Xchar to_lower(ch) Xregister char ch; X{ return( ((ch >= 'A') && (ch <= 'Z')) ? ch + 0x20 : ch); X} /* end of to_lower() */ X X X/*+----------------------------------------------------------------------- X pad_zstr_to_len(zstr,len) X X pads with spaces to specified length, unless already longer than X len in which case the string is truncated to 'len' characters. X------------------------------------------------------------------------*/ Xvoid Xpad_zstr_to_len(zstr,len) Xchar *zstr; Xint len; X{ Xregister int izstr; X X izstr = strlen(zstr); X if(izstr >= len) X zstr[len] = 0; X else X { X while(izstr < len) X zstr[izstr++] = 0x20; X zstr[izstr] = 0; X } X} /* end of pad_zstr_to_len */ X SHAR_EOF chmod 0644 help/util.c || echo "restore of help/util.c fails" echo "x - extracting ecuungetty/Makefile (Text)" sed 's/^X//' << 'SHAR_EOF' > ecuungetty/Makefile && X# CHK=0x085E X#+------------------------------- X# makefile for ecuungetty X#-------------------------------- X#+:EDITS:*/ X#:07-03-1989-22:58-wht------------- ecu 2.00 ---------------- X#:07-03-1989-02:06-wht-creation X XCFLAGS = `sysdep =M_I386 -Ox =M_I286 -O -M2le` X XOBJ = ../bamboozle.o ecuungetty.o X Xall: ecuungetty X Xecuungetty: $(OBJ) X cc $(CFLAGS) $(OBJ) -o ecuungetty -lcrypt -lx X Xinstall: X -mkdir /usr/lib/ecu X cp ecuungetty /usr/lib/ecu X chown root /usr/lib/ecu/ecuungetty X chmod u+s /usr/lib/ecu/ecuungetty X SHAR_EOF chmod 0644 ecuungetty/Makefile || echo "restore of ecuungetty/Makefile fails" echo "x - extracting ecuungetty/ecuungetty.c (Text)" sed 's/^X//' << 'SHAR_EOF' > ecuungetty/ecuungetty.c && X/* CHK=0x8FCB */ X/*+------------------------------------------------------------------------- X ecuungetty.c - ecu "ungetty" program X Copyright 1989 Warren H. Tucker, III. All Rights Reserved X Xecuungetty /dev/ttyxx <bamboozle-str> Xecuungetty -t /dev/ttyxx <bamboozle-str> Xecuungetty -r /dev/ttyxx <bamboozle-str> X Xcc -Ox ecuungetty.c -o ecuungetty Xchown root ecuungetty Xchmod u+s ecuungetty Xmv ecuungetty /usr/lib/ecu X X--------------------------------------------------------------------------*/ X/*+:EDITS:*/ X/*:07-03-1989-22:58-wht------------- ecu 2.00 ---------------- */ X/*:06-29-1989-17:19-wht-creation */ X X#include <stdio.h> X#include <ctype.h> X#include <fcntl.h> X#include <errno.h> X#include <signal.h> X#include <sys/types.h> X#include <sys/stat.h> X#include <utmp.h> X#ifdef XENIX /* bincc */ X#include "/u1/src/ecu/stdio_lint.h" X#include "/u1/src/ecu/ecuungetty.h" X#else X#include "../stdio_lint.h" X#include "../ecuungetty.h" X#endif X X#define UTMP_FILE "/etc/utmp" X X/* utmp_status defines */ X#define US_NOTFOUND 100 /* not in utmp, or getty dead */ X#define US_LOGIN 101 /* enabled for login, idle */ X#define US_DIALOUT 102 /* enabled for login, currently dialout */ X#define US_LOGGEDIN 103 /* enabled for login, in use */ X Xstruct utmp uu; X/*+------------------------------------------------------------------------- X to_upper() / to_lower() X one would think that these were relatively standard X types of thing, but MSC/Xenix specifies toupper() to convert to upper X case if not already and Unix says to adjust without testing, X so, two stupid little routines here X ASCII only -- no EBCDIC gradoo here please X--------------------------------------------------------------------------*/ Xchar to_upper(ch) Xregister char ch; X{ return( ((ch >= 'a') && (ch <= 'z')) ? ch - 0x20 : ch); X} /* end of to_upper() */ X Xchar to_lower(ch) Xregister char ch; X{ return( ((ch >= 'A') && (ch <= 'Z')) ? ch + 0x20 : ch); X} /* end of to_lower() */ X X/*+---------------------------------------------------------------------------- X ulcmpb(str1,str) -- Upper/Lower [case insensitive] Compare Bytes X X Returns -1 if strings are equal, else failing character position X If the second strings terminates with a null and both strings have matched X character for character until that point, then -1 is returned. X NOTE: this is not a test for complete equality of two strings, but allows X discovery of a string as a substring in a larger containing string. X-----------------------------------------------------------------------------*/ Xint Xulcmpb(str1,str2) Xregister unsigned char *str1; Xregister unsigned char *str2; X{ Xregister istr; X X for( istr=0 ; ; ++istr ) X { X if(str2[istr] == '\0') /* if second string exhausts, match! */ X return(-1); X if((str1[istr] == '\0' ) || X ( to_upper(str1[istr]) != to_upper(str2[istr]) )) X return(istr); X } X /*NOTREACHED*/ X} /* end of ulcmpb */ X X/*+------------------------------------------------------------------------- X utmp_status(line) Xreturns US_ value and utmp struct uu; X--------------------------------------------------------------------------*/ Xint Xutmp_status(line) Xchar *line; X{ Xregister ufd; Xregister status = US_NOTFOUND; X X if((ufd = open(UTMP_FILE,O_RDONLY,755)) < 0) X { X perror(UTMP_FILE); X return(0); X } X X while(read(ufd,(char *)&uu,sizeof(uu)) > 0) X { X if((ulcmpb(uu.ut_line,line + 5) < 0) && X (!kill(uu.ut_pid,0) || (errno != ESRCH))) X { X if(!strcmp(uu.ut_user,"LOGIN")) X status = US_LOGIN; X else if(!strcmp(uu.ut_user,"DIALOUT")) X status = US_DIALOUT; X else X status = US_LOGGEDIN; X break; X } X } X close(ufd); X return(status); X X} /* end of utmp_status */ X X/*+------------------------------------------------------------------------- X main(argc,argv,envp) X--------------------------------------------------------------------------*/ Xmain(argc,argv,envp) Xint argc; Xchar **argv; Xchar **envp; X{ Xint op = 'g'; /* assume "get" operation */ Xint status; Xint itmp; Xchar *tty = argv[1]; Xchar *bamboozlement = argv[2]; Xchar *bamboozle(); X X if(geteuid() != 0) X exit(UGE_NOTROOT); X X if(*argv[1] == '-') X { X switch(op = *(argv[1] + 1)) X { X case 'r': X case 't': X break; X default: X exit(UGE_BADSWITCH); X } X if(argc < 3) X exit(UGE_BADARGC); X tty = argv[2]; X bamboozlement = argv[3]; X } X else if(argc <= 2) X exit(UGE_BADARGC); X X if(getuid() != 0) X { X if(strcmp(bamboozlement,bamboozle(getppid()))) X exit(UGE_CALLER); X } X X status = utmp_status(tty); X X switch(op) X { X case 'g': X switch(status) X { X case US_NOTFOUND: /* not in utmp, or getty dead */ X exit(UG_NOTENAB); X case US_LOGIN: /* enabled for login, idle */ X kill(uu.ut_pid,SIGUSR1); X nap(200L); X exit(UG_ENAB); X case US_DIALOUT: /* enabled for login, currently dialout */ X case US_LOGGEDIN: /* enabled for login, in use */ X exit(UG_FAIL); X } X break; X X case 't': X switch(status) X { X case US_NOTFOUND: /* not in utmp, or getty dead */ X exit(0x30); X case US_LOGIN: /* enabled for login, idle */ X exit(0x31); X case US_LOGGEDIN: /* enabled for login, in use */ X exit(0x32); X case US_DIALOUT: /* enabled for login, currently dialout */ X exit(UG_RESTART); X } X break; X X case 'r': X switch(status) X { X case US_NOTFOUND: /* not in utmp, or getty dead */ X case US_LOGIN: /* enabled for login, idle */ X case US_LOGGEDIN: /* enabled for login, in use */ X exit(0); X case US_DIALOUT: /* enabled for login, currently dialout */ X kill(uu.ut_pid,SIGUSR2); X exit(0); X } X break; X } X exit(0); X} /* end of main */ X X/* vi: set tabstop=4 shiftwidth=4: */ X/* end of ecuungetty.c */ SHAR_EOF chmod 0644 ecuungetty/ecuungetty.c || echo "restore of ecuungetty/ecuungetty.c fails" echo "x - extracting z/Makefile (Text)" sed 's/^X//' << 'SHAR_EOF' > z/Makefile && X# CHK=0x849A X#+------------------------------------------------------------------- X# Makefile for ecurz/ecusz (ecu file transfer) X#-------------------------------------------------------------------- X#+:EDITS:*/ X#:07-03-1989-22:58-wht------------- ecu 2.00 ---------------- X#:05-08-1989-16:51-wht-rename files, solidify make procedure X#:01-11-1989-21:00-wht-change over to 386 X XSHELL = /bin/sh X X.SUFFIXES: .o .c .h X.PRECIOUS: zlint.h X X#PROFILE = -p X XSYSTEM = `sysdep =M_I386 Xenix/386 =M_I286 Xenix/286` XCOMFLAGS = -i $(PROFILE) `sysdep =M_I386 -M3 -Ox =M_I286 -M2le -O -F 1000 -LARGE` XCFLAGS = -c $(COMFLAGS) -DMD -DLINT_ARGS -DREADCHECK -DLOG_XFER X XLDFLAGS = -lcurses -ltermcap -lx X XCOMMON_SRC = \ X zcommon.c\ X zmodem.c\ X zcurses.c\ X zdebug.c X XCOMMON_OBJ = \ X zcommon.o\ X zmodem.o\ X zcurses.o\ X ../logevent.o X X.c.o:; fcrc -u $*.c ; /bin/time cc $(CFLAGS) $*.c X Xall: ecusz ecurz X Xecusz: ecusz.o $(COMMON_OBJ) X buildrev `date` $(SYSTEM) >ecuszrev.c X cc $(CFLAGS) ecuszrev.c ; rm ecuszrev.c X /bin/time cc $(COMFLAGS) ecusz.o ecuszrev.o $(COMMON_OBJ) $(LDFLAGS) -o ecusz X rm -f ecuszrev.o X Xecurz: ecurz.o $(COMMON_OBJ) X buildrev `date` $(SYSTEM) >ecurzrev.c X cc $CFLAGS) ecurzrev.c ; rm ecurzrev.c X /bin/time cc $(COMFLAGS) ecurz.o ecurzrev.o $(COMMON_OBJ) $(LDFLAGS) -o ecurz X rm -f ecurzrev.o X Xcomsrc.fls: $(COMMON_SRC) Makefile X ls $(COMMON_SRC) > comsrc.fls X Xlint: comsrc.fls X csh ../zgcc comsrc.fls zlint.h $(CFLAGS) X fcrc -u Makefile *.h X X# X# MAKE DEPEND: regenerate .c:.h, .ol:.c, .ol:.asm dependencies automatically X# Xdepend: X rm -f depend.tmp X if test '$(COMMON_SRC)' ;\ X then (grep '^#include' $(COMMON_SRC) \ X | sed -e 's?:[^<]*<\([^>]*\)>.*?: /usr/include/\1?'\ X -e 's?:[^"]*"\([^"]*\)".*?: \1?'\ X -e 's?\(.*\)\.c?\1.o?'\ X >> depend.tmp) ;\ X fi X X echo '/^# DO NOT DELETE THIS LINE' >exdep.tmp X echo '.+1,$$d' >>exdep.tmp X echo 'r depend.tmp' >> exdep.tmp X echo 'w' >> exdep.tmp X cp Makefile Makefile.new X ex Makefile.new < exdep.tmp X rm exdep.tmp depend.tmp X echo '# DEPENDENCIES MUST END AT END OF FILE' >>Makefile.new X echo '# IF YOU PUT STUFF HERE IT WILL GO AWAY'>>Makefile.new X echo '# see make depend above'>>Makefile.new X mv Makefile Makefile.bak X mv Makefile.new Makefile X fcrc -u Makefile X X# DO NOT DELETE THIS LINE Xzcommon.o: /usr/include/stdio.h Xzcommon.o: /usr/include/signal.h Xzcommon.o: /usr/include/setjmp.h Xzcommon.o: /usr/include/ctype.h Xzcommon.o: zmodem.h Xzcommon.o: /usr/include/fcntl.h Xzmodem.o: zmodem.h Xzmodem.o: zlint.h Xzcurses.o: /usr/include/curses.h Xzcurses.o: /usr/include/sys/types.h Xzcurses.o: /usr/include/sys/stat.h Xzcurses.o: /usr/include/ctype.h Xzcurses.o: /usr/include/signal.h Xzcurses.o: /usr/include/time.h Xzcurses.o: /usr/include/sys/timeb.h Xzcurses.o: ../pc_scr.h Xzcurses.o: zlint.h Xzeculog.o: /usr/include/stdio.h Xzeculog.o: /usr/include/sys/types.h Xzeculog.o: /usr/include/time.h Xzeculog.o: /usr/include/sys/timeb.h Xzeculog.o: zlint.h X# DEPENDENCIES MUST END AT END OF FILE X# IF YOU PUT STUFF HERE IT WILL GO AWAY X# see make depend above SHAR_EOF chmod 0644 z/Makefile || echo "restore of z/Makefile fails" echo "x - extracting z/ecurz.c (Text)" sed 's/^X//' << 'SHAR_EOF' > z/ecurz.c && X/* CHK=0x67F8 */ Xchar *numeric_revision = "ecurz 2.21"; X/*+------------------------------------------------------------------------- X ecurz.c - X/Y/ZMODEM receive program X Derived from public domain source by Chuck Foresberg, Omen Technologies X Adaptation for ecu Copyright 1989, Warren H. Tucker, III X X Defined functions: X SIGALRM_handler() X cancel_transaction(n) X close_and_report() X flushline() X getfree() X isanylc(s) X main(argc,argv,envp) X make_dirs(pathname) X mkdir(dpath,dmode) X procheader(name) X purgeline() X readline(timeout) X rzfile() X rzfiles() X send_ZFIN_and_exit() X send_cancel() X sendline(c) X substr(str,token) X sys2(shellcmd) X tryz() X uncaps(s) X usage(fail_reason) X wcgetsec(rxbuf,maxtime) X wcreceive(argc,argp) X wcrx() X wcrxpn(rpn) X write_sec_to_disk(buf,n) X xsendline(c) X X Usage: ecurz -Z [-abeuy] (ZMODEM) X ecurz -Y [-abuy] (YMODEM) X ecurz -X [-abc] file (XMODEM or XMODEM-1k) X X -a ASCII transfer (strip CR) X -b Binary transfer for all files X -c Use 16 bit CRC (XMODEM) X -e Escape control characters (ZMODEM) X -p protect local files (ZMODEM) X -t <tenths> rx timeout seconds X -+ force append X -u convert uppercase filenames to lower case X -y Yes, clobber existing file if any X -. line fd to use X -, log protocol packets X X--------------------------------------------------------------------------*/ X/*+:EDITS:*/ X/*:07-03-1989-22:58-wht------------- ecu 2.00 ---------------- */ X/*:06-26-1989-23:24-wht-exclude "!! " from error messages on screen */ X/*:06-24-1989-16:51-wht-flush edits --- ecu 1.95 */ X X#include <stdio.h> X#include <signal.h> X#include <setjmp.h> X#include <ctype.h> X#include <errno.h> X#include <fcntl.h> X#include "zmodem.h" X#include "zlint.h" X Xextern unsigned short crctab[]; /* wht */ Xextern unsigned long total_data_chars_xfered; /* zcurses.c */ Xextern int errno; Xextern char Attn[]; /* Attention string rx sends to tx on err */ Xextern int Crc32; /* Display flag indicating 32 bit CRC being received */ Xextern int Rxcount; /* Count of data bytes received */ Xextern char Rxhdr[]; /* Received header */ Xextern char Txhdr[]; /* Transmitted header */ Xextern int Rxtimeout; /* Tenths of seconds to wait for something */ Xextern char s256[]; X X/* Max value for VMIN_COUNT is 255. A larger value reduces system Xoverhead but may evoke kernel bugs. 133 corresponds to an XMODEM/CRC Xsector */ X#if !defined(VMIN_COUNT) X#define VMIN_COUNT 133 X#endif Xunsigned char vmin_count = VMIN_COUNT; Xint Readnum = VMIN_COUNT; /* num bytes to ask for in read() from modem */ X X#define DEFBYTL 2000000000L /* default rx file size */ X#define RETRYMAX 5 X XFILE *fout; Xchar Lzmanag; /* Local file management request */ Xchar Pathname[PATHLEN]; Xchar curr_dir[256]; Xchar linbuf[VMIN_COUNT]; Xchar s128[128]; Xchar secbuf[1025]; Xchar zconv; /* ZMODEM file conversion request */ Xchar zmanag; /* ZMODEM file management request */ Xchar ztrans; /* ZMODEM file transport request */ Xint Batch=0; Xint Blklen; /* record length of received packets */ Xint Crcflg; Xint Eofseen; /* indicates cpm eof (^Z) has been received */ Xint Filcnt=0; /* count of number of files opened */ Xint Filemode; /* Unix style mode for incoming file */ Xint Firstsec; Xint Lastrx; Xint Lleft=0; /* number of characters in linbuf */ Xint MakeLCPathname=1; /* make received pathname lower case */ Xint Nozmodem = 0; /* If invoked as "rb" */ Xint Rxascii=0; /* receive files in ascii (translate) mode */ Xint Rxbinary=0; /* receive all files in bin mode */ Xint Rxclob=0; /* Clobber existing file */ Xint Thisbinary; /* current file is to be received in bin mode */ Xint Twostop = 0; /* use two stop bits */ Xint Zctlesc; /* Encode control characters */ Xint Zmodem=0; /* ZMODEM protocol requested */ Xint Zrwindow = 1400; /* RX window size (controls garbage count) */ Xint ecusz_flag = 0; Xint errors; Xint iofd = 0; Xint log_packets = 0; Xint npats = 0; Xint oldBlklen = -1; /* last block length */ Xint this_file_errors = 0; Xint tryzhdrtype=ZRINIT; /* Header type to send corresponding to Last rx close */ Xjmp_buf tohere; /* For the interrupt on RX timeout */ Xlong Bytesleft; /* number of bytes of incoming file left */ Xlong Modtime; /* Unix style mod time for incoming file */ Xlong TotalToReceive = 0L; Xlong rx_char_count = 0L; Xlong tx_char_count = 0L; Xstruct stat fout_stat; Xtime_t timep[2]; Xunsigned Baudrate; Xunsigned long this_file_length; Xint required_type = 0; Xchar *bottom_label = (char *)0; X X/*+------------------------------------------------------------------------- X substr(str,token) X X searches for token in string str returns pointer to token within X string if found,NULL otherwise X--------------------------------------------------------------------------*/ Xchar * Xsubstr(str,token) Xregister char *str,*token; X{ Xregister char *ss,*tt; X X /* search for first char of token */ X for(ss=str; *str; str++) X if(*str == *token) X /* compare token with substring */ X for(ss=str,tt=token; ;) X { X if(*tt == 0) X return(str); X if(*ss++ != *tt++) X break; X } X return(NULL); X} /* end of substr */ X X/*+------------------------------------------------------------------------- X getfree() X X Routine to calculate the free bytes on the current file system ~0 X means many free bytes (unknown) X--------------------------------------------------------------------------*/ Xlong Xgetfree() X{ X return(~0L); /* many free bytes ... */ X} /* end of getfree */ X X/*+------------------------------------------------------------------------- X usage(fail_reason) X--------------------------------------------------------------------------*/ Xvoid Xusage(fail_reason) Xchar *fail_reason; X{ X fprintf(stderr,"%s\n",fail_reason); X exit(255); X} /* end of usage */ X X/*+------------------------------------------------------------------------- X SIGALRM_handler() X--------------------------------------------------------------------------*/ Xvoid XSIGALRM_handler() X{ X report_tx_ind(0); X report_rx_ind(0); X longjmp(tohere,-1); X} /* end of SIGALRM_handler */ X X/*+------------------------------------------------------------------------- X bye_bye(sig) X--------------------------------------------------------------------------*/ Xvoid Xbye_bye(sig) Xint sig; X{ X exit(sig+128); X} /* end of bye_bye */ X X/*+------------------------------------------------------------------------- X cancel_transaction(n) Xcalled by signal interrupt or terminate to clean things up X--------------------------------------------------------------------------*/ Xvoid Xcancel_transaction(n) X{ X if(Zmodem) X zmputs(Attn); X send_cancel(); X mode(0); X if(n >= 0) X { X sprintf(s128,"ecurz received signal %d: exiting",n); X report_str(s128,0); X } X report_tx_ind(0); X report_rx_ind(0); X report_uninit(0); X bye_bye(n); X} /* end of cancel_transaction */ X X/*+------------------------------------------------------------------------- X sendline(c) - send a character to DCE X--------------------------------------------------------------------------*/ Xsendline(c) Xchar c; X{ X write(iofd,&c,1); X ++tx_char_count; X} /* end of sendline */ X X/*+------------------------------------------------------------------------- X xsendline(c) X--------------------------------------------------------------------------*/ Xxsendline(c) X{ X sendline(c); X} /* end of xsendline */ X X/*+------------------------------------------------------------------------- X flushline() X--------------------------------------------------------------------------*/ Xflushline() SHAR_EOF echo "End of part 24" echo "File z/ecurz.c is continued in part 25" echo "25" > s2_seq_.tmp exit 0 -- ------------------------------------------------------------------- Warren Tucker, Tridom Corporation ...!gatech!emory!tridom!wht Ker-au'-lo-phon. An 8-foot partial flue-stop, having metal pipes surmounted by adjustable rings, and with a hole bored near the top of each pipe, producing a soft and "reedy" tone.