home *** CD-ROM | disk | FTP | other *** search
- From: wht@n4hgf.uucp (Warren Tucker)
- Newsgroups: comp.sources.misc
- Subject: v16i032: ECU async comm package rev 3.0, Part08/35
- Message-ID: <1991Jan6.051946.27628@sparky.IMD.Sterling.COM>
- Date: 6 Jan 91 05:19:46 GMT
- Approved: kent@sparky.imd.sterling.com
- X-Checksum-Snefru: 234c2d4f 130d17e8 627683b6 fd09c597
-
- Submitted-by: wht@n4hgf.uucp (Warren Tucker)
- Posting-number: Volume 16, Issue 32
- Archive-name: ecu3/part08
-
- ---- Cut Here and feed the following to sh ----
- #!/bin/sh
- # This is part 08 of ecu3
- if touch 2>&1 | fgrep 'amc' > /dev/null
- then TOUCH=touch
- else TOUCH=true
- fi
- # ============= ecutime.c ==============
- echo 'x - extracting ecutime.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'ecutime.c' &&
- X/*+-------------------------------------------------------------------------
- X ecutime.c -- ecu time-related functions
- X wht@n4hgf.Mt-Park.GA.US
- X
- X Defined functions:
- X epoch_secs_to_str(epoch_secs,type,buf)
- X get_elapsed_time(elapsed_seconds)
- X get_tod(type,buf)
- X
- X--------------------------------------------------------------------------*/
- X/*+:EDITS:*/
- X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
- X
- X#include <sys/types.h>
- X#include <time.h>
- X#include <sys/timeb.h>
- X
- Xstruct tm *gmtime();
- Xstruct tm *localtime();
- X
- X/*+-------------------------------------------------------------------------
- X get_month(zflag) - month 1-12 - zflag true for UTC (Z)), else local time
- X--------------------------------------------------------------------------*/
- Xint
- Xget_month(zflag)
- Xint zflag;
- X{
- Xlong time();
- Xlong epoch_secs = time((long *)0);
- Xstruct tm *tod = (zflag) ? gmtime(&epoch_secs) : localtime(&epoch_secs);
- X return(tod->tm_mon + 1);
- X} /* end of get_month */
- X
- X/*+-------------------------------------------------------------------------
- X get_day(zflag) - day 0-6 - zflag true for UTC (Z)), else local time
- X--------------------------------------------------------------------------*/
- Xint
- Xget_day(zflag)
- Xint zflag;
- X{
- Xlong time();
- Xlong epoch_secs = time((long *)0);
- Xstruct tm *tod = (zflag) ? gmtime(&epoch_secs) : localtime(&epoch_secs);
- X return(tod->tm_wday);
- X} /* end of get_day */
- X
- X/*+-----------------------------------------------------------------------
- X char *epoch_secs_to_str(epoch_secs,type,buf)
- X
- X time of day types:
- X 0 hh:mm
- X 1 hh:mm:ss
- X 2 mm-dd-yyyy hh:mm
- X 3 mm-dd-yyyy hh:mm:ss
- X 4 mm-dd-yyyy hh:mm:ss (UTC hh:mm)
- X 5 mm-dd-yyyy
- X 6 hh:mmZ
- X 7 hh:mm:ssZ
- X 8 mm-dd-yyyy (UTC date)
- X
- X returns 'buf' address
- X
- X------------------------------------------------------------------------*/
- Xchar *
- Xepoch_secs_to_str(epoch_secs,type,buf)
- Xlong epoch_secs;
- Xint type;
- Xchar *buf;
- X{
- Xstruct tm *tod;
- X
- X
- X if(type < 6)
- X tod = localtime(&epoch_secs);
- X else
- X tod = gmtime(&epoch_secs);
- X
- X switch(type)
- X {
- X default:
- X case 6:
- X case 0:
- X sprintf(buf,"%02d:%02d",tod->tm_hour,tod->tm_min);
- X if(type == 6)
- X strcat(buf,"Z");
- X break;
- X
- X case 7:
- X case 1:
- X sprintf(buf,"%02d:%02d:%02d",tod->tm_hour,tod->tm_min,tod->tm_sec);
- X if(type == 7)
- X strcat(buf,"Z");
- X break;
- X
- X case 2:
- X sprintf(buf,"%02d-%02d-%04d %02d:%02d",
- X tod->tm_mon + 1,tod->tm_mday,tod->tm_year + 1900,
- X tod->tm_hour,tod->tm_min);
- X break;
- X
- X case 3:
- X sprintf(buf,"%02d-%02d-%04d %02d:%02d:%02d",
- X tod->tm_mon + 1,tod->tm_mday,tod->tm_year + 1900,
- X tod->tm_hour,tod->tm_min,tod->tm_sec);
- X break;
- X
- X case 4:
- X sprintf(buf,"%02d-%02d-%04d %02d:%02d:%02d",
- X tod->tm_mon + 1,tod->tm_mday,tod->tm_year + 1900,
- X tod->tm_hour,tod->tm_min,tod->tm_sec);
- X tod = gmtime(&epoch_secs);
- X sprintf(&buf[strlen(buf) ]," (UTC %02d:%02d)",
- X tod->tm_hour,tod->tm_min);
- X break;
- X
- X case 8:
- X case 5:
- X sprintf(buf,"%02d-%02d-%04d",
- X tod->tm_mon + 1,tod->tm_mday,tod->tm_year + 1900);
- X break;
- X
- X }
- X
- X return(buf);
- X} /* end of epoch_secs_to_str */
- X
- X/*+-----------------------------------------------------------------------
- X char *get_tod(type,buf)
- X
- X time of day types:
- X 0 hh:mm
- X 1 hh:mm:ss
- X 2 mm-dd-yyyy hh:mm
- X 3 mm-dd-yyyy hh:mm:ss
- X 4 mm-dd-yyyy hh:mm:ss (UTC hh:mm)
- X 5 mm-dd-yyyy
- X 6 hh:mmZ
- X 7 hh:mm:ssZ
- X 8 mm-dd-yyyy (UTC date)
- X
- X returns 'buf' address
- X
- X------------------------------------------------------------------------*/
- Xchar *
- Xget_tod(type,buf)
- Xint type;
- Xchar *buf;
- X{
- Xlong time();
- X return(epoch_secs_to_str(time((long *)0),type,buf));
- X} /* end of get_tod */
- X
- X/*+-----------------------------------------------------------------------
- X char *get_elapsed_time(elapsed_seconds)
- X "hh:mm:ss" returned
- X static string address is returned
- X------------------------------------------------------------------------*/
- Xchar *
- Xget_elapsed_time(elapsed_seconds)
- Xlong elapsed_seconds;
- X{
- Xstatic char elapsed_time_str[40];
- Xlong hh,mm,ss;
- X
- X hh = elapsed_seconds / 3600;
- X elapsed_seconds -= hh * 3600;
- X mm = elapsed_seconds / 60L;
- X elapsed_seconds -= mm * 60L;
- X ss = elapsed_seconds;
- X
- X sprintf(elapsed_time_str,"%02ld:%02ld:%02ld",hh,mm,ss);
- X return(elapsed_time_str);
- X} /* end of get_elapsed_time */
- X
- X/* end of ecutime.c */
- X/* vi: set tabstop=4 shiftwidth=4: */
- SHAR_EOF
- $TOUCH -am 1224223490 'ecutime.c' &&
- chmod 0644 ecutime.c ||
- echo 'restore of ecutime.c failed'
- Wc_c="`wc -c < 'ecutime.c'`"
- test 4253 -eq "$Wc_c" ||
- echo 'ecutime.c: original size 4253, current size' "$Wc_c"
- # ============= ecutty.c ==============
- echo 'x - extracting ecutty.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'ecutty.c' &&
- X/*+-------------------------------------------------------------------------
- X ecutty.c - local tty (console) functions
- X wht@n4hgf.Mt-Park.GA.US
- X
- X Defined functions:
- X _setcolor(clrs)
- X B_to_timeout_msec(c_cflag,st_rdev)
- X color_name_to_num(cname)
- X get_ttymode()
- X get_ttyname()
- X ring_bell()
- X setcolor(new_colors)
- X setcolor_internal(ntokens,tokens)
- X ttyflush(flush_type)
- X ttygetc(xkey_ok)
- X ttygets(str,maxsize,flags)
- X ttygets_esd(tesd,flags,append_flag)
- X ttyinit(param)
- X ttymode(arg)
- X
- X--------------------------------------------------------------------------*/
- X/*+:EDITS:*/
- X/*:12-01-1990-14:33-wht@n4hgf-more non-ansi - fkey mapping with nonansi.c */
- X/*:11-28-1990-15:56-wht@n4hgf-add non-ansi terminal support */
- X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
- X
- X#include "ecu.h"
- X#include "esd.h"
- X#include "ecufkey.h"
- X#include "ecukey.h"
- X#include "ecuxkey.h"
- X#include "ecuerror.h"
- X#include "ecuhangup.h"
- X#include <sys/machdep.h>
- X
- X#define DEFINE_TTY_DATA
- X#include "ecutty.h"
- X
- X/*
- X * mapping table index to internal function code map
- X *
- X * the order of this table depends upon the pseudo-magic
- X * KDEk_.. codes defined in ecufkey.h
- X */
- Xuchar KDEk_to_XF[] =
- X{
- X XF1, /* KDEk_F1 */
- X XF2, /* KDEk_F2 */
- X XF3, /* KDEk_F3 */
- X XF4, /* KDEk_F4 */
- X XF5, /* KDEk_F5 */
- X XF6, /* KDEk_F6 */
- X XF7, /* KDEk_F7 */
- X XF8, /* KDEk_F8 */
- X XF9, /* KDEk_F9 */
- X XF10, /* KDEk_F10 */
- X XF11, /* KDEk_F11 */
- X XF12, /* KDEk_F12 */
- X XFcurup, /* KDEk_CUU */
- X XFcurdn, /* KDEk_CUD */
- X XFcurlf, /* KDEk_CUL */
- X XFcurrt, /* KDEk_CUR */
- X XFcur5, /* KDEk_CU5 */
- X XFpgup, /* KDEk_PGUP */
- X XFpgdn, /* KDEk_PGDN */
- X XFend, /* KDEk_END */
- X XFins, /* KDEk_INS */
- X XFbktab, /* KDEk_BKTAB */
- X XFhome /* KDEk_HOME */
- X};
- X
- Xstatic char *dole_out_rd_char = (char *)0;
- X
- Xextern int interrupt;
- Xextern uint tcap_LINES;
- Xextern uint tcap_COLS;
- Xextern int LINES;
- Xextern int COLS;
- X
- Xuint LINESxCOLS;
- Xint current_ttymode = 0;
- Xint tty_is_ansi;
- Xint tty_is_multiscreen;
- X
- Xstruct termio tty_termio_at_entry;
- Xstruct termio tty_termio_current;
- Xstruct stat tty_stat;
- Xstruct stat dn;
- Xstruct stat tty01;
- Xstruct stat ttyp0;
- Xstruct stat console;
- X
- Xuchar kbdeof; /* current input EOF */
- Xuchar kbdeol2; /* current secondary input EOL */
- Xuchar kbdeol; /* current input EOL */
- Xuchar kbderase; /* current input ERASE */
- Xuchar kbdintr; /* current input INTR */
- Xuchar kbdkill; /* current input KILL */
- Xuchar kbdquit; /* current input QUIT */
- Xint echo_erase_char; /* save users ECHOE bit */
- Xint echo_kill_char; /* save users ECHOK bit */
- Xchar kbd_is_7bit; /* keyboard has parity */
- Xlong TOmsec = 20L; /* timeout on waiting for char after ESC */
- X
- Xulong colors_current = 0x04070A00L;
- Xulong colors_normal = 0x04070A00L; /* lt_green/black red/white */
- Xulong colors_success = 0x07000A00L; /* lt_green/black red/white */
- Xulong colors_alert = 0x0E000E00L; /* yellow */
- Xulong colors_error = 0x04000400L; /* red */
- Xulong colors_notify = 0x08000800L; /* gray */
- X
- Xint use_colors = 0; /* set by ttyinit, but default no */
- Xint tty_not_char_special;
- X
- Xextern char screen_dump_file_name[];
- X
- X/*+-------------------------------------------------------------------------
- X B_to_timeout_msec(c_cflag,st_rdev) - CBAUD code to ESC timeout msec
- X--------------------------------------------------------------------------*/
- Xlong
- XB_to_timeout_msec(c_cflag,st_rdev)
- Xushort c_cflag;
- Xushort st_rdev;
- X{
- Xlong ms = 0L;
- X
- X /* if multiscreen, 20 msec is pu-lenty */
- X
- X if(((st_rdev & 0xFF00) == (tty01.st_rdev & 0xFF00)) ||
- X ((st_rdev & 0xFF00) == (console.st_rdev & 0xFF00)) )
- X {
- X return(20L);
- X }
- X
- X /* baud rate fiddling */
- X
- X switch(c_cflag & CBAUD)
- X {
- X /* char times * time/char */
- X case B110: ms = 3 * 100;
- X case B300: ms = 3 * 33;
- X case B600: ms = 3 * 16;
- X case B1200: ms = 3 * 8;
- X case B2400: ms = 3 * 4;
- X case B4800: ms = 8 * 2;
- X case B9600: ms = 8 * 1;
- X case EXTA: ms = 8 * 1;
- X case EXTB: ms = 8 * 1;
- X }
- X
- X
- X /* make network/xterm/pty sweat, but don't make as many mistakes */
- X
- X if(((st_rdev & 0xFF00) == (ttyp0.st_rdev & 0xFF00)) && (ms < 80L))
- X ms = 80L;
- X else if(ms < 20L) /* enforce minimum time for obvious reasons + */
- X ms = 20L; /* make sure we don't incur the UNIX nap() bug */
- X
- X return(ms);
- X
- X} /* end of B_to_timeout_msec */
- X
- X/*+-------------------------------------------------------------------------
- X color_name_to_num(cname)
- X--------------------------------------------------------------------------*/
- Xint
- Xcolor_name_to_num(cname)
- Xchar *cname;
- X{
- Xregister COLOR *color = colors;
- Xregister itmp;
- X
- X while(color->name)
- X {
- X if((itmp = strcmp(color->name,cname)) > 0)
- X return(-1);
- X if(!itmp)
- X return(color->num);
- X color++;
- X }
- X return(-1);
- X
- X} /* end of color_name_to_num */
- X
- X/*+-------------------------------------------------------------------------
- X _setcolor(clrs)
- X--------------------------------------------------------------------------*/
- Xvoid
- X_setcolor(clrs)
- Xulong clrs;
- X{
- X if(!use_colors || tty_not_char_special)
- X return;
- X
- X /* normal */
- X ff(se,"\033[=%ldF\033[=%ldG",(clrs >> 8) & 0xFF,clrs & 0xFF);
- X
- X /* reverse */
- X ff(se,"\033[=%ldH\033[=%ldI",(clrs >> 24) & 0xFF,(clrs >> 16) & 0xFF);
- X
- X colors_current = clrs;
- X
- X} /* end of _setcolor */
- X
- X/*+-------------------------------------------------------------------------
- X setcolor(new_colors)
- X
- Xrequires termcap init to have been done
- X--------------------------------------------------------------------------*/
- Xvoid
- Xsetcolor(new_colors)
- Xulong new_colors;
- X{
- X if(tty_not_char_special)
- X return;
- X
- X if(!use_colors)
- X {
- X if((new_colors == colors_notify) || (new_colors == colors_alert) ||
- X (new_colors == colors_error))
- X {
- X tcap_stand_out();
- X }
- X else
- X tcap_stand_end();
- X return;
- X }
- X _setcolor(new_colors);
- X tcap_stand_end();
- X
- X} /* end of setcolor */
- X
- X/*+-------------------------------------------------------------------------
- X setcolor_internal(ntokens,tokens)
- X
- Xreturns 0 on success, else token number in error + 1
- X--------------------------------------------------------------------------*/
- Xint
- Xsetcolor_internal(ntokens,tokens)
- Xint ntokens;
- Xchar **tokens;
- X{
- Xulong fgnd;
- Xulong bgnd;
- X
- X if(tty_not_char_special || !use_colors)
- X return(0);
- X
- X if(ntokens == 2)
- X tokens[2] = "black";
- X
- X if((fgnd = (ulong)color_name_to_num(tokens[1])) > 15)
- X return(2);
- X if((bgnd = (ulong)color_name_to_num(tokens[2])) > 15)
- X return(3);
- X
- X if(!strcmp(tokens[0],"normal"))
- X {
- X colors_normal &= 0xFFFF0000L;
- X colors_normal |= (fgnd << 8) | bgnd;
- X setcolor(colors_normal);
- X }
- X else if(!strcmp(tokens[0],"reverse"))
- X {
- X colors_normal &= 0x0000FFFFL;
- X colors_normal |= (fgnd << 24) | (bgnd << 16);
- X setcolor(colors_normal);
- X }
- X else if(!strcmp(tokens[0],"notify"))
- X colors_notify = (fgnd << 24) | (bgnd << 16) | (fgnd << 8) | bgnd;
- X else if(!strcmp(tokens[0],"success"))
- X colors_success = (fgnd << 24) | (bgnd << 16) | (fgnd << 8) | bgnd;
- X else if(!strcmp(tokens[0],"alert"))
- X colors_alert = (fgnd << 24) | (bgnd << 16) | (fgnd << 8) | bgnd;
- X else if(!strcmp(tokens[0],"error"))
- X colors_error = (fgnd << 24) | (bgnd << 16) | (fgnd << 8) | bgnd;
- X else
- X return(1);
- X
- X return(0);
- X
- X} /* end of setcolor_internal */
- X
- X/*+-------------------------------------------------------------------------
- X read_colors_file()
- X--------------------------------------------------------------------------*/
- Xvoid
- Xread_colors_file()
- X{
- XFILE *fp;
- Xchar s128[128];
- X#define MAX_COLOR_TOKENS 6
- Xchar *tokens[MAX_COLOR_TOKENS];
- Xint ntokens;
- Xchar *cptr;
- Xint itmp;
- X
- X if(tty_not_char_special)
- X return;
- X
- X get_home_dir(s128);
- X strcat(s128,"/.ecu/colors");
- X if(access(s128,4))
- X return;
- X
- X fp = fopen(s128,"r");
- X
- X while(fgets(s128,sizeof(s128),fp))
- X {
- X if(s128[0] == '#') /* comment? */
- X continue;
- X if(itmp = strlen(s128)) /* itmp = len; if > 0 ... */
- X {
- X itmp--;
- X s128[itmp] = 0; /* ... strip trailing NL */
- X }
- X cptr = s128; /* first call to str_token, -> buff */
- X while((*cptr == 0x20) || (*cptr == TAB))
- X cptr++; /* strip leading spaces */
- X if(*cptr == 0) /* if line all blank, skip it */
- X continue;
- X
- X build_str_array(s128,tokens,MAX_COLOR_TOKENS,&ntokens);
- X if(ntokens < 2)
- X continue;
- X
- X setcolor_internal(ntokens,tokens);
- X
- X } /* while records left to ready */
- X fclose(fp);
- X} /* end of read_colors_file */
- X
- X/*+-------------------------------------------------------------------------
- X ring_bell()
- X--------------------------------------------------------------------------*/
- Xvoid
- Xring_bell()
- X{
- X if(tty_not_char_special)
- X return;
- X
- X fputc(7,se);
- X} /* end of ring_bell */
- X
- X/*+-------------------------------------------------------------------------
- X ttyinit(param)
- X--------------------------------------------------------------------------*/
- Xvoid
- Xttyinit(param)
- Xuchar param;
- X{
- Xint itmp;
- Xint monitor_type;
- Xchar *cptr;
- X
- X interrupt = 0; /* see xmtr signal handlers */
- X
- X memset((char *)&ttyp0,0xFF,sizeof(struct stat));
- X memset((char *)&console,0xFF,sizeof(struct stat));
- X stat("/dev/null",&dn);
- X stat("/dev/tty01",&tty01);
- X stat("/dev/ttyp0",&ttyp0);
- X stat("/dev/console",&console);
- X
- X if(fstat(TTYIN,&tty_stat) || ((tty_stat.st_mode & S_IFMT) != S_IFCHR) ||
- X ((dn.st_ino == tty_stat.st_ino) && (dn.st_rdev == tty_stat.st_rdev)))
- X {
- X tcap_LINES = LINES = 25; /* fake necessary termcap/curses vars */
- X tcap_COLS = COLS = 80;
- X LINESxCOLS = tcap_LINES * tcap_COLS;
- X
- X tty_not_char_special = 1;
- X tty_is_ansi = (param == TTYINIT_FORCE_ANSI);
- X tty_is_multiscreen = 0;
- X return;
- X }
- X
- X /* save initial tty state */
- X ioctl(TTYIN,TCGETA,(char *)&tty_termio_at_entry);
- X TOmsec = B_to_timeout_msec(tty_termio_at_entry.c_cflag,tty_stat.st_rdev);
- X
- X kbdintr = (tty_termio_at_entry.c_cc[VINTR])
- X ? (tty_termio_at_entry.c_cc[VINTR] & 0x7F) : '\377';
- X kbdquit = (tty_termio_at_entry.c_cc[VQUIT])
- X ? (tty_termio_at_entry.c_cc[VQUIT] & 0x7F) : '\377';
- X kbderase = (tty_termio_at_entry.c_cc[VERASE])
- X ? (tty_termio_at_entry.c_cc[VERASE] & 0x7F) : '\377';
- X kbdkill = (tty_termio_at_entry.c_cc[VKILL])
- X ? (tty_termio_at_entry.c_cc[VKILL] & 0x7F) : '\377';
- X kbdeof = (tty_termio_at_entry.c_cc[VEOF])
- X ? (tty_termio_at_entry.c_cc[VEOF] & 0x7F) : '\04';
- X kbdeol2 = (tty_termio_at_entry.c_cc[VEOL])
- X ? (tty_termio_at_entry.c_cc[VEOL] & 0x7F) : '\377';
- X kbdeol = (tty_termio_at_entry.c_iflag & ICRNL)
- X ? '\r' : '\n';
- X
- X kbd_is_7bit = ((tty_termio_at_entry.c_cflag & PARENB) != 0);
- X echo_erase_char = tty_termio_at_entry.c_lflag & ECHOE;
- X echo_kill_char = tty_termio_at_entry.c_lflag & ECHOK;
- X tty_termio_current = tty_termio_at_entry;
- X current_ttymode = 0;
- X
- X get_home_dir(screen_dump_file_name);
- X strcat(screen_dump_file_name,"/.ecu/screen.dump");
- X
- X cptr = (char *)0;
- X if(param)
- X tty_is_ansi = (param == TTYINIT_FORCE_ANSI);
- X else
- X tty_is_ansi = ((cptr = getenv("TERM")) && (ulindex(cptr,"ansi") != -1));
- X
- X if(!tty_is_ansi && cptr)
- X nonansi_key_read(cptr);
- X
- X/* initialize termcap */
- X tcap_init(); /* read termcap strings */
- X
- X/* yetch - magic number gretching for lines and columns */
- X if((tcap_LINES < 16) || (tcap_LINES > 43))
- X {
- X ff(se,"terminal height must be >= 16 and <= 43 lines.\r\n");
- X hangup(HANGUP_USAGE);
- X }
- X if(tcap_COLS != 80)
- X {
- X ff(se,"terminal width must be 80 columns.\r\n");
- X hangup(HANGUP_USAGE);
- X }
- X if(!tcap_LINES || !tcap_COLS)
- X {
- X tcap_LINES = 25;
- X tcap_COLS = 80;
- X }
- X if(tcap_LINES > 43)
- X tcap_LINES = 43;
- X if(tcap_COLS > 80)
- X tcap_COLS = 80;
- X LINESxCOLS = tcap_LINES * tcap_COLS;
- X
- X /*
- X * use color if we are on a multiscreen and video supports it
- X * also, remember whether or not we are on a multiscreen
- X * (I ain't proud of this beyond being a valiant attempt)
- X */
- X tty_is_multiscreen =
- X ((tty_stat.st_rdev & 0xFF00) == (tty01.st_rdev & 0xFF00)) ||
- X ((tty_stat.st_rdev & 0xFF00) == (console.st_rdev & 0xFF00));
- X use_colors = 0;
- X itmp = 0;
- X if(tty_is_multiscreen &&
- X ((itmp = ioctl(TTYIN,CONS_GET,&monitor_type)) >= 0) &&
- X (use_colors = (monitor_type != MONO)))
- X {
- X read_colors_file();
- X setcolor(colors_normal);
- X }
- X if(itmp < 0)
- X tty_is_multiscreen = 0;
- X
- X} /* end of ttyinit */
- X
- X/*+-----------------------------------------------------------------------
- X ttymode(arg) -- control user console (kbd/screen)
- X
- X Where arg ==
- X 0 restore attributes saved at start of execution
- X 1 raw mode (send xon/xoff, but do not respond to it, no ISIG/SIGINT)
- X 2 raw mode (same as 1 but allow keyboard interrupts)
- X 3 attributes at start of execution, but with echo disabled and no parity
- X
- X------------------------------------------------------------------------*/
- Xvoid
- Xttymode(arg)
- X{
- X if(tty_not_char_special)
- X return;
- X
- X if(arg == 0)
- X {
- X ioctl(TTYIN,TCSETAW,(char *)&tty_termio_at_entry);
- X tty_termio_current = tty_termio_at_entry;
- X current_ttymode = 0;
- X }
- X else if((arg == 1) || (arg == 2))
- X {
- X tty_termio_current = tty_termio_at_entry;
- X
- X tty_termio_current.c_cflag &= ~(PARENB | PARODD);
- X tty_termio_current.c_cflag |= CS8;
- X
- X /* don't want to honor tty xon/xoff, but pass to other end */
- X tty_termio_current.c_iflag &=
- X ~(INLCR | ICRNL | IGNCR | IXON | IUCLC | ISTRIP);
- X tty_termio_current.c_iflag |= IXOFF; /* this end will xon/xoff */
- X
- X tty_termio_current.c_oflag |= OPOST;
- X tty_termio_current.c_oflag &= ~(OLCUC | ONLCR | OCRNL | ONOCR | ONLRET);
- X
- X tty_termio_current.c_lflag &= ~(ICANON | ISIG | ECHO);
- X if(arg == 2)
- X tty_termio_current.c_lflag |= ISIG;
- X
- X tty_termio_current.c_cc[VMIN] = 1;
- X tty_termio_current.c_cc[VTIME] = 0;
- X
- X ioctl(TTYIN,TCSETAW,(char *)&tty_termio_current);
- X current_ttymode = arg;
- X }
- X else if(arg == 3)
- X {
- X tty_termio_current = tty_termio_at_entry;
- X tty_termio_current.c_cflag &= ~(PARENB | PARODD);
- X tty_termio_current.c_cflag |= CS8;
- X tty_termio_current.c_iflag &= ~(ISTRIP);
- X tty_termio_current.c_lflag &= ~(ICANON | ISIG | ECHO);
- X ioctl(TTYIN,TCSETAW,(char *)&tty_termio_current);
- X current_ttymode = 3;
- X }
- X} /* end of ttymode */
- X
- X/*+-------------------------------------------------------------------------
- X int get_ttymode()
- X--------------------------------------------------------------------------*/
- Xint
- Xget_ttymode()
- X{
- X return(current_ttymode);
- X} /* end of get_ttymode */
- X
- X/*+-----------------------------------------------------------------------
- X ttyflush(flush_type) -- flush tty driver input &/or output buffers
- X
- X0 == input buffer
- X1 == output buffer
- X2 == both buffers
- X------------------------------------------------------------------------*/
- Xvoid
- Xttyflush(flush_type)
- Xint flush_type;
- X{
- X if(tty_not_char_special)
- X return;
- X
- X ioctl(TTYIN,TCXONC,(char *)0); /* stop tty output */
- X
- X#if !defined(M_I286)
- X ioctl(TTYIN,TCFLSH,(char *)flush_type);
- X#else
- X /* avoid 286 compiler warning of cast int to far ptr */
- X switch(flush_type)
- X {
- X case 0:
- X ioctl(TTYIN,TCFLSH,(char *)0); break;
- X case 1:
- X ioctl(TTYIN,TCFLSH,(char *)1); break;
- X case 2:
- X ioctl(TTYIN,TCFLSH,(char *)2); break;
- X }
- X#endif
- X
- X ioctl(TTYIN,TCXONC,(char *)1); /* restart tty output */
- X
- X#if defined(M_XENIX) || defined(M_UNIX)
- X dole_out_rd_char = (char *)0; /* see ttygetc() */
- X#endif
- X
- X} /* end of ttyflush */
- X
- X/*+-------------------------------------------------------------------------
- X ttygetc(xkey_ok) -- get a key from the keyboard
- Xif UNIX or XENIX, map extended keys to sign-bit-set special value
- Xif xkey_ok is 0, disallow extended keys
- X--------------------------------------------------------------------------*/
- Xuint
- Xttygetc(xkey_ok)
- Xint xkey_ok;
- X{
- Xuchar ctmp;
- Xextern int errno;
- Xregister uint itmp = 0;
- Xstatic uchar rd_char[16];
- Xuchar map_nonansi_key();
- X
- X if(tty_not_char_special)
- X {
- X rd_char[0] = 0;
- X read(0,rd_char,1);
- X return((uint)rd_char[0]);
- X }
- X
- X if(dole_out_rd_char) /* handle (very unlikely) FAST typist */
- X {
- X if(itmp = *dole_out_rd_char++)
- X return(itmp);
- X else
- X dole_out_rd_char = (char *)0;
- X }
- X
- XGET_KEY:
- X errno = 0;
- X if(read(TTYIN,&ctmp,1) < 0)
- X {
- X if(errno == EINTR)
- X goto GET_KEY;
- X perror_errmsg("keyboard");
- X hangup(HANGUP_TTYIN_READ_ERROR);
- X }
- X
- X if(kbd_is_7bit)
- X ctmp &= 0x7F;
- X
- X if(tty_is_ansi && (ctmp == ESC)) /* if escape from ansi terminal */
- X {
- X itmp = 0;
- X nap(TOmsec);
- X while((!isalpha(ctmp)) && (itmp < sizeof(rd_char) - 1))
- X {
- X if(rdchk(0) <= 0)
- X break;
- X read(TTYIN,&ctmp,1);
- X if(kbd_is_7bit)
- X ctmp &= 0x7F;
- X if(itmp == (sizeof(rd_char) - 1)) /* do not allow overflow */
- X break;
- X rd_char[itmp++] = ctmp;
- X nap(TOmsec);
- X }
- X rd_char[itmp] = 0;
- X if(!itmp) /* no subsequent chars, so ... */
- X return(ESC); /* return the escape */
- X else if((itmp == 2) && (rd_char[0] == '['))
- X {
- X switch(rd_char[1] | 0x80)
- X {
- X case XFcur5:
- X screen_dump(screen_dump_file_name);
- X goto GET_KEY;
- X case XFcurup: case XFcurdn: case XFcurrt: case XFcurlf:
- X case XFend: case XFpgdn: case XFhome: case XFpgup: case XFins:
- X case XF1: case XF2: case XF3: case XF4: case XF5: case XF6:
- X case XF7: case XF8: case XF9: case XF10: case XF11: case XF12:
- X case XFbktab:
- X if(xkey_ok)
- X return(rd_char[1] | 0x80);
- X /* fall thru -- xkey not allowed */
- X default:
- X ring_bell();
- X goto GET_KEY;
- X }
- X /*NOTREACHED*/
- X }
- X /* not func key -- we have a FAST typist */
- X dole_out_rd_char = rd_char;
- X return(ESC);
- X }
- X else if(!tty_is_ansi && (ctmp >= 0x01) && (ctmp <= 0x1F) &&
- X (ctmp != kbderase) && (ctmp != kbdkill) &&
- X (ctmp != kbdeol) && (ctmp != kbdeol2) &&
- X (ctmp != kbdintr) && (ctmp != kbdeof) )
- X {
- X rd_char[0] = ctmp;
- X rd_char[itmp = 1] = 0;
- X nap(TOmsec);
- X while((ctmp = map_nonansi_key(rd_char,itmp)) == 255)
- X {
- X
- X if(rdchk(0) <= 0)
- X break;
- X read(TTYIN,&ctmp,1);
- X if(kbd_is_7bit)
- X ctmp &= 0x7F;
- X if(itmp == (sizeof(rd_char) - 1)) /* do not allow overflow */
- X break;
- X rd_char[itmp++] = ctmp;
- X nap(TOmsec);
- X }
- X rd_char[itmp] = 0;
- X if((ctmp == 255) && (itmp == 1))
- X return(rd_char[0]);
- X else if(ctmp != 255) /* if we got a map */
- X {
- X if(!xkey_ok)
- X {
- X ring_bell();
- X goto GET_KEY;
- X }
- X switch(ctmp)
- X {
- X case KDEk_CU5:
- X screen_dump(screen_dump_file_name);
- X goto GET_KEY;
- X default:
- X return(KDEk_to_XF[ctmp]);
- X }
- X /*NOTREACHED*/
- X }
- X /* not func key -- we have a FAST typist */
- X dole_out_rd_char = rd_char;
- X return(ctmp);
- X }
- X return(ctmp);
- X} /* end if ttygetc */
- X
- X/*+-----------------------------------------------------------------------
- X ttygets(str,maxsize,flags)
- X
- Xflags & 1 - echo cr/lf terminator
- Xflags & 2 - extended delimiter set (Home, End, PgUp, PgDn, CurUp, CurDn)
- Xflags & 4 - redisplay/edit current string
- X------------------------------------------------------------------------*/
- Xvoid
- Xttygets(str,maxsize,flags)
- Xregister char *str;
- Xint maxsize;
- Xint flags;
- X{
- Xregister inch;
- Xregister strcount = 0;
- Xregister strpos = 0;
- Xint insert_mode = 0;
- X
- X --maxsize; /* decrement for safety */
- X
- X if(flags & 4)
- X {
- X strpos = strcount = strlen(str);
- X fputs(str,se);
- X }
- X
- X while(1)
- X {
- X inch = ttygetc(1);
- X if((inch == kbdintr) || (inch == ESC))
- X {
- X tcap_curright(strcount - strpos);
- X while(strcount)
- X {
- X fputc(BS,se);
- X fputc(SPACE,se);
- X fputc(BS,se);
- X strcount--;
- X }
- X *str = ESC;
- X *(str + 1) = 0;
- X return;
- X }
- X else if(inch == kbdkill)
- X {
- X tcap_curright(strcount - strpos);
- X while(strcount)
- X {
- X fputc(BS,se);
- X fputc(SPACE,se);
- X fputc(BS,se);
- X strcount--;
- X }
- X strpos = 0;
- X *str = 0;
- X continue;
- X }
- X else if(inch == kbderase)
- X {
- X if(strcount)
- X {
- X if(strcount == strpos)
- X {
- X fputc(BS,se);
- X fputc(SPACE,se);
- X fputc(BS,se);
- X strcount--,strpos--;
- X }
- X else
- X {
- X if(!strpos)
- X continue;
- X mem_cpy(str + strpos - 1,str + strpos,strcount - strpos);
- X fputc(BS,se);
- X str[--strcount] = 0;
- X strpos--;
- X fputs(str + strpos,se);
- X fputc(' ',se);
- X tcap_curleft(strcount - strpos + 1);
- X }
- X }
- X str[strcount] = 0;
- X continue;
- X }
- X else if(inch == XFins)
- X {
- X insert_mode = !insert_mode;
- X continue;
- X }
- X else if(inch == XFcurlf)
- X {
- X if(strpos)
- X {
- X strpos--;
- X tcap_curleft(1);
- X }
- X continue;
- X }
- X else if(inch == XFcurrt)
- X {
- X if(strpos < strcount)
- X {
- X strpos++;
- X tcap_curright(1);
- X }
- X continue;
- X }
- X
- X if(flags & 2) /* extended delimiter */
- X {
- X switch(inch)
- X {
- X case XFhome:
- X case XFend:
- X case XFpgup:
- X case XFpgdn:
- X case XFcurup:
- X case XFcurdn:
- X tcap_curright(strcount - strpos);
- X while(strcount)
- X {
- X fputc(BS,se);
- X fputc(SPACE,se);
- X fputc(BS,se);
- X strcount--;
- X }
- X *str = inch;
- X *(str + 1) = 0;
- X return;
- X }
- X }
- X
- X switch(inch)
- X {
- X case CR:
- X case NL:
- X str[strcount] = 0;
- X tcap_curright(strcount - strpos);
- X if((flags & 1))
- X ff(se,"\r\n");
- X return;
- X
- X case CTL_L:
- X case CTL_R:
- X tcap_curright(strcount - strpos);
- X ff(se,"%s (insert mode %s)\r\n",make_char_graphic(inch,0),
- X (insert_mode) ? "ON" : "OFF");
- X tcap_eeol();
- X fputs(str,se);
- X tcap_curleft(strcount - strpos);
- X break;
- X
- X default:
- X if((inch < SPACE) || (inch >= 0x7F))
- X {
- X ring_bell();
- X break;
- X }
- X if(strpos == strcount)
- X {
- X if(strcount == maxsize)
- X {
- X ring_bell();
- X break;
- X }
- X str[strcount++] = inch & 0x7F;
- X strpos++;
- X fputc(inch,se);
- X }
- X else
- X {
- X if(insert_mode)
- X {
- X if(strcount == maxsize)
- X {
- X ring_bell();
- X break;
- X }
- X mem_cpy(str+strpos+1,str+strpos,strcount-strpos);
- X str[strpos] = inch;
- X strcount++;
- X str[strcount] = 0;
- X fputs(str + strpos++,se);
- X tcap_curleft(strcount - strpos);
- X }
- X else
- X {
- X str[strpos++] = inch;
- X fputc(inch,se);
- X }
- X }
- X str[strcount] = 0;
- X break;
- X }
- X } /* end of while we have room left in string */
- X
- X} /* end of ttygets() */
- X
- X/*+-------------------------------------------------------------------------
- X ttygets_esd(tesd,flags,append_flag)
- X--------------------------------------------------------------------------*/
- Xttygets_esd(tesd,flags,append_flag)
- XESD *tesd;
- Xint flags;
- Xint append_flag;
- X{
- Xchar *pb = tesd->pb;
- Xint maxcb = tesd->maxcb;
- X
- X if(append_flag)
- X {
- X pb += tesd->cb;
- X maxcb -= tesd->cb;
- X }
- X else
- X {
- X pb = tesd->pb;
- X maxcb = tesd->maxcb;
- X tesd->cb = 0;
- X }
- X
- X ttygets(pb,maxcb,flags);
- X
- X if(*pb == ESC)
- X {
- X if(!append_flag)
- X zero_esd(tesd);
- X return(eProcAttn_ESCAPE);
- X }
- X
- X tesd->cb = strlen(tesd->pb);
- X plogs(pb);
- X if(flags & 1)
- X plogc(NL);
- X return(0);
- X
- X} /* end of ttygets_esd */
- X
- X/*+-------------------------------------------------------------------------
- X char *get_ttyname() - return pointer to static string
- X
- XThis routine is largely a crock and is likely to explode at any rev or twist
- X--------------------------------------------------------------------------*/
- Xchar *
- Xget_ttyname()
- X{
- X#ifndef OLD_WAY
- Xchar *ttyname();
- X return(ttyname(TTYIN));
- X#else
- Xstatic char ttname[64];
- Xregister unsigned int rdev;
- Xregister char *cptr;
- X
- X if(tty_not_char_special)
- X return("stdin");
- X else if(!tty_is_multiscreen)
- X return("non-multiscreen");
- X
- X rdev = (unsigned)tty_stat.st_rdev;
- X if(rdev == 0x0301)
- X strcpy(ttname,"/dev/console");
- X#if defined(M_UNIX)
- X else if(rdev == 0x0000)
- X strcpy(ttname,"/dev/syscon");
- X#endif
- X else
- X {
- X strcpy(ttname,"/dev/tty");
- X cptr = ttname + 8;
- X
- X if(rdev < 0x000C)
- X {
- X *cptr++ = '0' + ((rdev + 1) / 10);
- X *cptr++ = '0' + ((rdev + 1) % 10);
- X }
- X else if(!(rdev & ~0x58F))
- X {
- X *cptr++ = (rdev & 0x0008) ? '2' : '1';
- X *cptr++ = ((rdev & 0x0080) ? 'A' : 'a') + (rdev & 0x0007);
- X }
- X else
- X {
- X *cptr++ = '?';
- X *cptr++ = '?';
- X }
- X *cptr = 0;
- X }
- X
- X return(ttname);
- X#endif
- X} /* end of get_ttyname */
- X
- X/* end of ecutty.c */
- X/* vi: set tabstop=4 shiftwidth=4: */
- SHAR_EOF
- $TOUCH -am 1224223490 'ecutty.c' &&
- chmod 0644 ecutty.c ||
- echo 'restore of ecutty.c failed'
- Wc_c="`wc -c < 'ecutty.c'`"
- test 23288 -eq "$Wc_c" ||
- echo 'ecutty.c: original size 23288, current size' "$Wc_c"
- # ============= ecuuclc.c ==============
- echo 'x - extracting ecuuclc.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'ecuuclc.c' &&
- X/*+-----------------------------------------------------------------------
- X ecuuclc.c - uuper/lower-case string functions
- X wht@n4hgf.Mt-Park.GA.US
- X
- X Defined functions:
- X minunique(str1,str2,minquan)
- X to_lower(ch)
- X to_upper(ch)
- X ulcmpb(str1,str2)
- X ulindex(str1,str2)
- X ulrindex(str1,str2)
- X
- X------------------------------------------------------------------------*/
- X/*+:EDITS:*/
- X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
- X
- 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 ulindex: Upper/Lower [case insensitive] Index function
- X
- X Returns position of 'str2' in 'str1' if found
- X If 'str2' is null, then 0 is returned (null matches anything)
- X Returns -1 if not found
- X
- X uses 'ulcmpb'
- X--------------------------------------------------------------------------*/
- Xint
- Xulindex(str1,str2)
- Xregister char *str1; /* the (target) string to search */
- Xregister char *str2; /* the (comparand) string to search for */
- X{
- Xregister istr1 = 0; /* moving index into str1 */
- Xregister char *mstr = str1; /* moving string pointer */
- X
- X if(str2[0] == '\0') /* null string matches anything */
- X return(0);
- X if(strlen(str2) > strlen(str1))
- X return(-1);
- X while(1)
- X {
- X if(*mstr == '\0') /* if we exhaust target string, flunk */
- X return(-1);
- X /* Can we find either case of first comparand char in target? */
- X if( to_upper(*mstr) == to_upper(str2[0]) )
- X {
- X /* we have a first char match... does rest of string match? */
- X if(ulcmpb(mstr,str2) == -1) /* if the rest matches, ... */
- X return(istr1); /* ... return match position */
- X }
- X /* we did not match this time... increment istr1, mstr and try again */
- X ++istr1;
- X ++mstr;
- X }
- X} /* end of ulindex */
- X
- X/*+-------------------------------------------------------------------------
- X ulrindex: Upper/Lower [case insensitive] Right Index function
- X
- X Returns position of 'str2' in 'str1' if found
- X Returns -1 if not found
- X If 'str2' is null, then -1 is returned
- X
- X uses 'ulcmpb'
- X--------------------------------------------------------------------------*/
- Xint
- Xulrindex(str1,str2)
- Xregister char *str1; /* the (target) string to search */
- Xregister char *str2; /* the (comparand) string to search for */
- X{
- Xregister char *mstr;
- Xregister istr1;
- X
- X if(!str2[0]) /* null string matches anything */
- X return(-1);
- X if(strlen(str2) > strlen(str1))
- X return(-1);
- X
- X mstr = str1 + strlen(str1) - strlen(str2); /* moving string pointer */
- X istr1 = mstr - str1; /* moving index into str1 */
- X
- X while(mstr >= str1)
- X {
- X /* Can we find either case of first comparand char in target? */
- X if( to_upper(*mstr) == to_upper(str2[0]) )
- X {
- X /* we have a first char match... does rest of string match? */
- X if(ulcmpb(mstr,str2) == -1) /* if the rest matches, ... */
- X return(istr1); /* ... return match position */
- X }
- X /* we did not match this time... increment istr1, mstr and try again */
- X --istr1;
- X --mstr;
- X }
- X return(-1);
- X} /* end of ulrindex */
- X
- X/*+----------------------------------------------------------------
- X minunique(str1,str2,minquan)
- X
- X Returns 1 if at least 'minquan' chars of str2 match
- X str1 and there are no chars after the minimum unique
- X chars which do not match str1. Returns 0 on failure.
- X-----------------------------------------------------------------*/
- Xint
- Xminunique(str1,str2,minquan)
- Xregister char *str1;
- Xregister char *str2;
- Xregister minquan;
- X{
- Xregister index;
- X
- X if(strlen(str2) < minquan)
- X return(0);
- X
- X index = ulcmpb(str1,str2);
- X if(index < 0)
- X return(1);
- X
- X if(index < minquan)
- X return(0);
- X if(index < strlen(str2))
- X return(0);
- X
- X return(1);
- X
- X} /* end of minunique */
- X/* vi: set tabstop=4 shiftwidth=4: */
- SHAR_EOF
- $TOUCH -am 1224223590 'ecuuclc.c' &&
- chmod 0644 ecuuclc.c ||
- echo 'restore of ecuuclc.c failed'
- Wc_c="`wc -c < 'ecuuclc.c'`"
- test 5623 -eq "$Wc_c" ||
- echo 'ecuuclc.c: original size 5623, current size' "$Wc_c"
- # ============= ecuusage.c ==============
- echo 'x - extracting ecuusage.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'ecuusage.c' &&
- X/*+-----------------------------------------------------------------------
- X ecuusage.c - user admonishment
- X wht@n4hgf.Mt-Park.GA.US
- X
- X Defined functions:
- X general_usage(uptr)
- X log_cmd_usage()
- X usage()
- X
- X------------------------------------------------------------------------*/
- X/*+:EDITS:*/
- X/*:08-14-1990-20:40-wht@n4hgf-ecu3.00-flush old edit history */
- X
- X#include <stdio.h>
- X#include "ecuhangup.h"
- X#define ff fprintf
- X#define se stderr
- X
- Xextern char *makedate; /* temporary make date */
- Xextern char *numeric_revision; /* ecunumrev.c */
- Xextern char *revision_modifier; /* ecunumrev.c */
- X
- Xchar *usage_text[] =
- X{
- X"usage: ecu [-l /dev/tty<ttynum>] [-b <baud_rate>] [-e] [-o] [-d]\r\n",
- X" [-c <filename>] [-h] [-k] [-t] [-v[vv...]]\r\n",
- X" [-p <initial_proc> | <phone_number>]\r\n",
- X"Default: 2400,N,8 (use -e for even parity, -o for odd 7 data bits)\r\n",
- X"-c <filename> use this file rather than ~/.ecumodem\r\n",
- X"-h half duplex ... default is full duplex\r\n",
- X"-v verbosity ... the more 'v's the more verbosity.\r\n",
- X"-d stop execution if -p initial procedure fails\r\n",
- X"-D unconditionally stop execution when -p initial procedure is done\r\n",
- X"\r\n",
- X"For a list of built in commands, type HOME?<ENTER> once program started\r\n",
- X"\r\n",
- X"For access to line with no dialing try: ecu - [-eosv]\r\n",
- X"However, program default line may be busy or not exist\r\n",
- X (char *)0 /* terminated with null pointer */
- X};
- X
- Xchar *log_cmd_usage_text[] =
- X{
- X"Usage: log [-s] [-r] <filename>\r\n",
- X" log off turn logging off\r\n",
- X" -s scratch any previous contents of <filename>, else append\r\n",
- X" -r raw log, else drop 0x00-0x08,0x11-0x1F,0x7F-0xFF\r\n",
- X (char *)0 /* terminated with null pointer */
- X};
- X
- X/*+-----------------------------------------------------------------------
- X general_usage(uptr)
- X------------------------------------------------------------------------*/
- Xvoid
- Xgeneral_usage(uptr)
- Xregister char **uptr;
- X{
- X while(*uptr != (char *)0)
- X fputs(*(uptr++),se);
- X} /* end of usage */
- X
- X/*+-----------------------------------------------------------------------
- X usage()
- X------------------------------------------------------------------------*/
- Xvoid
- Xusage()
- X{
- X ff(se,"ecu %s%s made: %s\r\n",
- X numeric_revision,revision_modifier,makedate);
- X general_usage(usage_text);
- X hangup(HANGUP_USAGE);
- X /*NOTREACHED*/
- X}
- X
- X/*+-------------------------------------------------------------------------
- X log_cmd_usage()
- X--------------------------------------------------------------------------*/
- Xvoid
- Xlog_cmd_usage()
- X{
- X general_usage(log_cmd_usage_text);
- X} /* end of log_cmd_usage */
- X
- X/* vi: set tabstop=4 shiftwidth=4: */
- SHAR_EOF
- $TOUCH -am 1224223590 'ecuusage.c' &&
- chmod 0644 ecuusage.c ||
- echo 'restore of ecuusage.c failed'
- Wc_c="`wc -c < 'ecuusage.c'`"
- test 2642 -eq "$Wc_c" ||
- echo 'ecuusage.c: original size 2642, current size' "$Wc_c"
- true || echo 'restore of ecuutil.c failed'
- echo End of part 8, continue with part 9
- exit 0
- --------------------------------------------------------------------
- Warren Tucker, TuckerWare emory!n4hgf!wht or wht@n4hgf.Mt-Park.GA.US
- Hacker Extraordinaire d' async PADs, pods, proteins and protocols
-
- exit 0 # Just in case...
- --
- Kent Landfield INTERNET: kent@sparky.IMD.Sterling.COM
- Sterling Software, IMD UUCP: uunet!sparky!kent
- Phone: (402) 291-8300 FAX: (402) 291-4362
- Please send comp.sources.misc-related mail to kent@uunet.uu.net.
-