📄 commands.c
字号:
&autosynch, "send interrupt characters in urgent mode", 0 },#if defined(AUTHENTICATION) { "autologin", "automatic sending of login and/or authentication info", 0, &autologin, "send login name and/or authentication information", 0 }, { "authdebug", "Toggle authentication debugging", auth_togdebug, 0, "print authentication debugging information", 0 },#endif#if defined(ENCRYPTION) { "autoencrypt", "automatic encryption of data stream", EncryptAutoEnc, 0, "automatically encrypt output", 0 }, { "autodecrypt", "automatic decryption of data stream", EncryptAutoDec, 0, "automatically decrypt input", 0 }, { "verbose_encrypt", "Toggle verbose encryption output", EncryptVerbose, 0, "print verbose encryption output", 0 }, { "encdebug", "Toggle encryption debugging", EncryptDebug, 0, "print encryption debugging information", 0 },#endif { "skiprc", "don't read ~/.telnetrc file", 0, &skiprc, "skip reading of ~/.telnetrc file", 0 }, { "binary", "sending and receiving of binary data", togbinary, 0, 0, 0 }, { "inbinary", "receiving of binary data", togrbinary, 0, 0, 0 }, { "outbinary", "sending of binary data", togxbinary, 0, 0, 0 }, { "crlf", "sending carriage returns as telnet <CR><LF>", togcrlf, &crlf, 0, 0 }, { "crmod", "mapping of received carriage returns", 0, &crmod, "map carriage return on output", 0 }, { "localchars", "local recognition of certain control characters", lclchars, &localchars, "recognize certain control characters", 0 }, { " ", "", 0, NULL, NULL, 0 }, /* empty line */#if defined(unix) && defined(TN3270) { "apitrace", "(debugging) toggle tracing of API transactions", 0, &apitrace, "trace API transactions", 0 }, { "cursesdata", "(debugging) toggle printing of hexadecimal curses data", 0, &cursesdata, "print hexadecimal representation of curses data", 0 },#endif /* defined(unix) && defined(TN3270) */ { "debug", "debugging", togdebug, &debug, "turn on socket level debugging", 0 }, { "netdata", "printing of hexadecimal network data (debugging)", 0, &netdata, "print hexadecimal representation of network traffic", 0 }, { "prettydump", "output of \"netdata\" to user readable format (debugging)", 0, &prettydump, "print user readable output for \"netdata\"", 0 }, { "options", "viewing of options processing (debugging)", 0, &showoptions, "show option processing", 0 },#if defined(unix) { "termdata", "(debugging) toggle printing of hexadecimal terminal data", 0, &termdata, "print hexadecimal representation of terminal traffic", 0 },#endif /* defined(unix) */ { "?", 0, togglehelp, NULL, NULL, 0 }, { "help", 0, togglehelp, NULL, NULL, 0 }, { NULL, NULL, NULL, NULL, NULL, 0 }}; static inttogglehelp(int arg){ struct togglelist *c; (void)arg; for (c = Togglelist; c->name; c++) { if (c->help) { if (*c->help) printf("%-15s toggle %s\r\n", c->name, c->help); else printf("\r\n"); } } printf("\r\n"); printf("%-15s %s\r\n", "?", "display help information"); return 0;} static voidsettogglehelp(int set){ struct togglelist *c; for (c = Togglelist; c->name; c++) { if (c->help) { if (*c->help) printf("%-15s %s %s\r\n", c->name, set ? "enable" : "disable", c->help); else printf("\r\n"); } }}#define GETTOGGLE(name) (struct togglelist *) \ genget(name, (char **) Togglelist, sizeof(struct togglelist)) static inttoggle(int argc, char *argv[]){ int retval = 1; char *name; struct togglelist *c; if (argc < 2) { fprintf(stderr, "Need an argument to 'toggle' command. 'toggle ?' for help.\r\n"); return 0; } argc--; argv++; while (argc--) { name = *argv++; c = GETTOGGLE(name); if (Ambiguous(c)) { fprintf(stderr, "'%s': ambiguous argument ('toggle ?' for help).\r\n", name); return 0; } else if (c == 0) { fprintf(stderr, "'%s': unknown argument ('toggle ?' for help).\r\n", name); return 0; } else if (!connected && c->needconnect) { printf("?Need to be connected first.\r\n"); printf("'send ?' for help\r\n"); return 0; } else { if (c->variable) { *c->variable = !*c->variable; /* invert it */ if (c->actionexplanation) { printf("%s %s.\r\n", *c->variable? "Will" : "Won't", c->actionexplanation); } } if (c->handler) { retval &= (*c->handler)(-1); } } } return retval;}/* * The following perform the "set" command. */#ifdef USE_TERMIOstruct termios new_tc;#endiftypedef void (*set_handler_t) P((int));struct setlist { const char *name; /* name */ const char *help; /* help information */ set_handler_t handler; cc_t *charp; /* where it is located at */};static struct setlist Setlist[] = {#ifdef KLUDGELINEMODE { "echo", "character to toggle local echoing on/off", 0, &echoc },#endif { "escape", "character to escape back to telnet command mode", 0, &escape }, { "rlogin", "rlogin escape character", 0, &rlogin }, { "tracefile", "file to write trace information to", (set_handler_t)SetNetTrace, (cc_t *)NetTraceFile}, { " ", "", 0, NULL }, { " ", "The following need 'localchars' to be toggled true", 0, 0 }, { "flushoutput", "character to cause an Abort Output", 0, &termFlushChar }, { "interrupt", "character to cause an Interrupt Process", 0, &termIntChar }, { "quit", "character to cause an Abort process", 0, &termQuitChar }, { "eof", "character to cause an EOF ", 0, &termEofChar }, { " ", "" , 0, NULL }, { " ", "The following are for local editing in linemode", 0, 0 }, { "erase", "character to use to erase a character", 0, &termEraseChar }, { "kill", "character to use to erase a line", 0, &termKillChar }, { "lnext", "character to use for literal next", 0, &termLiteralNextChar }, { "susp", "character to cause a Suspend Process", 0, &termSuspChar }, { "reprint", "character to use for line reprint", 0, &termRprntChar }, { "worderase", "character to use to erase a word", 0, &termWerasChar }, { "start", "character to use for XON", 0, &termStartChar }, { "stop", "character to use for XOFF", 0, &termStopChar }, { "forw1", "alternate end of line character", 0, &termForw1Char }, { "forw2", "alternate end of line character", 0, &termForw2Char }, { "ayt", "alternate AYT character", 0, &termAytChar }, { NULL, NULL, 0, NULL }}; static struct setlist *getset(char *name){ return (struct setlist *) genget(name, (char **) Setlist, sizeof(struct setlist));} voidset_escape_char(char *s){ if (rlogin != _POSIX_VDISABLE) { rlogin = (s && *s) ? special(s) : _POSIX_VDISABLE; printf("Telnet rlogin escape character is '%s'.\r\n", control(rlogin)); } else { escape = (s && *s) ? special(s) : _POSIX_VDISABLE; printf("Telnet escape character is '%s'.\r\n", control(escape)); }} static intsetcmd(int argc, char *argv[]){ int value; struct setlist *ct; struct togglelist *c; if (argc < 2 || argc > 3) { printf("Format is 'set Name Value'\r\n'set ?' for help.\r\n"); return 0; } if ((argc == 2) && (isprefix(argv[1], "?") || isprefix(argv[1], "help"))) { for (ct = Setlist; ct->name; ct++) printf("%-15s %s\r\n", ct->name, ct->help); printf("\r\n"); settogglehelp(1); printf("%-15s %s\r\n", "?", "display help information"); return 0; } ct = getset(argv[1]); if (ct == 0) { c = GETTOGGLE(argv[1]); if (c == 0) { fprintf(stderr, "'%s': unknown argument ('set ?' for help).\r\n", argv[1]); return 0; } else if (Ambiguous(c)) { fprintf(stderr, "'%s': ambiguous argument ('set ?' for help).\r\n", argv[1]); return 0; } else if (!connected && c->needconnect) { printf("?Need to be connected first.\r\n"); printf("'send ?' for help\r\n"); return 0; } if (c->variable) { if ((argc == 2) || (strcmp("on", argv[2]) == 0)) *c->variable = 1; else if (strcmp("off", argv[2]) == 0) *c->variable = 0; else { printf("Format is 'set togglename [on|off]'\r\n'set ?' for help.\r\n"); return 0; } if (c->actionexplanation) { printf("%s %s.\r\n", *c->variable? "Will" : "Won't", c->actionexplanation);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -