summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2014-07-20 08:56:48 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2014-07-20 08:56:48 +0000
commitca28eced370e76e5dd041ecd3001c68a9aaf1e74 (patch)
treea132edc34f393af320c1000ea7f6ae28e0a16a52 /usr.bin
parented1bc543945a7fe165e416655fdb1240f4b578db (diff)
Add prototypes to some function callbacks and fix the type errors that
this reveals. Make NetTrace static to utilities.c
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/telnet/commands.c44
-rw-r--r--usr.bin/telnet/externs.h8
-rw-r--r--usr.bin/telnet/network.c4
-rw-r--r--usr.bin/telnet/telnet.c6
-rw-r--r--usr.bin/telnet/utilities.c4
5 files changed, 34 insertions, 32 deletions
diff --git a/usr.bin/telnet/commands.c b/usr.bin/telnet/commands.c
index 7e81c725371..b6b3a3deb61 100644
--- a/usr.bin/telnet/commands.c
+++ b/usr.bin/telnet/commands.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: commands.c,v 1.62 2014/07/20 08:12:45 guenther Exp $ */
+/* $OpenBSD: commands.c,v 1.63 2014/07/20 08:56:47 guenther Exp $ */
/* $NetBSD: commands.c,v 1.14 1996/03/24 22:03:48 jtk Exp $ */
/*
@@ -58,7 +58,7 @@ static int call(intrtn_t, ...);
typedef struct {
char *name; /* command name */
char *help; /* help string (NULL for no help) */
- int (*handler)(); /* routine which executes command */
+ int (*handler)(int, char **);/* routine which executes command */
int needconnect; /* Do we need to be connected to execute? */
} Command;
@@ -346,7 +346,7 @@ sendcmd(argc, argv)
for (i = 1; i < argc; i++) {
if ((s = GETSEND(argv[i])) == 0) {
fprintf(stderr, "Telnet 'send' error - argument disappeared!\r\n");
- (void) quit();
+ quit();
/*NOTREACHED*/
}
if (s->handler) {
@@ -602,12 +602,12 @@ togxbinary(val)
}
-static int togglehelp(void);
+static int togglehelp(int);
struct togglelist {
- char *name; /* name of toggle */
- char *help; /* help message */
- int (*handler)(); /* routine to do actual setting */
+ char *name; /* name of toggle */
+ char *help; /* help message */
+ int (*handler)(int); /* routine to do actual setting */
int *variable;
char *actionexplanation;
int needconnect; /* Need to be connected */
@@ -700,7 +700,7 @@ static struct togglelist Togglelist[] = {
};
static int
-togglehelp()
+togglehelp(int unused)
{
struct togglelist *c;
@@ -793,7 +793,7 @@ struct termios new_tc = { 0 };
struct setlist {
char *name; /* name */
char *help; /* help information */
- void (*handler)();
+ void (*handler)(char *);
cc_t *charp; /* where it is located at */
};
@@ -979,7 +979,7 @@ unsetcmd(argc, argv)
name);
return 0;
} else if (ct->handler) {
- (*ct->handler)(0);
+ (*ct->handler)(NULL);
printf("%s reset to \"%s\".\r\n", ct->name, (char *)ct->charp);
} else {
*(ct->charp) = _POSIX_VDISABLE;
@@ -1068,12 +1068,12 @@ tn_clearmode(bit)
struct modelist {
char *name; /* command name */
char *help; /* help string */
- int (*handler)(); /* routine which executes command */
+ int (*handler)(int);/* routine which executes command */
int needconnect; /* Do we need to be connected to execute? */
int arg1;
};
-static int modehelp(void);
+static int modehelp(int);
static struct modelist ModeList[] = {
{ "character", "Disable LINEMODE option", docharmode, 1 },
@@ -1109,7 +1109,7 @@ static struct modelist ModeList[] = {
static int
-modehelp()
+modehelp(int unused)
{
struct modelist *mt;
@@ -1363,13 +1363,19 @@ bye(argc, argv)
return 0; /* NOTREACHED */
}
-int
+void
quit(void)
{
(void) call(bye, "bye", "fromquit", 0);
Exit(0);
}
+static int
+quitcmd(int unused1, char *unused2[])
+{
+ quit();
+}
+
/*VARARGS*/
static int
logout()
@@ -1387,11 +1393,11 @@ logout()
struct slclist {
char *name;
char *help;
- void (*handler)();
+ void (*handler)(int);
int arg;
};
-static void slc_help();
+static void slc_help(int);
struct slclist SlcList[] = {
{ "export", "Use local special character definitions",
@@ -1406,7 +1412,7 @@ struct slclist SlcList[] = {
};
static void
-slc_help()
+slc_help(int unused)
{
struct slclist *c;
@@ -2153,7 +2159,7 @@ static Command cmdtab[] = {
{ "display", displayhelp, display, 0 },
{ "mode", modestring, modecmd, 0 },
{ "open", openhelp, tn, 0 },
- { "quit", quithelp, quit, 0 },
+ { "quit", quithelp, quitcmd, 0 },
{ "send", sendhelp, sendcmd, 0 },
{ "set", sethelp, setcmd, 0 },
{ "unset", unsethelp, unsetcmd, 0 },
@@ -2247,7 +2253,7 @@ command(top, tbuf, cnt)
printf("%s> ", prompt);
if (fgets(line, sizeof(line), stdin) == NULL) {
if (feof(stdin) || ferror(stdin)) {
- (void) quit();
+ quit();
/*NOTREACHED*/
}
break;
diff --git a/usr.bin/telnet/externs.h b/usr.bin/telnet/externs.h
index b8b1aee8b8c..cc05172aa6f 100644
--- a/usr.bin/telnet/externs.h
+++ b/usr.bin/telnet/externs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: externs.h,v 1.22 2014/07/20 08:12:45 guenther Exp $ */
+/* $OpenBSD: externs.h,v 1.23 2014/07/20 08:56:47 guenther Exp $ */
/* $KTH: externs.h,v 1.16 1997/11/29 02:28:35 joda Exp $ */
/*
@@ -146,8 +146,6 @@ extern int rtableid; /* routing table to use */
#define set_his_want_state_wont set_my_want_state_dont
-extern FILE
- *NetTrace; /* Where debugging output goes */
extern unsigned char
NetTraceFile[]; /* Name of file where debugging output goes */
extern void
@@ -255,7 +253,7 @@ void lm_mode (unsigned char *, int, int);
void slc_init (void);
void slcstate (void);
-void slc_mode_export (void);
+void slc_mode_export (int);
void slc_mode_import (int);
void slc_import (int);
void slc_export (void);
@@ -280,7 +278,7 @@ int dosynch (void);
cc_t *tcval (int);
-__dead int quit(void);
+__dead void quit(void);
/* genget.c */
diff --git a/usr.bin/telnet/network.c b/usr.bin/telnet/network.c
index 5cf14bb4e7c..bb124f11329 100644
--- a/usr.bin/telnet/network.c
+++ b/usr.bin/telnet/network.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: network.c,v 1.13 2014/07/20 08:12:46 guenther Exp $ */
+/* $OpenBSD: network.c,v 1.14 2014/07/20 08:56:47 guenther Exp $ */
/* $NetBSD: network.c,v 1.5 1996/02/28 21:04:06 thorpej Exp $ */
/*
@@ -48,7 +48,7 @@ init_network(void)
{
ring_init(&netoring, netobuf, sizeof netobuf);
ring_init(&netiring, netibuf, sizeof netibuf);
- NetTrace = stdout;
+ SetNetTrace(NULL);
}
diff --git a/usr.bin/telnet/telnet.c b/usr.bin/telnet/telnet.c
index f582f059963..72033a713c6 100644
--- a/usr.bin/telnet/telnet.c
+++ b/usr.bin/telnet/telnet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: telnet.c,v 1.24 2014/07/20 08:12:46 guenther Exp $ */
+/* $OpenBSD: telnet.c,v 1.25 2014/07/20 08:56:47 guenther Exp $ */
/* $NetBSD: telnet.c,v 1.7 1996/02/28 21:04:15 thorpej Exp $ */
/*
@@ -145,8 +145,6 @@ init_telnet()
SYNCHing = 0;
- /* Don't change NetTrace */
-
escape = CONTROL(']');
rlogin = _POSIX_VDISABLE;
#ifdef KLUDGELINEMODE
@@ -986,7 +984,7 @@ slcstate()
}
void
-slc_mode_export()
+slc_mode_export(int unused)
{
slc_mode = SLC_EXPORT;
if (my_state_is_will(TELOPT_LINEMODE))
diff --git a/usr.bin/telnet/utilities.c b/usr.bin/telnet/utilities.c
index 4fdf36bc8ff..f1ccb70bfaa 100644
--- a/usr.bin/telnet/utilities.c
+++ b/usr.bin/telnet/utilities.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: utilities.c,v 1.16 2014/07/20 08:12:46 guenther Exp $ */
+/* $OpenBSD: utilities.c,v 1.17 2014/07/20 08:56:47 guenther Exp $ */
/* $NetBSD: utilities.c,v 1.5 1996/02/28 21:04:21 thorpej Exp $ */
/*
@@ -44,7 +44,7 @@
#include <stdlib.h>
#include <string.h>
-FILE *NetTrace = 0; /* Not in bss, since needs to stay */
+static FILE *NetTrace = NULL;
int prettydump;
/*