Module Name:    src
Committed By:   maya
Date:           Sat Jan  5 08:55:58 UTC 2019

Modified Files:
        src/lib/libtelnet: enc-proto.h encrypt.c
        src/usr.bin/telnet: commands.c

Log Message:
Match the function prototype of encrypthandler instead of casting to it.
Make GCC 9 snapshot happier with the code

While here, remove unnecessary braces around return (KNF).


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/libtelnet/enc-proto.h
cvs rdiff -u -r1.17 -r1.18 src/lib/libtelnet/encrypt.c
cvs rdiff -u -r1.75 -r1.76 src/usr.bin/telnet/commands.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libtelnet/enc-proto.h
diff -u src/lib/libtelnet/enc-proto.h:1.9 src/lib/libtelnet/enc-proto.h:1.10
--- src/lib/libtelnet/enc-proto.h:1.9	Mon Jan  9 15:25:33 2012
+++ src/lib/libtelnet/enc-proto.h	Sat Jan  5 08:55:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: enc-proto.h,v 1.9 2012/01/09 15:25:33 christos Exp $	*/
+/*	$NetBSD: enc-proto.h,v 1.10 2019/01/05 08:55:58 maya Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -61,13 +61,13 @@ void encrypt_list_types(void);
 int EncryptEnable(char *, char *);
 int EncryptDisable(char *, char *);
 int EncryptType(char *, char *);
-int EncryptStart(char *);
-int EncryptStartInput(void);
-int EncryptStartOutput(void);
-int EncryptStop(char *);
-int EncryptStopInput(void);
-int EncryptStopOutput(void);
-int EncryptStatus(void);
+int EncryptStart(char *, char *);
+int EncryptStartInput(char *, char *);
+int EncryptStartOutput(char *, char *);
+int EncryptStop(char *, char *);
+int EncryptStopInput(char *, char *);
+int EncryptStopOutput(char *, char *);
+int EncryptStatus(char *, char *);
 void encrypt_send_support(void);
 int EncryptDebug(int);
 int EncryptVerbose(int);

Index: src/lib/libtelnet/encrypt.c
diff -u src/lib/libtelnet/encrypt.c:1.17 src/lib/libtelnet/encrypt.c:1.18
--- src/lib/libtelnet/encrypt.c:1.17	Wed Mar 21 05:33:27 2012
+++ src/lib/libtelnet/encrypt.c	Sat Jan  5 08:55:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: encrypt.c,v 1.17 2012/03/21 05:33:27 matt Exp $	*/
+/*	$NetBSD: encrypt.c,v 1.18 2019/01/05 08:55:58 maya Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -33,7 +33,7 @@
 #if 0
 static char sccsid[] = "@(#)encrypt.c	8.2 (Berkeley) 5/30/95";
 #else
-__RCSID("$NetBSD: encrypt.c,v 1.17 2012/03/21 05:33:27 matt Exp $");
+__RCSID("$NetBSD: encrypt.c,v 1.18 2019/01/05 08:55:58 maya Exp $");
 #endif /* not lint */
 
 /*
@@ -226,11 +226,11 @@ EncryptEnable(char *type, char *mode)
 	if (isprefix(type, "help") || isprefix(type, "?")) {
 		printf("Usage: encrypt enable <type> [input|output]\n");
 		encrypt_list_types();
-		return(0);
+		return 0;
 	}
 	if (EncryptType(type, mode))
-		return(EncryptStart(mode));
-	return(0);
+		return EncryptStart(mode, NULL);
+	return 0;
 }
 
 int
@@ -250,13 +250,13 @@ EncryptDisable(char *type, char *mode)
 	} else {
 		if ((mode == 0) || (isprefix(mode, "input") ? 1 : 0)) {
 			if (decrypt_mode == ep->type)
-				EncryptStopInput();
+				EncryptStopInput(NULL, NULL);
 			i_wont_support_decrypt |= typemask(ep->type);
 			ret = 1;
 		}
 		if ((mode == 0) || (isprefix(mode, "output"))) {
 			if (encrypt_mode == ep->type)
-				EncryptStopOutput();
+				EncryptStopOutput(NULL, NULL);
 			i_wont_support_encrypt |= typemask(ep->type);
 			ret = 1;
 		}
@@ -298,28 +298,28 @@ EncryptType(char *type, char *mode)
 }
 
 int
-EncryptStart(char *mode)
+EncryptStart(char *mode, char *unused __unused)
 {
 	register int ret = 0;
 	if (mode) {
 		if (isprefix(mode, "input"))
-			return(EncryptStartInput());
+			return EncryptStartInput(NULL, NULL);
 		if (isprefix(mode, "output"))
-			return(EncryptStartOutput());
+			return EncryptStartOutput(NULL, NULL);
 		if (isprefix(mode, "help") || isprefix(mode, "?")) {
 			printf("Usage: encrypt start [input|output]\n");
-			return(0);
+			return 0;
 		}
 		printf("%s: invalid encryption mode 'encrypt start ?' for help\n", mode);
-		return(0);
+		return 0;
 	}
-	ret += EncryptStartInput();
-	ret += EncryptStartOutput();
-	return(ret);
+	ret += EncryptStartInput(NULL, NULL);
+	ret += EncryptStartOutput(NULL, NULL);
+	return ret;
 }
 
 int
-EncryptStartInput(void)
+EncryptStartInput(char *unused1 __unused, char *unused2 __unused)
 {
 	if (decrypt_mode) {
 		encrypt_send_request_start();
@@ -330,7 +330,7 @@ EncryptStartInput(void)
 }
 
 int
-EncryptStartOutput(void)
+EncryptStartOutput(char *unused1 __unused, char *unused2 __unused)
 {
 	if (encrypt_mode) {
 		encrypt_start_output(encrypt_mode);
@@ -341,38 +341,38 @@ EncryptStartOutput(void)
 }
 
 int
-EncryptStop(char *mode)
+EncryptStop(char *mode, char *unused __unused)
 {
 	int ret = 0;
 	if (mode) {
 		if (isprefix(mode, "input"))
-			return(EncryptStopInput());
+			return EncryptStopInput(NULL, NULL);
 		if (isprefix(mode, "output"))
-			return(EncryptStopOutput());
+			return EncryptStopOutput(NULL, NULL);
 		if (isprefix(mode, "help") || isprefix(mode, "?")) {
 			printf("Usage: encrypt stop [input|output]\n");
-			return(0);
+			return 0;
 		}
 		printf("%s: invalid encryption mode 'encrypt stop ?' for help\n", mode);
-		return(0);
+		return 0;
 	}
-	ret += EncryptStopInput();
-	ret += EncryptStopOutput();
-	return(ret);
+	ret += EncryptStopInput(NULL, NULL);
+	ret += EncryptStopOutput(NULL, NULL);
+	return ret;
 }
 
 int
-EncryptStopInput(void)
+EncryptStopInput(char *unused1 __unused, char *unused2 __unused)
 {
 	encrypt_send_request_end();
-	return(1);
+	return 1;
 }
 
 int
-EncryptStopOutput(void)
+EncryptStopOutput(char *unused1 __unused, char *unused2 __unused)
 {
 	encrypt_send_end();
-	return(1);
+	return 1;
 }
 
 void
@@ -387,7 +387,7 @@ encrypt_display(void)
 }
 
 int
-EncryptStatus(void)
+EncryptStatus(char *unused1 __unused, char *unused2 __unused)
 {
 	if (encrypt_output)
 		printf("Currently encrypting output with %s\r\n",

Index: src/usr.bin/telnet/commands.c
diff -u src/usr.bin/telnet/commands.c:1.75 src/usr.bin/telnet/commands.c:1.76
--- src/usr.bin/telnet/commands.c:1.75	Sat Jan  5 06:47:24 2019
+++ src/usr.bin/telnet/commands.c	Sat Jan  5 08:55:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: commands.c,v 1.75 2019/01/05 06:47:24 maya Exp $	*/
+/*	$NetBSD: commands.c,v 1.76 2019/01/05 08:55:58 maya Exp $	*/
 
 /*
  * Copyright (C) 1997 and 1998 WIDE Project.
@@ -63,7 +63,7 @@
 #if 0
 static char sccsid[] = "@(#)commands.c	8.4 (Berkeley) 5/30/95";
 #else
-__RCSID("$NetBSD: commands.c,v 1.75 2019/01/05 06:47:24 maya Exp $");
+__RCSID("$NetBSD: commands.c,v 1.76 2019/01/05 08:55:58 maya Exp $");
 #endif
 #endif /* not lint */
 
@@ -1280,7 +1280,7 @@ display(int  argc, char *argv[])
     }
 /*@*/optionstatus();
 #ifdef	ENCRYPTION
-    EncryptStatus();
+    EncryptStatus(NULL, NULL);
 #endif	/* ENCRYPTION */
     return 1;
 #undef	doset
@@ -1888,9 +1888,7 @@ struct encryptlist {
 	int	maxarg;
 };
 
-static int
-	EncryptHelp(char *, char *);
-typedef int (*encrypthandler)(char *, char *);
+static int EncryptHelp(char *, char *);
 
 struct encryptlist EncryptList[] = {
     { "enable", "Enable encryption. ('encrypt enable ?' for more)",
@@ -1900,22 +1898,22 @@ struct encryptlist EncryptList[] = {
     { "type", "Set encryption type. ('encrypt type ?' for more)",
 						EncryptType, 0, 1, 1 },
     { "start", "Start encryption. ('encrypt start ?' for more)",
-				(encrypthandler) EncryptStart, 1, 0, 1 },
+						EncryptStart, 1, 0, 1 },
     { "stop", "Stop encryption. ('encrypt stop ?' for more)",
-				(encrypthandler) EncryptStop, 1, 0, 1 },
+						EncryptStop, 1, 0, 1 },
     { "input", "Start encrypting the input stream",
-				(encrypthandler) EncryptStartInput, 1, 0, 0 },
+						EncryptStartInput, 1, 0, 0 },
     { "-input", "Stop encrypting the input stream",
-				(encrypthandler) EncryptStopInput, 1, 0, 0 },
+						EncryptStopInput, 1, 0, 0 },
     { "output", "Start encrypting the output stream",
-				(encrypthandler) EncryptStartOutput, 1, 0, 0 },
+						EncryptStartOutput, 1, 0, 0 },
     { "-output", "Stop encrypting the output stream",
-				(encrypthandler) EncryptStopOutput, 1, 0, 0 },
+						EncryptStopOutput, 1, 0, 0 },
 
     { "status",       "Display current status of authentication information",
-				(encrypthandler) EncryptStatus,	0, 0, 0 },
-    { "help", 0,				 EncryptHelp,	0, 0, 0 },
-    { "?",    "Print help information",		 EncryptHelp,	0, 0, 0 },
+						EncryptStatus,	0, 0, 0 },
+    { "help", 0,				EncryptHelp,	0, 0, 0 },
+    { "?",    "Print help information",		EncryptHelp,	0, 0, 0 },
     { .name = 0 },
 };
 

Reply via email to