+2002-11-15 Ezra Peisach <epeisach@bu.edu>
+
+ * sys_bsd.c: Moved declaration for susp() to type of file and
+ provide prototype.
+
+ * commands.c, externs.h, telnet.c, network.c: Add prototype
+ declaration for command handler table dispatch functions. Make
+ functions called consistant with prototype. Misc unsigned/signed
+ cleanups.
+
+ * authenc.c, main.c, utilities.c: Signed vs. unsigned cleanup.
+
2002-10-22 Ezra Peisach <epeisach@bu.edu>
* configure.in: Autoconf 2.55 will not simply use cpp to test for
printf("%s", tprompt);
res = fgets(result, length, stdin);
} else if ((res = getpass(tprompt))) {
- strncpy(result, res, length);
+ strncpy(result, res, (unsigned) length);
res = result;
}
TerminalNewMode(om);
typedef struct {
char *name; /* command name */
char *help; /* help string (NULL for no help) */
- int (*handler)(); /* routine which executes command */
+ int (*handler) /* routine which executes command */
+ (int, char *[]);
int needconnect; /* Do we need to be connected to execute? */
} Command;
char *help; /* Help information (0 ==> no help) */
int needconnect; /* Need to be connected */
int narg; /* Number of arguments */
- int (*handler)(); /* Routine to perform (for special ops) */
+ int (*handler) /* Routine to perform (for special ops) */
+ (char *);
int nbyte; /* Number of bytes to send this command */
int what; /* Character to be sent (<0 ==> special) */
};
\f
static int
- send_esc (void),
- send_help (void),
+ send_esc (char *),
+ send_help (char *),
send_docmd (char *),
send_dontcmd (char *),
send_willcmd (char *),
}
count += s->nbyte;
if (s->handler == send_help) {
- send_help();
+ send_help(NULL);
return 0;
}
for (i = 1; i < argc; i++) {
if ((s = GETSEND(argv[i])) == 0) {
fprintf(stderr, "Telnet 'send' error - argument disappeared!\n");
- (void) quit();
+ (void) quit(0, NULL);
/*NOTREACHED*/
}
if (s->handler) {
count++;
- success += (*s->handler)((s->narg > 0) ? argv[i+1] : 0,
- (s->narg > 1) ? argv[i+2] : 0);
+ success += (*s->handler)(argv[i+1]);
i += s->narg;
} else {
NET2ADD(IAC, s->what);
}
static int
-send_esc()
+send_esc(s)
+ char *s;
{
NETADD(escape);
return 1;
}
static int
-send_help()
+send_help(n)
+ char *n;
{
struct sendlist *s; /* pointer to current command */
for (s = Sendlist; s->name; s++) {
*/
static int
-lclchars()
+lclchars(s)
+ int s;
{
donelclchars = 1;
return 1;
}
static int
-togdebug()
+togdebug(s)
+ int s;
{
#ifndef NOT43
if (net > 0 &&
static int
-togcrlf()
+togcrlf(s)
+ int s;
{
if (crlf) {
printf("Will send carriage returns as telnet <CR><LF>.\r\n");
}
-static int togglehelp (void);
+static int togglehelp (int);
#if defined(AUTHENTICATION)
extern int auth_togdebug (int);
#endif
struct togglelist {
char *name; /* name of toggle */
char *help; /* help message */
- int (*handler)(); /* routine to do actual setting */
+ int (*handler) /* routine to do actual setting */
+ (int);
int *variable;
char *actionexplanation;
};
};
static int
-togglehelp()
+togglehelp(n)
+ int n;
{
struct togglelist *c;
/*VARARGS*/
static int
-togcrmod()
+togcrmod(argc, argv)
+ int argc;
+ char **argv;
{
crmod = !crmod;
printf("Deprecated usage - please use 'toggle crmod' in the future.\r\n");
/*VARARGS*/
static int
-suspend()
+suspend(argc, argv)
+ int argc;
+ char **argv;
{
#ifdef SIGTSTP
setcommandmode();
/*VARARGS*/
int
-quit()
+quit(argc, argv)
+ int argc;
+ char *argv[];
{
(void) call(bye, "bye", "fromquit", 0);
Exit(0);
/*VARARGS*/
static int
-logout()
+logout(argc, argv)
+ int argc;
+ char **argv;
{
send_do(TELOPT_LOGOUT, 1);
(void) netflush();
if (ep->next)
ep->next->prev = ep;
}
- ep->welldefined = opt_welldefined(var);
+ ep->welldefined = opt_welldefined((char *)var);
ep->export = 1;
ep->var = (unsigned char *)strdup((char *)var);
ep->value = (unsigned char *)strdup((char *)value);
unsigned char *what;
{
extern int old_env_var, old_env_value, env_auto;
- int len = strlen((char *)what);
+ unsigned int len = strlen((char *)what);
if (len == 0)
goto unknown;
if (argc < 2) {
(void) strcpy(line, "open ");
printf("(to) ");
- (void) fgets(&line[strlen(line)], sizeof(line) - strlen(line), stdin);
+ (void) fgets(&line[strlen(line)], (int) (sizeof(line) - strlen(line)),
+ stdin);
makeargv();
argc = margc;
argv = margv;
printf("%s> ", prompt);
if (fgets(line, sizeof(line), stdin) == NULL) {
if (feof(stdin) || ferror(stdin)) {
- (void) quit();
+ (void) quit(0, NULL);
/*NOTREACHED*/
}
break;
register Command *c;
FILE *rcfile;
int gotmachine = 0;
- int l1 = strlen(m1);
- int l2 = strlen(m2);
+ unsigned int l1 = strlen(m1);
+ unsigned int l2 = strlen(m2);
char m1save[64];
if (skiprc)
slc_end_reply (void);
extern int
- quit (void),
+ quit (int, char *[]),
ttyflush (int),
rlogin_susp (void),
tn (int, char **),
stilloob (void),
telrcv (void),
telnet_spin (void),
- TerminalWrite (char *, int),
- TerminalRead (char *, int),
+ TerminalWrite (unsigned char *, int),
+ TerminalRead (unsigned char *, int),
TerminalAutoFlush (void),
TerminalSpecialChars (int),
TerminalWindowSize (long *, long *);
env_is_exported (unsigned char *);
extern int
- get_status (void),
- dosynch (void);
+ get_status (char *),
+ dosynch (char *);
extern cc_t
*tcval (int);
#if defined(AUTHENTICATION) && defined(KRB4)
{
extern char *dest_realm, dst_realm_buf[];
- extern int dst_realm_sz;
+ extern unsigned int dst_realm_sz;
dest_realm = dst_realm_buf;
(void)strncpy(dest_realm, optarg, dst_realm_sz);
}
if (value < 0) {
perror("select");
- (void) quit();
+ (void) quit(0, NULL);
/* NOTREACHED */
}
if (FD_ISSET(net, &excepts)) {
#define SIG_FUNC_RET int
#endif
+#ifdef SIGTSTP
+static SIG_FUNC_RET susp(int);
+#endif /* SIGTSTP */
+#ifdef SIGINFO
+SIG_FUNC_RET ayt(int);
+#endif
#ifdef SIGINFO
extern SIG_FUNC_RET ayt_status();
#endif
int
TerminalWrite(buf, n)
- char *buf;
+ unsigned char *buf;
int n;
{
return write(tout, buf, n);
int
TerminalRead(buf, n)
- char *buf;
+ unsigned char *buf;
int n;
{
return read(tin, buf, n);
/*
* Flush output to the terminal
*/
-
void
TerminalFlushOutput()
{
}
if (f != -1) {
-#ifdef SIGTSTP
- static SIG_FUNC_RET susp();
-#endif /* SIGTSTP */
-#ifdef SIGINFO
- SIG_FUNC_RET ayt();
-#endif
#ifdef SIGTSTP
(void) signal(SIGTSTP, susp);
*/
if (n || (cp - cp2 > 41))
;
- else if (name && (strncasecmp(name, cp2, cp-cp2) == 0))
+ else if (name && (strncasecmp(name, cp2,
+ (unsigned) (cp-cp2))
+ == 0))
*argv = cp2;
else if (is_unique(cp2, argv+1, argvp))
*argvp++ = cp2;
register char *name, **as, **ae;
{
register char **ap;
- register int n;
+ register unsigned int n;
n = strlen(name) + 1;
for (ap = as; ap < ae; ap++)
if (opt_replyp + (vp ? strlen((char *)vp) : 0) +
strlen((char *)ep) + 6 > opt_replyend)
{
- register int len;
+ register unsigned int len;
opt_replyend += OPT_REPLY_SIZE;
len = opt_replyend - opt_reply;
opt_reply = (unsigned char *)realloc(opt_reply, len);
int
-dosynch()
+dosynch(s)
+ char *s;
{
netclear(); /* clear the path to the network */
NETADD(IAC);
int want_status_response = 0;
int
-get_status()
+get_status(s)
+ char *s;
{
unsigned char tmp[16];
register unsigned char *cp;
doflush();
}
if (autosynch) {
- dosynch();
+ dosynch(NULL);
}
}
doflush();
}
if (autosynch) {
- dosynch();
+ dosynch(NULL);
}
}
doflush();
}
if (autosynch) {
- dosynch();
+ dosynch(NULL);
}
}
doflush();
}
if (autosynch) {
- dosynch();
+ dosynch(NULL);
}
}
int length; /* length of suboption data */
{
register int i;
- char buf[512];
+ unsigned char buf[512];
extern int want_status_response;
if (showoptions || direction == 0 ||