File bash-4.3-loadables.dif of Package bash.4748

--- examples/loadables/basename.c
+++ examples/loadables/basename.c
@@ -31,6 +31,7 @@
 #include "shell.h"
 #include "common.h"
 
+int
 basename_builtin (list)
      WORD_LIST *list;
 {
--- examples/loadables/dirname.c
+++ examples/loadables/dirname.c
@@ -31,6 +31,7 @@
 #include "shell.h"
 #include "common.h"
 
+int
 dirname_builtin (list)
      WORD_LIST *list;
 {
--- examples/loadables/finfo.c
+++ examples/loadables/finfo.c
@@ -99,7 +99,7 @@ int	argc;
 char	**argv;
 {
 	register int	i;
-	int	mode, flags, opt;
+	int	flags, opt;
 
 	sh_optind = 0;	/* XXX */
 	prog = base_pathname(argv[0]);
@@ -192,7 +192,7 @@ int	m;
 	return (m & (S_IRWXU|S_IRWXG|S_IRWXO|S_ISUID|S_ISGID));
 }
 
-static int
+static void
 perms(m)
 int	m;
 {
@@ -236,7 +236,7 @@ int	m;
 	printf ("u=%s,g=%s,o=%s", ubits, gbits, obits);
 }
 
-static int
+static void
 printmode(mode)
 int	mode;
 {
@@ -331,13 +331,13 @@ int	flags;
 		else
 			printf("%ld\n", st->st_ctime);
 	} else if (flags & OPT_DEV)
-		printf("%d\n", st->st_dev);
+		printf("%lu\n", (ulong)st->st_dev);
 	else if (flags & OPT_INO)
-		printf("%d\n", st->st_ino);
+		printf("%lu\n", (ulong)st->st_ino);
 	else if (flags & OPT_FID)
-		printf("%d:%ld\n", st->st_dev, st->st_ino);
+		printf("%lu:%lu\n", (ulong)st->st_dev, (ulong)st->st_ino);
 	else if (flags & OPT_NLINK)
-		printf("%d\n", st->st_nlink);
+		printf("%lu\n", (ulong)st->st_nlink);
 	else if (flags & OPT_LNKNAM) {
 #ifdef S_ISLNK
 		b = xmalloc(4096);
@@ -387,7 +387,6 @@ finfo_builtin(list)
 {
   int c, r;
   char **v;
-  WORD_LIST *l;
 
   v = make_builtin_argv (list, &c);
   r = finfo_main (c, v);
--- examples/loadables/head.c
+++ examples/loadables/head.c
@@ -88,8 +88,10 @@ file_head (fp, cnt)
 	    break;
 	}
     }
+  return EXECUTION_SUCCESS;
 }
 
+int
 head_builtin (list)
      WORD_LIST *list;
 {
@@ -97,8 +99,6 @@ head_builtin (list)
   WORD_LIST *l;
   FILE *fp;
 
-  char *t;
-
   munge_list (list);	/* change -num into -n num */
 
   reset_internal_getopt ();
--- examples/loadables/id.c
+++ examples/loadables/id.c
@@ -64,8 +64,6 @@ static int id_flags;
 static uid_t ruid, euid;
 static gid_t rgid, egid;
 
-static char *id_user;
-
 static int inituser ();
 
 static int id_pruser ();
--- examples/loadables/ln.c
+++ examples/loadables/ln.c
@@ -50,6 +50,7 @@ typedef int unix_link_syscall_t __P((con
 static unix_link_syscall_t *linkfn;
 static int dolink ();
 
+int
 ln_builtin (list)
      WORD_LIST *list;
 {
--- examples/loadables/logname.c
+++ examples/loadables/logname.c
@@ -35,6 +35,7 @@
 extern int errno;
 #endif
 
+int
 logname_builtin (list)
      WORD_LIST *list;
 {
--- examples/loadables/mkdir.c
+++ examples/loadables/mkdir.c
@@ -52,7 +52,7 @@ int
 mkdir_builtin (list)
      WORD_LIST *list;
 {
-  int opt, pflag, omode, rval, octal, nmode, parent_mode, um;
+  int opt, pflag, omode, rval, octal, nmode, parent_mode;
   char *mode;
   WORD_LIST *l;
 
@@ -169,7 +169,7 @@ make_path (path, nmode, parent_mode)
   while (*p == '/')
     p++;
 
-  while (p = strchr (p, '/'))
+  while ((p = strchr (p, '/')))
     {
       *p = '\0';
       if (stat (npath, &sb) != 0)
--- examples/loadables/pathchk.c
+++ examples/loadables/pathchk.c
@@ -98,6 +98,7 @@ extern char *strerror ();
 
 static int validate_path ();
 
+int
 pathchk_builtin (list)
      WORD_LIST *list;
 {
@@ -290,10 +291,8 @@ validate_path (path, portability)
   if (*path == '\0')
     return 0;
 
-#ifdef lint
   /* Suppress `used before initialized' warning.  */
   exists = 0;
-#endif
 
   /* Figure out the parent of the first element in PATH.  */
   parent = xstrdup (*path == '/' ? "/" : ".");
@@ -370,7 +369,7 @@ validate_path (path, portability)
   free (parent);
   if (strlen (path) > path_max)
     {
-      builtin_error ("path `%s' has length %d; exceeds limit of %d",
+      builtin_error ("path `%s' has length %zu; exceeds limit of %d",
 	     path, strlen (path), path_max);
       return 1;
     }
--- examples/loadables/print.c
+++ examples/loadables/print.c
@@ -77,7 +77,7 @@ print_builtin (list)
 {
   int c, r, nflag, raw, ofd, sflag;
   intmax_t lfd;
-  char **v, *pfmt, *arg;
+  char *pfmt;
   WORD_LIST *l;
 
   nflag = raw = sflag = 0;
--- examples/loadables/realpath.c
+++ examples/loadables/realpath.c
@@ -60,6 +60,7 @@ extern int	errno;
 
 extern char	*sh_realpath();
 
+int
 realpath_builtin(list)
 WORD_LIST	*list;
 {
--- examples/loadables/rmdir.c
+++ examples/loadables/rmdir.c
@@ -32,6 +32,7 @@
 extern int errno;
 #endif
 
+int
 rmdir_builtin (list)
      WORD_LIST *list;
 {
--- examples/loadables/sync.c
+++ examples/loadables/sync.c
@@ -28,6 +28,7 @@
 #include "shell.h"
 #include "bashgetopt.h"
 
+int
 sync_builtin (list)
      WORD_LIST *list;
 {
--- examples/loadables/tee.c
+++ examples/loadables/tee.c
@@ -60,6 +60,7 @@ extern int interrupt_immediately;
 
 extern char *strerror ();
 
+int
 tee_builtin (list)
      WORD_LIST *list;
 {
@@ -68,8 +69,6 @@ tee_builtin (list)
   FLIST *fl;
   char *buf, *bp;
 
-  char *t;
-
   reset_internal_getopt ();
   append = nointr = 0;
   tee_flist = (FLIST *)NULL;
--- examples/loadables/truefalse.c
+++ examples/loadables/truefalse.c
@@ -25,26 +25,26 @@
 #include "builtins.h"
 #include "common.h"
 
-true_builtin (list)
+int true_builtin (list)
      WORD_LIST *list;
 {
   return EXECUTION_SUCCESS;
 }
 
-false_builtin (list)
+int false_builtin (list)
      WORD_LIST *list;
 {
   return EXECUTION_FAILURE;
 }
 
-static char *true_doc[] = {
+char * const true_doc[] = {
 	"Exit successfully.",
 	"",
 	"Return a successful result.",
 	(char *)NULL
 };
 
-static char *false_doc[] = {
+char * const false_doc[] = {
 	"Exit unsuccessfully.",
 	"",
 	"Return an unsuccessful result.",
--- examples/loadables/tty.c
+++ examples/loadables/tty.c
@@ -30,6 +30,7 @@
 
 extern char *ttyname ();
 
+int
 tty_builtin (list)
      WORD_LIST *list;
 {
--- examples/loadables/uname.c
+++ examples/loadables/uname.c
@@ -63,10 +63,11 @@ static void uprint();
 
 static int uname_flags;
 
+int
 uname_builtin (list)
      WORD_LIST *list;
 {
-  int opt, r;
+  int opt;
   struct utsname uninfo;
 
   uname_flags = 0;
--- examples/loadables/unlink.c
+++ examples/loadables/unlink.c
@@ -38,6 +38,7 @@
 extern int errno;
 #endif
 
+int
 unlink_builtin (list)
      WORD_LIST *list;
 {
--- examples/loadables/whoami.c
+++ examples/loadables/whoami.c
@@ -28,6 +28,7 @@
 #include "bashgetopt.h"
 #include "common.h"
 
+int
 whoami_builtin (list)
      WORD_LIST *list;
 {