[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug-inetutils] Cleaning up warnings
From: |
Debarshi Ray |
Subject: |
[bug-inetutils] Cleaning up warnings |
Date: |
Tue, 6 May 2008 08:28:54 +0530 |
Over the last few days, I have been trying to reduce the massive
amount of warnings that are generated by CFLAGS="-Wall". There is
still much to do, but I thought I will just let you review what I have
got so far:
diff -urNp inetutils/libtelnet/auth.h inetutils-build/libtelnet/auth.h
--- inetutils/libtelnet/auth.h 2007-12-10 21:17:19.000000000 +0530
+++ inetutils-build/libtelnet/auth.h 2008-05-06 07:27:10.000000000 +0530
@@ -76,5 +76,5 @@ typedef struct XauthP
# define OPTS_FORWARD_CREDS 0x00000002
# define OPTS_FORWARDABLE_CREDS 0x00000001
-extern auth_debug_mode;
+extern int auth_debug_mode;
#endif
diff -urNp inetutils/libls/ls.c inetutils-build/libls/ls.c
--- inetutils/libls/ls.c 2007-12-10 21:17:19.000000000 +0530
+++ inetutils-build/libls/ls.c 2008-04-22 08:48:34.000000000 +0530
@@ -107,7 +107,7 @@ ls_main (argc, argv)
{
static char dot[] = ".", *dotav[] = { dot, NULL };
struct winsize win;
- int ch, fts_options, notused;
+ int ch, fts_options;
int kflag = 0;
char *p;
@@ -265,6 +265,7 @@ ls_main (argc, argv)
if (f_longform || f_size)
{
#ifdef ORIGINAL_SOURCE
+ int notused;
if (!kflag)
getbsize (¬used, &blocksize);
#else
diff -urNp inetutils/libls/stat_flags.c inetutils-build/libls/stat_flags.c
--- inetutils/libls/stat_flags.c 2007-12-10 21:17:19.000000000 +0530
+++ inetutils-build/libls/stat_flags.c 2008-04-22 08:46:11.000000000 +0530
@@ -103,8 +103,7 @@ string_to_flags (stringp, setp, clrp)
char **stringp;
u_int *setp, *clrp;
{
- int clear;
- char *string, *p;
+ char *string;
if (setp)
*setp = 0;
@@ -112,6 +111,9 @@ string_to_flags (stringp, setp, clrp)
*clrp = 0;
string = *stringp;
#ifdef ORIGINAL_SOURCE
+ int clear;
+ char *p;
+
while ((p = strsep (&string, "\t ,")) != NULL)
{
clear = 0;
diff -urNp inetutils/syslogd/syslogd.c inetutils-build/syslogd/syslogd.c
--- inetutils/syslogd/syslogd.c 2008-05-06 07:18:00.000000000 +0530
+++ inetutils-build/syslogd/syslogd.c 2008-05-06 07:25:45.000000000 +0530
@@ -607,7 +607,7 @@ main (int argc, char *argv[])
if (fdarray[i].revents & (POLLIN | POLLPRI))
{
int result;
- size_t len;
+ socklen_t len;
if (fdarray[i].fd == -1)
continue;
else if (fdarray[i].fd == fklog)
diff -urNp inetutils/telnetd/pty.c inetutils-build/telnetd/pty.c
--- inetutils/telnetd/pty.c 2007-12-10 21:17:18.000000000 +0530
+++ inetutils-build/telnetd/pty.c 2008-05-06 08:02:40.000000000 +0530
@@ -18,6 +18,9 @@
Fifth Floor, Boston, MA 02110-1301 USA. */
#include "telnetd.h"
+
+#include <pty.h>
+#include <sys/stat.h>
#include <sys/wait.h>
#ifdef AUTHENTICATION
@@ -34,7 +37,7 @@ setup_utmp (char *line)
int
-startslave (char *host, int autologin, char *autoname)
+start_slave (char *host, int autologin, char *autoname)
{
pid_t pid;
int master;
diff -urNp inetutils/telnetd/slc.c inetutils-build/telnetd/slc.c
--- inetutils/telnetd/slc.c 2007-12-10 21:17:18.000000000 +0530
+++ inetutils-build/telnetd/slc.c 2008-04-28 00:37:12.000000000 +0530
@@ -284,7 +284,7 @@ process_slc (register unsigned char func
* 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 int func, register char flag, register cc_t val)
{
register int hislevel, mylevel;
diff -urNp inetutils/telnetd/state.c inetutils-build/telnetd/state.c
--- inetutils/telnetd/state.c 2007-12-10 21:17:18.000000000 +0530
+++ inetutils-build/telnetd/state.c 2008-04-22 09:06:07.000000000 +0530
@@ -28,6 +28,8 @@
*/
#include "telnetd.h"
+
+#include <ctype.h>
#include <stdarg.h>
/* Format lines for corresponing commands */
diff -urNp inetutils/telnetd/telnetd.c inetutils-build/telnetd/telnetd.c
--- inetutils/telnetd/telnetd.c 2007-12-10 21:17:18.000000000 +0530
+++ inetutils-build/telnetd/telnetd.c 2008-05-06 08:02:59.000000000 +0530
@@ -216,10 +216,12 @@ 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)
@@ -443,7 +445,7 @@ telnetd_setup (int fd)
setenv ("TERM", terminaltype ? terminaltype : "network", 1);
if (uname[0])
user_name = xstrdup (uname);
- pty = startslave (remote_hostname, level, user_name);
+ pty = start_slave (remote_hostname, level, user_name);
#ifndef HAVE_STREAMSPTY
/* Turn on packet mode */
diff -urNp inetutils/telnetd/telnetd.h inetutils-build/telnetd/telnetd.h
--- inetutils/telnetd/telnetd.h 2007-12-10 21:17:18.000000000 +0530
+++ inetutils-build/telnetd/telnetd.h 2008-05-06 08:17:02.000000000 +0530
@@ -324,11 +324,25 @@ extern void tty_tspeed (int);
extern char *expand_line (const char *fmt);
+/* Utility functions */
+extern int getterminaltype (char *user_name);
+extern int net_buffer_is_full (void);
+extern int net_get_char (int peek);
+extern int net_input_level (void);
+extern void net_output_byte (int c);
+extern int net_output_level (void);
+extern int net_read (void);
+extern int pty_get_char (int peek);
+extern int pty_input_level (void);
+extern int pty_input_putback (const char *str, size_t len);
+extern int pty_output_level (void);
+extern int pty_read (void);
+
/* FIXME */
extern void _termstat (void);
extern void add_slc (char func, char flag, cc_t val);
extern void check_slc (void);
-extern void change_slc (char func, char flag, cc_t val);
+extern void change_slc (int func, char flag, cc_t val);
extern void cleanup (int);
extern void clientstat (int, int, int);
@@ -355,7 +369,7 @@ extern void send_wont (int, int);
extern void set_termbuf (void);
extern void start_login (char *, int, char *);
extern void start_slc (int);
-extern void start_slave (char *, int, char *);
+extern int start_slave (char *host, int autologin, char *autoname);
extern void suboption (void);
extern void telrcv (void);
diff -urNp inetutils/telnetd/term.c inetutils-build/telnetd/term.c
--- inetutils/telnetd/term.c 2007-12-10 21:17:18.000000000 +0530
+++ inetutils-build/telnetd/term.c 2008-05-06 07:47:02.000000000 +0530
@@ -304,7 +304,9 @@ tty_iscrnl ()
# define termdesc_status c_cc[VSTATUS]
# endif
+# if VEOF == VMIN
static cc_t oldeofc = '\004';
+# endif
void
term_send_eof ()
@@ -323,8 +325,8 @@ term_change_eof ()
return 1;
if (slctab[SLC_EOF].sptr)
oldeofc = *slctab[SLC_EOF].sptr;
- return 0;
# endif
+ return 0;
}
int
diff -urNp inetutils/telnetd/termstat.c inetutils-build/telnetd/termstat.c
--- inetutils/telnetd/termstat.c 2007-12-10 21:17:18.000000000 +0530
+++ inetutils-build/telnetd/termstat.c 2008-04-28 01:32:36.000000000 +0530
@@ -469,7 +469,7 @@ clientstat (register int code, register
ack = (useeditmode & MODE_ACK);
useeditmode &= ~MODE_ACK;
- if (changed = (useeditmode ^ editmode))
+ if ((changed = (useeditmode ^ editmode)))
{
/*
* This check is for a timing problem. If the
diff -urNp inetutils/telnetd/utility.c inetutils-build/telnetd/utility.c
--- inetutils/telnetd/utility.c 2007-12-10 21:17:18.000000000 +0530
+++ inetutils-build/telnetd/utility.c 2008-05-06 07:54:43.000000000 +0530
@@ -21,11 +21,21 @@
#define TELCMDS
#define SLC_NAMES
#include "telnetd.h"
+
+#include <ctype.h>
#include <stdarg.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <time.h>
+
+#ifdef HAVE_LIBREADLINE
+# include <curses.h>
+# include <term.h>
+#endif
+
#ifdef HAVE_TERMIO_H
# include <termio.h>
#endif
-#include <time.h>
#if defined(AUTHENTICATION) || defined(ENCRYPTION)
# include <libtelnet/misc.h>
@@ -659,6 +669,22 @@ _gettermname ()
ttloop (sequenceIs (ttypesubopt, baseline));
}
+int
+terminaltypeok (char *s)
+{
+ char buf[1024];
+
+ if (terminaltype == NULL)
+ return 1;
+
+#ifdef HAVE_LIBREADLINE
+ if (tgetent (buf, s) == 0)
+#endif
+ return 0;
+
+ return 1;
+}
+
/* FIXME: should be getterminaltype (char *user_name, size_t size)
Changes terminaltype.
*/
@@ -803,22 +829,6 @@ getterminaltype (char *user_name)
return retval;
}
-int
-terminaltypeok (char *s)
-{
- char buf[1024];
-
- if (terminaltype == NULL)
- return 1;
-
-#ifdef HAVE_LIBREADLINE
- if (tgetent (buf, s) == 0)
-#endif
- return 0;
-
- return 1;
-}
-
/* ************************************************************************* */
/* Debugging support */
@@ -838,9 +848,12 @@ debug_open ()
static int
debug_close ()
{
+ int result = 0;
+
if (debug_fp)
- fclose (debug_fp);
+ result = fclose (debug_fp);
debug_fp = NULL;
+ return result;
}
void
@@ -886,7 +899,6 @@ void
printsub (int direction, unsigned char *pointer, int length)
{
register int i;
- char buf[512];
if (direction)
{
@@ -1346,6 +1358,8 @@ printsub (int direction, unsigned char *
#if defined(AUTHENTICATION)
case TELOPT_AUTHENTICATION:
+ char buf[512];
+
debug_output_data ("AUTHENTICATION");
if (length < 2)
@@ -1419,7 +1433,10 @@ printsub (int direction, unsigned char *
#ifdef ENCRYPTION
case TELOPT_ENCRYPT:
+ char buf[512];
+
debug_output_data ("ENCRYPT");
+
if (length < 2)
{
debug_output_data (" (empty suboption??\?)");
diff -urNp inetutils/libinetutils/argcv.c inetutils-build/libinetutils/argcv.c
--- inetutils/libinetutils/argcv.c 2007-12-10 21:17:19.000000000 +0530
+++ inetutils-build/libinetutils/argcv.c 2008-04-22 08:56:45.000000000
+0530
@@ -15,6 +15,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
+#include <ctype.h>
#include "argcv.h"
/*
@@ -66,7 +67,7 @@ int
argcv_get (const char *command, const char *delim, int *argc, char ***argv)
{
int len = strlen (command);
- int i = 0, j = 0;
+ int i = 0;
int start, end, save;
*argc = 0;
Comments?
Happy hacking,
Debarshi
--
"From what we get, we can make a living; what we give, however, makes a life."
-- Arthur Ashe