Fix up lint errors.
authorGregory Minshall <minshall@ucbvax.Berkeley.EDU>
Tue, 28 Jun 1988 13:19:40 +0000 (05:19 -0800)
committerGregory Minshall <minshall@ucbvax.Berkeley.EDU>
Tue, 28 Jun 1988 13:19:40 +0000 (05:19 -0800)
SCCS-vsn: usr.bin/telnet/ring.c 1.9
SCCS-vsn: usr.bin/telnet/terminal.c 1.12
SCCS-vsn: usr.bin/telnet/network.c 1.12
SCCS-vsn: usr.bin/telnet/ring.h 1.7
SCCS-vsn: usr.bin/telnet/externs.h 1.10
SCCS-vsn: usr.bin/telnet/tn3270.c 1.11
SCCS-vsn: usr.bin/telnet/telnet.c 5.32
SCCS-vsn: usr.bin/telnet/sys_bsd.c 1.12
SCCS-vsn: usr.bin/telnet/utilities.c 1.6
SCCS-vsn: usr.bin/telnet/main.c 1.7
SCCS-vsn: usr.bin/telnet/commands.c 1.6

usr/src/usr.bin/telnet/commands.c
usr/src/usr.bin/telnet/externs.h
usr/src/usr.bin/telnet/main.c
usr/src/usr.bin/telnet/network.c
usr/src/usr.bin/telnet/ring.c
usr/src/usr.bin/telnet/ring.h
usr/src/usr.bin/telnet/sys_bsd.c
usr/src/usr.bin/telnet/telnet.c
usr/src/usr.bin/telnet/terminal.c
usr/src/usr.bin/telnet/tn3270.c
usr/src/usr.bin/telnet/utilities.c

index e3ff66a..c36a016 100644 (file)
@@ -11,7 +11,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)commands.c 1.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)commands.c 1.6 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/types.h>
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -811,7 +811,7 @@ setescape(argc, argv)
                arg = argv[1];
        else {
                printf("new escape character: ");
                arg = argv[1];
        else {
                printf("new escape character: ");
-               gets(buf);
+               (void) gets(buf);
                arg = buf;
        }
        if (arg[0] != '\0')
                arg = buf;
        }
        if (arg[0] != '\0')
@@ -819,7 +819,7 @@ setescape(argc, argv)
        if (!In3270) {
                printf("Escape character is '%s'.\n", control(escape));
        }
        if (!In3270) {
                printf("Escape character is '%s'.\n", control(escape));
        }
-       fflush(stdout);
+       (void) fflush(stdout);
        return 1;
 }
 
        return 1;
 }
 
@@ -830,7 +830,7 @@ togcrmod()
     crmod = !crmod;
     printf("Deprecated usage - please use 'toggle crmod' in the future.\n");
     printf("%s map carriage return on output.\n", crmod ? "Will" : "Won't");
     crmod = !crmod;
     printf("Deprecated usage - please use 'toggle crmod' in the future.\n");
     printf("%s map carriage return on output.\n", crmod ? "Will" : "Won't");
-    fflush(stdout);
+    (void) fflush(stdout);
     return 1;
 }
 
     return 1;
 }
 
@@ -839,7 +839,7 @@ suspend()
 {
        setcommandmode();
 #if    defined(unix)
 {
        setcommandmode();
 #if    defined(unix)
-       kill(0, SIGTSTP);
+       (void) kill(0, SIGTSTP);
 #endif /* defined(unix) */
        /* reget parameters in case they were changed */
        TerminalSaveState();
 #endif /* defined(unix) */
        /* reget parameters in case they were changed */
        TerminalSaveState();
@@ -854,9 +854,9 @@ int argc;           /* Number of arguments */
 char   *argv[];        /* arguments */
 {
     if (connected) {
 char   *argv[];        /* arguments */
 {
     if (connected) {
-       shutdown(net, 2);
+       (void) shutdown(net, 2);
        printf("Connection closed.\n");
        printf("Connection closed.\n");
-       NetClose(net);
+       (void) NetClose(net);
        connected = 0;
        /* reset options */
        tninit();
        connected = 0;
        /* reset options */
        tninit();
@@ -876,13 +876,13 @@ quit()
 {
        (void) call(bye, "bye", "fromquit", 0);
        Exit(0);
 {
        (void) call(bye, "bye", "fromquit", 0);
        Exit(0);
-       /*NOTREACHED*/
        return 1;                       /* just to keep lint happy */
 }
 
 /*
  * Print status about the connection.
  */
        return 1;                       /* just to keep lint happy */
 }
 
 /*
  * Print status about the connection.
  */
+/*ARGSUSED*/
 static
 status(argc, argv)
 int    argc;
 static
 status(argc, argv)
 int    argc;
@@ -902,7 +902,7 @@ char        *argv[];
     }
 #   if !defined(TN3270)
     printf("Escape character is '%s'.\n", control(escape));
     }
 #   if !defined(TN3270)
     printf("Escape character is '%s'.\n", control(escape));
-    fflush(stdout);
+    (void) fflush(stdout);
 #   else /* !defined(TN3270) */
     if ((!In3270) && ((argc < 2) || strcmp(argv[1], "notmuch"))) {
        printf("Escape character is '%s'.\n", control(escape));
 #   else /* !defined(TN3270) */
     if ((!In3270) && ((argc < 2) || strcmp(argv[1], "notmuch"))) {
        printf("Escape character is '%s'.\n", control(escape));
@@ -912,7 +912,7 @@ char        *argv[];
        printf("Transparent mode command is '%s'.\n", transcom);
     }
 #   endif /* defined(unix) */
        printf("Transparent mode command is '%s'.\n", transcom);
     }
 #   endif /* defined(unix) */
-    fflush(stdout);
+    (void) fflush(stdout);
     if (In3270) {
        return 0;
     }
     if (In3270) {
        return 0;
     }
@@ -931,6 +931,7 @@ tn(argc, argv)
     struct sockaddr_in sin;
     struct servent *sp = 0;
     static char        hnamebuf[32];
     struct sockaddr_in sin;
     struct servent *sp = 0;
     static char        hnamebuf[32];
+    unsigned long inet_addr();
 
 
 #if defined(MSDOS)
 
 
 #if defined(MSDOS)
@@ -944,7 +945,7 @@ tn(argc, argv)
     if (argc < 2) {
        (void) strcpy(line, "Connect ");
        printf("(to) ");
     if (argc < 2) {
        (void) strcpy(line, "Connect ");
        printf("(to) ");
-       gets(&line[strlen(line)]);
+       (void) gets(&line[strlen(line)]);
        makeargv();
        argc = margc;
        argv = margv;
        makeargv();
        argc = margc;
        argv = margv;
@@ -992,6 +993,10 @@ tn(argc, argv)
                return 0;
            }
        } else {
                return 0;
            }
        } else {
+#if    !defined(htons)
+           u_short htons();
+#endif /* !defined(htons) */
+
            sin.sin_port = atoi(argv[2]);
            sin.sin_port = htons(sin.sin_port);
        }
            sin.sin_port = atoi(argv[2]);
            sin.sin_port = htons(sin.sin_port);
        }
@@ -1000,7 +1005,7 @@ tn(argc, argv)
        if (sp == 0) {
            sp = getservbyname("telnet", "tcp");
            if (sp == 0) {
        if (sp == 0) {
            sp = getservbyname("telnet", "tcp");
            if (sp == 0) {
-               fprintf(stderr, "telnet: tcp/telnet: unknown service\n",1);
+               fprintf(stderr, "telnet: tcp/telnet: unknown service\n");
                return 0;
            }
            sin.sin_port = sp->s_port;
                return 0;
            }
            sin.sin_port = sp->s_port;
@@ -1022,6 +1027,7 @@ tn(argc, argv)
 #if    defined(h_addr)         /* In 4.3, this is a #define */
            if (host && host->h_addr_list[1]) {
                int oerrno = errno;
 #if    defined(h_addr)         /* In 4.3, this is a #define */
            if (host && host->h_addr_list[1]) {
                int oerrno = errno;
+               extern char *inet_ntoa();
 
                fprintf(stderr, "telnet: connect to address %s: ",
                                                inet_ntoa(sin.sin_addr));
 
                fprintf(stderr, "telnet: connect to address %s: ",
                                                inet_ntoa(sin.sin_addr));
@@ -1041,10 +1047,10 @@ tn(argc, argv)
            }
        connected++;
     } while (connected == 0);
            }
        connected++;
     } while (connected == 0);
-    call(status, "status", "notmuch", 0);
+    (void) call(status, "status", "notmuch", 0);
     if (setjmp(peerdied) == 0)
        telnet();
     if (setjmp(peerdied) == 0)
        telnet();
-    NetClose(net);
+    (void) NetClose(net);
     ExitString("Connection closed by foreign host.\n",1);
     /*NOTREACHED*/
 }
     ExitString("Connection closed by foreign host.\n",1);
     /*NOTREACHED*/
 }
index aa311f2..6efd165 100644 (file)
@@ -9,7 +9,7 @@
  * software without specific prior written permission. This software
  * is provided ``as is'' without express or implied warranty.
  *
  * software without specific prior written permission. This software
  * is provided ``as is'' without express or implied warranty.
  *
- *     @(#)externs.h   1.9 (Berkeley) %G%
+ *     @(#)externs.h   1.10 (Berkeley) %G%
  */
 
 #include <stdio.h>
  */
 
 #include <stdio.h>
@@ -64,11 +64,27 @@ extern jmp_buf
     toplevel;          /* For error conditions. */
 
 extern void
     toplevel;          /* For error conditions. */
 
 extern void
+    command(),
 #if    !defined(NOT43)
     dosynch(),
 #endif /* !defined(NOT43) */
 #if    !defined(NOT43)
     dosynch(),
 #endif /* !defined(NOT43) */
+    Dump(),
+    init_3270(),
+    printoption(),
+    printsub(),
     setconnmode(),
     setconnmode(),
-    setcommandmode();
+    setcommandmode(),
+    setneturg(),
+    sys_telnet_init(),
+    telnet(),
+    TerminalFlushOutput(),
+    TerminalNewMode(),
+    TerminalRestoreState(),
+    TerminalSaveState(),
+    tninit(),
+    upcase(),
+    willoption(),
+    wontoption();
 
 #if    defined(NOT43)
 extern int
 
 #if    defined(NOT43)
 extern int
index 80d24a9..4206621 100644 (file)
@@ -17,7 +17,7 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)main.c     1.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c     1.7 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/types.h>
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -51,7 +51,7 @@ tninit()
  */
 
 
  */
 
 
-void
+int
 main(argc, argv)
        int argc;
        char *argv[];
 main(argc, argv)
        int argc;
        char *argv[];
@@ -96,9 +96,13 @@ main(argc, argv)
     if (argc != 1) {
        if (setjmp(toplevel) != 0)
            Exit(0);
     if (argc != 1) {
        if (setjmp(toplevel) != 0)
            Exit(0);
-       tn(argc, argv);
+       if (tn(argc, argv) == 1) {
+           return 0;
+       } else {
+           return 1;
+       }
     }
     }
-    setjmp(toplevel);
+    (void) setjmp(toplevel);
     for (;;) {
 #if    !defined(TN3270)
        command(1);
     for (;;) {
 #if    !defined(TN3270)
        command(1);
index d2fbb5d..307cdb0 100644 (file)
@@ -11,7 +11,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)network.c  1.11 (Berkeley) %G%";
+static char sccsid[] = "@(#)network.c  1.12 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/types.h>
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -37,8 +37,12 @@ char netobuf[2*BUFSIZ], netibuf[BUFSIZ];
 
 init_network()
 {
 
 init_network()
 {
-    ring_init(&netoring, netobuf, sizeof netobuf);
-    ring_init(&netiring, netibuf, sizeof netibuf);
+    if (ring_init(&netoring, netobuf, sizeof netobuf) != 1) {
+       exit(1);
+    }
+    if (ring_init(&netiring, netibuf, sizeof netibuf) != 1) {
+       exit(1);
+    }
     NetTrace = stdout;
 }
 
     NetTrace = stdout;
 }
 
@@ -63,7 +67,7 @@ stilloob()
 
     if (value < 0) {
        perror("select");
 
     if (value < 0) {
        perror("select");
-       quit();
+       (void) quit();
     }
     if (FD_ISSET(net, &excepts)) {
        return 1;
     }
     if (FD_ISSET(net, &excepts)) {
        return 1;
index 680f5c8..500e25f 100644 (file)
@@ -11,7 +11,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)ring.c     1.8 (Berkeley) %G%";
+static char sccsid[] = "@(#)ring.c     1.9 (Berkeley) %G%";
 #endif /* not lint */
 
 /*
 #endif /* not lint */
 
 /*
index fa1d966..5d7bdd2 100644 (file)
@@ -9,7 +9,7 @@
  * software without specific prior written permission. This software
  * is provided ``as is'' without express or implied warranty.
  *
  * software without specific prior written permission. This software
  * is provided ``as is'' without express or implied warranty.
  *
- *     @(#)ring.h      1.6 (Berkeley) %G%
+ *     @(#)ring.h      1.7 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -59,4 +59,25 @@ extern int
        ring_full_count(Ring *ring),
        ring_full_consecutive(Ring *ring);
 
        ring_full_count(Ring *ring),
        ring_full_consecutive(Ring *ring);
 
+#else /* LINT_ARGS */
+extern int
+       ring_init();
+
+extern void
+    ring_supply_data(),
+    ring_consume_data();
+
+extern void
+    ring_supplied(),
+    ring_consumed();
+
+extern void
+    ring_clear_mark(),
+    ring_mark();
+
+extern int
+    ring_empty_count(),
+    ring_empty_consecutive(),
+    ring_full_count(),
+    ring_full_consecutive();
 #endif /* defined(LINT_ARGS) */
 #endif /* defined(LINT_ARGS) */
index d5fbe8a..000ff24 100644 (file)
@@ -11,7 +11,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)sys_bsd.c  1.11 (Berkeley) %G%";
+static char sccsid[] = "@(#)sys_bsd.c  1.12 (Berkeley) %G%";
 #endif /* not lint */
 
 /*
 #endif /* not lint */
 
 /*
@@ -289,9 +289,9 @@ register int f;
     if (MODE_LINE(f)) {
        void doescape();
 
     if (MODE_LINE(f)) {
        void doescape();
 
-       signal(SIGTSTP, doescape);
+       (void) signal(SIGTSTP, (int (*)())doescape);
     } else if (MODE_LINE(old)) {
     } else if (MODE_LINE(old)) {
-       signal(SIGTSTP, SIG_DFL);
+       (void) signal(SIGTSTP, SIG_DFL);
        sigsetmask(sigblock(0) & ~(1<<(SIGTSTP-1)));
     }
 }
        sigsetmask(sigblock(0) & ~(1<<(SIGTSTP-1)));
     }
 }
@@ -314,6 +314,7 @@ int
     ioctl(fd, FIONBIO, (char *)&onoff);
 }
 
     ioctl(fd, FIONBIO, (char *)&onoff);
 }
 
+#if    defined(TN3270)
 void
 NetSigIO(fd, onoff)
 int
 void
 NetSigIO(fd, onoff)
 int
@@ -335,6 +336,7 @@ int fd;
 #endif /* defined(NOT43) */
     ioctl(fd, SIOCSPGRP, (char *)&myPid);      /* set my pid */
 }
 #endif /* defined(NOT43) */
     ioctl(fd, SIOCSPGRP, (char *)&myPid);      /* set my pid */
 }
+#endif /*defined(TN3270)*/
 \f
 /*
  * Various signal handling routines.
 \f
 /*
  * Various signal handling routines.
@@ -380,9 +382,9 @@ sys_telnet_init()
     int myPid;
 #endif /* defined(TN3270) */
 
     int myPid;
 #endif /* defined(TN3270) */
 
-    signal(SIGINT, intr);
-    signal(SIGQUIT, intr2);
-    signal(SIGPIPE, deadpeer);
+    (void) signal(SIGINT, (int (*)())intr);
+    (void) signal(SIGQUIT, (int (*)())intr2);
+    (void) signal(SIGPIPE, (int (*)())deadpeer);
 
     setconnmode();
 
 
     setconnmode();
 
@@ -396,7 +398,9 @@ sys_telnet_init()
 #endif /* defined(TN3270) */
 
 #if    defined(SO_OOBINLINE)
 #endif /* defined(TN3270) */
 
 #if    defined(SO_OOBINLINE)
-    SetSockOpt(net, SOL_SOCKET, SO_OOBINLINE, 1);
+    if (SetSockOpt(net, SOL_SOCKET, SO_OOBINLINE, 1) == -1) {
+       perror("SetSockOpt");
+    }
 #endif /* defined(SO_OOBINLINE) */
 }
 
 #endif /* defined(SO_OOBINLINE) */
 }
 
index 843ce4c..6c4894a 100644 (file)
@@ -11,7 +11,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)telnet.c   5.31 (Berkeley) %G%";
+static char sccsid[] = "@(#)telnet.c   5.32 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/types.h>
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -69,8 +69,10 @@ int
        crmod,
        netdata,        /* Print out network data flow */
        crlf,           /* Should '\r' be mapped to <CR><LF> (or <CR><NUL>)? */
        crmod,
        netdata,        /* Print out network data flow */
        crlf,           /* Should '\r' be mapped to <CR><LF> (or <CR><NUL>)? */
+#if    defined(TN3270)
        noasynch = 0,   /* User specified "-noasynch" on command line */
        askedSGA = 0,   /* We have talked about suppress go ahead */
        noasynch = 0,   /* User specified "-noasynch" on command line */
        askedSGA = 0,   /* We have talked about suppress go ahead */
+#endif /* defined(TN3270) */
        telnetport,
        SYNCHing,       /* we are in TELNET SYNCH mode */
        flushout,       /* flush output */
        telnetport,
        SYNCHing,       /* we are in TELNET SYNCH mode */
        flushout,       /* flush output */
@@ -157,6 +159,7 @@ init_telnet()
 
 #include <varargs.h>
 
 
 #include <varargs.h>
 
+/*VARARGS*/
 static void
 printring(va_alist)
 va_dcl
 static void
 printring(va_alist)
 va_dcl
@@ -719,7 +722,6 @@ int
 Scheduler(block)
 int    block;                  /* should we block in the select ? */
 {
 Scheduler(block)
 int    block;                  /* should we block in the select ? */
 {
-    register int c;
                /* One wants to be a bit careful about setting returnValue
                 * to one, since a one implies we did some useful work,
                 * and therefore probably won't be called to block next
                /* One wants to be a bit careful about setting returnValue
                 * to one, since a one implies we did some useful work,
                 * and therefore probably won't be called to block next
@@ -765,6 +767,8 @@ int block;                  /* should we block in the select ? */
     if (ring_full_count(&ttyiring)) {
 #   if defined(TN3270)
        if (In3270) {
     if (ring_full_count(&ttyiring)) {
 #   if defined(TN3270)
        if (In3270) {
+           int c;
+
            c = DataFromTerminal(ttyiring.consume,
                                        ring_full_consecutive(&ttyiring));
            if (c) {
            c = DataFromTerminal(ttyiring.consume,
                                        ring_full_consecutive(&ttyiring));
            if (c) {
@@ -803,7 +807,7 @@ telnet()
            willoption(TELOPT_SGA, 0);
        }
        if (!myopts[TELOPT_TTYPE]) {
            willoption(TELOPT_SGA, 0);
        }
        if (!myopts[TELOPT_TTYPE]) {
-           dooption(TELOPT_TTYPE, 0);
+           dooption(TELOPT_TTYPE);
        }
     }
 #   endif /* !defined(TN3270) */
        }
     }
 #   endif /* !defined(TN3270) */
@@ -865,6 +869,7 @@ telnet()
 #   endif /* !defined(TN3270) */
 }
 \f
 #   endif /* !defined(TN3270) */
 }
 \f
+#if    0       /* XXX - this not being in is a bug */
 /*
  * nextitem()
  *
 /*
  * nextitem()
  *
@@ -905,6 +910,7 @@ char        *current;
        return current+2;
     }
 }
        return current+2;
     }
 }
+#endif /* 0 */
 
 /*
  * netclear()
 
 /*
  * netclear()
index 844f0b8..64d13a1 100644 (file)
@@ -11,7 +11,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)terminal.c 1.11 (Berkeley) %G%";
+static char sccsid[] = "@(#)terminal.c 1.12 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <arpa/telnet.h>
 #endif /* not lint */
 
 #include <arpa/telnet.h>
@@ -31,7 +31,9 @@ char
     termFlushChar,
     termIntChar,
     termKillChar,
     termFlushChar,
     termIntChar,
     termKillChar,
+#if    defined(MSDOS)
     termLiteralNextChar,
     termLiteralNextChar,
+#endif /* defined(MSDOS) */
     termQuitChar;
 
 /*
     termQuitChar;
 
 /*
@@ -40,8 +42,12 @@ char
 
 init_terminal()
 {
 
 init_terminal()
 {
-    ring_init(&ttyoring, ttyobuf, sizeof ttyobuf);
-    ring_init(&ttyiring, ttyibuf, sizeof ttyibuf);
+    if (ring_init(&ttyoring, ttyobuf, sizeof ttyobuf) != 1) {
+       exit(1);
+    }
+    if (ring_init(&ttyiring, ttyibuf, sizeof ttyibuf) != 1) {
+       exit(1);
+    }
     autoflush = TerminalAutoFlush();
 }
 
     autoflush = TerminalAutoFlush();
 }
 
index 9537163..0e6532e 100644 (file)
@@ -11,7 +11,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)tn3270.c   1.10 (Berkeley) %G%";
+static char sccsid[] = "@(#)tn3270.c   1.11 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/types.h>
 #endif /* not lint */
 
 #include <sys/types.h>
index f34660c..fb038d4 100644 (file)
@@ -11,7 +11,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)utilities.c        1.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)utilities.c        1.6 (Berkeley) %G%";
 #endif /* not lint */
 
 #define        TELOPTS
 #endif /* not lint */
 
 #define        TELOPTS
@@ -171,7 +171,8 @@ int length;                 /* length of suboption data */
                break;
            default:
                fprintf(NetTrace,
                break;
            default:
                fprintf(NetTrace,
-                               "- unknown qualifier %d (0x%x).\n", pointer[1]);
+                               "- unknown qualifier %d (0x%x).\n",
+                               pointer[1], pointer[1]);
            }
            break;
        default:
            }
            break;
        default: