From fd8ad2c1313cb949cf42f4c31d55b9126398834f Mon Sep 17 00:00:00 2001 From: guenther Date: Sun, 20 Jul 2014 10:18:10 +0000 Subject: [PATCH] Kill lint comments; mark ExitString() as __dead --- usr.bin/telnet/commands.c | 25 +++++-------------------- usr.bin/telnet/externs.h | 5 ++--- usr.bin/telnet/main.c | 7 +++---- usr.bin/telnet/network.c | 3 +-- usr.bin/telnet/sys_bsd.c | 8 +------- usr.bin/telnet/telnet.c | 6 ++---- 6 files changed, 14 insertions(+), 40 deletions(-) diff --git a/usr.bin/telnet/commands.c b/usr.bin/telnet/commands.c index 8b59a9299e1..efce4e4dfaa 100644 --- a/usr.bin/telnet/commands.c +++ b/usr.bin/telnet/commands.c @@ -1,4 +1,4 @@ -/* $OpenBSD: commands.c,v 1.65 2014/07/20 09:59:42 guenther Exp $ */ +/* $OpenBSD: commands.c,v 1.66 2014/07/20 10:18:10 guenther Exp $ */ /* $NetBSD: commands.c,v 1.14 1996/03/24 22:03:48 jtk Exp $ */ /* @@ -347,7 +347,6 @@ sendcmd(argc, argv) if ((s = GETSEND(argv[i])) == 0) { fprintf(stderr, "Telnet 'send' error - argument disappeared!\r\n"); quit(); - /*NOTREACHED*/ } if (s->handler) { count++; @@ -1249,7 +1248,6 @@ setescape(argc, argv) return 1; } - /*VARARGS*/ static int togcrmod() { @@ -1260,7 +1258,6 @@ togcrmod() return 1; } - /*VARARGS*/ int telnetsuspend() { @@ -1286,7 +1283,6 @@ telnetsuspend() return 1; } - /*ARGSUSED*/ int shell(argc, argv) int argc; @@ -1335,7 +1331,6 @@ shell(argc, argv) return 1; } - /*VARARGS*/ static int bye(argc, argv) int argc; /* Number of arguments */ @@ -1352,11 +1347,9 @@ bye(argc, argv) /* reset options */ tninit(); } - if ((argc != 2) || (strcmp(argv[1], "fromquit") != 0)) { + if ((argc != 2) || (strcmp(argv[1], "fromquit") != 0)) longjmp(toplevel, 1); - /* NOTREACHED */ - } - return 0; /* NOTREACHED */ + return 0; } void @@ -1372,7 +1365,6 @@ quitcmd(int unused1, char *unused2[]) quit(); } -/*VARARGS*/ static int logout() { @@ -1762,7 +1754,6 @@ env_getvalue(var, exported_only) /* * Print status about the connection. */ - /*ARGSUSED*/ static int status(argc, argv) int argc; @@ -2120,8 +2111,6 @@ tn(argc, argv) telnet(user); (void) NetClose(net); ExitString("Connection closed by foreign host.\r\n",1); - /*NOTREACHED*/ - return 0; } #define HELPINDENT (sizeof ("connect")) @@ -2248,10 +2237,8 @@ command(top, tbuf, cnt) if (rlogin != _POSIX_VDISABLE) printf("%s> ", prompt); if (fgets(line, sizeof(line), stdin) == NULL) { - if (feof(stdin) || ferror(stdin)) { + if (feof(stdin) || ferror(stdin)) quit(); - /*NOTREACHED*/ - } break; } } @@ -2279,10 +2266,8 @@ command(top, tbuf, cnt) } } if (!top) { - if (!connected) { + if (!connected) longjmp(toplevel, 1); - /*NOTREACHED*/ - } setconnmode(0); } } diff --git a/usr.bin/telnet/externs.h b/usr.bin/telnet/externs.h index 227ec6cdfb8..0aa9c6a10a9 100644 --- a/usr.bin/telnet/externs.h +++ b/usr.bin/telnet/externs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: externs.h,v 1.24 2014/07/20 09:31:25 guenther Exp $ */ +/* $OpenBSD: externs.h,v 1.25 2014/07/20 10:18:10 guenther Exp $ */ /* $KTH: externs.h,v 1.16 1997/11/29 02:28:35 joda Exp $ */ /* @@ -180,7 +180,6 @@ void command(int top, char *tbuf, int cnt); /* main.c */ void tninit(void); -void usage(void); /* network.c */ @@ -302,7 +301,7 @@ void printsub(int direction, unsigned char *pointer, int length); void EmptyTerminal(void); void SetForExit(void); __dead void Exit(int returnCode); -void ExitString(char *string, int returnCode); +__dead void ExitString(char *string, int returnCode); extern struct termios new_tc; diff --git a/usr.bin/telnet/main.c b/usr.bin/telnet/main.c index abc6ef1b328..bfeed1f0c7e 100644 --- a/usr.bin/telnet/main.c +++ b/usr.bin/telnet/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.26 2014/07/20 08:12:45 guenther Exp $ */ +/* $OpenBSD: main.c,v 1.27 2014/07/20 10:18:10 guenther Exp $ */ /* $NetBSD: main.c,v 1.5 1996/02/28 21:04:05 thorpej Exp $ */ /* @@ -55,8 +55,8 @@ tninit() init_sys(); } - void -usage() +static __dead void +usage(void) { extern char *__progname; @@ -165,7 +165,6 @@ main(argc, argv) case '?': default: usage(); - /* NOTREACHED */ } } diff --git a/usr.bin/telnet/network.c b/usr.bin/telnet/network.c index bb124f11329..39a3f766ced 100644 --- a/usr.bin/telnet/network.c +++ b/usr.bin/telnet/network.c @@ -1,4 +1,4 @@ -/* $OpenBSD: network.c,v 1.14 2014/07/20 08:56:47 guenther Exp $ */ +/* $OpenBSD: network.c,v 1.15 2014/07/20 10:18:10 guenther Exp $ */ /* $NetBSD: network.c,v 1.5 1996/02/28 21:04:06 thorpej Exp $ */ /* @@ -130,7 +130,6 @@ netflush() (void)NetClose(net); ring_clear_mark(&netoring); longjmp(peerdied, -1); - /*NOTREACHED*/ } n = 0; } diff --git a/usr.bin/telnet/sys_bsd.c b/usr.bin/telnet/sys_bsd.c index 658fd8a2592..2ac91941b08 100644 --- a/usr.bin/telnet/sys_bsd.c +++ b/usr.bin/telnet/sys_bsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_bsd.c,v 1.23 2014/07/20 09:59:42 guenther Exp $ */ +/* $OpenBSD: sys_bsd.c,v 1.24 2014/07/20 10:18:10 guenther Exp $ */ /* $NetBSD: sys_bsd.c,v 1.11 1996/02/28 21:04:10 thorpej Exp $ */ /* @@ -563,7 +563,6 @@ NetNonblockingIO(fd, onoff) * Various signal handling routines. */ - /* ARGSUSED */ void deadpeer(sig) int sig; @@ -572,7 +571,6 @@ deadpeer(sig) longjmp(peerdied, -1); } - /* ARGSUSED */ void intr(sig) int sig; @@ -585,7 +583,6 @@ intr(sig) longjmp(toplevel, -1); } - /* ARGSUSED */ void intr2(sig) int sig; @@ -601,7 +598,6 @@ intr2(sig) } } - /* ARGSUSED */ void susp(sig) int sig; @@ -613,7 +609,6 @@ susp(sig) } #ifdef SIGWINCH - /* ARGSUSED */ void sendwin(sig) int sig; @@ -625,7 +620,6 @@ sendwin(sig) #endif #ifdef SIGINFO - /* ARGSUSED */ void ayt(sig) int sig; diff --git a/usr.bin/telnet/telnet.c b/usr.bin/telnet/telnet.c index 72033a713c6..e473b9993d9 100644 --- a/usr.bin/telnet/telnet.c +++ b/usr.bin/telnet/telnet.c @@ -1,4 +1,4 @@ -/* $OpenBSD: telnet.c,v 1.25 2014/07/20 08:56:47 guenther Exp $ */ +/* $OpenBSD: telnet.c,v 1.26 2014/07/20 10:18:10 guenther Exp $ */ /* $NetBSD: telnet.c,v 1.7 1996/02/28 21:04:15 thorpej Exp $ */ /* @@ -655,10 +655,8 @@ suboption() TELQUAL_IS, name, IAC, SE); ring_supply_data(&netoring, temp, len); printsub('>', &temp[2], len-2); - } else { + } else ExitString("No room in buffer for terminal type.\n", 1); - /*NOTREACHED*/ - } } break; case TELOPT_TSPEED: -- 2.20.1