Fix compiler warnings

This commit is contained in:
Giuseppe Scrivano
2009-12-03 17:49:45 +01:00
parent f688407791
commit dc01797816
51 changed files with 368 additions and 170 deletions

126
ChangeLog
View File

@@ -1,3 +1,129 @@
2009-12-03 Giuseppe Scrivano <gscrivano@gnu.org>
* ftp/cmds.c (domap): Add braces around the else branch.
(strup): Remove function.
* ftp/ftp.c (hookup): Change `len' type to size_t.
(getreply): Add parentheses around logic operators.
(initconn): Change `len' type to size_t.
(dataconn): Change `fromlen' type to size_t.
(gunique): Add braces around the else branch.
* ftp/main.c [HAVE_LIBREADLINE]: Include <readline/history.h>.
* ftp/ruserpass.c (ruserpass): Add braces around the if branch.
Add parentheses around logic operators.
* ftpd/popen.c (ls_main): Add prototype.
(ftpd_popen): Add parentheses.
* ftpd/ftpd.c (off_to_str): Add casts to satisfy what the format
string expects.
(yyparse) Add prototype.
(authentication_setup) Remove prototype.
* ftpd/ftpcmd.y (yylex): Cast p->name to (char *) when its value
is assigned to yylval.s. Convert a ternary operator to an
explicit if/else.
* ftpd/server_mode.c (server_mode): Change type of `addrlen' to
size_t.
* hostname/hostname.c (struct hostname_arguments): Change type of
`hostname_new' to (char *).
(set_name): Likewise.
(get_name): Remove unused variable.
* ifconfig/system/linux.c (system_fh_hwaddr): Add cast.
* inetd/inetd.c (expand_enter): Remove unused variables.
* libinetutils/tftpsubs.c (synchnet): Change the `fromlen' type to
socklen_t.
* libinetutils/ttymsg.c (normalize_path): Use parentheses around
assignment used as truth value.
* libinetutils/utmp_logout.c (utmp_logout): Move assignment out
from the if condition.
* libls/ls.c (mastercmp): Add explicit braces.
* ping/libping.c (ping_recv): Change `fromlen' type to size_t.
* ping/ping6.c (parse_opt): Remove unused variable.
* rcp/rcp.c (toremote): Remove unused variable.
(rsource): Use parentheses around assignment used as truth value.
* rexecd/rexecd.c (main): Change type of `fromlen' to size_t. Use
NULL as sentinel value to execl. Add return statement.
* rlogind/rlogind.c (iruserok): Add prototype.
(rlogind_auth): Change type of `optisize' to size_t.
* rsh/rsh.c (main): Remove unused variable.
* rshd/rshd.c (iruserok): Add prototype.
(main): Change type of `addrlen' to size_t. Remove unused
variable.
(doit): Change type of `optsize' to size_t. Add parentheses. Use
NULL as sentinel to execl instead of 0.
* talk/ctl.c (open_sockt): Change `length' type to size_t. Add
return statement.
(open_ctl): Likewise.
* talk/ctl_transact.c (ctl_transact): Add return statement.
* talk/display.c (display): Add return statement.
* talk/get_addrs.c (get_addrs): Likewise.
* talk/get_names.c (get_names): Likewise.
* talk/init_disp.c (init_display): Likewise.
(set_edit_chars): Likewise.
* talk/invite.c (announce_invite): Likewise.
(invite_remote): Likewise.
(send_delete): Likewise.
* talk/io.c (p_error): Add return statement.
(message): Add return statement.
* talk/look_up.c (check_local): add return statement.
* talk/msgs.c (start_msgs): Add return statement.
(end_msgs): Add return statement.
* talk/talk.h (display): Change the type of 'text' to (char *).
* talk/talk.c (display): Likewise. Insert <unistd.h>.
* talkd/talkd.c (talkd_run): Change type of len to size_t.
* telnetd/slc.c (change_slc): Introduce a new variable `func' of
type int. Rename the previous `func' to `func_c' and assign its
value to `func'.
* telnetd/state.c (telrcv): Add parentheses around comparison.
* telnetd/telnetd.c (struct debug_mode): Add missing braces around
initializer.
(telnetd_run): Add missing return statement.
* telnetd/term.c (term_change_eof): Likewise.
(oldeofc): Define it only if VEOF == VMIN.
* telnetd/termstat.c (clientstat): Add parentheses around
assignment.
(getconfigent): Change `argc' and `i' type to int.
* telnetd/utility.c [HAVE_READLINE_READLINE_H]: Include
<term.h>.
(net_get_char): Add default return statement.
(pty_get_char): Likewise.
(pty_input_putback): Likewise.
(debug_close): Likewise.
(printsub): Cast &pointer[i] to (char *) when used as argument to
debug_output_datalen.
* tftpd/tftpd.c (fromlen): Change type to size_t. Make it
static.
(peer, rexmtval, maxtimeout, buf, ackbuf, from): Make static.
(main): Change type of `j' to size_t.
* telnet/externs.h (env_getvalue): Change argument type to const
char *.
* telnet/commands.c (makeargv): Add parentheses around assignment
used as boolean value.
(dokludgemode): Add return statement.
(shell): Use NULL as sentinel to execl.
(quit): Add return statement.
(env_default, env_undefine, getcmd, tn): Add
parentheses around assignment used as boolean value.
(env_define, env_export, env_getvalue, env_init, env_undefine)
(env_unexport): Move assignment out from the if condition.
(env_export, env_find, env_define, env_send, env_unexport)
(env_varval): Change type of `var' to (const char *).
(tn): Add parentheses around logic operators.
(cmdtab, cmdtab2): Add missing braces around initializer.
* telnet/main.c (main): Add parentheses around assignment used as
boolean value.
* telnet/sys_bsd.c (process_rings): Cast ttyiring.supply to char *
when used as argument to TerminalRead.
* telnet/telnet.c [HAVE_READLINE_READLINE_H]: Include
<term.h>.
(initfunc, env_opt_add): Add parentheses around assignment used as
boolean value.
(dooption, gettermname, suboption, telnet): Remove cast.
(suboption): Add casts to int.
* telnet/terminal.c (ttyflush): When used as argument, cast
ttyiring.{bottom, consume} (char *) to TerminalRead.
* tftp/tftp.c (send_file): Change `fromlen' type to size_t.
(recvfile): Likewise.
(printstats): Add cast.
* whois/whois.c (queryformat): Remove unused variable.
2009-12-03 Alfred M. Szmidt <ams@gnu.org>
* inetd/inetd.c (setup) [IPV6]: Reverse the value of

View File

@@ -119,18 +119,6 @@ all_upper (str)
return 1;
}
/* Destructively converts STR to upper case. */
static char *
strup (str)
char *str;
{
char *p;
for (p = str; *p; p++)
if (islower (*p))
*p = toupper (*p);
return str;
}
/* Destructively converts STR to lower case. */
static char *
strdown (str)
@@ -2364,13 +2352,13 @@ domap (name)
cp2++;
}
else if (*cp2 == '$' && isdigit (*(cp2 + 1)))
if (cp_subst (&cp2,
&cp1, toks, tp, te, name, &buf, &buf_len))
match = 1;
else if (*cp2)
{
{
if (cp_subst (&cp2,
&cp1, toks, tp, te, name, &buf, &buf_len))
match = 1;
else if (*cp2)
*cp1++ = *cp2++;
}
}
}
if (!*cp2)
{

View File

@@ -130,7 +130,8 @@ hookup (host, port)
int port;
{
struct hostent *hp = 0;
int s, len, tos;
int s, tos;
size_t len;
static char hostnamebuf[80];
memset ((char *) &hisctladdr, 0, sizeof (hisctladdr));
@@ -475,7 +476,7 @@ getreply (expecteof)
if (c != '\r' && (verbose > 0 ||
(verbose > -1 && n == '5' && dig > 4)))
{
if (proxflag && (dig == 1 || dig == 5 && verbose == 0))
if (proxflag && (dig == 1 || (dig == 5 && verbose == 0)))
printf ("%s:", hostname);
putchar (c);
}
@@ -506,7 +507,7 @@ getreply (expecteof)
if (cp < &reply_string[sizeof (reply_string) - 1])
*cp++ = c;
}
if (verbose > 0 || verbose > -1 && n == '5')
if (verbose > 0 || (verbose > -1 && n == '5'))
{
putchar (c);
fflush (stdout);
@@ -1153,7 +1154,8 @@ int
initconn ()
{
char *p, *a;
int result, len, tmpno = 0;
int result, tmpno = 0;
size_t len;
int on = 1;
int a0, a1, a2, a3, p0, p1;
@@ -1290,7 +1292,8 @@ dataconn (lmode)
char *lmode;
{
struct sockaddr_in from;
int s, fromlen = sizeof (from), tos;
int s, tos;
size_t fromlen = sizeof (from);
if (passivemode)
return (fdopen (data, lmode));
@@ -1678,10 +1681,12 @@ gunique (local)
ext++;
if (stat (new, &st) != 0)
if (errno == ENOENT)
return new;
else
return 0;
{
if (errno == ENOENT)
return new;
else
return 0;
}
if (ext != '0')
cp--;

View File

@@ -79,6 +79,7 @@
#if HAVE_LIBREADLINE
# include <readline/readline.h>
# include <readline/history.h>
#else
# include "readline.h"
#endif

View File

@@ -181,16 +181,18 @@ ruserpass (char *host, char **aname, char **apass, char **aacct)
{
case LOGIN:
if (token ())
if (*aname == 0)
{
*aname = xmalloc ((unsigned) strlen (tokval) + 1);
strcpy (*aname, tokval);
}
else
{
if (strcmp (*aname, tokval))
goto next;
}
{
if (*aname == 0)
{
*aname = xmalloc ((unsigned) strlen (tokval) + 1);
strcpy (*aname, tokval);
}
else
{
if (strcmp (*aname, tokval))
goto next;
}
}
break;
case PASSWD:
if ((*aname == NULL || strcmp (*aname, "anonymous"))
@@ -227,7 +229,7 @@ ruserpass (char *host, char **aname, char **apass, char **aacct)
if (proxy)
goto done;
while ((c = getc (cfile)) != EOF && c == ' ' || c == '\t')
while (((c = getc (cfile)) != EOF && c == ' ') || c == '\t')
;
if (c == EOF || c == '\n')
{

View File

@@ -995,7 +995,7 @@ yylex()
/* NOTREACHED */
}
state = p->state;
yylval.s = p->name;
yylval.s = (char*) p->name;
return (p->token);
}
break;
@@ -1021,7 +1021,7 @@ yylex()
/* NOTREACHED */
}
state = p->state;
yylval.s = p->name;
yylval.s = (char*)p->name;
return (p->token);
}
state = CMD;
@@ -1038,7 +1038,10 @@ yylex()
dostr1:
if (cbuf[cpos] == ' ') {
cpos++;
state = state == OSTR ? STR2 : ++state;
if (state == OSTR)
state = STR2;
else
++state;
return (SP);
}
break;

View File

@@ -193,11 +193,11 @@ off_to_str (off_t off)
next_buf = bufs;
if (sizeof (off) > sizeof (long))
sprintf (*next_buf, "%qd", off);
sprintf (*next_buf, "%qd", (long long int) off);
else if (sizeof (off) == sizeof (long))
sprintf (*next_buf, "%ld", off);
else
sprintf (*next_buf, "%d", off);
sprintf (*next_buf, "%d", (int) off);
return *next_buf++;
}
@@ -237,8 +237,9 @@ char proctitle[LINE_MAX]; /* initial part of title */
off_to_str (cnt)); \
}
extern int yyparse (void);
static void ack (const char *);
static void authentication_setup (const char *);
#ifdef HAVE_LIBWRAP
static int check_host (struct sockaddr *sa);
#endif

View File

@@ -90,6 +90,8 @@ struct file_pid
/* A linked list associating ftpd_popen'd FILEs with pids. */
struct file_pid *file_pids = 0;
extern int ls_main (int argc, char *argv[]);
FILE *
ftpd_popen (char *program, const char *type)
{
@@ -99,7 +101,7 @@ ftpd_popen (char *program, const char *type)
int argc, gargc, pdes[2], pid;
char **pop, *argv[MAX_ARGC], *gargv[MAX_GARGC];
if (*type != 'r' && *type != 'w' || type[1])
if (((*type != 'r') && (*type != 'w')) || type[1])
return (NULL);
if (pipe (pdes) < 0)

View File

@@ -161,7 +161,7 @@ server_mode (const char *pidfile, struct sockaddr_in *phis_addr)
children to handle them. */
while (1)
{
int addrlen = sizeof (*phis_addr);
size_t addrlen = sizeof (*phis_addr);
fd = accept (ctl_sock, (struct sockaddr *) phis_addr, &addrlen);
if (fork () == 0) /* child */
{

View File

@@ -38,7 +38,7 @@
typedef struct
{
const char *hostname_file;
const char *hostname_new;
char *hostname_new;
short int hostname_alias;
short int hostname_fqdn;
short int hostname_ip_address;
@@ -168,7 +168,6 @@ static void
get_name (const hostname_arguments *const args)
{
char *sname, *name;
int status;
sname = (*get_name_action) ();
@@ -211,7 +210,7 @@ get_name (const hostname_arguments *const args)
static void
set_name (const hostname_arguments *const args)
{
const char *hostname_new;
char *hostname_new;
int status;
size_t size;

View File

@@ -554,7 +554,8 @@ system_fh_hwaddr (format_data_t form, int argc, char *argv[])
arp = arphrd_findvalue (form->ifr->ifr_hwaddr.sa_family);
if (arp && arp->print_hwaddr)
arp->print_hwaddr (form, form->ifr->ifr_hwaddr.sa_data);
arp->print_hwaddr (form,
(unsigned char *) form->ifr->ifr_hwaddr.sa_data);
else
put_string (form, "(hwaddr unknown)");
}

View File

@@ -826,8 +826,6 @@ int
expand_enter (struct servtab *sep)
{
int err;
const int on = 1;
const int off = 0;
struct addrinfo *result, *rp;
struct protoent *proto;
struct servtab *cp;
@@ -1017,7 +1015,7 @@ getconfigent (FILE *fconfig, const char *file, size_t *line)
{
static struct servtab serv;
struct servtab *sep = &serv;
size_t argc = 0, i;
int argc = 0, i;
char **argv = NULL;
char *node, *service;
static char TCPMUX_TOKEN[] = "tcpmux/";

View File

@@ -288,7 +288,7 @@ synchnet (int f)
int i, j = 0;
char rbuf[PKTSIZE];
struct sockaddr_in from;
int fromlen;
socklen_t fromlen;
while (1)
{

View File

@@ -294,7 +294,7 @@ normalize_path (char *path, const char *delim)
/* Copy stuff */
s = p + 2;
p = q;
while (*q++ = *s++)
while ((*q++ = *s++))
;
continue;
}

View File

@@ -73,7 +73,8 @@ utmp_logout (char *line)
strncpy (utx.ut_line, line, sizeof (utx.ut_line));
if ((ut = getutxline (&utx)))
ut = getutxline (&utx);
if (ut)
{
ut->ut_type = DEAD_PROCESS;
ut->ut_exit.e_termination = 0;
@@ -89,7 +90,8 @@ utmp_logout (char *line)
strncpy (utx.ut_line, line, sizeof (utx.ut_line));
if (ut = getutline (&utx))
ut = getutline (&utx);
if (ut)
{
# ifdef HAVE_STRUCT_UTMP_UT_TYPE
ut->ut_type = DEAD_PROCESS;

View File

@@ -611,12 +611,14 @@ mastercmp (a, b)
return (0);
if (a_info == FTS_NS || b_info == FTS_NS)
if (b_info != FTS_NS)
return (1);
else if (a_info != FTS_NS)
return (-1);
else
return (namecmp (*a, *b));
{
if (b_info != FTS_NS)
return (1);
else if (a_info != FTS_NS)
return (-1);
else
return (namecmp (*a, *b));
}
if (a_info != b_info && (*a)->fts_level == FTS_ROOTLEVEL && !f_listdir)
{

View File

@@ -172,7 +172,7 @@ my_echo_reply (PING * p, icmphdr_t * icmp)
int
ping_recv (PING * p)
{
int fromlen = sizeof (p->ping_from.ping_sockaddr);
size_t fromlen = sizeof (p->ping_from.ping_sockaddr);
int n, rc;
icmphdr_t *icmp;
struct ip *ip;

View File

@@ -100,7 +100,6 @@ parse_opt (int key, char *arg, struct argp_state *state)
{
char *endptr;
u_char pattern[16];
double v;
switch (key)
{

View File

@@ -353,7 +353,7 @@ main (int argc, char *argv[])
void
toremote (char *targ, int argc, char *argv[])
{
int i, len, tos;
int i, tos;
char *bp, *host, *src, *suser, *thost, *tuser;
*targ++ = 0;
@@ -682,7 +682,7 @@ rsource (char *name, struct stat *statp)
return;
}
while (dp = readdir (dirp))
while ((dp = readdir (dirp)))
{
if (!strcmp (dp->d_name, ".") || !strcmp (dp->d_name, ".."))
continue;

View File

@@ -121,7 +121,8 @@ int
main (int argc, char **argv)
{
struct sockaddr_in from;
int fromlen, sockfd = STDIN_FILENO;
size_t fromlen;
int sockfd = STDIN_FILENO;
int index;
set_program_name (argv[0]);
@@ -325,8 +326,10 @@ doit (int f, struct sockaddr_in *fromp)
cp++;
else
cp = pwd->pw_shell;
execl (pwd->pw_shell, cp, "-c", cmdbuf, 0);
execl (pwd->pw_shell, cp, "-c", cmdbuf, NULL);
error (EXIT_FAILURE, errno, "executing %s", pwd->pw_shell);
return -1;
}
void

View File

@@ -190,6 +190,9 @@ int local_dot_count;
struct winsize win = { 0, 0, 0, 0 };
extern int iruserok (uint32_t raddr, int superuser,
const char *ruser, const char *luser);
void rlogin_daemon (int maxchildren, int port);
int rlogind_auth (int fd, struct auth_data *ap);
void setup_tty (int fd, struct auth_data *ap);
@@ -592,7 +595,8 @@ rlogind_auth (int fd, struct auth_data *ap)
{
u_char optbuf[BUFSIZ / 3], *cp;
char lbuf[BUFSIZ], *lp;
int optsize = sizeof (optbuf), ipproto;
size_t optsize = sizeof (optbuf);
int ipproto;
struct protoent *ip;
if ((ip = getprotobyname ("ip")) != NULL)

View File

@@ -218,7 +218,7 @@ main (int argc, char **argv)
struct passwd *pw;
struct servent *sp;
sigset_t sigs, osigs;
int asrsh, ch, rem;
int asrsh, rem;
pid_t pid = 0;
uid_t uid;
char *args, *host;

View File

@@ -174,6 +174,9 @@ static struct argp_option options[] = {
extern int __check_rhosts_file; /* hook in rcmd(3) */
extern int iruserok (uint32_t raddr, int superuser,
const char *ruser, const char *luser);
static error_t
parse_opt (int key, char *arg, struct argp_state *state)
{
@@ -229,7 +232,8 @@ main (int argc, char *argv[])
{
int index;
struct linger linger;
int ch, on = 1, fromlen;
int on = 1;
size_t fromlen;
struct sockaddr_in from;
int sockfd;
@@ -360,7 +364,8 @@ doit (int sockfd, struct sockaddr_in *fromp)
{
u_char optbuf[BUFSIZ / 3], *cp;
char lbuf[BUFSIZ], *lp;
int optsize = sizeof (optbuf), ipproto;
size_t optsize = sizeof (optbuf);
int ipproto;
struct protoent *ip;
if ((ip = getprotobyname ("ip")) != NULL)
@@ -773,9 +778,9 @@ doit (int sockfd, struct sockaddr_in *fromp)
}
else
#endif
if (errorstr || pwd->pw_passwd != 0 && *pwd->pw_passwd != '\0'
&& (iruserok (fromp->sin_addr.s_addr, pwd->pw_uid == 0,
remuser, locuser)) < 0)
if (errorstr || (pwd->pw_passwd != 0 && *pwd->pw_passwd != '\0'
&& (iruserok (fromp->sin_addr.s_addr, pwd->pw_uid == 0,
remuser, locuser)) < 0))
{
if (__rcmd_errstr)
syslog (LOG_INFO | LOG_AUTH,
@@ -1135,10 +1140,10 @@ doit (int sockfd, struct sockaddr_in *fromp)
}
#ifdef SHISHI
if (doencrypt)
execl (pwd->pw_shell, cp, "-c", cmdbuf + 3, 0);
execl (pwd->pw_shell, cp, "-c", cmdbuf + 3, NULL);
else
#endif
execl (pwd->pw_shell, cp, "-c", cmdbuf, 0);
execl (pwd->pw_shell, cp, "-c", cmdbuf, NULL);
error (1, errno, "cannot execute %s", pwd->pw_shell);
}

View File

@@ -91,7 +91,7 @@ CTL_MSG msg;
int
open_sockt ()
{
int length;
size_t length;
my_addr.sin_addr = my_machine_addr;
my_addr.sin_port = 0;
@@ -103,13 +103,15 @@ open_sockt ()
length = sizeof (my_addr);
if (getsockname (sockt, (struct sockaddr *) &my_addr, &length) == -1)
p_error ("Bad address for socket");
return 0;
}
/* open the ctl socket */
int
open_ctl ()
{
int length;
size_t length;
ctl_addr.sin_port = 0;
ctl_addr.sin_addr = my_machine_addr;
@@ -121,5 +123,7 @@ open_ctl ()
length = sizeof (ctl_addr);
if (getsockname (ctl_sockt, (struct sockaddr *) &ctl_addr, &length) == -1)
p_error ("Bad address for ctl socket");
return 0;
}

View File

@@ -148,4 +148,6 @@ ctl_transact (struct in_addr target, CTL_MSG msg, int type, CTL_RESPONSE * rp)
while (rp->vers != TALK_VERSION || rp->type != type);
rp->id_num = ntohl (rp->id_num);
rp->addr.sa_family = ntohs (rp->addr.sa_family);
return 0;
}

View File

@@ -118,7 +118,7 @@ xscroll (register xwin_t * win, int flag)
* characters while we are at it.
*/
int
display (register xwin_t * win, register unsigned char *text, int size)
display (register xwin_t * win, register char *text, int size)
{
register int i;
unsigned char cch;
@@ -218,5 +218,7 @@ display (register xwin_t * win, register unsigned char *text, int size)
text++;
}
wrefresh (win->x_win);
return 0;
}

View File

@@ -107,4 +107,6 @@ get_addrs (char *my_machine_name, char *his_machine_name)
exit (-1);
}
daemon_port = sp->s_port;
return 0;
}

View File

@@ -145,4 +145,6 @@ get_names (int argc, char *argv[])
msg.r_tty[TTY_SIZE - 1] = '\0';
free (my_machine_name);
return 0;
}

View File

@@ -135,6 +135,8 @@ init_display ()
wrefresh (line_win);
/* let them know we are working on it */
current_state = "No connection yet";
return 0;
}
/*
@@ -203,6 +205,8 @@ set_edit_chars ()
his_win.cerase = buf[0];
his_win.kill = buf[1];
his_win.werase = buf[2];
return 0;
}
/*

View File

@@ -119,6 +119,8 @@ announce_invite ()
/* leave the actual invitation on my talk daemon */
ctl_transact (my_machine_addr, msg, LEAVE_INVITE, &response);
local_id = response.id_num;
return 0;
}
/*
@@ -187,6 +189,8 @@ invite_remote ()
msg.id_num = htonl (remote_id);
ctl_transact (his_machine_addr, msg, DELETE, &response);
invitation_waiting = 0;
return 0;
}
/*
@@ -213,4 +217,6 @@ send_delete ()
(struct sockaddr *) &daemon_addr,
sizeof (daemon_addr)) != sizeof (msg))
perror ("send_delete (local)");
return 0;
}

View File

@@ -163,6 +163,8 @@ p_error (char *string)
move (LINES - 1, 0);
refresh ();
quit ();
return 0;
}
/*
@@ -177,4 +179,6 @@ message (char *string)
current_line++;
wmove (my_win.x_win, current_line % my_win.x_nlines, 0);
wrefresh (my_win.x_win);
return 0;
}

View File

@@ -133,5 +133,7 @@ check_local ()
return (0);
}
p_error ("Unable to connect with initiator");
return -1;
}

View File

@@ -90,6 +90,8 @@ start_msgs ()
itimer.it_value.tv_sec = itimer.it_interval.tv_sec = MSG_INTERVAL;
itimer.it_value.tv_usec = itimer.it_interval.tv_usec = 0;
setitimer (ITIMER_REAL, &itimer, (struct itimerval *) 0);
return 0;
}
int
@@ -101,4 +103,6 @@ end_msgs ()
timerclear (&itimer.it_interval);
setitimer (ITIMER_REAL, &itimer, (struct itimerval *) 0);
signal (SIGALRM, SIG_DFL);
return 0;
}

View File

@@ -53,6 +53,7 @@
#include "talk.h"
#include <argp.h>
#include <unistd.h>
#include <libinetutils.h>
void usage (void);

View File

@@ -97,7 +97,7 @@ int get_addrs (char *my_machine_name, char *his_machine_name);
int get_names (int argc, char *argv[]);
/* display.c */
int display (xwin_t * win, unsigned char *text, int size);
int display (xwin_t * win, char *text, int size);
int open_sockt (void);
int open_ctl (void);

View File

@@ -140,7 +140,7 @@ talkd_run (int fd)
struct sockaddr_in sa_in;
CTL_MSG msg;
CTL_RESPONSE resp;
int len;
size_t len;
len = sizeof sa_in;
rc =

View File

@@ -149,7 +149,7 @@ makeargv (void)
margc++;
cp++;
}
while (c = *cp)
while ((c = *cp))
{
register int inquote = 0;
while (isspace (c))
@@ -1237,6 +1237,7 @@ dokludgemode ()
send_wont (TELOPT_LINEMODE, 1);
send_dont (TELOPT_SGA, 1);
send_dont (TELOPT_ECHO, 1);
return 0;
}
#endif
@@ -1582,9 +1583,9 @@ shell (int argc, char *argv[])
else
shellname++;
if (argc > 1)
execl (shellp, shellname, "-c", &saveline[1], 0);
execl (shellp, shellname, "-c", &saveline[1], NULL);
else
execl (shellp, shellname, 0);
execl (shellp, shellname, NULL);
perror ("Execl");
_exit (1);
}
@@ -1640,6 +1641,7 @@ quit ()
{
call (bye, "bye", "fromquit", 0);
Exit (0);
return 0;
}
int
@@ -1745,13 +1747,13 @@ struct envlist
int narg;
};
extern struct env_lst *env_define (unsigned char *, unsigned char *);
extern struct env_lst *env_define (const char *, unsigned char *);
extern void
env_undefine (unsigned char *),
env_export (unsigned char *),
env_unexport (unsigned char *), env_send (unsigned char *),
env_undefine (const char *),
env_export (const char *),
env_unexport (const char *), env_send (const char *),
#if defined(OLD_ENVIRON) && defined(ENV_HACK)
env_varval (unsigned char *),
env_varval (const char *),
#endif
env_list (void);
static void env_help (void);
@@ -1850,13 +1852,13 @@ struct env_lst
struct env_lst envlisthead;
struct env_lst *
env_find (unsigned char *var)
env_find (const char *var)
{
register struct env_lst *ep;
for (ep = envlisthead.next; ep; ep = ep->next)
{
if (strcmp ((char *) ep->var, (char *) var) == 0)
if (strcmp ((char *) ep->var, var) == 0)
return (ep);
}
return (NULL);
@@ -1874,10 +1876,11 @@ env_init ()
for (epp = environ; *epp; epp++)
{
if (cp = strchr (*epp, '='))
cp = strchr (*epp, '=');
if (cp)
{
*cp = '\0';
ep = env_define ((unsigned char *) *epp, (unsigned char *) cp + 1);
ep = env_define (*epp, (unsigned char *) cp + 1);
ep->export = 0;
*cp = '=';
}
@@ -1909,19 +1912,18 @@ env_init ()
*/
if ((env_find ("USER") == NULL) && (ep = env_find ("LOGNAME")))
{
env_define ((unsigned char *) "USER", ep->value);
env_unexport ((unsigned char *) "USER");
env_define ("USER", ep->value);
env_unexport ("USER");
}
env_export ((unsigned char *) "DISPLAY");
env_export ((unsigned char *) "PRINTER");
env_export ("DISPLAY");
env_export ("PRINTER");
}
struct env_lst *
env_define (unsigned char *var, unsigned char *value)
env_define (const char *var, unsigned char *value)
{
register struct env_lst *ep;
if (ep = env_find (var))
register struct env_lst *ep = env_find (var);
if (ep)
{
free (ep->var);
free (ep->value);
@@ -1935,7 +1937,7 @@ env_define (unsigned char *var, unsigned char *value)
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);
@@ -1943,11 +1945,10 @@ env_define (unsigned char *var, unsigned char *value)
}
void
env_undefine (unsigned char *var)
env_undefine (const char *var)
{
register struct env_lst *ep;
if (ep = env_find (var))
register struct env_lst *ep = env_find (var);
if (ep)
{
ep->prev->next = ep->next;
if (ep->next)
@@ -1959,25 +1960,23 @@ env_undefine (unsigned char *var)
}
void
env_export (unsigned char *var)
env_export (const char *var)
{
register struct env_lst *ep;
if (ep = env_find (var))
register struct env_lst *ep = env_find (var);
if (ep)
ep->export = 1;
}
void
env_unexport (unsigned char *var)
env_unexport (const char *var)
{
register struct env_lst *ep;
if (ep = env_find (var))
register struct env_lst *ep = env_find (var);
if (ep)
ep->export = 0;
}
void
env_send (unsigned char *var)
env_send (const char *var)
{
register struct env_lst *ep;
@@ -2025,7 +2024,7 @@ env_default (int init, int welldefined)
}
if (nep)
{
while (nep = nep->next)
while ((nep = nep->next))
{
if (nep->export && (nep->welldefined == welldefined))
return (nep->var);
@@ -2035,21 +2034,20 @@ env_default (int init, int welldefined)
}
unsigned char *
env_getvalue (unsigned char *var)
env_getvalue (const char *var)
{
register struct env_lst *ep;
if (ep = env_find (var))
register struct env_lst *ep = env_find (var);
if (ep)
return (ep->value);
return (NULL);
}
#if defined(OLD_ENVIRON) && defined(ENV_HACK)
void
env_varval (unsigned char *what)
env_varval (const char *what)
{
extern int old_env_var, old_env_value, env_auto;
int len = strlen ((char *) what);
int len = strlen (what);
if (len == 0)
goto unknown;
@@ -2735,9 +2733,9 @@ tn (int argc, char *argv[])
struct passwd *pw;
user = getenv ("USER");
if (user == NULL || (pw = getpwnam (user)) && pw->pw_uid != getuid ())
if (user == NULL || ((pw = getpwnam (user)) && pw->pw_uid != getuid ()))
{
if (pw = getpwuid (getuid ()))
if ((pw = getpwuid (getuid ())))
user = pw->pw_name;
else
user = NULL;
@@ -2745,8 +2743,8 @@ tn (int argc, char *argv[])
}
if (user)
{
env_define ((unsigned char *) "USER", (unsigned char *) user);
env_export ((unsigned char *) "USER");
env_define ("USER", (unsigned char *) user);
env_export ("USER");
}
call (status, "status", "notmuch", 0);
if (setjmp (peerdied) == 0)
@@ -2825,7 +2823,7 @@ static Command cmdtab[] = {
#endif
{"environ", envhelp, env_cmd, 0},
{"?", helphelp, help, 0},
0
{0}
};
static char crmodhelp[] = "deprecated command -- use 'toggle crmod' instead";
@@ -2835,7 +2833,7 @@ static Command cmdtab2[] = {
{"help", 0, help, 0},
{"escape", escapehelp, setescape, 0},
{"crmod", crmodhelp, togcrmod, 0},
0
{0}
};
@@ -2878,7 +2876,7 @@ getcmd (char *name)
{
Command *cm;
if (cm = (Command *) genget (name, (char **) cmdtab, sizeof (Command)))
if ((cm = (Command *) genget (name, (char **) cmdtab, sizeof (Command))))
return cm;
return (Command *) genget (name, (char **) cmdtab2, sizeof (Command));
}

View File

@@ -333,7 +333,7 @@ env_opt (unsigned char *, int),
env_opt_start (void),
env_opt_start_info (void), env_opt_add (unsigned char *), env_opt_end (int);
extern unsigned char *env_default (int, int), *env_getvalue (unsigned char *);
extern unsigned char *env_default (int, int), *env_getvalue (const char *);
extern int get_status (void), dosynch (void);

View File

@@ -327,7 +327,7 @@ main (int argc, char *argv[])
TerminalSaveState ();
if (prompt = strrchr (argv[0], '/'))
if ((prompt = strrchr (argv[0], '/')))
++prompt;
else
prompt = argv[0];

View File

@@ -1319,7 +1319,8 @@ process_rings (int netin, int netout, int netex, int ttyin, int ttyout,
if (FD_ISSET (tin, &ibits))
{
FD_CLR (tin, &ibits);
c = TerminalRead (ttyiring.supply, ring_empty_consecutive (&ttyiring));
c = TerminalRead ((char *)ttyiring.supply,
ring_empty_consecutive (&ttyiring));
if (c < 0 && errno == EIO)
c = 0;
if (c < 0 && errno == EWOULDBLOCK)

View File

@@ -75,6 +75,10 @@
#include "externs.h"
#include "types.h"
#include "general.h"
#ifdef HAVE_LIBREADLINE
# include <term.h>
#endif
#define strip(x) ((my_want_state_is_wont(TELOPT_BINARY)) ? ((x)&0x7f) : (x))
@@ -483,7 +487,7 @@ dooption (int option)
#endif
case TELOPT_XDISPLOC: /* X Display location */
if (env_getvalue ((unsigned char *) "DISPLAY"))
if (env_getvalue ("DISPLAY"))
new_state_ok = 1;
break;
@@ -757,7 +761,7 @@ gettermname ()
resettermname = 0;
if (tnamep && tnamep != unknown)
free (tnamep);
if ((tname = (char *) env_getvalue ((unsigned char *) "TERM")) &&
if ((tname = (char *) env_getvalue ("TERM")) &&
(init_term (tname, 1, &err) == 0))
{
tnamep = mklist (termbuf, tname);
@@ -850,7 +854,7 @@ suboption ()
TerminalSpeeds (&ispeed, &ospeed);
sprintf ((char *) temp, "%c%c%c%c%d,%d%c%c", IAC, SB, TELOPT_TSPEED,
TELQUAL_IS, ospeed, ispeed, IAC, SE);
TELQUAL_IS, (int) ospeed, (int) ispeed, IAC, SE);
len = strlen ((char *) temp + 4) + 4; /* temp[3] is 0 ... */
if (len < NETROOM ())
@@ -954,7 +958,7 @@ suboption ()
unsigned char temp[50], *dp;
int len;
if ((dp = env_getvalue ((unsigned char *) "DISPLAY")) == NULL)
if ((dp = env_getvalue ("DISPLAY")) == NULL)
{
/*
* Something happened, we no longer have a DISPLAY
@@ -1233,7 +1237,7 @@ slc_init ()
#define initfunc(func, flags) { \
spcp = &spc_data[func]; \
if (spcp->valp = tcval(func)) { \
if ((spcp->valp = tcval(func))) { \
spcp->val = *spcp->valp; \
spcp->mylevel = SLC_VARIABLE|flags; \
} else { \
@@ -1664,16 +1668,16 @@ env_opt_add (register unsigned char *ep)
{
/* Send user defined variables first. */
env_default (1, 0);
while (ep = env_default (0, 0))
while ((ep = env_default (0, 0)))
env_opt_add (ep);
/* Now add the list of well know variables. */
env_default (1, 1);
while (ep = env_default (0, 1))
while ((ep = env_default (0, 1)))
env_opt_add (ep);
return;
}
vp = env_getvalue (ep);
vp = env_getvalue ((char *)ep);
if (opt_replyp + (vp ? strlen ((char *) vp) : 0) +
strlen ((char *) ep) + 6 > opt_replyend)
{
@@ -1690,7 +1694,7 @@ env_opt_add (register unsigned char *ep)
opt_replyp = opt_reply + len - (opt_replyend - opt_replyp);
opt_replyend = opt_reply + len;
}
if (opt_welldefined (ep))
if (opt_welldefined ((char *) ep))
#ifdef OLD_ENVIRON
if (telopt_environ == TELOPT_OLD_ENVIRON)
*opt_replyp++ = old_env_var;
@@ -1701,7 +1705,7 @@ env_opt_add (register unsigned char *ep)
*opt_replyp++ = ENV_USERVAR;
for (;;)
{
while (c = *ep++)
while ((c = *ep++))
{
switch (c & 0xff)
{
@@ -1717,7 +1721,7 @@ env_opt_add (register unsigned char *ep)
}
*opt_replyp++ = c;
}
if (ep = vp)
if ((ep = vp))
{
#ifdef OLD_ENVIRON
if (telopt_environ == TELOPT_OLD_ENVIRON)
@@ -2422,7 +2426,7 @@ telnet (char *user)
send_will (TELOPT_LINEMODE, 1);
send_will (TELOPT_NEW_ENVIRON, 1);
send_do (TELOPT_STATUS, 1);
if (env_getvalue ((unsigned char *) "DISPLAY"))
if (env_getvalue ("DISPLAY"))
send_will (TELOPT_XDISPLOC, 1);
if (eight)
tel_enter_binary (eight);

View File

@@ -146,7 +146,7 @@ ttyflush (int drop)
}
else
{
n = TerminalWrite (ttyoring.consume, n);
n = TerminalWrite ((char *) ttyoring.consume, n);
}
}
if (n > 0)
@@ -164,7 +164,7 @@ ttyflush (int drop)
{
n1 = n0 - n;
if (!drop)
n1 = TerminalWrite (ttyoring.bottom, n1);
n1 = TerminalWrite ((char *) ttyoring.bottom, n1);
if (n1 > 0)
n += n1;
}

View File

@@ -306,8 +306,9 @@ process_slc (register unsigned char func, register unsigned char flag,
* Compare client's request with what we are capable of supporting.
*/
void
change_slc (register char func, register char flag, register cc_t val)
change_slc (register char func_c, register char flag, register cc_t val)
{
register int func = func_c;
register int hislevel, mylevel;
hislevel = flag & SLC_LEVELBITS;

View File

@@ -186,7 +186,7 @@ telrcv ()
register int c;
static int state = TS_DATA;
while (net_input_level () > 0 & !pty_buffer_is_full ())
while ((net_input_level () > 0) & !pty_buffer_is_full ())
{
c = net_get_char (0);
#ifdef ENCRYPTION

View File

@@ -222,10 +222,11 @@ static struct
int modnum;
} debug_mode[debug_max_mode] =
{
"options", debug_options,
"report", debug_report,
"netdata", debug_net_data,
"ptydata", debug_pty_data, "auth", debug_auth,};
{"options", debug_options},
{"report", debug_report},
{"netdata", debug_net_data},
{"ptydata", debug_pty_data},
{"auth", debug_auth},};
void
parse_debug_level (char *str)
@@ -662,6 +663,8 @@ telnetd_run ()
ptyflush ();
}
cleanup (0);
return 0;
}
void

View File

@@ -306,7 +306,9 @@ tty_iscrnl ()
# define termdesc_status c_cc[VSTATUS]
# endif
# if VEOF == VMIN
static cc_t oldeofc = '\004';
# endif
void
term_send_eof ()
@@ -325,8 +327,9 @@ term_change_eof ()
return 1;
if (slctab[SLC_EOF].sptr)
oldeofc = *slctab[SLC_EOF].sptr;
return 0;
# endif
return 0;
}
int

View File

@@ -491,7 +491,7 @@ clientstat (register int code, register int parm1, register int parm2)
ack = (useeditmode & MODE_ACK);
useeditmode &= ~MODE_ACK;
if (changed = (useeditmode ^ editmode))
if ((changed = (useeditmode ^ editmode)))
{
/*
* This check is for a timing problem. If the

View File

@@ -37,6 +37,11 @@
# define NET_ENCRYPT()
#endif
#ifdef HAVE_LIBREADLINE
# include <term.h>
#endif
static char netobuf[BUFSIZ + NETSLOP], *nfrontp, *nbackp;
static char *neturg; /* one past last byte of urgent data */
#ifdef ENCRYPTION
@@ -244,6 +249,8 @@ net_get_char (int peek)
ncc--;
return *netip++ & 0377;
}
return 0;
}
int
@@ -337,6 +344,8 @@ pty_get_char (int peek)
pcc--;
return *ptyip++ & 0377;
}
return 0;
}
int
@@ -346,6 +355,8 @@ pty_input_putback (const char *str, size_t len)
len = &ptyibuf[BUFSIZ] - ptyip;
strncpy (ptyip, str, len);
pcc += len;
return 0;
}
int
@@ -840,6 +851,8 @@ debug_close ()
if (debug_fp)
fclose (debug_fp);
debug_fp = NULL;
return 0;
}
void
@@ -1323,12 +1336,12 @@ printsub (int direction, unsigned char *pointer, int length)
default:
if (isprint (pointer[i]) && pointer[i] != '"')
{
if (noquote)
if (noquote)
{
debug_output_data ("\"");
noquote = 0;
}
debug_output_datalen (&pointer[i], 1);
debug_output_datalen ((char*) &pointer[i], 1);
}
else
{

View File

@@ -115,7 +115,7 @@ send_file (int fd, char *name, char *mode)
volatile int block, size, convert;
volatile unsigned long amount;
struct sockaddr_in from;
int fromlen;
size_t fromlen;
FILE *file;
startclock (); /* start stat's clock */
@@ -228,7 +228,7 @@ recvfile (int fd, char *name, char *mode)
volatile int block, size, firsttrip;
volatile unsigned long amount;
struct sockaddr_in from;
int fromlen;
size_t fromlen;
FILE *file;
volatile int convert; /* true if converting crlf -> lf */
@@ -466,7 +466,7 @@ printstats (const char *direction, unsigned long amount)
delta = ((tstop.tv_sec * 10.) + (tstop.tv_usec / 100000)) -
((tstart.tv_sec * 10.) + (tstart.tv_usec / 100000));
delta = delta / 10.; /* back to seconds */
printf ("%s %d bytes in %.1f seconds", direction, amount, delta);
printf ("%s %d bytes in %.1f seconds", direction, (int) amount, delta);
if (verbose)
printf (" [%.0f bits/sec]", (amount * 8.) / delta);
putchar ('\n');

View File

@@ -95,15 +95,15 @@ void usage (void);
# define LOG_FTP LOG_DAEMON /* Use generic facility. */
#endif
int peer;
int rexmtval = TIMEOUT;
int maxtimeout = 5 * TIMEOUT;
static int peer;
static int rexmtval = TIMEOUT;
static int maxtimeout = 5 * TIMEOUT;
#define PKTSIZE SEGSIZE+4
char buf[PKTSIZE];
char ackbuf[PKTSIZE];
struct sockaddr_in from;
int fromlen;
static char buf[PKTSIZE];
static char ackbuf[PKTSIZE];
static struct sockaddr_in from;
static size_t fromlen;
void tftp (struct tftphdr *, int);
@@ -226,7 +226,8 @@ main (int argc, char *argv[])
*/
{
int pid;
int i, j;
int i;
size_t j;
for (i = 1; i < 20; i++)
{

View File

@@ -409,7 +409,7 @@ char *
queryformat (const char *server, const char *flags, const char *query)
{
char *buf;
int i, isripe = 0;
int isripe = 0;
/* +10 for CORE; +2 for \r\n; +1 for NULL */
buf = malloc (strlen (flags) + strlen (query) + 10 + 2 + 1);