/[inetutils]/inetutils/telnet/commands.c
ViewVC logotype

Diff of /inetutils/telnet/commands.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.18 by ams, Mon Jun 20 08:20:37 2005 UTC revision 1.19 by gray, Tue Oct 11 11:16:15 2005 UTC
# Line 362  sendcmd(int  argc, char **argv) Line 362  sendcmd(int  argc, char **argv)
362      for (i = 1; i < argc; i++) {      for (i = 1; i < argc; i++) {
363          if ((s = GETSEND(argv[i])) == 0) {          if ((s = GETSEND(argv[i])) == 0) {
364              fprintf(stderr, "Telnet 'send' error - argument disappeared!\n");              fprintf(stderr, "Telnet 'send' error - argument disappeared!\n");
365              (void) quit();              quit();
366              /*NOTREACHED*/              /*NOTREACHED*/
367          }          }
368          if (s->handler) {          if (s->handler) {
# Line 1311  setescape(int argc, char *argv[]) Line 1311  setescape(int argc, char *argv[])
1311                  arg = argv[1];                  arg = argv[1];
1312          else {          else {
1313                  printf("new escape character: ");                  printf("new escape character: ");
1314                  (void) fgets(buf, sizeof(buf), stdin);                  fgets(buf, sizeof(buf), stdin);
1315                  arg = buf;                  arg = buf;
1316          }          }
1317          if (arg[0] != '\0')          if (arg[0] != '\0')
# Line 1319  setescape(int argc, char *argv[]) Line 1319  setescape(int argc, char *argv[])
1319          if (!In3270) {          if (!In3270) {
1320                  printf("Escape character is '%s'.\n", control(escape));                  printf("Escape character is '%s'.\n", control(escape));
1321          }          }
1322          (void) fflush(stdout);          fflush(stdout);
1323          return 1;          return 1;
1324  }  }
1325    
# Line 1330  togcrmod() Line 1330  togcrmod()
1330      crmod = !crmod;      crmod = !crmod;
1331      printf("Deprecated usage - please use 'toggle crmod' in the future.\n");      printf("Deprecated usage - please use 'toggle crmod' in the future.\n");
1332      printf("%s map carriage return on output.\n", crmod ? "Will" : "Won't");      printf("%s map carriage return on output.\n", crmod ? "Will" : "Won't");
1333      (void) fflush(stdout);      fflush(stdout);
1334      return 1;      return 1;
1335  }  }
1336    
# Line 1344  suspend() Line 1344  suspend()
1344          long oldrows, oldcols, newrows, newcols, err;          long oldrows, oldcols, newrows, newcols, err;
1345    
1346          err = (TerminalWindowSize(&oldrows, &oldcols) == 0) ? 1 : 0;          err = (TerminalWindowSize(&oldrows, &oldcols) == 0) ? 1 : 0;
1347          (void) kill(0, SIGTSTP);          kill(0, SIGTSTP);
1348          /*          /*
1349           * If we didn't get the window size before the SUSPEND, but we           * If we didn't get the window size before the SUSPEND, but we
1350           * can get them now (?), then send the NAWS to make sure that           * can get them now (?), then send the NAWS to make sure that
# Line 1404  shell(int argc, char *argv[]) Line 1404  shell(int argc, char *argv[])
1404              _exit(1);              _exit(1);
1405          }          }
1406      default:      default:
1407              (void)wait((int *)0);       /* Wait for the shell to complete */              wait((int *)0);     /* Wait for the shell to complete */
1408    
1409              if (TerminalWindowSize(&newrows, &newcols) && connected &&              if (TerminalWindowSize(&newrows, &newcols) && connected &&
1410                  (err || ((oldrows != newrows) || (oldcols != newcols)))) {                  (err || ((oldrows != newrows) || (oldcols != newcols)))) {
# Line 1427  bye(int  argc, char *argv[]) Line 1427  bye(int  argc, char *argv[])
1427      extern int resettermname;      extern int resettermname;
1428    
1429      if (connected) {      if (connected) {
1430          (void) shutdown(net, 2);          shutdown(net, 2);
1431          printf("Connection closed.\n");          printf("Connection closed.\n");
1432          (void) NetClose(net);          NetClose(net);
1433          connected = 0;          connected = 0;
1434          resettermname = 1;          resettermname = 1;
1435  #if     defined(AUTHENTICATION) || defined(ENCRYPTION)  #if     defined(AUTHENTICATION) || defined(ENCRYPTION)
# Line 1452  bye(int  argc, char *argv[]) Line 1452  bye(int  argc, char *argv[])
1452  int  int
1453  quit()  quit()
1454  {  {
1455          (void) call(bye, "bye", "fromquit", 0);          call(bye, "bye", "fromquit", 0);
1456          Exit(0);          Exit(0);
1457          /*NOTREACHED*/          /*NOTREACHED*/
1458  }  }
# Line 1462  int Line 1462  int
1462  logout()  logout()
1463  {  {
1464          send_do(TELOPT_LOGOUT, 1);          send_do(TELOPT_LOGOUT, 1);
1465          (void) netflush();          netflush();
1466          return 1;          return 1;
1467  }  }
1468    
# Line 2152  status(int      argc, char *argv[]) Line 2152  status(int      argc, char *argv[])
2152      }      }
2153  #   if !defined(TN3270)  #   if !defined(TN3270)
2154      printf("Escape character is '%s'.\n", control(escape));      printf("Escape character is '%s'.\n", control(escape));
2155      (void) fflush(stdout);      fflush(stdout);
2156  #   else /* !defined(TN3270) */  #   else /* !defined(TN3270) */
2157      if ((!In3270) && ((argc < 2) || strcmp(argv[1], "notmuch"))) {      if ((!In3270) && ((argc < 2) || strcmp(argv[1], "notmuch"))) {
2158          printf("Escape character is '%s'.\n", control(escape));          printf("Escape character is '%s'.\n", control(escape));
# Line 2176  status(int      argc, char *argv[]) Line 2176  status(int      argc, char *argv[])
2176         printf("Transparent mode command is '%s'.\n", transcom);         printf("Transparent mode command is '%s'.\n", transcom);
2177      }      }
2178  #   endif /* defined(unix) */  #   endif /* defined(unix) */
2179      (void) fflush(stdout);      fflush(stdout);
2180      if (In3270) {      if (In3270) {
2181          return 0;          return 0;
2182      }      }
# Line 2191  status(int      argc, char *argv[]) Line 2191  status(int      argc, char *argv[])
2191  int  int
2192  ayt_status()  ayt_status()
2193  {  {
2194      (void) call(status, "status", "notmuch", 0);      call(status, "status", "notmuch", 0);
2195  }  }
2196  #endif  #endif
2197    
# Line 2224  tn(int argc, char *argv[]) Line 2224  tn(int argc, char *argv[])
2224      }      }
2225    if (argc < 2)    if (argc < 2)
2226      {      {
2227        (void) strcpy(line, "open ");        strcpy(line, "open ");
2228        printf("(to) ");        printf("(to) ");
2229        (void) fgets(&line[strlen(line)], sizeof(line) - strlen(line), stdin);        fgets(&line[strlen(line)], sizeof(line) - strlen(line), stdin);
2230        makeargv();        makeargv();
2231        argc = margc;        argc = margc;
2232        argv = margv;        argv = margv;
# Line 2504  tn(int argc, char *argv[]) Line 2504  tn(int argc, char *argv[])
2504        env_define((unsigned char *)"USER", (unsigned char *)user);        env_define((unsigned char *)"USER", (unsigned char *)user);
2505        env_export((unsigned char *)"USER");        env_export((unsigned char *)"USER");
2506      }      }
2507    (void) call(status, "status", "notmuch", 0);    call(status, "status", "notmuch", 0);
2508    if (setjmp(peerdied) == 0)    if (setjmp(peerdied) == 0)
2509      telnet(user);      telnet(user);
2510    
# Line 2648  command(int top, char *tbuf, int cnt) Line 2648  command(int top, char *tbuf, int cnt)
2648          putchar('\n');          putchar('\n');
2649  #if     defined(unix)  #if     defined(unix)
2650      } else {      } else {
2651          (void) signal(SIGINT, SIG_DFL);          signal(SIGINT, SIG_DFL);
2652          (void) signal(SIGQUIT, SIG_DFL);          signal(SIGQUIT, SIG_DFL);
2653  #endif  /* defined(unix) */  #endif  /* defined(unix) */
2654      }      }
2655      for (;;) {      for (;;) {
# Line 2672  command(int top, char *tbuf, int cnt) Line 2672  command(int top, char *tbuf, int cnt)
2672                  printf("%s> ", prompt);                  printf("%s> ", prompt);
2673              if (fgets(line, sizeof(line), stdin) == NULL) {              if (fgets(line, sizeof(line), stdin) == NULL) {
2674                  if (feof(stdin) || ferror(stdin)) {                  if (feof(stdin) || ferror(stdin)) {
2675                      (void) quit();                      quit();
2676                      /*NOTREACHED*/                      /*NOTREACHED*/
2677                  }                  }
2678                  break;                  break;

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26