- signal(SIGINT, intr);
- signal(SIGQUIT, intr2);
- signal(SIGPIPE, deadpeer);
- printf("Trying...\n");
- do {
- net = socket(AF_INET, SOCK_STREAM, 0);
- if (net < 0) {
- perror("telnet: socket");
- return 0;
- }
-#ifndef NOT43
- if (debug &&
- setsockopt(net, SOL_SOCKET, SO_DEBUG,
- (char *)&debug, sizeof(debug)) < 0)
-#else NOT43
- if (debug && setsockopt(net, SOL_SOCKET, SO_DEBUG, 0, 0) < 0)
-#endif NOT43
- perror("setsockopt (SO_DEBUG)");
-
- if (connect(net, (struct sockaddr *)&sin, sizeof (sin)) < 0) {
-#ifndef NOT43
- if (host && host->h_addr_list[1]) {
- int oerrno = errno;
-
- fprintf(stderr,
- "telnet: connect to address %s: ",
- inet_ntoa(sin.sin_addr));
- errno = oerrno;
- perror((char *)0);
- host->h_addr_list++;
- bcopy(host->h_addr_list[0],
- (caddr_t)&sin.sin_addr, host->h_length);
- fprintf(stderr, "Trying %s...\n",
- inet_ntoa(sin.sin_addr));
- (void) close(net);
- continue;
- }
-#endif NOT43
- perror("telnet: connect");
- signal(SIGINT, SIG_DFL);
- signal(SIGQUIT, SIG_DFL);
- return 0;
- }
- connected++;
- } while (connected == 0);
- call(status, "status", "notmuch", 0);
- if (setjmp(peerdied) == 0)
- telnet();
- fprintf(stderr, "Connection closed by foreign host.\n");
- exit(1);
- /*NOTREACHED*/
-}
-
-
-#define HELPINDENT (sizeof ("connect"))
-
-char openhelp[] = "connect to a site";
-char closehelp[] = "close current connection";
-char quithelp[] = "exit telnet";
-char zhelp[] = "suspend telnet";
-char statushelp[] = "print status information";
-char helphelp[] = "print help information";
-char sendhelp[] = "transmit special characters ('send ?' for more)";
-char sethelp[] = "set operating parameters ('set ?' for more)";
-char togglestring[] ="toggle operating parameters ('toggle ?' for more)";
-char displayhelp[] = "display operating parameters";
-char modehelp[] =
- "try to enter line-by-line or character-at-a-time mode";
-
-int help();
-
-struct cmd cmdtab[] = {
- { "close", closehelp, bye, 1, 1 },
- { "display", displayhelp, display, 1, 0 },
- { "mode", modehelp, modecmd, 1, 1 },
- { "open", openhelp, tn, 1, 0 },
- { "quit", quithelp, quit, 1, 0 },
- { "send", sendhelp, sendcmd, 1, 1 },
- { "set", sethelp, setcmd, 1, 0 },
- { "status", statushelp, status, 1, 0 },
- { "toggle", togglestring, toggle, 1, 0 },
- { "z", zhelp, suspend, 1, 0 },
- { "?", helphelp, help, 1, 0 },
- 0
-};
-
-char crmodhelp[] = "deprecated command -- use 'toggle crmod' instead";
-char escapehelp[] = "deprecated command -- use 'set escape' instead";
-
-struct cmd cmdtab2[] = {
- { "help", helphelp, help, 0, 0 },
- { "escape", escapehelp, setescape, 1, 0 },
- { "crmod", crmodhelp, togcrmod, 1, 0 },
- 0
-};