--- examples/loadables/Makefile.in +++ examples/loadables/Makefile.in 2006-09-25 13:31:55.000000000 +0200 @@ -81,7 +81,7 @@ $(SHOBJ_CC) $(SHOBJ_CFLAGS) $(CCFLAGS) $(INC) -c -o $@ $< -ALLPROG = print truefalse sleep pushd finfo logname basename dirname \ +ALLPROG = print sleep finfo logname basename dirname \ tty pathchk tee head mkdir rmdir printenv id whoami \ uname sync push ln unlink cut realpath getconf strftime OTHERPROG = necho hello cat --- examples/loadables/basename.c +++ examples/loadables/basename.c 2006-09-25 13:49:31.000000000 +0200 @@ -9,9 +9,12 @@ #endif #include -#include "builtins.h" #include "shell.h" +#include "builtins.h" +#include "builtins/builtext.h" +#include "builtins/common.h" +int basename_builtin (list) WORD_LIST *list; { --- examples/loadables/cat.c +++ examples/loadables/cat.c 2006-09-25 13:37:46.000000000 +0200 @@ -7,8 +7,10 @@ #include #include -#include "builtins.h" #include "shell.h" +#include "builtins.h" +#include "builtins/builtext.h" +#include "builtins/common.h" #ifndef errno extern int errno; --- examples/loadables/cut.c +++ examples/loadables/cut.c 2006-09-25 14:00:21.000000000 +0200 @@ -60,8 +60,10 @@ # include #endif -#include "builtins.h" #include "shell.h" +#include "builtins.h" +#include "builtins/builtext.h" +#include "builtins/common.h" #include "bashgetopt.h" #if !defined (errno) @@ -243,7 +245,7 @@ pos = positions + 1; for (col = maxval; col; --col) { if ((ch = getc(fp)) == EOF) - return; + return (0); if (ch == '\n') break; if (*pos++) --- examples/loadables/dirname.c +++ examples/loadables/dirname.c 2006-09-25 13:49:38.000000000 +0200 @@ -9,9 +9,12 @@ #endif #include -#include "builtins.h" #include "shell.h" +#include "builtins.h" +#include "builtins/builtext.h" +#include "builtins/common.h" +int dirname_builtin (list) WORD_LIST *list; { --- examples/loadables/finfo.c +++ examples/loadables/finfo.c 2006-09-25 13:48:52.000000000 +0200 @@ -16,6 +16,8 @@ #include "bashansi.h" #include "shell.h" #include "builtins.h" +#include "builtins/builtext.h" +#include "builtins/common.h" #include "common.h" #ifndef errno @@ -77,7 +79,7 @@ char **argv; { register int i; - int mode, flags, opt; + int flags, opt; sh_optind = 0; /* XXX */ prog = base_pathname(argv[0]); @@ -170,7 +172,7 @@ return (m & (S_IRWXU|S_IRWXG|S_IRWXO|S_ISUID|S_ISGID)); } -static int +static void perms(m) int m; { @@ -214,7 +216,7 @@ printf ("u=%s,g=%s,o=%s", ubits, gbits, obits); } -static int +static void printmode(mode) int mode; { @@ -309,13 +311,13 @@ 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); @@ -365,7 +367,6 @@ { int c, r; char **v; - WORD_LIST *l; v = make_builtin_argv (list, &c); r = finfo_main (c, v); --- examples/loadables/getconf.c +++ examples/loadables/getconf.c 2006-09-25 14:02:33.000000000 +0200 @@ -65,6 +65,8 @@ #include "bashansi.h" #include "shell.h" #include "builtins.h" +#include "builtins/builtext.h" +#include "builtins/common.h" #include "stdc.h" #include "common.h" #include "bashgetopt.h" @@ -1119,8 +1121,6 @@ { NULL } }; -static int num_getconf_variables = sizeof(conf_table) / sizeof(struct conf_variable) - 1; - extern char *this_command_name; extern char **make_builtin_argv (); @@ -1133,8 +1133,7 @@ getconf_builtin (list) WORD_LIST *list; { - int c, r, opt, aflag; - char **v; + int r, opt, aflag; aflag = 0; reset_internal_getopt(); @@ -1169,7 +1168,6 @@ getconf_help() { const struct conf_variable *cp; - register int i, column; builtin_usage(); printf("Acceptable variable names are:\n"); --- examples/loadables/head.c +++ examples/loadables/head.c 2006-09-25 13:55:24.000000000 +0200 @@ -20,6 +20,8 @@ #include "builtins.h" #include "shell.h" +#include "builtins/builtext.h" +#include "builtins/common.h" #include "bashgetopt.h" #if !defined (errno) @@ -69,8 +71,10 @@ break; } } + return EXECUTION_SUCCESS; } +int head_builtin (list) WORD_LIST *list; { @@ -78,8 +82,6 @@ WORD_LIST *l; FILE *fp; - char *t; - munge_list (list); /* change -num into -n num */ reset_internal_getopt (); --- examples/loadables/hello.c +++ examples/loadables/hello.c 2006-09-25 13:38:25.000000000 +0200 @@ -11,8 +11,10 @@ #include -#include "builtins.h" #include "shell.h" +#include "builtins.h" +#include "builtins/builtext.h" +#include "builtins/common.h" #include "bashgetopt.h" /* A builtin `xxx' is normally implemented with an `xxx_builtin' function. --- examples/loadables/id.c +++ examples/loadables/id.c 2006-09-25 13:57:41.000000000 +0200 @@ -29,6 +29,8 @@ #include "shell.h" #include "builtins.h" +#include "builtins/builtext.h" +#include "builtins/common.h" #include "stdc.h" #include "common.h" #include "bashgetopt.h" @@ -46,8 +48,6 @@ 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 2006-09-25 13:59:09.000000000 +0200 @@ -15,8 +15,10 @@ #include #include -#include "builtins.h" #include "shell.h" +#include "builtins.h" +#include "builtins/builtext.h" +#include "builtins/common.h" #include "bashgetopt.h" #if !defined (errno) @@ -31,6 +33,7 @@ static unix_link_syscall_t *linkfn; static int dolink (); +int ln_builtin (list) WORD_LIST *list; { --- examples/loadables/logname.c +++ examples/loadables/logname.c 2006-09-25 13:30:40.000000000 +0200 @@ -9,8 +9,10 @@ #include #include -#include "builtins.h" #include "shell.h" +#include "builtins.h" +#include "builtins/common.h" +#include "builtins/builtext.h" #if !defined (errno) extern int errno; --- examples/loadables/mkdir.c +++ examples/loadables/mkdir.c 2006-09-25 13:56:07.000000000 +0200 @@ -13,8 +13,10 @@ # include #endif -#include "builtins.h" #include "shell.h" +#include "builtins.h" +#include "builtins/builtext.h" +#include "builtins/common.h" #include "bashgetopt.h" #if !defined (errno) @@ -33,7 +35,7 @@ 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; @@ -150,7 +152,7 @@ while (*p == '/') p++; - while (p = strchr (p, '/')) + while ((p = strchr (p, '/'))) { *p = '\0'; if (stat (npath, &sb) != 0) --- examples/loadables/necho.c +++ examples/loadables/necho.c 2006-09-25 13:39:26.000000000 +0200 @@ -3,9 +3,15 @@ /* Sample builtin to be dynamically loaded with enable -f and replace an existing builtin. */ +#ifdef HAVE_CONFIG_H +# include +#endif + #include -#include "builtins.h" #include "shell.h" +#include "builtins.h" +#include "builtins/builtext.h" +#include "builtins/common.h" necho_builtin (list) WORD_LIST *list; --- examples/loadables/pathchk.c +++ examples/loadables/pathchk.c 2006-09-25 13:53:13.000000000 +0200 @@ -40,8 +40,10 @@ #include #include -#include "builtins.h" #include "shell.h" +#include "builtins.h" +#include "builtins/builtext.h" +#include "builtins/common.h" #include "stdc.h" #include "bashgetopt.h" #include "maxpath.h" @@ -79,6 +81,7 @@ static int validate_path (); +int pathchk_builtin (list) WORD_LIST *list; { @@ -257,7 +260,7 @@ char *path; int portability; { - int path_max; + size_t path_max; int last_elem; /* Nonzero if checking last element of path. */ int exists; /* 2 if the path element exists. */ char *slash; @@ -269,10 +272,8 @@ 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 == '/' ? "/" : "."); @@ -349,7 +350,7 @@ 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 %zu", path, strlen (path), path_max); return 1; } --- examples/loadables/print.c +++ examples/loadables/print.c 2006-09-25 13:23:46.000000000 +0200 @@ -15,6 +15,8 @@ #include "bashansi.h" #include "shell.h" #include "builtins.h" +#include "builtins/common.h" +#include "builtins/builtext.h" #include "stdc.h" #include "bashgetopt.h" @@ -55,7 +57,7 @@ { 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/printenv.c +++ examples/loadables/printenv.c 2006-09-25 13:39:47.000000000 +0200 @@ -8,8 +8,10 @@ #include #include -#include "builtins.h" #include "shell.h" +#include "builtins.h" +#include "builtins/builtext.h" +#include "builtins/common.h" #include "bashgetopt.h" extern char **export_env; --- examples/loadables/push.c +++ examples/loadables/push.c 2006-09-25 13:39:53.000000000 +0200 @@ -7,8 +7,10 @@ #include #include -#include "builtins.h" #include "shell.h" +#include "builtins.h" +#include "builtins/builtext.h" +#include "builtins/common.h" #include "jobs.h" #include "bashgetopt.h" --- examples/loadables/realpath.c +++ examples/loadables/realpath.c 2006-09-25 14:03:01.000000000 +0200 @@ -31,8 +31,10 @@ #include #include -#include "builtins.h" #include "shell.h" +#include "builtins.h" +#include "builtins/builtext.h" +#include "builtins/common.h" #include "bashgetopt.h" #ifndef errno @@ -41,6 +43,7 @@ extern char *sh_realpath(); +int realpath_builtin(list) WORD_LIST *list; { @@ -67,14 +70,14 @@ vflag = 1; break; default: - usage(); + builtin_usage(); } } list = loptend; if (list == 0) - usage(); + builtin_usage(); for (es = EXECUTION_SUCCESS; list; list = list->next) { p = list->word->word; --- examples/loadables/rmdir.c +++ examples/loadables/rmdir.c 2006-09-25 13:56:28.000000000 +0200 @@ -6,13 +6,16 @@ #include #include -#include "builtins.h" #include "shell.h" +#include "builtins.h" +#include "builtins/builtext.h" +#include "builtins/common.h" #if !defined (errno) extern int errno; #endif +int rmdir_builtin (list) WORD_LIST *list; { --- examples/loadables/sleep.c +++ examples/loadables/sleep.c 2006-09-25 13:24:54.000000000 +0200 @@ -27,6 +27,8 @@ #include "shell.h" #include "builtins.h" +#include "builtins/common.h" +#include "builtins/builtext.h" #define RETURN(x) \ do { \ --- examples/loadables/strftime.c +++ examples/loadables/strftime.c 2006-09-25 13:40:17.000000000 +0200 @@ -13,8 +13,10 @@ #include -#include "builtins.h" #include "shell.h" +#include "builtins.h" +#include "builtins/builtext.h" +#include "builtins/common.h" #include "common.h" int --- examples/loadables/sync.c +++ examples/loadables/sync.c 2006-09-25 13:58:50.000000000 +0200 @@ -6,10 +6,13 @@ #include #endif -#include "builtins.h" #include "shell.h" +#include "builtins.h" +#include "builtins/builtext.h" +#include "builtins/common.h" #include "bashgetopt.h" +int sync_builtin (list) WORD_LIST *list; { --- examples/loadables/tee.c +++ examples/loadables/tee.c 2006-09-25 13:54:21.000000000 +0200 @@ -19,8 +19,10 @@ #include #include -#include "builtins.h" #include "shell.h" +#include "builtins.h" +#include "builtins/builtext.h" +#include "builtins/common.h" #include "bashgetopt.h" #if !defined (errno) @@ -41,6 +43,7 @@ extern char *strerror (); +int tee_builtin (list) WORD_LIST *list; { @@ -49,8 +52,6 @@ FLIST *fl; char *buf, *bp; - char *t; - reset_internal_getopt (); append = nointr = 0; tee_flist = (FLIST *)NULL; --- examples/loadables/template.c +++ examples/loadables/template.c 2006-09-25 13:40:33.000000000 +0200 @@ -11,8 +11,10 @@ #include #include -#include "builtins.h" #include "shell.h" +#include "builtins.h" +#include "builtins/builtext.h" +#include "builtins/common.h" #include "bashgetopt.h" #if !defined (errno) --- examples/loadables/truefalse.c +++ examples/loadables/truefalse.c 2006-09-25 13:40:42.000000000 +0200 @@ -1,16 +1,22 @@ /* true and false builtins */ +#ifdef HAVE_CONFIG_H +# include +#endif + #include "bashtypes.h" #include "shell.h" #include "builtins.h" +#include "builtins/builtext.h" +#include "builtins/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; --- examples/loadables/tty.c +++ examples/loadables/tty.c 2006-09-25 13:49:53.000000000 +0200 @@ -5,12 +5,15 @@ #include "config.h" #include -#include "builtins.h" #include "shell.h" +#include "builtins.h" +#include "builtins/builtext.h" +#include "builtins/common.h" #include "bashgetopt.h" extern char *ttyname (); +int tty_builtin (list) WORD_LIST *list; { --- examples/loadables/uname.c +++ examples/loadables/uname.c 2006-09-25 13:58:18.000000000 +0200 @@ -24,8 +24,10 @@ #include -#include "builtins.h" #include "shell.h" +#include "builtins.h" +#include "builtins/builtext.h" +#include "builtins/common.h" #include "bashgetopt.h" #define FLAG_SYSNAME 0x01 /* -s */ @@ -44,10 +46,11 @@ 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 2006-09-25 13:59:37.000000000 +0200 @@ -12,13 +12,16 @@ #include #include -#include "builtins.h" #include "shell.h" +#include "builtins.h" +#include "builtins/builtext.h" +#include "builtins/common.h" #ifndef errno extern int errno; #endif +int unlink_builtin (list) WORD_LIST *list; { --- examples/loadables/whoami.c +++ examples/loadables/whoami.c 2006-09-25 13:57:54.000000000 +0200 @@ -5,10 +5,13 @@ #include #include -#include "builtins.h" #include "shell.h" +#include "builtins.h" +#include "builtins/builtext.h" +#include "builtins/common.h" #include "bashgetopt.h" +int whoami_builtin (list) WORD_LIST *list; {