bug-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-inetutils] Re: Cleaning up warnings


From: Debarshi Ray
Subject: [bug-inetutils] Re: Cleaning up warnings
Date: Tue, 6 May 2008 19:45:22 +0530

Here is an update:

diff -urNp inetutils/ftp/cmds.c inetutils-build/ftp/cmds.c
--- inetutils/ftp/cmds.c        2007-09-06 08:45:56.000000000 +0530
+++ inetutils-build/ftp/cmds.c  2008-05-06 17:48:28.000000000 +0530
@@ -65,6 +65,17 @@
 # endif
 #endif
 #include <unistd.h>
+
+#if HAVE_LIBREADLINE
+# include <readline/readline.h>
+#else
+# include "readline.h"
+#endif
+
+#if HAVE_LIBHISTORY
+# include <readline/history.h>
+#endif
+
 /* Include glob.h last, because it may define "const" which breaks
    system headers on some platforms. */
 #include <glob.h>
@@ -640,7 +651,7 @@ mput (argc, argv)
     }
   for (i = 1; i < argc; i++)
     {
-      char **cpp, **gargs;
+      char **cpp;
       glob_t gl;
       int flags;

@@ -898,8 +909,8 @@ mget (argc, argv)
      char **argv;
 {
   sig_t oldintr;
-  int ch, ointer;
-  char *cp, *tp, *tp2;
+  int ointer;
+  char *cp, *tp;

   if (argc < 2 && !another (&argc, &argv, "remote-files"))
     {
@@ -969,7 +980,7 @@ remglob (argv, doswitch)
   int sofar = 0;
   int oldverbose, oldhash;
   int fd;
-  char *cp, *mode, *end;
+  char *cp, *mode;

   if (!mflag)
     {
diff -urNp inetutils/ftp/ftp.c inetutils-build/ftp/ftp.c
--- inetutils/ftp/ftp.c 2007-09-05 09:35:51.000000000 +0530
+++ inetutils-build/ftp/ftp.c   2008-05-06 17:14:21.000000000 +0530
@@ -1634,7 +1634,7 @@ gunique (local)
 {
   static char *new = 0;
   char *cp;
-  int d, count = 0;
+  int count = 0;
   char ext = '1';

   if (new)
diff -urNp inetutils/ftp/main.c inetutils-build/ftp/main.c
--- inetutils/ftp/main.c        2007-09-05 09:35:51.000000000 +0530
+++ inetutils-build/ftp/main.c  2008-05-06 17:48:22.000000000 +0530
@@ -63,6 +63,11 @@
 #else
 #  include "readline.h"
 #endif
+
+#if HAVE_LIBHISTORY
+#  include <readline/history.h>
+#endif
+
 

 #define DEFAULT_PROMPT "ftp> "
@@ -136,7 +141,7 @@ static struct argp argp = {argp_options,
 int
 main (int argc, char *argv[])
 {
-  int ch, top;
+  int top;
   int index;
   struct passwd *pw = NULL;
   char *cp;
diff -urNp inetutils/ftp/ruserpass.c inetutils-build/ftp/ruserpass.c
--- inetutils/ftp/ruserpass.c   2006-10-21 23:38:45.000000000 +0530
+++ inetutils-build/ftp/ruserpass.c     2008-05-06 17:46:11.000000000 +0530
@@ -36,6 +36,7 @@

 #include <ctype.h>
 #include <errno.h>
+#include <error.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff -urNp inetutils/inetd/inetd.c inetutils-build/inetd/inetd.c
--- inetutils/inetd/inetd.c     2007-06-29 21:59:32.000000000 +0530
+++ inetutils-build/inetd/inetd.c       2008-05-06 19:27:13.000000000 +0530
@@ -144,6 +144,7 @@
 #endif
 #include <grp.h>

+#include "argcv.h"
 #include "libinetutils.h"

 #define TOOMANY                40      /* don't start more than TOOMANY */
@@ -648,13 +649,12 @@ run_service (int ctrl, struct servtab *s
 }

 void
-reapchild (int signo)
+reapchild (int signo ARG_UNUSED)
 {
   int status;
   pid_t pid;
   struct servtab *sep;

-  signo;                       /* shutup gcc */
   for (;;)
     {
 #ifdef HAVE_WAIT3
@@ -683,14 +683,12 @@ reapchild (int signo)
 }

 void
-config (int signo)
+config (int signo ARG_UNUSED)
 {
   int i;
   struct stat stats;
   struct servtab *sep;

-  signo;                       /* Shutup gcc.  */
-
   for (sep = servtab; sep; sep = sep->se_next)
     sep->se_checked = 0;

@@ -871,11 +869,10 @@ nextconfig (const char *file)
 }

 void
-retry (int signo)
+retry (int signo ARG_UNUSED)
 {
   struct servtab *sep;

-  signo;                       /* shutup gcc */
   timingout = 0;
   for (sep = servtab; sep; sep = sep->se_next)
     if (sep->se_fd == -1 && !ISMUX (sep))
@@ -1116,7 +1113,8 @@ struct servtab *
 getconfigent (FILE * fconfig, const char *file, size_t * line)
 {
   struct servtab *sep = &serv;
-  size_t argc = 0, i;
+  int argc = 0;
+  size_t i;
   char **argv = NULL;
   char *cp;
   static char TCPMUX_TOKEN[] = "tcpmux/";
@@ -1386,7 +1384,7 @@ echo_stream (int s, struct servtab *sep)

 /* Echo service -- echo data back */
 void
-echo_dg (int s, struct servtab *sep)
+echo_dg (int s, struct servtab *sep ARG_UNUSED)
 {
   char buffer[BUFSIZE];
   int i;
@@ -1397,7 +1395,6 @@ echo_dg (int s, struct servtab *sep)
   struct sockaddr sa;
 #endif

-  sep;
   size = sizeof sa;
   i = recvfrom (s, buffer, sizeof buffer, 0, (struct sockaddr *) &sa, &size);
   if (i < 0)
@@ -1425,10 +1422,10 @@ discard_stream (int s, struct servtab *s

 void
 /* Discard service -- ignore data */
-discard_dg (int s, struct servtab *sep)
+discard_dg (int s, struct servtab *sep ARG_UNUSED)
 {
   char buffer[BUFSIZE];
-  sep;                         /* shutup gcc */
+
   read (s, buffer, sizeof buffer);
 }

@@ -1485,7 +1482,7 @@ chargen_stream (int s, struct servtab *s

 /* Character generator */
 void
-chargen_dg (int s, struct servtab *sep)
+chargen_dg (int s, struct servtab *sep ARG_UNUSED)
 {
 #ifdef IPV6
   struct sockaddr_storage sa;
@@ -1497,7 +1494,6 @@ chargen_dg (int s, struct servtab *sep)
   socklen_t size;
   char text[LINESIZ + 2];

-  sep;                         /* shutup gcc */
   if (endring == 0)
     {
       initring ();
@@ -1547,17 +1543,16 @@ machtime (void)
 }

 void
-machtime_stream (int s, struct servtab *sep)
+machtime_stream (int s, struct servtab *sep ARG_UNUSED)
 {
   long result;

-  sep;                         /* shutup gcc */
   result = machtime ();
   write (s, (char *) &result, sizeof result);
 }

 void
-machtime_dg (int s, struct servtab *sep)
+machtime_dg (int s, struct servtab *sep ARG_UNUSED)
 {
   long result;
 #ifdef IPV6
@@ -1567,7 +1562,6 @@ machtime_dg (int s, struct servtab *sep)
 #endif
   socklen_t size;

-  sep;                         /* shutup gcc */
   size = sizeof sa;
   if (recvfrom (s, (char *) &result, sizeof result, 0,
                (struct sockaddr *) &sa, &size) < 0)
@@ -1579,12 +1573,11 @@ machtime_dg (int s, struct servtab *sep)

 void
 /* Return human-readable time of day */
-daytime_stream (int s, struct servtab *sep)
+daytime_stream (int s, struct servtab *sep ARG_UNUSED)
 {
   char buffer[256];
   time_t lclock;

-  sep;                         /*shutup gcc */
   lclock = time ((time_t *) 0);

   sprintf (buffer, "%.24s\r\n", ctime (&lclock));
@@ -1593,7 +1586,7 @@ daytime_stream (int s, struct servtab *s

 /* Return human-readable time of day */
 void
-daytime_dg (int s, struct servtab *sep)
+daytime_dg (int s, struct servtab *sep ARG_UNUSED)
 {
   char buffer[256];
   time_t lclock;
@@ -1604,7 +1597,6 @@ daytime_dg (int s, struct servtab *sep)
 #endif
   socklen_t size;

-  sep;                         /* shutup gcc */
   lclock = time ((time_t *) 0);

   size = sizeof sa;
diff -urNp inetutils/libinetutils/argcv.c inetutils-build/libinetutils/argcv.c
--- inetutils/libinetutils/argcv.c      2007-06-29 21:59:31.000000000 +0530
+++ inetutils-build/libinetutils/argcv.c        2008-05-06 15:55:20.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;
diff -urNp inetutils/libinetutils/libinetutils.h
inetutils-build/libinetutils/libinetutils.h
--- inetutils/libinetutils/libinetutils.h       2007-06-29 21:59:31.000000000 
+0530
+++ inetutils-build/libinetutils/libinetutils.h 2008-05-06
16:51:34.000000000 +0530
@@ -19,6 +19,7 @@
 #include "config.h"

 void utmp_init (char *line, char *user, char *id);
+void utmp_logout (char *line);
 char *utmp_ptsid (char *line, char *tag);
 char *localhost (void);
 void logwtmp (const char *, const char *, const char *);
diff -urNp inetutils/libinetutils/tftpsubs.c
inetutils-build/libinetutils/tftpsubs.c
--- inetutils/libinetutils/tftpsubs.c   2006-10-21 23:38:45.000000000 +0530
+++ inetutils-build/libinetutils/tftpsubs.c     2008-05-06 17:07:34.000000000 
+0530
@@ -269,7 +269,7 @@ synchnet (int f)
   int i, j = 0;
   char rbuf[PKTSIZE];
   struct sockaddr_in from;
-  int fromlen;
+  socklen_t fromlen;

   while (1)
     {
diff -urNp inetutils/libinetutils/utmp_logout.c
inetutils-build/libinetutils/utmp_logout.c
--- inetutils/libinetutils/utmp_logout.c        2006-10-21 20:54:20.000000000 
+0530
+++ inetutils-build/libinetutils/utmp_logout.c  2008-05-06
17:03:43.000000000 +0530
@@ -50,7 +50,8 @@ utmp_logout (char *line)

   strncpy (utx.ut_line, line, sizeof (utx.ut_line));

-  if ((ut = getutxline (&utx)))
+  ut = getutxline (&utx);
+  if (ut != NULL)
     {
       ut->ut_type = DEAD_PROCESS;
       ut->ut_exit.e_termination = 0;
@@ -66,7 +67,7 @@ utmp_logout (char *line)

   strncpy (utx.ut_line, line, sizeof (utx.ut_line));

-  if (ut = getutline (&utx))
+  if ((ut = getutline (&utx)))
     {
 # ifdef HAVE_STRUCT_UTMP_UT_TYPE
       ut->ut_type = DEAD_PROCESS;
diff -urNp inetutils/libls/ls.c inetutils-build/libls/ls.c
--- inetutils/libls/ls.c        2006-10-21 23:38:45.000000000 +0530
+++ inetutils-build/libls/ls.c  2008-05-06 15:55:20.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 (&notused, &blocksize);
 #else
diff -urNp inetutils/libls/stat_flags.c inetutils-build/libls/stat_flags.c
--- inetutils/libls/stat_flags.c        2006-10-21 23:38:45.000000000 +0530
+++ inetutils-build/libls/stat_flags.c  2008-05-06 15:55:20.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/libtelnet/auth.h inetutils-build/libtelnet/auth.h
--- inetutils/libtelnet/auth.h  2006-10-21 20:54:20.000000000 +0530
+++ inetutils-build/libtelnet/auth.h    2008-05-06 15:55:20.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/syslogd/syslogd.c inetutils-build/syslogd/syslogd.c
--- inetutils/syslogd/syslogd.c 2008-05-06 15:52:51.000000000 +0530
+++ inetutils-build/syslogd/syslogd.c   2008-05-06 15:55:20.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-06-29 21:59:29.000000000 +0530
+++ inetutils-build/telnetd/pty.c       2008-05-06 15:55:20.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     2006-10-21 23:38:45.000000000 +0530
+++ inetutils-build/telnetd/slc.c       2008-05-06 15:55:20.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-05-24 21:25:00.000000000 +0530
+++ inetutils-build/telnetd/state.c     2008-05-06 15:55:20.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-06-29 21:59:29.000000000 +0530
+++ inetutils-build/telnetd/telnetd.c   2008-05-06 15:55:20.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-06-29 21:59:29.000000000 +0530
+++ inetutils-build/telnetd/telnetd.h   2008-05-06 16:41:08.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 void 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-06-29 21:59:28.000000000 +0530
+++ inetutils-build/telnetd/term.c      2008-05-06 15:55:20.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        2006-10-21 23:38:45.000000000 +0530
+++ inetutils-build/telnetd/termstat.c  2008-05-06 15:55:20.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-06-29 21:59:28.000000000 +0530
+++ inetutils-build/telnetd/utility.c   2008-05-06 16:45:34.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>
@@ -336,7 +346,7 @@ pty_get_char (int peek)
     }
 }

-int
+void
 pty_input_putback (const char *str, size_t len)
 {
   if (len > &ptyibuf[BUFSIZ] - ptyip)
@@ -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
@@ -885,8 +898,11 @@ printoption (register char *fmt, registe
 void
 printsub (int direction, unsigned char *pointer, int length)
 {
-  register int i;
+#if defined(AUTHENTICATION) || defined(ENCRYPTION)
   char buf[512];
+#endif
+
+  register int i;

   if (direction)
     {
@@ -1319,7 +1335,6 @@ printsub (int direction, unsigned char *
                    break;

                  default:
-                 def_case:
                    if (isprint (pointer[i]) && pointer[i] != '"')
                      {
                        if (noquote)
@@ -1327,7 +1342,7 @@ printsub (int direction, unsigned char *
                            debug_output_data ("\"");
                            noquote = 0;
                          }
-                       debug_output_datalen (&pointer[i], 1);
+                       debug_output_datalen ((char *) &pointer[i], 1);
                      }
                    else
                      {
@@ -1420,6 +1435,7 @@ printsub (int direction, unsigned char *
 #ifdef ENCRYPTION
     case TELOPT_ENCRYPT:
       debug_output_data ("ENCRYPT");
+
       if (length < 2)
        {
          debug_output_data (" (empty suboption??\?)");

Happy hacking,
Debarshi
-- 
"From what we get, we can make a living; what we give, however, makes a life."
 -- Arthur Ashe




reply via email to

[Prev in Thread] Current Thread [Next in Thread]