home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / ncr9800 / ckvus2.c < prev    next >
C/C++ Source or Header  |  2020-01-01  |  33KB  |  1,238 lines

  1. /*  C K U U S 2  --  "User Interface" STRINGS module for NCR-VRX Kermit  */
  2.  
  3. /**********************************************************************
  4. *                                                                     *
  5. * IVS / MCS-Kermit REL 2                                              *
  6. * source code                                                         *
  7. *                                                                     *
  8. * Change History:                                                     *
  9. *                                                                     *
  10. *                1. Modify C-Kermit(4E) source code to                *
  11. *                   produce new module for MCS/IVS-Kermit             *
  12. *                   ORIGINAL RELEASE                                  *
  13. *                   June 22, 1990                                     *
  14. *                                                                     *
  15. *                                                                     *
  16. ***********************************************************************/
  17.  
  18.  
  19. /*
  20.  Author: Frank da Cruz (SY.FDC@CU20B),
  21.  Columbia University Center for Computing Activities, January 1985.
  22.  Copyright (C) 1985, Trustees of Columbia University in the City of New York.
  23.  Permission is granted to any individual or institution to use, copy, or
  24.  redistribute this software so long as it is not sold for profit, provided this
  25.  copyright notice is retained.
  26. */
  27.  
  28. /*  This module separates long strings from the body of the ckuser module. */
  29.  
  30. #include "ckcdeb.h"
  31. #include <stdio.h>
  32. #include <ctype.h>
  33. #include "ckcker.h"
  34. #include "ckucmd.h"
  35. #include "ckuusr.h"
  36. #ifdef MCS_FLAG
  37. #include "mcs.h"
  38. #endif
  39.  
  40. extern CHAR    mystch, stchr, eol, seol, padch, mypadc, ctlq;
  41. extern CHAR    data[], *rdatap, ttname[];
  42. extern char    cmdbuf[], line[], debfil[], pktfil[], sesfil[], trafil[];
  43. extern int     nrmt, nprm, dfloc, deblog, seslog, speed, local, parity,
  44.                duplex;
  45. extern int     send_id, recv_id, send_num,  recv_num, send_renum, recv_renum;
  46. extern int     send_addnum, recv_addnum, rptflg;
  47. extern int     turn, turnch, pktlog, tralog, mdmtyp, flow, cmask, timef,
  48.  spsizf;
  49. extern int     rtimo, timint, npad, mypadn, bctr, delay;
  50. extern int     maxtry, spsiz, urpsiz, maxsps, maxrps, ebqflg, ebq;
  51. extern int     rptflg, rptq, fncnv, binary, pktlog, /* warn,*/ quiet, fmask,
  52.                keep;
  53. extern int     tsecs, bctu, len, atcapu, lpcapu, swcapu, wsize, sq, rpsiz;
  54. extern int     capas;
  55. extern long    filcnt, tfc, tlci, tlco, ffc, flci, flco;
  56. extern char    *dftty, *versio, *ckxsys;
  57. extern struct  keytab prmtab[];
  58. extern struct  keytab remcmd[];
  59.  
  60. static
  61. char     *hlp1[] = {                  /* unless the  kermit CNTLSTR
  62.                                      is set up properly this
  63.                                      message will never be output
  64.                                                                    */
  65.      "\n",
  66.      "  Usage: kermit [-x arg [-x arg]...[-yyy]..]]\n",
  67.      "   x requires an argument, y requires option with no argument:\n",
  68.           "     actions (* options also require -l and -b) --\n",
  69.      "       -s file(s)   send\n",
  70.      "       -r           receive\n",
  71.      "       -k           receive to stdout\n",
  72.      "       -a name      alternate name, used with -s, -r, -g\n",
  73.           "       -x           enter server mode\n",
  74.      "     * -c           connect before transaction\n",
  75.      "     * -n           connect after transaction\n",
  76.      "     settings --\n",
  77.      "       -l line      communication line device\n",
  78.      "       -b baud      line speed, e.g. 1200\n",
  79.      "       -i           binary file or NCR-VRX-to-PC (text by default)\n",
  80.           "       -p x         parity, x is one of e,o,m,s,n\n",
  81.      "       -t           line turnaround handshake = xon, half duplex\n",
  82.           "       -q           be quiet during file transfer\n",
  83.      "       -d           log debugging info to debuglog\n",
  84.      "       -e length    (extended) receive packet length\n",
  85.      " If no action command is included, enter interactive dialog.\n",
  86.           ""
  87. };
  88.  
  89.  
  90. /*  U S A G E */
  91.  
  92. usage()
  93. {
  94.      conola(hlp1);
  95. }
  96.  
  97.  
  98. /*  Help string definitions  */
  99.  
  100. static char     *tophlp[] = {
  101. "\n",
  102. "Type ? for a list of commands, type 'help x' for any command x.\n",
  103. "While typing commands, use the following special characters:\n\n",
  104. " DEL, RUBOUT, BACKSPACE, CTRL-H: Delete the most recent character typed.\n",
  105. " ?       (question mark) display help on the current command or field.\n",
  106. " \\      (backslash) include the following character literally.\n\n",
  107. "\n",
  108.      "" };
  109.  
  110.  
  111. static char     *hmxxbye = "V-Kermit does not support this functionality";
  112.  
  113. static char     *hmxxclo =
  114. "Close logs: 'help log' for further info.";
  115.  
  116. static char     *hmxxcon = "V-Kermit does not support this functionality";
  117.  
  118. static char     *hmxxget = "V-Kermit does not support this functionality";
  119.  
  120. static char     *hmxxlg[] = {
  121. "Record information in a log file:\n\n",
  122. " debugging             Debugging information, to help track down\n",
  123. "  (default debuglog)  bugs in the V-Kermit program.\n\n",
  124. " packets           Kermit packets, to help track down protocol problems.\n",
  125. "  (packetlog)\n\n",
  126. " transactions          Names and statistics about files transferred.\n",
  127. "  (transactlog)\n",
  128. "" };
  129.  
  130.  
  131. static char     *hmxxlogi[] = {
  132.      "V-Kermit does not support this functionality\n",
  133.      "" };
  134.  
  135.  
  136. static char     *hmxxrc[] = {
  137.      "V-Kermit does not support this functionality",
  138.      "" };
  139.  
  140.  
  141. static char     *hmxxsen = "V-Kermit does not support this functionality";
  142.  
  143. static char     *hmxxser =
  144. "Enter server mode. Commands are in packet form from other Kermit program.";
  145.  
  146. static char     *hmhset[] = {
  147. "The 'set' command is used to establish various communication or file\n",
  148. "parameters.  The 'show' command can be used to display the values of\n",
  149. "'set' parameters.  Help is available for each individual parameter;\n",
  150. "type 'help set ?' to see what's available.\n",
  151. "" };
  152.  
  153.  
  154. static char     *hmxychkt[] = {
  155. "Type of packet block check to be used for error detection, 1, 2, or 3.\n",
  156. "Type 1 is standard, and catches most errors.  Types 2 and 3 specify more\n",
  157. "rigorous checking at the cost of higher overhead.  Not all Kermit programs\n",
  158. "support types 2 and 3.\n",
  159. "" };
  160.  
  161.  
  162. static char     *hmxyf[] = {
  163. "set file: names, type, display.\n\n",
  164. "'names' are normally 'converted', which means file names are converted\n",
  165. "to 'common form' during transmission; 'literal' means use filenames\n",
  166. "literally (useful between like systems).\n\n",
  167. "'type' is normally 'text', in which conversion is done between NCR-VRX\n",
  168. "newlines and CRLF line delimiters; 'binary' means to do no conversion.\n",
  169. "Use 'binary' for executable programs or binary data.\n\n",
  170. "\n'display' is normally 'on', causing file transfer ",
  171. "progress to be displayed\n",
  172. "on your screen when in local mode.  'set display off' is useful for\n",
  173. "allowing file transfers to proceed in the background.\n\n",
  174. "" };
  175.  
  176.  
  177. static char     *hmhrmt[] = {
  178.      "V-Kermit does not support this functionality",
  179.      "" };
  180.  
  181.  
  182. /*  D O H L P  --  Give a help message  */
  183.  
  184. dohlp(xx)
  185. int     xx;
  186. {
  187.      int     x, y;
  188.  
  189.      if (xx < 0)
  190.           return(xx);
  191.      switch (xx) {
  192.  
  193.      case XXBYE:
  194.           return(hmsg(hmxxbye));
  195.  
  196.      case XXCLO:
  197.           return(hmsg(hmxxclo));
  198.  
  199. /*
  200.      case XXCON:
  201.           return(hmsg(hmxxcon));
  202. */
  203.  
  204. /*
  205.      case XXCWD:
  206.           return(hmsg(
  207.                 "Change Working Directory, equivalent to VRX filen command"));
  208. */
  209.  
  210. /*
  211.      case XXDEL:
  212.           return(hmsg("Delete a local file or files"));
  213. */
  214.  
  215. /*
  216.      case XXDIAL:
  217.           return(hmsg("Dial a number using modem autodialer"));
  218. */
  219.  
  220. /*
  221.      case XXDIR:
  222.           return(hmsg("Display a directory of local files"));
  223. */
  224.  
  225.      case XXECH:
  226.           return(hmsg("Display the rest of the command on the terminal."));
  227.  
  228.      case XXEXI:
  229.      case XXQUI:
  230.           return(hmsg("Exit from the Kermit program, closing any open logs."));
  231.  
  232. /*
  233.      case XXFIN:
  234.           return(hmsg(
  235.           "Tell the remote Kermit server to shut down without logging out."));
  236. */
  237.  
  238. /*
  239.      case XXGET:
  240.           return(hmsg(hmxxget));
  241. */
  242.  
  243. /*
  244.      case XXHAN:
  245.           return(hmsg("Hang up the phone."));
  246. */
  247.  
  248.      case XXHLP:
  249.           return(hmsga(tophlp));
  250.  
  251.      case XXLOG:
  252.           return(hmsga(hmxxlg));
  253.  
  254. /*
  255.      case XXLOGI:
  256.           return(hmsga(hmxxlogi));
  257. */
  258.  
  259. /*
  260.      case XXREC:
  261.           return(hmsga(hmxxrc));
  262. */
  263.  
  264. /*
  265.      case XXREM:
  266.           if ((y = cmkey(remcmd,nrmt,"Remote command","")) == -2) return(y);
  267.           if (y == -1) return(y);
  268.           if (x = (cmcfm()) < 0) return(x);
  269.           return(dohrmt(y));
  270. */
  271.  
  272. /*
  273.       case XXSEN:
  274.            return(hmsg(hmxxsen));
  275. */
  276.  
  277.      case XXSER:
  278.           return(hmsg(hmxxser));
  279.  
  280.      case XXSET:
  281.           if ((y = cmkey(prmtab, nprm, "Parameter", "")) == -2)
  282.                return(y);
  283.           if (y == -2)
  284.                return(y);
  285.           if (x = (cmcfm()) < 0)
  286.                return(x);
  287.           return(dohset(y));
  288.  
  289. /*
  290.      case XXSHE:
  291.           return(hmsg(
  292.             "Issue a command to the VRX shell (space req.after '!')"));
  293. */
  294.  
  295.      case XXSHO:
  296.           return(hmsg("Display current values of 'set' parameters."));
  297.  
  298. /*
  299.      case XXSPA:
  300.           return(hmsg("Display disk usage in current device, directory"));
  301. */
  302.  
  303.      case XXSTA:
  304.           return(hmsg("Display statistics about most recent file transfer"));
  305.  
  306.      case XXTAK:
  307.           return(hmsg("Take Kermit commands from the named file."));
  308.  
  309.      default:
  310.           if (x = (cmcfm()) < 0)
  311.                return(x);
  312. #ifndef MCS_FLAG
  313.           printf("V-Kermit does not support: %s\n", cmdbuf);
  314. #else
  315.           sprintf(print_str,"V-Kermit does not support: %s\n", cmdbuf);
  316.           mcs_printf(print_str);
  317. #endif
  318.           break;
  319.      }
  320.      return(0);
  321. }
  322.  
  323.  
  324. /*  H M S G  --  Get confirmation, then print the given message  */
  325.  
  326. hmsg(s)
  327. char     *s;
  328. {
  329.      int     x;
  330.      if ((x = cmcfm()) < 0)
  331.           return(x);
  332.      puts(s);
  333.      return(0);
  334. }
  335.  
  336.  
  337. hmsga(s)
  338. char     *s[];
  339. {                   /* Same function, but for arrays */
  340.      int     x, i;
  341.      if ( x = (cmcfm()) < 0)
  342.           return(x);
  343.      for ( i = 0; *s[i] ; i++)
  344.           fputs(s[i], stdout);
  345.      fputc( '\n', stdout);
  346.      return(0);
  347. }
  348.  
  349.  
  350. /*  D O H S E T  --  Give help for SET command  */
  351.  
  352. dohset(xx)
  353. int     xx;
  354. {
  355.  
  356.      if (xx == -3)
  357.           return(hmsga(hmhset));
  358.      if (xx < 0)
  359.           return(xx);
  360.      switch (xx) {
  361.  
  362.      case XYCHKT:
  363.           return(hmsga(hmxychkt));
  364.  
  365. /*
  366.      case XYDELA:
  367.           puts(
  368.           "\# of secs to wait before SND first packet after 'send' command.");
  369.           return(0);
  370. */
  371.  
  372.      case XYDUPL:
  373.           puts("During 'connect': 'full' means remote echoes, ");
  374.           puts("'half' means this program does its own echoing.");
  375.           return(0);
  376.  
  377. /*
  378.      case XYESC:
  379.           printf(
  380.                "Dec ASCII for ESC char during 'connect',\n(Control-\\)\n");
  381.           return(0);
  382. */
  383.  
  384.      case XYFILE:
  385.           return(hmsga(hmxyf));
  386.  
  387.      case XYFLOW:
  388.           puts("Type of flow control used.  Choices 'xon/xoff' and 'none'.");
  389.           puts("normally xon/xoff.");
  390.           return(0);
  391.  
  392.      case XYHAND:
  393.           puts("Dec ASCII for char to use for half duplex line turnaround");
  394.           puts("handshake.  Normally, handshaking is not done.");
  395.           return(0);
  396.  
  397. /*
  398.      case XYLINE:
  399.           printf("Device name of communication line to use. Normally %s.\n",
  400.                  dftty);
  401.           if (!dfloc) {
  402.           printf("If you set the line to other than %s, then Kermit\n",dftty);
  403.           printf("will be in 'local' mode; 'set line' will reset Kermit ");
  404.           printf("to remote mode.\n");
  405.            }
  406.           return(0);
  407. */
  408.  
  409. /*
  410.           case XYMODM:
  411.                puts("Type of modem for dialing remote connections. ");
  412.                puts(" Needed to indicate modem can");
  413.                puts(" be commanded to dial without 'CD' from modem. ");
  414.                puts("  Many recently") ;
  415.                puts("manufactured modems use 'hayes' protocol.  ");
  416.                puts("Type 'set modem ?' to see what");
  417.                puts("types of modems are supported by this program.");
  418.                return(0);
  419. */
  420.  
  421.  
  422.      case XYPARI:
  423.           puts("Parity to use during terminal connection and file transfer:");
  424.           puts("even, odd, mark, space, or none.  Normally none.");
  425.           return(0);
  426.  
  427.      case XYPROM:
  428. #ifndef MCS_FLAG
  429.           puts("Prompt string for this program, normally 'IVS-Kermit>'.");
  430. #else
  431.           puts("Prompt string for this program, normally 'MCS-Kermit>'.");
  432. #endif
  433.           return(0);
  434.  
  435.      case XYRETR:
  436.           puts("How many times to retransmit a packet before giving up");
  437.           return(0);
  438.  
  439.      case XYSPEE:
  440.           puts("Communication line speed for external tty line ");
  441.           puts("specified in most recent");
  442.           puts("'set line' command.  Any of the common baud rates:");
  443.           puts(" 0, 110, 150, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200.");
  444.           return(0);
  445.  
  446.      case XYRECV:
  447. /*
  448. puts("Specify parameters for inbound packets:");
  449. puts("End-Of-Packet (ASCII value), Id-Fields ('keep' or 'discard'),");
  450. puts("Line-Numbers ('keep' or 'discard'), Renumber ('on' or 'off'),");
  451. puts("Packet-Length (1000 or less), Padding (amount, 94 or less),");
  452. puts("Pad-Character (ASCII value), Start-Of-Packet (ASCII value),");
  453. puts("and Timeout (94 seconds or less), all specified as decimal numbers");
  454. puts("except for Id-Fields, Line-Numbers and Renumber.");
  455. return(0);
  456. */
  457.     puts("Specify parameters for inbound packets:");
  458.     puts("  End-of-Packet (ASCII value), Packet-Length (1000 or less),");
  459.     puts("  Padding (amount, 94 or less), Pad-Character (ASCII value),");
  460.     puts("  Start-of-Packet (ASCII value), and Timeout (94 seconds or less),");
  461.     puts("  all specified as decimal numbers.");
  462.     return(0);
  463.  
  464.      case XYSEND:
  465. /*
  466. puts("Specify parameters for outbound packets:");
  467. puts("End-Of-Packet (ASCII value), Id-Fields ('keep' or 'discard'),");
  468. puts("Line-Numbers ('keep' or 'discard'), Renumber ('on' or 'off'),");
  469. puts("Packet-Length (1000 or less), Padding (amount, 94 or less),");
  470. puts("Pad-Character (ASCII value), Start-Of-Packet (ASCII value),");
  471. puts("and Timeout (94 seconds or less), all specified as decimal numbers");
  472. puts("except for Id-Fields, Line-Numbers and Renumber.");
  473. return(0);
  474. */
  475.    puts("Specify parameters for outbound packets:");
  476.    puts("  End-of-Packet (ASCII value), Packet-Length (1000 or less),");
  477.    puts("  Padding (amount, 94 or less), Pad-Character (ASCII value),");
  478.    puts("  Start-of-Packet (ASCII value), and Timeout (94 seconds or less),");
  479.    puts("  all specified as decimal numbers.");
  480.    return(0);
  481.  
  482.      default:
  483. #ifndef MCS_FLAG
  484.           printf("V-Kermit does not support: %s\n", cmdbuf);
  485. #else
  486.           sprintf(print_str,"V-Kermit does not support: %s\n", cmdbuf);
  487.           mcs_printf(print_str);
  488. #endif
  489.           return(0);
  490.      }
  491. }
  492.  
  493.  
  494. /*  D O H R M T  --  Give help about REMOTE command  */
  495.  
  496. dohrmt(xx)
  497. int     xx;
  498. {
  499.      int     x;
  500.      if (xx == -3)
  501.           return(hmsga(hmhrmt));
  502.      if (xx < 0)
  503.           return(xx);
  504.      if (x = (cmcfm()) < 0)
  505.           return(x);
  506. #ifndef MCS_FLAG
  507.      printf("V-Kermit does not support this functionality- %s\n",
  508.           cmdbuf);
  509. #else
  510.       sprintf(print_str,"V-Kermit does not support this functionality- %s\n",
  511.           cmdbuf);
  512.       mcs_printf(print_str);
  513. #endif
  514.      return(-2);
  515. }
  516.  
  517. /*  D O L O G  --  Do the log command  */
  518.  
  519. dolog(x)
  520. int     x;
  521. {
  522.      int     y;
  523.      char     *s;
  524.  
  525.      switch (x) {
  526.  
  527.      case LOGD:
  528.           y = cmofi("Name of debugging log file", "debuglog",
  529.               &s);
  530.           break;
  531.  
  532.      case LOGP:
  533.           y = cmofi("Name of packet log file", "packetlog", &s);
  534.           break;
  535.  
  536. /*
  537.      case LOGS:
  538.           y = cmofi("Name of session log file","sessionlog",&s);
  539.           break;
  540. */
  541.  
  542.      case LOGT:
  543.           y = cmofi("Name of transaction log file", "transactlog",
  544.                &s);
  545.           break;
  546.  
  547.      default:
  548. #ifndef MCS_FLAG
  549.           printf("\n?Unexpected log designator - %d\n", x);
  550. #else
  551.           sprintf(print_str,"\n?Unexpected log designator - %d\n", x);
  552.           mcs_printf(print_str);
  553. #endif
  554.           return(-2);
  555.      }
  556.      if (y < 0)
  557.           return(y);
  558.  
  559.      strcpy(line, s);
  560.      s = line;
  561.      if ((y = cmcfm()) < 0)
  562.           return(y);
  563.  
  564.      switch (x) {
  565.  
  566.      case LOGD:
  567.           return(deblog = debopn(s));
  568.  
  569.      case LOGP:
  570.           zclose(ZPFILE);
  571.           y = zopeno(ZPFILE, s);
  572.           if (y > 0)
  573.                strcpy(pktfil, s);
  574.           else
  575.                *pktfil = '\0';
  576.           return(pktlog = y);
  577.  
  578. /*
  579.      case LOGS:
  580.           zclose(ZSFILE);
  581.           y = zopeno(ZSFILE,s);
  582.           if (y > 0) strcpy(sesfil,s); else *sesfil = '\0';
  583.           return(seslog = y);
  584. */
  585.  
  586.      case LOGT:
  587.           zclose(ZTFILE);
  588.           tralog = zopeno(ZTFILE, s);
  589.           if (tralog > 0) {
  590.                strcpy(trafil, s);
  591.                tlog(F110, "Transaction Log:", versio, 0l);
  592.                tlog(F100, ckxsys, "", 0);
  593.                ztime(&s);
  594.                tlog(F100, s, "", 0l);
  595.           } else
  596.                *trafil = '\0';
  597.           return(tralog);
  598.  
  599.      default:
  600.           return(-2);
  601.      }
  602. }
  603.  
  604.  
  605. /*  D E B O P N  --  Open a debugging file  */
  606.  
  607. debopn(s)
  608. char     *s;
  609. {
  610.      char     *tp;
  611.      zclose(ZDFILE);
  612.      deblog = zopeno(ZDFILE, s);
  613.      if (deblog > 0) {
  614.           strcpy(debfil, s);
  615.           if (deblog)
  616.                debug(F110, "Debug Log ", versio, 0);
  617.           if (deblog)
  618.                debug(F100, ckxsys, "", 0);
  619.           ztime(&tp);
  620.           if (deblog)
  621.                debug(F100, tp, "", 0);
  622.      } else
  623.           *debfil = '\0';
  624.      return(deblog);
  625. }
  626.  
  627.  
  628. /*  S H O P A R  --  Show Parameters  */
  629.  
  630. shopar()
  631. {
  632.      int     i;
  633.      extern struct keytab mdmtab[];
  634.      extern int     nmdm;
  635.  
  636. #ifndef MCS_FLAG
  637.      printf("\n%s, %s\n", versio, ckxsys);
  638.      printf("Communications Parameters:\n");
  639. #else
  640.        sprintf(print_str,"\n%s, %s\n", versio, ckxsys);
  641.        mcs_printf(print_str);
  642.        mcs_printf("Communications Parameters:\n");
  643. #endif
  644. /*
  645.     printf(" Line: %s, speed: %d, mode: ",ttname,speed);
  646.     if (local) printf("local"); else printf("remote");
  647.     for (i = 0; i < nmdm; i++) {
  648.         if (mdmtab[i].val == mdmtyp) {
  649.             printf(", modem-dialer: %s",mdmtab[i].kwd);
  650.             break;
  651.         }
  652.     }
  653.  */
  654. #ifndef MCS_FLAG
  655.      printf("  Bits: %d", (parity) ? 7 : 8);
  656.      printf(", Parity: ");
  657. #else
  658.      sprintf(print_str,"  Bits: %d", (parity) ? 7 : 8);
  659.      mcs_printf(print_str);
  660.      mcs_printf(", Parity: ");
  661. #endif
  662.      switch (parity) {
  663.      case 'e':
  664. #ifndef MCS_FLAG
  665.           printf("even");
  666. #else
  667.           mcs_printf("even");
  668. #endif
  669.           break;
  670.      case 'o':
  671. #ifndef MCS_FLAG
  672.           printf("odd");
  673. #else
  674.           mcs_printf("odd");
  675. #endif
  676.           break;
  677.      case 'm':
  678. #ifndef MCS_FLAG
  679.           printf("mark");
  680. #else
  681.           mcs_printf("mark");
  682. #endif
  683.           break;
  684.      case 's':
  685. #ifndef MCS_FLAG
  686.           printf("space");
  687. #else
  688.           mcs_printf("space");
  689. #endif
  690.           break;
  691.      case 0:
  692. #ifndef MCS_FLAG
  693.           printf("none");
  694. #else
  695.           mcs_printf("none");
  696. #endif
  697.           break;
  698.      default:
  699. #ifndef MCS_FLAG
  700.           printf("invalid - %d", parity);
  701. #else
  702.           sprintf(print_str,"invalid - %d", parity);
  703.           mcs_printf(print_str);
  704. #endif
  705.           break;
  706.      }
  707. #ifndef MCS_FLAG
  708.      printf(", Duplex: ");
  709. #else
  710.      mcs_printf(", Duplex: ");
  711. #endif
  712.      if (duplex)
  713. #ifndef MCS_FLAG
  714.           printf("half, ");
  715. #else
  716.           mcs_printf("half, ");
  717. #endif
  718.      else
  719. #ifndef MCS_FLAG
  720.           printf("full, ");
  721.      printf("Flow: ");
  722. #else
  723.           mcs_printf("full, ");
  724.      mcs_printf("Flow: ");
  725. #endif
  726.      if (flow == 1)
  727. #ifndef MCS_FLAG
  728.           printf("xon/xoff");
  729. #else
  730.           mcs_printf("xon/xoff");
  731. #endif
  732.      else if (flow == 0)
  733. #ifndef MCS_FLAG
  734.           printf("none");
  735. #else
  736.           mcs_printf("none");
  737. #endif
  738.      else
  739. #ifndef MCS_FLAG
  740.           printf("%d", flow);
  741. #else
  742.           sprintf(print_str,"%d",flow);
  743.           mcs_printf(print_str);
  744. #endif
  745. #ifndef MCS_FLAG
  746.      printf(", Handshake: ");
  747. #else
  748.      mcs_printf(", Handshake: ");
  749. #endif
  750. #ifndef MCS_FLAG
  751.      if (turn)
  752.           printf("%d\n", turnch);
  753. #else
  754.      if (turn) {
  755.           sprintf(print_str,"%d\n", turnch);
  756.           mcs_printf(print_str);
  757.      }
  758. #endif
  759.      else
  760. #ifndef MCS_FLAG
  761.           printf("none\n");
  762. #else
  763.           mcs_printf("none\n");
  764. #endif
  765. /*
  766.     printf("  Terminal emulation: %d bits\n", (cmask == 0177) ? 7 : 8);
  767. */
  768.  
  769. #ifndef MCS_FLAG
  770.      printf("\nProtocol & Transfer Parameters:     Send      Receive");
  771. #else
  772.      mcs_printf("\nProtocol & Transfer Parameters:     Send      Receive");
  773. #endif
  774.      if (timef || spsizf)
  775. #ifndef MCS_FLAG
  776.           printf("    (* = override)");
  777. #else
  778.           mcs_printf("    (* = override)");
  779. #endif
  780.  
  781. #ifndef MCS_FLAG
  782.      printf("\n  Timeout:      %23d%12d", rtimo,  timint);
  783. #else
  784.        sprintf(print_str,"\n  Timeout:      %23d%12d",rtimo,timint);
  785.        mcs_printf(print_str);
  786. #endif
  787.      if (timef)
  788. #ifndef MCS_FLAG
  789.           printf("*");
  790. #else
  791.           mcs_printf("*");
  792. #endif
  793.  
  794. #ifndef MCS_FLAG
  795.      printf("\n  Padding:      %23d%12d\n", npad,   mypadn);
  796.      printf(  "  Pad Character:%23d%12d\n", padch,  mypadc);
  797.      printf(  "  Packet Start: %23d%12d\n", mystch, stchr);
  798.      printf(  "  Packet End:   %23d%12d\n", seol,   eol);
  799.      printf(  "  Packet Length:%23d", spsiz);
  800.      printf( spsizf ? "*" : " " );
  801. #else
  802.      sprintf(print_str,"\n  Padding:      %23d%12d\n", npad,   mypadn);
  803.      mcs_printf(print_str);
  804.      sprintf(print_str,"  Pad Character:%23d%12d\n", padch,  mypadc);
  805.      mcs_printf(print_str);
  806.      sprintf(print_str,"  Packet Start: %23d%12d\n", mystch, stchr);
  807.      mcs_printf(print_str);
  808.      sprintf(print_str,"  Packet End:   %23d%12d\n", seol,   eol);
  809.      mcs_printf(print_str);
  810.      sprintf(print_str,"  Packet Length:%23d", spsiz);
  811.      mcs_printf(print_str);
  812.      sprintf(print_str,(spsizf ? "*" : " "));
  813.      mcs_printf(print_str);
  814. #endif
  815.      /*  printf("%11d\n", rpsiz); */
  816.  
  817. #ifndef MCS_FLAG
  818.      if (urpsiz > 94)
  819.           printf("%11d (%d)\n", urpsiz, rpsiz);
  820. #else
  821.      if (urpsiz > 94) {
  822.           sprintf(print_str,"%11d (%d)\n", urpsiz, rpsiz);
  823.           mcs_printf(print_str);
  824.      }
  825. #endif
  826. #ifndef MCS_FLAG
  827.      else
  828.           printf("%11d\n", rpsiz);
  829. #else
  830.      else {
  831.           sprintf(print_str,"%11d\n", rpsiz);
  832.           mcs_printf(print_str);
  833.      }
  834. #endif
  835.  
  836. /*
  837.     printf(  "  ID Fields:    ");
  838.     if (send_id) printf("%23s","keep");
  839.     else printf("%23s","discard");
  840.     if (recv_id) printf("%12s\n","keep");
  841.     else printf("%12s\n","discard");
  842.  
  843.     printf(  "  Line Numbers: ");
  844.     if (send_num) printf("%23s","keep");
  845.     else printf("%23s","discard");
  846.     if (recv_num) printf("%12s\n","keep");
  847.     else printf("%12s\n","discard");
  848.  
  849.     printf(  "  Renumbering:  ");
  850.     if (send_renum) printf("%23s","on");
  851.     else printf("%23s","off");
  852.     if (recv_renum) printf("%12s\n","on");
  853.     else printf("%12s\n","off");
  854.  
  855.     printf(  "  Number Adding:");
  856.     if (send_addnum) printf("%23s","on");
  857.     else printf("%23s","off");
  858.     if (recv_addnum) printf("%12s\n","on");
  859.     else printf("%12s\n","off");
  860.     printf("  Block Check Type: %d,  Delay: %d\n",bctr,delay);
  861. */
  862. #ifndef MCS_FLAG
  863.      printf("  Block Check Type:     %d\n", bctr);
  864. #else
  865.      sprintf(print_str,"  Block Check Type:     %d\n", bctr);
  866.      mcs_printf(print_str);
  867. #endif
  868. #ifndef MCS_FLAG
  869.      if (ebqflg)
  870.           printf("  8th-Bit Prefix:      '%c'\n", ebq);
  871. #else
  872.      if (ebqflg) {
  873.           sprintf(print_str,"  8th-Bit Prefix:      '%c'\n", ebq);
  874.           mcs_printf(print_str);
  875.      }
  876. #endif
  877. #ifndef MCS_FLAG
  878.      if (rptflg)
  879.           printf("  Repeat-Count Prefix: '%c'\n", rptq);
  880. #else
  881.      if (rptflg) {
  882.           sprintf(print_str,"  Repeat-Count Prefix: '%c'\n", rptq);
  883.           mcs_printf(print_str);
  884.      }
  885. #endif
  886.  
  887. #ifndef MCS_FLAG
  888.      printf("\nFile Parameters:\n  File Names:     ");
  889. #else
  890.      mcs_printf("\nFile Parameters:\n  File Names:     ");
  891. #endif
  892. #ifndef MCS_FLAG
  893.      if (fncnv)
  894.           printf("%-12s", "converted");
  895. #else
  896.      if (fncnv) {
  897.           sprintf(print_str,"%-12s", "converted");
  898.           mcs_printf(print_str);
  899.      }
  900. #endif
  901. #ifndef MCS_FLAG
  902.      else
  903.           printf("%-12s", "literal");
  904. #else
  905.      else {
  906.           sprintf(print_str,"%-12s", "literal");
  907.           mcs_printf(print_str);
  908.      }
  909. #endif
  910. #ifndef MCS_FLAG
  911.      printf("   Debugging Log:    ");
  912. #else
  913.      sprintf(print_str,"   Debugging Log:    ");
  914.      mcs_printf(print_str);
  915. #endif
  916. #ifndef MCS_FLAG
  917.      if (deblog)
  918.           printf("%s", debfil);
  919. #else
  920.      if (deblog) {
  921.           sprintf(print_str,"%s", debfil);
  922.           mcs_printf(print_str);
  923.      }
  924. #endif
  925.      else
  926. #ifndef MCS_FLAG
  927.           printf("none");
  928. #else
  929.           mcs_printf("none");
  930. #endif
  931.  
  932. #ifndef MCS_FLAG
  933.      printf("\n  File Type:      ");
  934. #else
  935.      mcs_printf("\n  File Type:      ");
  936. #endif
  937. #ifndef MCS_FLAG
  938.      if (binary)
  939.           printf("%-12s", "binary");
  940. #else
  941.      if (binary) {
  942.           sprintf(print_str,"%-12s", "binary");
  943.           mcs_printf(print_str);
  944.      }
  945. #endif
  946. #ifndef MCS_FLAG
  947.      else
  948.           printf("%-12s", "text");
  949. #else
  950.      else {
  951.           sprintf(print_str,"%-12s", "text");
  952.           mcs_printf(print_str);
  953.      }
  954. #endif
  955. #ifndef MCS_FLAG
  956.      printf("   Packet Log:       ");
  957. #else
  958.      mcs_printf("   Packet Log:       ");
  959. #endif
  960.      if (pktlog)
  961. #ifndef MCS_FLAG
  962.           printf(pktfil);
  963. #else
  964.           mcs_printf(pktfil);
  965. #endif
  966.      else
  967. #ifndef MCS_FLAG
  968.           printf("none");
  969. #else
  970.           mcs_printf("none");
  971. #endif
  972.  
  973. /*  printf("\n  File Warning: ");
  974.     if (warn) printf("%-12s","on"); else printf("%-12s","off");
  975.     printf("   Session Log:      ");
  976.     if (seslog) printf(sesfil); else printf("none");
  977.     printf("\n  File Display:   ");
  978.     if (quiet) printf("%-12s","off"); else printf("%-12s","on");
  979.     printf("   Session Log:      ");
  980.     if (seslog) printf(sesfil); else printf("none");
  981. */
  982. #ifndef MCS_FLAG
  983.      printf("\n  File Byte Size: %-12d", (fmask == 0177) ? 7 : 8);
  984.      printf("   Transaction Log:  ");
  985. #else
  986.      sprintf(print_str,"\n  File Byte Size: %-12d", (fmask == 0177) ? 7 : 8);
  987.      mcs_printf(print_str);
  988.      mcs_printf("   Transaction Log:  ");
  989. #endif
  990.      if (tralog)
  991. #ifndef MCS_FLAG
  992.           printf(trafil);
  993. #else
  994.           mcs_printf(trafil);
  995. #endif
  996.      else
  997. #ifndef MCS_FLAG
  998.           printf("none");
  999. #else
  1000.           mcs_printf("none");
  1001. #endif
  1002.  
  1003. /*    printf("\n\nFile Byte Size: %d",(fmask == 0177) ? 7 : 8); */
  1004.  
  1005. #ifndef MCS_FLAG
  1006.      printf("\n  Incomplete File Disposition: ");
  1007. #else
  1008.      mcs_printf("\n  Incomplete File Disposition: ");
  1009. #endif
  1010.      if (keep)
  1011. #ifndef MCS_FLAG
  1012.           printf("keep");
  1013. #else
  1014.           mcs_printf("keep");
  1015. #endif
  1016.      else
  1017. #ifndef MCS_FLAG
  1018.           printf("discard");
  1019.      printf(",  Init file: %s", KERMRC);
  1020. #else
  1021.           mcs_printf("discard");
  1022.      sprintf(print_str,",  Init file: %s", KERMRC);
  1023.      mcs_printf(print_str);
  1024. #endif
  1025.      puts("\n");
  1026. }
  1027.  
  1028.  
  1029. /*  D O S T A T  --  Display file transfer statistics.  */
  1030.  
  1031. dostat()
  1032. {
  1033. #ifndef MCS_FLAG
  1034.      printf("\nMost recent transaction --\n");
  1035.      printf(" files: %ld\n", filcnt);
  1036.      printf(" total file characters  : %ld\n", tfc);
  1037.      printf(" communication line in  : %ld\n", tlci);
  1038.      printf(" communication line out : %ld\n", tlco);
  1039.      printf(" elapsed time           : %d sec\n", tsecs);
  1040. #else
  1041.      sprintf(print_str,"\nMost recent transaction --\n");
  1042.      mcs_printf(print_str);
  1043.      sprintf(print_str," files: %ld\n", filcnt);
  1044.      mcs_printf(print_str);
  1045.      sprintf(print_str," total file characters  : %ld\n", tfc);
  1046.      mcs_printf(print_str);
  1047.      sprintf(print_str," communication line in  : %ld\n", tlci);
  1048.      mcs_printf(print_str);
  1049.      sprintf(print_str," communication line out : %ld\n", tlco);
  1050.      mcs_printf(print_str);
  1051.      sprintf(print_str," elapsed time           : %d sec\n", tsecs);
  1052.      mcs_printf(print_str);
  1053. #endif
  1054.      if (filcnt > 0) {
  1055.           if (tsecs > 0) {
  1056.                long     lx;
  1057.                lx = (tfc * 10l) / tsecs;
  1058. #ifndef MCS_FLAG
  1059.                printf(" effective baud rate    : %ld\n", lx);
  1060. #else
  1061.                sprintf(print_str," effective baud rate    : %ld\n", lx);
  1062.                mcs_printf(print_str);
  1063. #endif
  1064.                if (speed > 0) {
  1065.                     lx = (lx * 100l) / speed;
  1066. #ifndef MCS_FLAG
  1067.                     printf(" efficiency             : %ld %%\n",lx);
  1068. #else
  1069.                     sprintf(print_str," efficiency             : %ld %%\n",
  1070.                             lx);
  1071.                     mcs_printf(print_str);
  1072. #endif
  1073.                }
  1074.           }
  1075. #ifndef MCS_FLAG
  1076.           printf(" packet length          : %d (send), %d (receive)\n",
  1077.                  spsiz, urpsiz);
  1078.           printf(" block check type used  : %d\n", bctu);
  1079.           printf(" compression            : ");
  1080. #else
  1081.           sprintf(print_str,
  1082.                   " packet length          : %d (send), %d (receive)\n",
  1083.                   spsiz, urpsiz);
  1084.           mcs_printf(print_str);
  1085.           sprintf(print_str," block check type used  : %d\n", bctu);
  1086.           mcs_printf(print_str);
  1087.           mcs_printf(" compression            : ");
  1088. #endif
  1089. #ifndef MCS_FLAG
  1090.           if (rptflg)
  1091.                printf("yes [%c]\n", rptq);
  1092. #else
  1093.           if (rptflg) {
  1094.                sprintf(print_str,"yes [%c]\n", rptq);
  1095.                mcs_printf(print_str);
  1096.           }
  1097. #endif
  1098.           else
  1099. #ifndef MCS_FLAG
  1100.                printf("no\n");
  1101.           printf(" 8th bit prefixing      : ");
  1102. #else
  1103.                mcs_printf("no\n");
  1104.           mcs_printf(" 8th bit prefixing      : ");
  1105. #endif
  1106. #ifndef MCS_FLAG
  1107.           if (ebqflg)
  1108.                printf("yes [%c]\n", ebq);
  1109. #else
  1110.           if (ebqflg) {
  1111.                sprintf(print_str,"yes [%c]\n", ebq);
  1112.                mcs_printf(print_str);
  1113.           }
  1114. #endif
  1115.           else
  1116. #ifndef MCS_FLAG
  1117.                printf("no\n\n");
  1118. #else
  1119.                mcs_printf("no\n\n");
  1120. #endif
  1121.      } else
  1122. #ifndef MCS_FLAG
  1123.           printf("\n");
  1124. #else
  1125.           mcs_printf("\n");
  1126. #endif
  1127.      return(0);
  1128. }
  1129.  
  1130.  
  1131. /*  F S T A T S  --  Record file statistics in transaction log  */
  1132.  
  1133. fstats()
  1134. {
  1135.      tlog(F100, " end of file", "", 0l);
  1136.      tlog(F101, "  file characters        ", "", ffc);
  1137.      tlog(F101, "  communication line in  ", "", flci);
  1138.      tlog(F101, "  communication line out ", "", flco);
  1139. }
  1140.  
  1141.  
  1142. /*  T S T A T S  --  Record statistics in transaction log  */
  1143.  
  1144. tstats()
  1145. {
  1146.      char     *tp;
  1147.      int     x;
  1148.  
  1149.      ztime(&tp);                         /* Get time stamp */
  1150.      tlog(F110, "End of transaction", tp, 0l);  /* Record it */
  1151.  
  1152.      if (filcnt < 1)
  1153.           return;             /* If no files, done. */
  1154.  
  1155.      /* If multiple files, record character totals for all files */
  1156.  
  1157.      if (filcnt > 1) {
  1158.           tlog(F101, " files", "", filcnt);
  1159.           tlog(F101, " total file characters   ", "", tfc);
  1160.           tlog(F101, " communication line in   ", "", tlci);
  1161.           tlog(F101, " communication line out  ", "", tlco);
  1162.      }
  1163.  
  1164.      /* Record timing info for one or more files */
  1165.  
  1166.      tlog(F101, " elapsed time (seconds)  ", "", (long) tsecs);
  1167.      if (tsecs > 0) {
  1168.           x = (tfc / tsecs) * 10;
  1169.           tlog(F101, " effective baud rate     ", "", x);
  1170.           if (speed > 0) {
  1171.                x = (x * 100) / speed;
  1172.                tlog(F101, " efficiency (percent)    ", "",
  1173.                    x);
  1174.           }
  1175.      }
  1176.      tlog(F100, "", "", 0);                 /* Leave a blank line */
  1177. }
  1178.  
  1179.  
  1180. /*  S D E B U  -- Record spar results in debugging log  */
  1181.  
  1182. sdebu(len)
  1183. int     len;
  1184. {
  1185.  
  1186.      if (!deblog)
  1187.           return;
  1188.  
  1189.      debug(F111, "spar: data", rdatap, len);
  1190.      debug(F101, " spsiz ", "", spsiz);
  1191.      debug(F101, " timint", "", timint);
  1192.      debug(F101, " npad  ", "",  npad);
  1193.      debug(F101, " padch ", "", padch);
  1194.      debug(F101, " seol  ", "",  seol);
  1195.      debug(F101, " ctlq  ", "",  ctlq);
  1196.      debug(F101, " ebq   ", "",   ebq);
  1197.      debug(F101, " ebqflg", "", ebqflg);
  1198.      debug(F101, " bctr  ", "",  bctr);
  1199.      debug(F101, " rptq  ", "",  rptq);
  1200.      debug(F101, " rptflg", "", rptflg);
  1201.      debug(F101, " atcapu", "", atcapu);
  1202.      debug(F101, " lpcapu", "", lpcapu);
  1203.      debug(F101, " swcapu", "", swcapu);
  1204.      debug(F101, " wsize ", "", wsize);
  1205. }
  1206.  
  1207.  
  1208. /*  R D E B U -- Debugging display of rpar() values  */
  1209.  
  1210. rdebu(len)
  1211. int     len;
  1212. {
  1213.  
  1214.      if (!deblog)
  1215.           return;
  1216.  
  1217.      debug(F111, "spar: data", rdatap, len);
  1218.      debug(F101, " rpsiz ", "", xunchar(data[1]));
  1219.      debug(F101, " rtimo ", "", rtimo);
  1220.      debug(F101, " mypadn", "", mypadn);
  1221.      debug(F101, " mypadc", "", mypadc);
  1222.      debug(F101, " eol   ", "",   eol);
  1223.      debug(F101, " ctlq  ", "",  ctlq);
  1224.      debug(F101, " sq    ", "",    sq);
  1225.      debug(F101, " ebq   ", "",   ebq);
  1226.      debug(F101, " ebqflg", "", ebqflg);
  1227.      debug(F101, " bctr  ", "",  bctr);
  1228.      debug(F101, " rptq  ", "", data[9]);
  1229.      debug(F101, " rptflg", "", rptflg);
  1230.      debug(F101, " capas ", "", capas);
  1231.      debug(F101, " bits  ", "", data[capas]);
  1232.      debug(F101, " atcapu", "", atcapu);
  1233.      debug(F101, " lpcapu", "", lpcapu);
  1234.      debug(F101, " swcapu", "", swcapu);
  1235.      debug(F101, " wsize ", "", wsize);
  1236.      debug(F101, " rpsiz(extended)", "", rpsiz);
  1237. }
  1238.