Annotation of researchv10dc/lbin/kermit/ckuus2.c, revision 1.1.1.1

1.1       root        1: /*  C K U U S 2  --  "User Interface" STRINGS module for Unix Kermit  */
                      2:  
                      3: /*
                      4:  Author: Frank da Cruz (SY.FDC@CU20B),
                      5:  Columbia University Center for Computing Activities, January 1985.
                      6:  Copyright (C) 1985, Trustees of Columbia University in the City of New York.
                      7:  Permission is granted to any individual or institution to use, copy, or
                      8:  redistribute this software so long as it is not sold for profit, provided this
                      9:  copyright notice is retained. 
                     10: */
                     11:  
                     12: /*  This module separates long strings from the body of the ckuser module. */  
                     13:  
                     14: #include "ckcdeb.h"
                     15: #include <stdio.h>
                     16: #include <ctype.h>
                     17: #include "ckcker.h"
                     18: #include "ckucmd.h"
                     19: #include "ckuusr.h"
                     20:  
                     21: extern CHAR mystch, stchr, eol, seol, padch, mypadc, ctlq;
                     22: extern CHAR data[], *rdatap, ttname[];
                     23: extern char cmdbuf[], line[], debfil[], pktfil[], sesfil[], trafil[];
                     24: extern int nrmt, nprm, dfloc, deblog, seslog, speed, local, parity, duplex;
                     25: extern int turn, turnch, pktlog, tralog, mdmtyp, flow, cmask, timef, spsizf;
                     26: extern int rtimo, timint, npad, mypadn, bctr, delay;
                     27: extern int maxtry, spsiz, urpsiz, maxsps, maxrps, ebqflg, ebq;
                     28: extern int rptflg, rptq, fncnv, binary, pktlog, warn, quiet, fmask, keep;
                     29: extern int tsecs, bctu, len, atcapu, lpcapu, swcapu, wsize, sq, rpsiz;
                     30: extern int capas;
                     31: extern long filcnt, tfc, tlci, tlco, ffc, flci, flco;
                     32: extern char *dftty, *versio, *ckxsys;
                     33: extern struct keytab prmtab[];
                     34: extern struct keytab remcmd[];
                     35:  
                     36: static
                     37: char *hlp1[] = {
                     38: "\n",
                     39: "  Usage: kermit [-x arg [-x arg]...[-yyy]..]]\n",
                     40: "   x is an option that requires an argument, y an option with no argument:\n",
                     41: "     actions (* options also require -l and -b) --\n",
                     42: "       -s file(s)   send (use '-s -' to send from stdin)\n",
                     43: "       -r           receive\n",
                     44: "       -k           receive to stdout\n",
                     45: "     * -g file(s)   get remote file(s) from server (quote wildcards)\n",
                     46: "       -a name      alternate name, used with -s, -r, -g\n",
                     47: "       -x           enter server mode\n",
                     48: "     * -f           finish remote server\n",
                     49: "     * -c           connect before transaction\n",
                     50: "     * -n           connect after transaction\n",
                     51: "     settings --\n",
                     52: "       -l line      communication line device\n",
                     53: "       -b baud      line speed, e.g. 1200\n",
                     54: "       -i           binary file or Unix-to-Unix (text by default)\n",
                     55: "       -p x         parity, x is one of e,o,m,s,n\n",
                     56: "       -t           line turnaround handshake = xon, half duplex\n",
                     57: "       -w           don't write over preexisting files\n",
                     58: "       -q           be quiet during file transfer\n",
                     59: "       -d           log debugging info to debug.log\n",
                     60: "       -e length    (extended) receive packet length\n",
                     61: " If no action command is included, enter interactive dialog.\n",
                     62: ""
                     63: };
                     64:  
                     65: /*  U S A G E */
                     66:  
                     67: usage() {
                     68:     conola(hlp1);
                     69: }
                     70: 
                     71:  
                     72: /*  Help string definitions  */
                     73:  
                     74: static char *tophlp[] = { "\n\
                     75: Type ? for a list of commands, type 'help x' for any command x.\n\
                     76: While typing commands, use the following special characters:\n\n\
                     77:  DEL, RUBOUT, BACKSPACE, CTRL-H: Delete the most recent character typed.\n\
                     78:  CTRL-W: Delete the most recent word typed.\n",
                     79:  
                     80: "\
                     81:  CTRL-U: Delete the current line.\n\
                     82:  CTRL-R: Redisplay the current line.\n\
                     83:  ?       (question mark) display help on the current command or field.\n\
                     84:  ESC     (Escape or Altmode) Attempt to complete the current field.\n",
                     85:  
                     86: "\
                     87:  \\       (backslash) include the following character literally.\n\n\
                     88: From system level, type 'kermit -h' to get help about command line args.\
                     89: \n",
                     90: "" };
                     91:  
                     92: static char *hmxxbye = "\
                     93: Shut down and log out a remote Kermit server";
                     94:  
                     95: static char *hmxxclo = "\
                     96: Close one of the following logs:\n\
                     97:  session, transaction, packet, debugging -- 'help log' for further info.";
                     98:  
                     99: static char *hmxxcon = "\
                    100: Connect to a remote system via the tty device given in the\n\
                    101: most recent 'set line' command";
                    102:  
                    103: static char *hmxxget = "\
                    104: Format: 'get filespec'.  Tell the remote Kermit server to send the named\n\
                    105: files.  If filespec is omitted, then you are prompted for the remote and\n\
                    106: local filenames separately.";
                    107:  
                    108: static char *hmxxlg[] = { "\
                    109: Record information in a log file:\n\n\
                    110:  debugging             Debugging information, to help track down\n\
                    111:   (default debug.log)  bugs in the C-Kermit program.\n\n\
                    112:  packets               Kermit packets, to help track down protocol problems.\n\
                    113:   (packet.log)\n\n",
                    114:  
                    115: " session               Terminal session, during CONNECT command.\n\
                    116:   (session.log)\n\n\
                    117:  transactions          Names and statistics about files transferred.\n\
                    118:   (transact.log)\n",
                    119: "" } ;
                    120: 
                    121:  
                    122: static char *hmxxlogi[] = { "\
                    123: Syntax: script text\n\n",
                    124: "Login to a remote system using the text provided.  The login script\n",
                    125: "is intended to operate similarly to uucp \"L.sys\" entries.\n",
                    126: "A login script is a sequence of the form:\n\n",
                    127: "      expect send [expect send] . . .\n\n",
                    128: "where 'expect' is a prompt or message to be issued by the remote site, and\n",
                    129: "'send' is the names, numbers, etc, to return.  The send may also be the\n",
                    130: "keyword EOT, to send control-d, or BREAK, to send a break.  Letters in\n",
                    131: "send may be prefixed by ~ to send special characters.  These are:\n",
                    132: "~b backspace, ~s space, ~q '?', ~n linefeed, ~r return, ~c don\'t\n",
                    133: "append a return, and ~o[o[o]] for octal of a character.  As with some \n",
                    134: "uucp systems, sent strings are followed by ~r unless they end with ~c.\n\n",
                    135: "Only the last 7 characters in each expect are matched.  A null expect,\n",
                    136: "e.g. ~0 or two adjacent dashes, causes a short delay.  If you expect\n",
                    137: "that a sequence might not arrive, as with uucp, conditional sequences\n",
                    138: "may be expressed in the form:\n\n",
                    139: "      -send-expect[-send-expect[...]]\n\n",
                    140: "where dashed sequences are followed as long as previous expects fail.\n",
                    141: "" };
                    142:  
                    143: static char *hmxxrc[] = { "\
                    144: Format: 'receive [filespec]'.  Wait for a file to arrive from the other\n\
                    145: Kermit, which must be given a 'send' command.  If the optional filespec is\n",
                    146:  
                    147: "given, the (first) incoming file will be stored under that name, otherwise\n\
                    148: it will be stored under the name it arrives with.",
                    149: "" } ;
                    150:  
                    151: static char *hmxxsen = "\
                    152: Format: 'send file1 [file2]'.  File1 may contain wildcard characters '*' or\n\
                    153: '?'.  If no wildcards, then file2 may be used to specify the name file1 is\n\
                    154: sent under; if file2 is omitted, file1 is sent under its own name.";
                    155:  
                    156: static char *hmxxser = "\
                    157: Enter server mode on the currently selected line.  All further commands\n\
                    158: will be taken in packet form from the other Kermit program.";
                    159:  
                    160: static char *hmhset[] = { "\
                    161: The 'set' command is used to establish various communication or file\n",
                    162: "parameters.  The 'show' command can be used to display the values of\n",
                    163: "'set' parameters.  Help is available for each individual parameter;\n",
                    164: "type 'help set ?' to see what's available.\n",
                    165: "" } ;
                    166:  
                    167: static char *hmxychkt[] = { "\
                    168: Type of packet block check to be used for error detection, 1, 2, or 3.\n",
                    169: "Type 1 is standard, and catches most errors.  Types 2 and 3 specify more\n",
                    170: "rigorous checking at the cost of higher overhead.  Not all Kermit programs\n",
                    171: "support types 2 and 3.\n",
                    172: "" } ;
                    173: 
                    174:  
                    175: static char *hmxyf[] = { "\set file: names, type, warning, display.\n\n",
                    176: "'names' are normally 'converted', which means file names are converted\n",
                    177: "to 'common form' during transmission; 'literal' means use filenames\n",
                    178: "literally (useful between like systems).\n\n",
                    179: "'type' is normally 'text', in which conversion is done between Unix\n",
                    180: "newlines and CRLF line delimiters; 'binary' means to do no conversion.\n",
                    181: "Use 'binary' for executable programs or binary data.\n\n",
                    182: "'warning' is 'on' or 'off', normally off.  When off, incoming files will\n",
                    183: "overwrite existing files of the same name.  When on, new names will be\n",
                    184: "given to incoming files whose names are the same as existing files.\n",
                    185: "\n\
                    186: 'display' is normally 'on', causing file transfer progress to be displayed\n",
                    187: "on your screen when in local mode.  'set display off' is useful for\n",
                    188: "allowing file transfers to proceed in the background.\n\n",
                    189: "" } ;
                    190:  
                    191: static char *hmhrmt[] = { "\
                    192: The 'remote' command is used to send file management instructions to a\n",
                    193: "remote Kermit server.  There should already be a Kermit running in server\n",
                    194: "mode on the other end of the currently selected line.  Type 'remote ?' to\n",
                    195: "see a list of available remote commands.  Type 'help remote x' to get\n",
                    196: "further information about a particular remote command 'x'.\n",
                    197: "" } ;
                    198: 
                    199:  
                    200: /*  D O H L P  --  Give a help message  */
                    201:  
                    202: dohlp(xx) int xx; {
                    203:     int x,y;
                    204:  
                    205:     if (xx < 0) return(xx);
                    206:     switch (xx) {
                    207:  
                    208: case XXBYE:
                    209:     return(hmsg(hmxxbye));
                    210:  
                    211: case XXCLO:
                    212:     return(hmsg(hmxxclo));
                    213:  
                    214: case XXCON:
                    215:     return(hmsg(hmxxcon));
                    216:  
                    217: case XXCWD:
                    218: #ifdef vms
                    219:     return(hmsg("\
                    220: Change Working Directory, equivalent to VMS SET DEFAULT command"));
                    221: #else
                    222: #ifdef datageneral
                    223:     return(hmsg("Change Working Directory, equivalent to DG 'dir' command"));
                    224: #else
                    225:     return(hmsg("Change Working Directory, equivalent to Unix 'cd' command"));
                    226: #endif
                    227: #endif
                    228:  
                    229: case XXDEL:
                    230:     return(hmsg("Delete a local file or files"));
                    231:  
                    232: case XXDIAL:
                    233:     return(hmsg("Dial a number using modem autodialer"));
                    234:  
                    235: case XXDIR:
                    236:     return(hmsg("Display a directory of local files"));
                    237:  
                    238: case XXECH:
                    239:     return(hmsg("Display the rest of the command on the terminal,\n\
                    240: useful in command files."));
                    241:  
                    242: case XXEXI:
                    243: case XXQUI:
                    244:     return(hmsg("Exit from the Kermit program, closing any open logs."));
                    245:  
                    246: case XXFIN:
                    247:     return(hmsg("\
                    248: Tell the remote Kermit server to shut down without logging out."));
                    249:  
                    250: case XXGET:
                    251:     return(hmsg(hmxxget));
                    252:  
                    253: case XXHLP:
                    254:     return(hmsga(tophlp));
                    255:  
                    256: case XXLOG:
                    257:     return(hmsga(hmxxlg));
                    258:  
                    259: case XXLOGI:
                    260:     return(hmsga(hmxxlogi));
                    261:  
                    262: case XXREC:
                    263:     return(hmsga(hmxxrc));
                    264: 
                    265:  
                    266: case XXREM:
                    267:     if ((y = cmkey(remcmd,nrmt,"Remote command","")) == -2) return(y);
                    268:     if (y == -1) return(y);
                    269:     if (x = (cmcfm()) < 0) return(x);
                    270:     return(dohrmt(y));
                    271:  
                    272: case XXSEN:
                    273:     return(hmsg(hmxxsen));
                    274:  
                    275: case XXSER:
                    276:     return(hmsg(hmxxser));
                    277:  
                    278: case XXSET:
                    279:     if ((y = cmkey(prmtab,nprm,"Parameter","")) == -2) return(y);
                    280:     if (y == -2) return(y);
                    281:     if (x = (cmcfm()) < 0) return(x);
                    282:     return(dohset(y));
                    283:  
                    284: case XXSHE:
                    285: #ifdef vms
                    286:     return(hmsg("\
                    287: Issue a command to VMS (space required after '!')"));
                    288: #else
                    289: #ifdef AMIGA
                    290:     return(hmsg("\
                    291: Issue a command to CLI (space required after '!')"));
                    292: #else
                    293: #ifdef datageneral
                    294:     return(hmsg("\
                    295: Issue a command to the CLI (space required after '!')"));
                    296: #else
                    297:     return(hmsg("\
                    298: Issue a command to the Unix shell (space required after '!')"));
                    299: #endif
                    300: #endif
                    301: #endif
                    302:  
                    303: case XXSHO:
                    304:     return(hmsg("\
                    305: Display current values of 'set' parameters; 'show version' will display\n\
                    306: program version information for each of the C-Kermit modules."));
                    307:  
                    308: case XXSPA:
                    309: #ifdef datageneral
                    310:     return(hmsg("\
                    311: Display disk usage in current device, directory,\n\
                    312: or return space for a specified device, directory."));
                    313: #else
                    314:     return(hmsg("Display disk usage in current device, directory"));
                    315: #endif
                    316:  
                    317: case XXSTA:
                    318:     return(hmsg("Display statistics about most recent file transfer"));
                    319:  
                    320: case XXTAK:
                    321:     return(hmsg("\
                    322: Take Kermit commands from the named file.  Kermit command files may\n\
                    323: themselves contain 'take' commands, up to a reasonable depth of nesting."));
                    324:  
                    325: default:
                    326:     if (x = (cmcfm()) < 0) return(x);
                    327:     printf("Not available yet - %s\n",cmdbuf);
                    328:     break;
                    329:     }
                    330:     return(0);
                    331: }
                    332: 
                    333:  
                    334: /*  H M S G  --  Get confirmation, then print the given message  */
                    335:  
                    336: hmsg(s) char *s; {
                    337:     int x;
                    338:     if ((x = cmcfm()) < 0) return(x);
                    339:     puts(s);
                    340:     return(0);
                    341: }
                    342:  
                    343: hmsga(s) char *s[]; {                  /* Same function, but for arrays */
                    344:     int x, i;
                    345:     if ( x = (cmcfm()) < 0) return(x);
                    346:     for ( i = 0; *s[i] ; i++ ) fputs(s[i], stdout);
                    347:     fputc( '\n', stdout);
                    348:     return(0);
                    349: }
                    350: 
                    351:  
                    352: /*  D O H S E T  --  Give help for SET command  */
                    353:  
                    354: dohset(xx) int xx; {
                    355:     
                    356:     if (xx == -3) return(hmsga(hmhset));
                    357:     if (xx < 0) return(xx);
                    358:     switch (xx) {
                    359:  
                    360: case XYCHKT:
                    361:     return(hmsga(hmxychkt));
                    362:  
                    363: case XYDELA: 
                    364:     puts("\
                    365: Number of seconds to wait before sending first packet after 'send' command.");
                    366:     return(0);
                    367:  
                    368: case XYDUPL:
                    369:     puts("\
                    370: During 'connect': 'full' means remote host echoes, 'half' means this program");
                    371:     puts("does its own echoing.");
                    372:     return(0);
                    373:  
                    374: case XYESC:
                    375:     printf("%s","\
                    376: Decimal ASCII value for escape character during 'connect', normally 28\n\
                    377: (Control-\\)\n");
                    378:     return(0);
                    379:  
                    380: case XYFILE:
                    381:     return(hmsga(hmxyf));
                    382:  
                    383: case XYFLOW:
                    384:     puts("\
                    385: Type of flow control to be used.  Choices are 'xon/xoff' and 'none'.");
                    386:     puts("normally xon/xoff.");
                    387:     return(0);
                    388:  
                    389: case XYHAND:
                    390:     puts("\
                    391: Decimal ASCII value for character to use for half duplex line turnaround");
                    392:     puts("handshake.  Normally, handshaking is not done.");
                    393:     return(0);
                    394: 
                    395: case XYLINE:
                    396:     printf("\
                    397: Device name of communication line to use.  Normally %s.\n",dftty);
                    398:     if (!dfloc) {
                    399:        printf("\
                    400: If you set the line to other than %s, then Kermit\n",dftty);
                    401:        printf("\
                    402: will be in 'local' mode; 'set line' will reset Kermit to remote mode.\n");
                    403:     puts("\
                    404: If the line has a modem, and if the modem-dialer is set to direct, this");
                    405:     puts("\
                    406: command causes waiting for a carrier detect (e.g. on a hayes type modem).");
                    407:     puts("\
                    408: This can be used to wait for incoming calls.");
                    409:     puts("\
                    410: To use the modem to dial out, first set modem-dialer (e.g., to hayes), then");
                    411:     puts("set line, next issue the dial command, and finally connect.");
                    412:     }
                    413:     return(0);
                    414:  
                    415: case XYMODM:
                    416:     puts("\
                    417: Type of modem for dialing remote connections.  Needed to indicate modem can");
                    418:     puts("\
                    419: be commanded to dial without 'carrier detect' from modem.  Many recently");
                    420:     puts("\
                    421: manufactured modems use 'hayes' protocol.  Type 'set modem ?' to see what");
                    422:     puts("\
                    423: types of modems are supported by this program.");
                    424:     return(0);
                    425:  
                    426:  
                    427: case XYPARI:
                    428:     puts("Parity to use during terminal connection and file transfer:");
                    429:     puts("even, odd, mark, space, or none.  Normally none.");
                    430:     return(0);
                    431:  
                    432: case XYPROM:
                    433:     puts("Prompt string for this program, normally 'C-Kermit>'.");
                    434:     return(0);
                    435:  
                    436: case XYRETR:
                    437:     puts("\
                    438: How many times to retransmit a particular packet before giving up");
                    439:     return(0);
                    440: 
                    441: case XYSPEE:
                    442:     puts("\
                    443: Communication line speed for external tty line specified in most recent");
                    444: #ifdef AMIGA
                    445:     puts("\
                    446: 'set line' command.  Any baud rate between 110 and 292000, although you");
                    447:     puts(" will receive a warning if you do not use a standard baud rate:");
                    448:     puts("\
                    449: 110, 150, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600.");
                    450: #else
                    451: #ifdef datageneral
                    452:     puts("\
                    453: 'set line' command.  Any of the common baud rates:");
                    454:     puts(" 0, 50, 75, 110, 134, 150, 300, 600, 1200, 1800, ");
                    455:     puts(" 2400, 3600, 7200, 4800, 9600, 19200, 38400.");
                    456: #else
                    457:     puts("\
                    458: 'set line' command.  Any of the common baud rates:");
                    459:     puts(" 0, 110, 150, 300, 600, 1200, 1800, 2400, 4800, 9600.");
                    460: #endif
                    461: #endif
                    462:     return(0);
                    463: 
                    464: case XYRECV:
                    465:     puts("\
                    466: Specify parameters for inbound packets:");
                    467:     puts("\
                    468: End-Of-Packet (ASCII value), Packet-Length (1000 or less),");
                    469:     puts("\
                    470: Padding (amount, 94 or less), Pad-Character (ASCII value),");
                    471:     puts("\
                    472: Start-Of-Packet (ASCII value), and Timeout (94 seconds or less),");
                    473:     puts("\
                    474: all specified as decimal numbers.");
                    475:     return(0);
                    476:  
                    477: case XYSEND:
                    478:     puts("\
                    479: Specify parameters for outbound packets:");
                    480:     puts("\
                    481: End-Of-Packet (ASCII value), Packet-Length (2000 or less),");
                    482:     puts("\
                    483: Padding (amount, 94 or less), Pad-Character (ASCII value),");
                    484:     puts("\
                    485: Start-Of-Packet (ASCII value), and Timeout (94 seconds or less),");
                    486:     puts("\
                    487: all specified as decimal numbers.");
                    488:     return(0);
                    489:  
                    490: default:
                    491:     printf("%s","Not available yet - %s\n",cmdbuf);
                    492:     return(0);
                    493:     }
                    494: }
                    495: 
                    496:  
                    497: /*  D O H R M T  --  Give help about REMOTE command  */
                    498:  
                    499: dohrmt(xx) int xx; {
                    500:     int x;
                    501:     if (xx == -3) return(hmsga(hmhrmt));
                    502:     if (xx < 0) return(xx);
                    503:     switch (xx) {
                    504:  
                    505: case XZCWD:
                    506:     return(hmsg("\
                    507: Ask remote Kermit server to change its working directory."));
                    508:  
                    509: case XZDEL:
                    510:     return(hmsg("\
                    511: Ask remote Kermit server to delete the named file(s)."));
                    512:  
                    513: case XZDIR:
                    514:     return(hmsg("\
                    515: Ask remote Kermit server to provide directory listing of the named file(s)."));
                    516:  
                    517: case XZHLP:
                    518:     return(hmsg("\
                    519: Ask remote Kermit server to tell you what services it provides."));
                    520:  
                    521: case XZHOS:
                    522:     return(hmsg("\
                    523: Send a command to the remote system in its own command language\n\
                    524: through the remote Kermit server."));
                    525:  
                    526: case XZSPA:
                    527:     return(hmsg("\
                    528: Ask the remote Kermit server to tell you about its disk space."));
                    529:  
                    530: case XZTYP:
                    531:     return(hmsg("\
                    532: Ask the remote Kermit server to type the named file(s) on your screen."));
                    533:  
                    534: case XZWHO:
                    535:     return(hmsg("\
                    536: Ask the remote Kermit server to list who's logged in, or to give information\n\
                    537: about the specified user."));
                    538:  
                    539: default:
                    540:     if (x = (cmcfm()) < 0) return(x);
                    541:     printf("%s","not working yet - %s\n",cmdbuf);
                    542:     return(-2);
                    543:     }
                    544: }
                    545: 
                    546: /*** The following functions moved here from ckuusr.c because that module ***/
                    547: /*** got too big for PDP-11s. ***/
                    548: 
                    549: /*  D O L O G  --  Do the log command  */
                    550:  
                    551: dolog(x) int x; {
                    552:     int y; char *s;
                    553:  
                    554:     switch (x) {
                    555:  
                    556:        case LOGD:
                    557: #ifdef DEBUG
                    558:            y = cmofi("Name of debugging log file","debug.log",&s);
                    559: #else
                    560:            y = -2; s = "";
                    561:            printf("%s","- Sorry, debug log not available\n");
                    562: #endif
                    563:            break;
                    564:  
                    565:        case LOGP:
                    566:            y = cmofi("Name of packet log file","packet.log",&s);
                    567:            break;
                    568:  
                    569:        case LOGS:
                    570:            y = cmofi("Name of session log file","session.log",&s);
                    571:            break;
                    572:  
                    573:        case LOGT:
                    574: #ifdef TLOG
                    575:            y = cmofi("Name of transaction log file","transact.log",&s);
                    576: #else
                    577:            y = -2; s = "";
                    578:            printf("%s","- Sorry, transaction log not available\n");
                    579: #endif
                    580:            break;
                    581:  
                    582:        default:
                    583:            printf("\n?Unexpected log designator - %d\n",x);
                    584:            return(-2);
                    585:     }
                    586:     if (y < 0) return(y);
                    587:  
                    588:     strcpy(line,s);
                    589:     s = line;
                    590:     if ((y = cmcfm()) < 0) return(y);
                    591:  
                    592: /* cont'd... */
                    593: 
                    594: /* ...dolog, cont'd */
                    595:  
                    596:  
                    597:     switch (x) {
                    598:  
                    599:        case LOGD:
                    600:            return(deblog = debopn(s));
                    601:  
                    602:        case LOGP:
                    603:            zclose(ZPFILE);
                    604:            y = zopeno(ZPFILE,s);
                    605:            if (y > 0) strcpy(pktfil,s); else *pktfil = '\0';
                    606:            return(pktlog = y);
                    607:  
                    608:        case LOGS:
                    609:            zclose(ZSFILE);
                    610:            y = zopeno(ZSFILE,s);
                    611:            if (y > 0) strcpy(sesfil,s); else *sesfil = '\0';
                    612:            return(seslog = y);
                    613:  
                    614:        case LOGT:
                    615:            zclose(ZTFILE);
                    616:            tralog = zopeno(ZTFILE,s);
                    617:            if (tralog > 0) {
                    618:                strcpy(trafil,s);
                    619:                tlog(F110,"Transaction Log:",versio,0l);
                    620:                tlog(F100,ckxsys,"",0);
                    621:                ztime(&s);
                    622:                tlog(F100,s,"",0l);
                    623:            }
                    624:            else *trafil = '\0';
                    625:            return(tralog);
                    626:  
                    627:        default:
                    628:            return(-2);
                    629:     }
                    630: }
                    631:  
                    632:  
                    633: /*  D E B O P N  --  Open a debugging file  */
                    634:  
                    635: debopn(s) char *s; {
                    636: #ifdef DEBUG
                    637:     char *tp;
                    638:     zclose(ZDFILE);
                    639:     deblog = zopeno(ZDFILE,s);
                    640:     if (deblog > 0) {
                    641:        strcpy(debfil,s);
                    642:        debug(F110,"Debug Log ",versio,0);
                    643:        debug(F100,ckxsys,"",0);
                    644:        ztime(&tp);
                    645:        debug(F100,tp,"",0);
                    646:     } else *debfil = '\0';
                    647:     return(deblog);
                    648: #else
                    649:     return(0);
                    650: #endif
                    651: }
                    652: 
                    653: /*  S H O P A R  --  Show Parameters  */
                    654:  
                    655: shopar() {
                    656:  
                    657:     int i;
                    658:     extern struct keytab mdmtab[]; extern int nmdm;
                    659: 
                    660:     printf("\n%s,%s, ",versio,ckxsys); 
                    661:     puts("Communications Parameters:");
                    662:     printf(" Line: %s, speed: %d, mode: ",ttname,speed);
                    663:     if (local) printf("local"); else printf("remote");
                    664:  
                    665:     for (i = 0; i < nmdm; i++) {
                    666:        if (mdmtab[i].val == mdmtyp) {
                    667:            printf(", modem-dialer: %s",mdmtab[i].kwd);
                    668:            break;
                    669:        }
                    670:     }
                    671:     printf("\n Bits: %d",(parity) ? 7 : 8);
                    672:     printf(", parity: ");
                    673:     switch (parity) {
                    674:        case 'e': printf("even");  break;
                    675:        case 'o': printf("odd");   break;
                    676:        case 'm': printf("mark");  break;
                    677:        case 's': printf("space"); break;
                    678:        case 0:   printf("none");  break;
                    679:        default:  printf("invalid - %d",parity); break;
                    680:     }          
                    681:     printf(", duplex: ");
                    682:     if (duplex) printf("half, "); else printf("full, ");
                    683:     printf("flow: ");
                    684:     if (flow == 1) printf("xon/xoff");
                    685:        else if (flow == 0) printf("none");
                    686:        else printf("%d",flow);
                    687:     printf(", handshake: ");
                    688:     if (turn) printf("%d\n",turnch); else printf("none\n");
                    689:     printf("Terminal emulation: %d bits\n", (cmask == 0177) ? 7 : 8);
                    690:  
                    691:     printf("\nProtocol Parameters:   Send    Receive");
                    692:     if (timef || spsizf) printf("    (* = override)");
                    693:     printf("\n Timeout:      %11d%9d", rtimo,  timint);
                    694:     if (timef) printf("*");
                    695:     printf("\n Padding:      %11d%9d", npad,   mypadn);
                    696:     printf("        Block Check: %6d\n",bctr);
                    697:     printf(  " Pad Character:%11d%9d", padch,  mypadc);
                    698:     printf("        Delay:       %6d\n",delay);
                    699:     printf(  " Packet Start: %11d%9d", mystch, stchr);
                    700:     printf("        Max Retries: %6d\n",maxtry);
                    701:     printf(  " Packet End:   %11d%9d", seol,   eol);
                    702:     if (ebqflg)
                    703:       printf("        8th-Bit Prefix: '%c'",ebq);
                    704:     printf(  "\n Packet Length:%11d", spsiz);
                    705:     printf( spsizf ? "*" : " " ); printf("%8d",  urpsiz);
                    706:     printf( (urpsiz > 94) ? " (94)" : "     ");
                    707:     if (rptflg)
                    708:       printf("   Repeat Prefix:  '%c'",rptq);
                    709:     printf(  "\n Length Limit: %11d%9d\n", maxsps, maxrps);
                    710:  
                    711:     printf("\nFile parameters:\n File Names:   ");
                    712:     if (fncnv) printf("%-12s","converted"); else printf("%-12s","literal");
                    713: #ifdef DEBUG
                    714:     printf("   Debugging Log:    ");
                    715:     if (deblog) printf("%s",debfil); else printf("none");
                    716: #endif
                    717:     printf("\n File Type:    ");
                    718:     if (binary) printf("%-12s","binary"); else printf("%-12s","text");
                    719:     printf("   Packet Log:       ");
                    720:     if (pktlog) printf(pktfil); else printf("none");
                    721:     printf("\n File Warning: ");
                    722:     if (warn) printf("%-12s","on"); else printf("%-12s","off");
                    723:     printf("   Session Log:      ");
                    724:     if (seslog) printf(sesfil); else printf("none");
                    725:     printf("\n File Display: ");
                    726:     if (quiet) printf("%-12s","off"); else printf("%-12s","on");
                    727: #ifdef TLOG
                    728:     printf("   Transaction Log:  ");
                    729:     if (tralog) printf(trafil); else printf("none");
                    730: #endif
                    731:     printf("\n\nFile Byte Size: %d",(fmask == 0177) ? 7 : 8);
                    732:     printf(", Incomplete File Disposition: ");
                    733:     if (keep) printf("keep"); else printf("discard");
                    734: #ifdef KERMRC    
                    735:     printf(", Init file: %s",KERMRC);
                    736: #endif
                    737:     puts("\n");
                    738: }
                    739: 
                    740: /*  D O S T A T  --  Display file transfer statistics.  */
                    741: 
                    742: dostat() {
                    743:     printf("\nMost recent transaction --\n");
                    744:     printf(" files: %ld\n",filcnt);
                    745:     printf(" total file characters  : %ld\n",tfc);
                    746:     printf(" communication line in  : %ld\n",tlci);
                    747:     printf(" communication line out : %ld\n",tlco);
                    748:     printf(" elapsed time           : %d sec\n",tsecs);
                    749:     if (filcnt > 0) {
                    750:        if (tsecs > 0) {
                    751:            long lx;
                    752:            lx = (tfc * 10l) / tsecs;
                    753:            printf(" effective baud rate    : %ld\n",lx);
                    754:            if (speed > 0) {
                    755:                lx = (lx * 100l) / speed;
                    756:                printf(" efficiency             : %ld %%\n",lx);
                    757:            }
                    758:        }
                    759:        printf(" packet length          : %d (send), %d (receive)\n",
                    760:               spsiz,urpsiz);
                    761:        printf(" block check type used  : %d\n",bctu);
                    762:        printf(" compression            : ");
                    763:        if (rptflg) printf("yes [%c]\n",rptq); else printf("no\n");
                    764:        printf(" 8th bit prefixing      : ");
                    765:        if (ebqflg) printf("yes [%c]\n",ebq); else printf("no\n\n");
                    766:     } else printf("\n");
                    767:     return(0);
                    768: }
                    769: 
                    770: /*  F S T A T S  --  Record file statistics in transaction log  */
                    771: 
                    772: fstats() {
                    773:     tlog(F100," end of file","",0l);
                    774:     tlog(F101,"  file characters        ","",ffc);
                    775:     tlog(F101,"  communication line in  ","",flci);
                    776:     tlog(F101,"  communication line out ","",flco);
                    777: }
                    778: 
                    779: 
                    780: /*  T S T A T S  --  Record statistics in transaction log  */
                    781: 
                    782: tstats() {
                    783:     char *tp; int x;
                    784: 
                    785:     ztime(&tp);                                /* Get time stamp */
                    786:     tlog(F110,"End of transaction",tp,0l);  /* Record it */
                    787: 
                    788:     if (filcnt < 1) return;            /* If no files, done. */
                    789: 
                    790: /* If multiple files, record character totals for all files */
                    791: 
                    792:     if (filcnt > 1) {
                    793:        tlog(F101," files","",filcnt);
                    794:        tlog(F101," total file characters   ","",tfc);
                    795:        tlog(F101," communication line in   ","",tlci);
                    796:        tlog(F101," communication line out  ","",tlco);
                    797:     }
                    798: 
                    799: /* Record timing info for one or more files */
                    800: 
                    801:     tlog(F101," elapsed time (seconds)  ","",(long) tsecs);
                    802:     if (tsecs > 0) {
                    803:        x = (tfc / tsecs) * 10;
                    804:        tlog(F101," effective baud rate     ","",x);
                    805:        if (speed > 0) {
                    806:            x = (x * 100) / speed;
                    807:            tlog(F101," efficiency (percent)    ","",x);
                    808:        }
                    809:     }
                    810:     tlog(F100,"","",0);                        /* Leave a blank line */
                    811: }
                    812: 
                    813: /*  S D E B U  -- Record spar results in debugging log  */
                    814: 
                    815: sdebu(len) int len; {
                    816:     debug(F111,"spar: data",rdatap,len);
                    817:     debug(F101," spsiz ","", spsiz);
                    818:     debug(F101," timint","",timint);
                    819:     debug(F101," npad  ","",  npad);
                    820:     debug(F101," padch ","", padch);
                    821:     debug(F101," seol  ","",  seol);
                    822:     debug(F101," ctlq  ","",  ctlq);
                    823:     debug(F101," ebq   ","",   ebq);
                    824:     debug(F101," ebqflg","",ebqflg);
                    825:     debug(F101," bctr  ","",  bctr);
                    826:     debug(F101," rptq  ","",  rptq);
                    827:     debug(F101," rptflg","",rptflg);
                    828:     debug(F101," atcapu","",atcapu);
                    829:     debug(F101," lpcapu","",lpcapu);
                    830:     debug(F101," swcapu","",swcapu);
                    831:     debug(F101," wsize ","", wsize);
                    832: }
                    833: /*  R D E B U -- Debugging display of rpar() values  */
                    834: 
                    835: rdebu(len) int len; {
                    836:     debug(F111,"spar: data",rdatap,len);
                    837:     debug(F101," rpsiz ","",xunchar(data[1]));
                    838:     debug(F101," rtimo ","", rtimo);
                    839:     debug(F101," mypadn","",mypadn);
                    840:     debug(F101," mypadc","",mypadc);
                    841:     debug(F101," eol   ","",   eol);
                    842:     debug(F101," ctlq  ","",  ctlq);
                    843:     debug(F101," sq    ","",    sq);
                    844:     debug(F101," ebq   ","",   ebq);
                    845:     debug(F101," ebqflg","",ebqflg);
                    846:     debug(F101," bctr  ","",  bctr);
                    847:     debug(F101," rptq  ","",data[9]);
                    848:     debug(F101," rptflg","",rptflg);
                    849:     debug(F101," capas ","",capas);
                    850:     debug(F101," bits  ","",data[capas]);
                    851:     debug(F101," atcapu","",atcapu);
                    852:     debug(F101," lpcapu","",lpcapu);
                    853:     debug(F101," swcapu","",swcapu);
                    854:     debug(F101," wsize ","", wsize);
                    855:     debug(F101," rpsiz(extended)","",rpsiz);
                    856: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.