|
|
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 cmdbuf[]; ! 22: extern int nrmt, nprm, dfloc; ! 23: extern char *dftty; ! 24: extern struct keytab prmtab[]; ! 25: extern struct keytab remcmd[]; ! 26: ! 27: static ! 28: char *hlp1[] = { ! 29: "\n", ! 30: " Usage: kermit [-x arg [-x arg]...[-yyy]..]]\n", ! 31: " x is an option that requires an argument, y an option with no argument:\n", ! 32: " actions (* options also require -l and -b) --\n", ! 33: " -s file(s) send (use '-s -' to send from stdin)\n", ! 34: " -r receive\n", ! 35: " -k receive to stdout\n", ! 36: " * -g file(s) get remote file(s) from server (quote wildcards)\n", ! 37: " -a name alternate name, used with -s, -r, -g\n", ! 38: " -x enter server mode\n", ! 39: " * -f finish remote server\n", ! 40: " * -c connect before transaction\n", ! 41: " * -n connect after transaction\n", ! 42: " -h help - print this message\n", ! 43: " settings --\n", ! 44: " -l line communication line device\n", ! 45: " -b baud line speed, e.g. 1200\n", ! 46: " -i binary file or Unix-to-Unix\n", ! 47: " -p x parity, x is one of e,o,m,s,n\n", ! 48: " -t line turnaround handshake = xon, half duplex\n", ! 49: " -w don't write over preexisting files\n", ! 50: " -q be quiet during file transfer\n", ! 51: " -d log debugging info to debug.log\n", ! 52: " If no action command is included, enter interactive dialog.\n", ! 53: "" ! 54: }; ! 55: ! 56: /* U S A G E */ ! 57: ! 58: usage() { ! 59: conola(hlp1); ! 60: } ! 61: ! 62: ! 63: /* Help string definitions */ ! 64: ! 65: static char *tophlp[] = { "\n\ ! 66: Type ? for a list of commands, type 'help x' for any command x.\n\ ! 67: While typing commands, use the following special characters:\n\n\ ! 68: DEL, RUBOUT, BACKSPACE, CTRL-H: Delete the most recent character typed.\n\ ! 69: CTRL-W: Delete the most recent word typed.\n", ! 70: ! 71: "\ ! 72: CTRL-U: Delete the current line.\n\ ! 73: CTRL-R: Redisplay the current line.\n\ ! 74: ? (question mark) display help on the current command or field.\n\ ! 75: ESC (Escape or Altmode) Attempt to complete the current field.\n", ! 76: ! 77: "\ ! 78: \\ (backslash) include the following character literally.\n\n\ ! 79: From system level, type 'kermit -h' to get help about command line args.\ ! 80: \n", ! 81: "" }; ! 82: ! 83: static char *hmxxbye = "\ ! 84: Shut down and log out a remote Kermit server"; ! 85: ! 86: static char *hmxxclo = "\ ! 87: Close one of the following logs:\n\ ! 88: session, transaction, packet, debugging -- 'help log' for further info."; ! 89: ! 90: static char *hmxxcon = "\ ! 91: Connect to a remote system via the tty device given in the\n\ ! 92: most recent 'set line' command"; ! 93: ! 94: static char *hmxxget = "\ ! 95: Format: 'get filespec'. Tell the remote Kermit server to send the named\n\ ! 96: files. If filespec is omitted, then you are prompted for the remote and\n\ ! 97: local filenames separately."; ! 98: ! 99: static char *hmxxlg[] = { "\ ! 100: Record information in a log file:\n\n\ ! 101: debugging Debugging information, to help track down\n\ ! 102: (default debug.log) bugs in the C-Kermit program.\n\n\ ! 103: packets Kermit packets, to help track down protocol problems.\n\ ! 104: (packet.log)\n\n", ! 105: ! 106: " session Terminal session, during CONNECT command.\n\ ! 107: (session.log)\n\n\ ! 108: transactions Names and statistics about files transferred.\n\ ! 109: (transact.log)\n", ! 110: "" } ; ! 111: ! 112: ! 113: static char *hmxxlogi[] = { "\ ! 114: Syntax: script text\n\n", ! 115: "Login to a remote system using the text provided. The login script\n", ! 116: "is intended to operate similarly to uucp \"L.sys\" entries.\n", ! 117: "A login script is a sequence of the form:\n\n", ! 118: " expect send [expect send] . . .\n\n", ! 119: "where 'expect' is a prompt or message to be issued by the remote site, and\n", ! 120: "'send' is the names, numbers, etc, to return. The send may also be the\n", ! 121: "keyword EOT, to send control-d, or BREAK, to send a break. Letters in\n", ! 122: "send may be prefixed by ~ to send special characters. These are:\n", ! 123: "~b backspace, ~s space, ~q '?', ~n linefeed, ~r return, ~c don\'t\n", ! 124: "append a return, and ~o[o[o]] for octal of a character. As with some \n", ! 125: "uucp systems, sent strings are followed by ~r unless they end with ~c.\n\n", ! 126: "Only the last 7 characters in each expect are matched. A null expect,\n", ! 127: "e.g. ~0 or two adjacent dashes, causes a short delay. If you expect\n", ! 128: "that a sequence might not arrive, as with uucp, conditional sequences\n", ! 129: "may be expressed in the form:\n\n", ! 130: " -send-expect[-send-expect[...]]\n\n", ! 131: "where dashed sequences are followed as long as previous expects fail.\n", ! 132: "" }; ! 133: ! 134: static char *hmxxrc[] = { "\ ! 135: Format: 'receive [filespec]'. Wait for a file to arrive from the other\n\ ! 136: Kermit, which must be given a 'send' command. If the optional filespec is\n", ! 137: ! 138: "given, the (first) incoming file will be stored under that name, otherwise\n\ ! 139: it will be stored under the name it arrives with.", ! 140: "" } ; ! 141: ! 142: static char *hmxxsen = "\ ! 143: Format: 'send file1 [file2]'. File1 may contain wildcard characters '*' or\n\ ! 144: '?'. If no wildcards, then file2 may be used to specify the name file1 is\n\ ! 145: sent under; if file2 is omitted, file1 is sent under its own name."; ! 146: ! 147: static char *hmxxser = "\ ! 148: Enter server mode on the currently selected line. All further commands\n\ ! 149: will be taken in packet form from the other Kermit program."; ! 150: ! 151: static char *hmhset[] = { "\ ! 152: The 'set' command is used to establish various communication or file\n", ! 153: "parameters. The 'show' command can be used to display the values of\n", ! 154: "'set' parameters. Help is available for each individual parameter;\n", ! 155: "type 'help set ?' to see what's available.\n", ! 156: "" } ; ! 157: ! 158: static char *hmxychkt[] = { "\ ! 159: Type of packet block check to be used for error detection, 1, 2, or 3.\n", ! 160: "Type 1 is standard, and catches most errors. Types 2 and 3 specify more\n", ! 161: "rigorous checking at the cost of higher overhead. Not all Kermit programs\n", ! 162: "support types 2 and 3.\n", ! 163: "" } ; ! 164: ! 165: ! 166: static char *hmxyf[] = { "\set file: names, type, warning, display.\n\n", ! 167: "'names' are normally 'converted', which means file names are converted\n", ! 168: "to 'common form' during transmission; 'literal' means use filenames\n", ! 169: "literally (useful between like systems).\n\n", ! 170: "'type' is normally 'text', in which conversion is done between Unix\n", ! 171: "newlines and CRLF line delimiters; 'binary' means to do no conversion.\n", ! 172: "Use 'binary' for executable programs or binary data.\n\n", ! 173: "'warning' is 'on' or 'off', normally off. When off, incoming files will\n", ! 174: "overwrite existing files of the same name. When on, new names will be\n", ! 175: "given to incoming files whose names are the same as existing files.\n", ! 176: "\n\ ! 177: 'display' is normally 'on', causing file transfer progress to be displayed\n", ! 178: "on your screen when in local mode. 'set display off' is useful for\n", ! 179: "allowing file transfers to proceed in the background.\n\n", ! 180: "" } ; ! 181: ! 182: static char *hmhrmt[] = { "\ ! 183: The 'remote' command is used to send file management instructions to a\n", ! 184: "remote Kermit server. There should already be a Kermit running in server\n", ! 185: "mode on the other end of the currently selected line. Type 'remote ?' to\n", ! 186: "see a list of available remote commands. Type 'help remote x' to get\n", ! 187: "further information about a particular remote command 'x'.\n", ! 188: "" } ; ! 189: ! 190: ! 191: /* D O H L P -- Give a help message */ ! 192: ! 193: dohlp(xx) int xx; { ! 194: int x,y; ! 195: ! 196: if (xx < 0) return(xx); ! 197: switch (xx) { ! 198: ! 199: case XXBYE: ! 200: return(hmsg(hmxxbye)); ! 201: ! 202: case XXCLO: ! 203: return(hmsg(hmxxclo)); ! 204: ! 205: case XXCON: ! 206: return(hmsg(hmxxcon)); ! 207: ! 208: case XXCWD: ! 209: #ifdef vms ! 210: return(hmsg("\ ! 211: Change Working Directory, equivalent to VMS SET DEFAULT command")); ! 212: #else ! 213: return(hmsg("Change Working Directory, equivalent to Unix 'cd' command")); ! 214: #endif ! 215: ! 216: case XXDEL: ! 217: return(hmsg("Delete a local file or files")); ! 218: ! 219: case XXDIAL: ! 220: return(hmsg("Dial a number using modem autodialer")); ! 221: ! 222: case XXDIR: ! 223: return(hmsg("Display a directory of local files")); ! 224: ! 225: case XXECH: ! 226: return(hmsg("Display the rest of the command on the terminal,\n\ ! 227: useful in command files.")); ! 228: ! 229: case XXEXI: ! 230: case XXQUI: ! 231: return(hmsg("Exit from the Kermit program, closing any open logs.")); ! 232: ! 233: case XXFIN: ! 234: return(hmsg("\ ! 235: Tell the remote Kermit server to shut down without logging out.")); ! 236: ! 237: case XXGET: ! 238: return(hmsg(hmxxget)); ! 239: ! 240: case XXHLP: ! 241: return(hmsga(tophlp)); ! 242: ! 243: case XXLOG: ! 244: return(hmsga(hmxxlg)); ! 245: ! 246: case XXLOGI: ! 247: return(hmsga(hmxxlogi)); ! 248: ! 249: case XXREC: ! 250: return(hmsga(hmxxrc)); ! 251: ! 252: ! 253: case XXREM: ! 254: if ((y = cmkey(remcmd,nrmt,"Remote command","")) == -2) return(y); ! 255: if (y == -1) return(y); ! 256: if (x = (cmcfm()) < 0) return(x); ! 257: return(dohrmt(y)); ! 258: ! 259: case XXSEN: ! 260: return(hmsg(hmxxsen)); ! 261: ! 262: case XXSER: ! 263: return(hmsg(hmxxser)); ! 264: ! 265: case XXSET: ! 266: if ((y = cmkey(prmtab,nprm,"Parameter","")) == -2) return(y); ! 267: if (y == -2) return(y); ! 268: if (x = (cmcfm()) < 0) return(x); ! 269: return(dohset(y)); ! 270: ! 271: case XXSHE: ! 272: #ifdef vms ! 273: return(hmsg("\ ! 274: Issue a command to VMS (space required after '!')")); ! 275: #else ! 276: return(hmsg("\ ! 277: Issue a command to the Unix shell (space required after '!')")); ! 278: #endif ! 279: ! 280: case XXSHO: ! 281: return(hmsg("\ ! 282: Display current values of 'set' parameters; 'show version' will display\n\ ! 283: program version information for each of the C-Kermit modules.")); ! 284: ! 285: case XXSPA: ! 286: return(hmsg("Display disk usage in current device, directory")); ! 287: ! 288: case XXSTA: ! 289: return(hmsg("Display statistics about most recent file transfer")); ! 290: ! 291: case XXTAK: ! 292: return(hmsg("\ ! 293: Take Kermit commands from the named file. Kermit command files may\n\ ! 294: themselves contain 'take' commands, up to a reasonable depth of nesting.")); ! 295: ! 296: default: ! 297: if (x = (cmcfm()) < 0) return(x); ! 298: printf("Not available yet - %s\n",cmdbuf); ! 299: break; ! 300: } ! 301: return(0); ! 302: } ! 303: ! 304: ! 305: /* H M S G -- Get confirmation, then print the given message */ ! 306: ! 307: hmsg(s) char *s; { ! 308: int x; ! 309: if (x = (cmcfm()) < 0) return(x); ! 310: puts(s); ! 311: return(0); ! 312: } ! 313: ! 314: hmsga(s) char *s[]; { /* Same function, but for arrays */ ! 315: int x, i; ! 316: if ( x = (cmcfm()) < 0) return(x); ! 317: for ( i = 0; *s[i] ; i++ ) fputs(s[i], stdout); ! 318: fputc( '\n', stdout); ! 319: return(0); ! 320: } ! 321: ! 322: ! 323: /* D O H S E T -- Give help for SET command */ ! 324: ! 325: dohset(xx) int xx; { ! 326: ! 327: if (xx == -3) return(hmsga(hmhset)); ! 328: if (xx < 0) return(xx); ! 329: switch (xx) { ! 330: ! 331: case XYCHKT: ! 332: return(hmsga(hmxychkt)); ! 333: ! 334: case XYDELA: ! 335: puts("\ ! 336: Number of seconds to wait before sending first packet after 'send' command."); ! 337: return(0); ! 338: ! 339: case XYDUPL: ! 340: puts("\ ! 341: During 'connect': 'full' means remote host echoes, 'half' means this program"); ! 342: puts("does its own echoing."); ! 343: return(0); ! 344: ! 345: case XYESC: ! 346: printf("%s","\ ! 347: Decimal ASCII value for escape character during 'connect', normally 28\n\ ! 348: (Control-\\)\n"); ! 349: return(0); ! 350: ! 351: case XYFILE: ! 352: return(hmsga(hmxyf)); ! 353: ! 354: case XYFLOW: ! 355: puts("\ ! 356: Type of flow control to be used. Choices are 'xon/xoff' and 'none'."); ! 357: puts("normally xon/xoff."); ! 358: return(0); ! 359: ! 360: case XYHAND: ! 361: puts("\ ! 362: Decimal ASCII value for character to use for half duplex line turnaround"); ! 363: puts("handshake. Normally, handshaking is not done."); ! 364: return(0); ! 365: ! 366: case XYIFD: ! 367: puts("\ ! 368: Incomplete file disposition: discard or keep. Normally discard."); ! 369: return(0); ! 370: ! 371: case XYLINE: ! 372: printf("\ ! 373: Device name of communication line to use. Normally %s.\n",dftty); ! 374: if (!dfloc) { ! 375: printf("\ ! 376: If you set the line to other than %s, then Kermit\n",dftty); ! 377: printf("\ ! 378: will be in 'local' mode; 'set line' will reset Kermit to its default mode.\n"); ! 379: #ifndef vms ! 380: printf("\ ! 381: 'set line /dev/tty' will always put Kermit in remote mode.\n"); ! 382: #endif ! 383: } ! 384: puts("\ ! 385: If the line has a modem, and if the modem-dialer is set to direct, this"); ! 386: puts("\ ! 387: command causes waiting for a carrier detect (e.g. on a hayes type modem)."); ! 388: puts("\ ! 389: This can be used to wait for incoming calls."); ! 390: puts("\ ! 391: To use the modem to dial out, first set modem-dialer (e.g., to hayes), then"); ! 392: puts("set line, next issue the dial command, and finally connect."); ! 393: ! 394: return(0); ! 395: ! 396: case XYMODM: ! 397: puts("\ ! 398: Type of modem for dialing remote connections. Needed to indicate modem can"); ! 399: puts("\ ! 400: be commanded to dial without 'carrier detect' from modem. Many recently"); ! 401: puts("\ ! 402: manufactured modems use 'hayes' protocol. Type 'set modem ?' to see what"); ! 403: puts("\ ! 404: types of modems are supported by this program."); ! 405: return(0); ! 406: ! 407: ! 408: case XYPARI: ! 409: puts("Parity to use during terminal connection and file transfer:"); ! 410: puts("even, odd, mark, space, or none. Normally none."); ! 411: return(0); ! 412: ! 413: case XYPROM: ! 414: puts("Prompt string for this program, normally 'C-Kermit>'."); ! 415: return(0); ! 416: ! 417: case XYSPEE: ! 418: puts("\ ! 419: Communication line speed for external tty line specified in most recent"); ! 420: puts("\ ! 421: 'set line' command. Any of the common baud rates:"); ! 422: puts(" 0, 110, 150, 300, 600, 1200, 1800, 2400, 4800, 9600."); ! 423: return(0); ! 424: ! 425: case XYRECV: ! 426: puts("\ ! 427: Specify parameters for inbound packets:"); ! 428: puts("\ ! 429: End-Of-Packet (ASCII value), Packet-Length (94 or less),"); ! 430: puts("\ ! 431: Padding (amount, 94 or less), Pad-Character (ASCII value),"); ! 432: puts("\ ! 433: Start-Of-Packet (ASCII value), and Timeout (94 seconds or less),"); ! 434: puts("\ ! 435: all specified as decimal numbers."); ! 436: return(0); ! 437: ! 438: case XYSEND: ! 439: puts("\ ! 440: Specify parameters for outbound packets:"); ! 441: puts("\ ! 442: End-Of-Packet (ASCII value), Packet-Length (94 or less),"); ! 443: puts("\ ! 444: Padding (amount, 94 or less), Pad-Character (ASCII value),"); ! 445: puts("\ ! 446: Start-Of-Packet (ASCII value), and Timeout (94 seconds or less),"); ! 447: puts("\ ! 448: all specified as decimal numbers."); ! 449: return(0); ! 450: ! 451: default: ! 452: printf("%s","Not available yet - %s\n",cmdbuf); ! 453: return(0); ! 454: } ! 455: } ! 456: ! 457: ! 458: /* D O H R M T -- Give help about REMOTE command */ ! 459: ! 460: dohrmt(xx) int xx; { ! 461: int x; ! 462: if (xx == -3) return(hmsga(hmhrmt)); ! 463: if (xx < 0) return(xx); ! 464: switch (xx) { ! 465: ! 466: case XZCWD: ! 467: return(hmsg("\ ! 468: Ask remote Kermit server to change its working directory.")); ! 469: ! 470: case XZDEL: ! 471: return(hmsg("\ ! 472: Ask remote Kermit server to delete the named file(s).")); ! 473: ! 474: case XZDIR: ! 475: return(hmsg("\ ! 476: Ask remote Kermit server to provide directory listing of the named file(s).")); ! 477: ! 478: case XZHLP: ! 479: return(hmsg("\ ! 480: Ask remote Kermit server to tell you what services it provides.")); ! 481: ! 482: case XZHOS: ! 483: return(hmsg("\ ! 484: Send a command to the remote system in its own command language\n\ ! 485: through the remote Kermit server.")); ! 486: ! 487: case XZSPA: ! 488: return(hmsg("\ ! 489: Ask the remote Kermit server to tell you about its disk space.")); ! 490: ! 491: case XZTYP: ! 492: return(hmsg("\ ! 493: Ask the remote Kermit server to type the named file(s) on your screen.")); ! 494: ! 495: case XZWHO: ! 496: return(hmsg("\ ! 497: Ask the remote Kermit server to list who's logged in, or to give information\n\ ! 498: about the specified user.")); ! 499: ! 500: default: ! 501: if (x = (cmcfm()) < 0) return(x); ! 502: printf("%s","not working yet - %s\n",cmdbuf); ! 503: return(-2); ! 504: } ! 505: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.