-/* $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 $ */
/*
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;
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) {
}
-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 */
};
static int
-togglehelp()
+togglehelp(int unused)
{
struct togglelist *c;
struct setlist {
char *name; /* name */
char *help; /* help information */
- void (*handler)();
+ void (*handler)(char *);
cc_t *charp; /* where it is located at */
};
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;
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 },
static int
-modehelp()
+modehelp(int unused)
{
struct modelist *mt;
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()
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",
};
static void
-slc_help()
+slc_help(int unused)
{
struct slclist *c;
{ "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 },
printf("%s> ", prompt);
if (fgets(line, sizeof(line), stdin) == NULL) {
if (feof(stdin) || ferror(stdin)) {
- (void) quit();
+ quit();
/*NOTREACHED*/
}
break;