2010-02-18 12:17:29 +01:00
|
|
|
--- examples/loadables/basename.c
|
|
|
|
+++ examples/loadables/basename.c 2006-09-25 11:49:31.000000000 +0000
|
2014-10-22 14:53:54 +02:00
|
|
|
@@ -27,10 +27,13 @@
|
2006-12-15 18:03:59 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
-#include "builtins.h"
|
|
|
|
#include "shell.h"
|
2009-03-03 18:12:53 +01:00
|
|
|
#include "common.h"
|
2006-12-15 18:03:59 +01:00
|
|
|
+#include "builtins.h"
|
|
|
|
+#include "builtins/builtext.h"
|
|
|
|
+#include "builtins/common.h"
|
|
|
|
|
|
|
|
+int
|
|
|
|
basename_builtin (list)
|
|
|
|
WORD_LIST *list;
|
|
|
|
{
|
2010-02-18 12:17:29 +01:00
|
|
|
--- examples/loadables/cat.c
|
|
|
|
+++ examples/loadables/cat.c 2006-09-25 11:37:46.000000000 +0000
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -25,8 +25,10 @@
|
2006-12-15 18:03:59 +01:00
|
|
|
#include <fcntl.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
-#include "builtins.h"
|
|
|
|
#include "shell.h"
|
|
|
|
+#include "builtins.h"
|
|
|
|
+#include "builtins/builtext.h"
|
|
|
|
+#include "builtins/common.h"
|
|
|
|
|
|
|
|
#ifndef errno
|
|
|
|
extern int errno;
|
2010-02-18 12:17:29 +01:00
|
|
|
--- examples/loadables/dirname.c
|
|
|
|
+++ examples/loadables/dirname.c 2006-09-25 11:49:38.000000000 +0000
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -27,10 +27,13 @@
|
2006-12-15 18:03:59 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
-#include "builtins.h"
|
|
|
|
#include "shell.h"
|
2009-03-03 18:12:53 +01:00
|
|
|
#include "common.h"
|
2006-12-15 18:03:59 +01:00
|
|
|
+#include "builtins.h"
|
|
|
|
+#include "builtins/builtext.h"
|
|
|
|
+#include "builtins/common.h"
|
|
|
|
|
|
|
|
+int
|
|
|
|
dirname_builtin (list)
|
|
|
|
WORD_LIST *list;
|
|
|
|
{
|
2010-02-18 12:17:29 +01:00
|
|
|
--- examples/loadables/finfo.c
|
|
|
|
+++ examples/loadables/finfo.c 2006-09-25 11:48:52.000000000 +0000
|
2014-10-22 14:53:54 +02:00
|
|
|
@@ -38,6 +38,8 @@
|
2006-12-15 18:03:59 +01:00
|
|
|
#include "bashansi.h"
|
|
|
|
#include "shell.h"
|
|
|
|
#include "builtins.h"
|
|
|
|
+#include "builtins/builtext.h"
|
|
|
|
+#include "builtins/common.h"
|
|
|
|
#include "common.h"
|
|
|
|
|
|
|
|
#ifndef errno
|
2014-10-22 14:53:54 +02:00
|
|
|
@@ -99,7 +101,7 @@ int argc;
|
2006-12-15 18:03:59 +01:00
|
|
|
char **argv;
|
|
|
|
{
|
|
|
|
register int i;
|
|
|
|
- int mode, flags, opt;
|
|
|
|
+ int flags, opt;
|
|
|
|
|
|
|
|
sh_optind = 0; /* XXX */
|
|
|
|
prog = base_pathname(argv[0]);
|
2014-10-22 14:53:54 +02:00
|
|
|
@@ -192,7 +194,7 @@ int m;
|
2006-12-15 18:03:59 +01:00
|
|
|
return (m & (S_IRWXU|S_IRWXG|S_IRWXO|S_ISUID|S_ISGID));
|
|
|
|
}
|
|
|
|
|
|
|
|
-static int
|
|
|
|
+static void
|
|
|
|
perms(m)
|
|
|
|
int m;
|
|
|
|
{
|
2014-10-22 14:53:54 +02:00
|
|
|
@@ -236,7 +238,7 @@ int m;
|
2006-12-15 18:03:59 +01:00
|
|
|
printf ("u=%s,g=%s,o=%s", ubits, gbits, obits);
|
|
|
|
}
|
|
|
|
|
|
|
|
-static int
|
|
|
|
+static void
|
|
|
|
printmode(mode)
|
|
|
|
int mode;
|
|
|
|
{
|
2014-10-22 14:53:54 +02:00
|
|
|
@@ -331,13 +333,13 @@ int flags;
|
2006-12-15 18:03:59 +01:00
|
|
|
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);
|
2014-10-22 14:53:54 +02:00
|
|
|
@@ -387,7 +389,6 @@ finfo_builtin(list)
|
2006-12-15 18:03:59 +01:00
|
|
|
{
|
|
|
|
int c, r;
|
|
|
|
char **v;
|
|
|
|
- WORD_LIST *l;
|
|
|
|
|
|
|
|
v = make_builtin_argv (list, &c);
|
|
|
|
r = finfo_main (c, v);
|
2010-02-18 12:17:29 +01:00
|
|
|
--- examples/loadables/head.c
|
|
|
|
+++ examples/loadables/head.c 2006-09-25 11:55:24.000000000 +0000
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -38,6 +38,8 @@
|
2006-12-15 18:03:59 +01:00
|
|
|
|
|
|
|
#include "builtins.h"
|
|
|
|
#include "shell.h"
|
|
|
|
+#include "builtins/builtext.h"
|
|
|
|
+#include "builtins/common.h"
|
|
|
|
#include "bashgetopt.h"
|
2009-03-03 18:12:53 +01:00
|
|
|
#include "common.h"
|
2006-12-15 18:03:59 +01:00
|
|
|
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -88,8 +90,10 @@ file_head (fp, cnt)
|
2006-12-15 18:03:59 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
+ return EXECUTION_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
+int
|
|
|
|
head_builtin (list)
|
|
|
|
WORD_LIST *list;
|
|
|
|
{
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -97,8 +101,6 @@ head_builtin (list)
|
2006-12-15 18:03:59 +01:00
|
|
|
WORD_LIST *l;
|
|
|
|
FILE *fp;
|
|
|
|
|
|
|
|
- char *t;
|
|
|
|
-
|
|
|
|
munge_list (list); /* change -num into -n num */
|
|
|
|
|
|
|
|
reset_internal_getopt ();
|
2010-02-18 12:17:29 +01:00
|
|
|
--- examples/loadables/hello.c
|
|
|
|
+++ examples/loadables/hello.c 2006-09-25 11:38:25.000000000 +0000
|
2014-10-22 14:53:54 +02:00
|
|
|
@@ -29,8 +29,10 @@
|
2006-12-15 18:03:59 +01:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
-#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.
|
2010-02-18 12:17:29 +01:00
|
|
|
--- examples/loadables/id.c
|
|
|
|
+++ examples/loadables/id.c 2006-09-25 11:57:41.000000000 +0000
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -47,6 +47,8 @@ extern struct group *getgrgid ();
|
2006-12-15 18:03:59 +01:00
|
|
|
|
|
|
|
#include "shell.h"
|
|
|
|
#include "builtins.h"
|
|
|
|
+#include "builtins/builtext.h"
|
|
|
|
+#include "builtins/common.h"
|
|
|
|
#include "stdc.h"
|
|
|
|
#include "common.h"
|
|
|
|
#include "bashgetopt.h"
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -64,8 +66,6 @@ static int id_flags;
|
2006-12-15 18:03:59 +01:00
|
|
|
static uid_t ruid, euid;
|
|
|
|
static gid_t rgid, egid;
|
|
|
|
|
|
|
|
-static char *id_user;
|
|
|
|
-
|
|
|
|
static int inituser ();
|
|
|
|
|
|
|
|
static int id_pruser ();
|
2010-02-18 12:17:29 +01:00
|
|
|
--- examples/loadables/ln.c
|
|
|
|
+++ examples/loadables/ln.c 2006-09-25 11:59:09.000000000 +0000
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -33,8 +33,10 @@
|
2006-12-15 18:03:59 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
-#include "builtins.h"
|
|
|
|
#include "shell.h"
|
|
|
|
+#include "builtins.h"
|
|
|
|
+#include "builtins/builtext.h"
|
|
|
|
+#include "builtins/common.h"
|
|
|
|
#include "bashgetopt.h"
|
2009-03-03 18:12:53 +01:00
|
|
|
#include "common.h"
|
2006-12-15 18:03:59 +01:00
|
|
|
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -50,6 +52,7 @@ typedef int unix_link_syscall_t __P((con
|
2006-12-15 18:03:59 +01:00
|
|
|
static unix_link_syscall_t *linkfn;
|
|
|
|
static int dolink ();
|
|
|
|
|
|
|
|
+int
|
|
|
|
ln_builtin (list)
|
|
|
|
WORD_LIST *list;
|
|
|
|
{
|
2010-02-18 12:17:29 +01:00
|
|
|
--- examples/loadables/logname.c
|
|
|
|
+++ examples/loadables/logname.c 2006-09-25 11:30:40.000000000 +0000
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -27,8 +27,10 @@
|
2006-12-15 18:03:59 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
-#include "builtins.h"
|
|
|
|
#include "shell.h"
|
|
|
|
+#include "builtins.h"
|
|
|
|
+#include "builtins/common.h"
|
|
|
|
+#include "builtins/builtext.h"
|
2009-03-03 18:12:53 +01:00
|
|
|
#include "common.h"
|
2006-12-15 18:03:59 +01:00
|
|
|
|
|
|
|
#if !defined (errno)
|
2010-02-18 12:17:29 +01:00
|
|
|
--- examples/loadables/mkdir.c
|
|
|
|
+++ examples/loadables/mkdir.c 2006-09-25 11:56:07.000000000 +0000
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -31,8 +31,10 @@
|
2006-12-15 18:03:59 +01:00
|
|
|
# include <unistd.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
-#include "builtins.h"
|
|
|
|
#include "shell.h"
|
|
|
|
+#include "builtins.h"
|
|
|
|
+#include "builtins/builtext.h"
|
|
|
|
+#include "builtins/common.h"
|
|
|
|
#include "bashgetopt.h"
|
2009-03-03 18:12:53 +01:00
|
|
|
#include "common.h"
|
2006-12-15 18:03:59 +01:00
|
|
|
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -52,7 +54,7 @@ int
|
2006-12-15 18:03:59 +01:00
|
|
|
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;
|
|
|
|
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -169,7 +171,7 @@ make_path (path, nmode, parent_mode)
|
2006-12-15 18:03:59 +01:00
|
|
|
while (*p == '/')
|
|
|
|
p++;
|
|
|
|
|
|
|
|
- while (p = strchr (p, '/'))
|
|
|
|
+ while ((p = strchr (p, '/')))
|
|
|
|
{
|
|
|
|
*p = '\0';
|
|
|
|
if (stat (npath, &sb) != 0)
|
2010-02-18 12:17:29 +01:00
|
|
|
--- examples/loadables/necho.c
|
|
|
|
+++ examples/loadables/necho.c 2006-09-25 11:39:26.000000000 +0000
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -21,9 +21,15 @@
|
|
|
|
along with Bash. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2006-12-15 18:03:59 +01:00
|
|
|
|
|
|
|
+#ifdef HAVE_CONFIG_H
|
|
|
|
+# include <config.h>
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
#include <stdio.h>
|
|
|
|
-#include "builtins.h"
|
|
|
|
#include "shell.h"
|
|
|
|
+#include "builtins.h"
|
|
|
|
+#include "builtins/builtext.h"
|
|
|
|
+#include "builtins/common.h"
|
|
|
|
|
|
|
|
necho_builtin (list)
|
|
|
|
WORD_LIST *list;
|
2010-02-18 12:17:29 +01:00
|
|
|
--- examples/loadables/pathchk.c
|
|
|
|
+++ examples/loadables/pathchk.c 2006-09-25 11:53:13.000000000 +0000
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -58,8 +58,10 @@
|
2006-12-15 18:03:59 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
-#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"
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -98,6 +100,7 @@ extern char *strerror ();
|
2006-12-15 18:03:59 +01:00
|
|
|
|
|
|
|
static int validate_path ();
|
|
|
|
|
|
|
|
+int
|
|
|
|
pathchk_builtin (list)
|
|
|
|
WORD_LIST *list;
|
|
|
|
{
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -278,7 +281,7 @@ validate_path (path, portability)
|
2006-12-15 18:03:59 +01:00
|
|
|
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;
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -290,10 +293,8 @@ validate_path (path, portability)
|
2006-12-15 18:03:59 +01:00
|
|
|
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 == '/' ? "/" : ".");
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -370,7 +371,7 @@ validate_path (path, portability)
|
2006-12-15 18:03:59 +01:00
|
|
|
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;
|
|
|
|
}
|
2010-02-18 12:17:29 +01:00
|
|
|
--- examples/loadables/print.c
|
|
|
|
+++ examples/loadables/print.c 2006-09-25 11:23:46.000000000 +0000
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -33,6 +33,8 @@
|
2006-12-15 18:03:59 +01:00
|
|
|
#include "bashansi.h"
|
|
|
|
#include "shell.h"
|
|
|
|
#include "builtins.h"
|
|
|
|
+#include "builtins/common.h"
|
|
|
|
+#include "builtins/builtext.h"
|
|
|
|
#include "stdc.h"
|
|
|
|
#include "bashgetopt.h"
|
2009-03-03 18:12:53 +01:00
|
|
|
#include "builtext.h"
|
|
|
|
@@ -77,7 +79,7 @@ print_builtin (list)
|
2006-12-15 18:03:59 +01:00
|
|
|
{
|
|
|
|
int c, r, nflag, raw, ofd, sflag;
|
|
|
|
intmax_t lfd;
|
|
|
|
- char **v, *pfmt, *arg;
|
|
|
|
+ char *pfmt;
|
|
|
|
WORD_LIST *l;
|
|
|
|
|
|
|
|
nflag = raw = sflag = 0;
|
2010-02-18 12:17:29 +01:00
|
|
|
--- examples/loadables/printenv.c
|
|
|
|
+++ examples/loadables/printenv.c 2006-09-25 11:39:47.000000000 +0000
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -26,8 +26,10 @@
|
2006-12-15 18:03:59 +01:00
|
|
|
#include <config.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
-#include "builtins.h"
|
|
|
|
#include "shell.h"
|
|
|
|
+#include "builtins.h"
|
|
|
|
+#include "builtins/builtext.h"
|
|
|
|
+#include "builtins/common.h"
|
|
|
|
#include "bashgetopt.h"
|
2009-03-03 18:12:53 +01:00
|
|
|
#include "common.h"
|
2006-12-15 18:03:59 +01:00
|
|
|
|
2010-02-18 12:17:29 +01:00
|
|
|
--- examples/loadables/push.c
|
|
|
|
+++ examples/loadables/push.c 2006-09-25 11:39:53.000000000 +0000
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -25,8 +25,10 @@
|
2006-12-15 18:03:59 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
-#include "builtins.h"
|
|
|
|
#include "shell.h"
|
|
|
|
+#include "builtins.h"
|
|
|
|
+#include "builtins/builtext.h"
|
|
|
|
+#include "builtins/common.h"
|
|
|
|
#include "jobs.h"
|
|
|
|
#include "bashgetopt.h"
|
2009-03-03 18:12:53 +01:00
|
|
|
#include "common.h"
|
2010-02-18 12:17:29 +01:00
|
|
|
--- examples/loadables/realpath.c
|
|
|
|
+++ examples/loadables/realpath.c 2006-09-25 12:03:01.000000000 +0000
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -49,8 +49,10 @@
|
2006-12-15 18:03:59 +01:00
|
|
|
#include <maxpath.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
-#include "builtins.h"
|
|
|
|
#include "shell.h"
|
|
|
|
+#include "builtins.h"
|
|
|
|
+#include "builtins/builtext.h"
|
|
|
|
+#include "builtins/common.h"
|
|
|
|
#include "bashgetopt.h"
|
2009-03-03 18:12:53 +01:00
|
|
|
#include "common.h"
|
2006-12-15 18:03:59 +01:00
|
|
|
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -60,6 +62,7 @@ extern int errno;
|
2006-12-15 18:03:59 +01:00
|
|
|
|
|
|
|
extern char *sh_realpath();
|
|
|
|
|
|
|
|
+int
|
|
|
|
realpath_builtin(list)
|
|
|
|
WORD_LIST *list;
|
|
|
|
{
|
2010-02-18 12:17:29 +01:00
|
|
|
--- examples/loadables/rmdir.c
|
|
|
|
+++ examples/loadables/rmdir.c 2006-09-25 11:56:28.000000000 +0000
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -24,14 +24,17 @@
|
2006-12-15 18:03:59 +01:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <errno.h>
|
|
|
|
-#include "builtins.h"
|
|
|
|
#include "shell.h"
|
|
|
|
+#include "builtins.h"
|
|
|
|
+#include "builtins/builtext.h"
|
|
|
|
+#include "builtins/common.h"
|
2009-03-03 18:12:53 +01:00
|
|
|
#include "common.h"
|
2006-12-15 18:03:59 +01:00
|
|
|
|
|
|
|
#if !defined (errno)
|
|
|
|
extern int errno;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+int
|
|
|
|
rmdir_builtin (list)
|
|
|
|
WORD_LIST *list;
|
|
|
|
{
|
2010-02-18 12:17:29 +01:00
|
|
|
--- examples/loadables/sleep.c
|
|
|
|
+++ examples/loadables/sleep.c 2006-09-25 11:24:54.000000000 +0000
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -46,6 +46,8 @@
|
2006-12-15 18:03:59 +01:00
|
|
|
|
|
|
|
#include "shell.h"
|
|
|
|
#include "builtins.h"
|
|
|
|
+#include "builtins/builtext.h"
|
2009-03-03 18:12:53 +01:00
|
|
|
+#include "builtins/common.h"
|
|
|
|
#include "common.h"
|
2006-12-15 18:03:59 +01:00
|
|
|
|
|
|
|
#define RETURN(x) \
|
2010-02-18 12:17:29 +01:00
|
|
|
--- examples/loadables/strftime.c
|
|
|
|
+++ examples/loadables/strftime.c 2006-09-25 11:40:17.000000000 +0000
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -31,8 +31,10 @@
|
2006-12-15 18:03:59 +01:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
-#include "builtins.h"
|
|
|
|
#include "shell.h"
|
|
|
|
+#include "builtins.h"
|
|
|
|
+#include "builtins/builtext.h"
|
|
|
|
+#include "builtins/common.h"
|
|
|
|
#include "common.h"
|
|
|
|
|
|
|
|
int
|
2010-02-18 12:17:29 +01:00
|
|
|
--- examples/loadables/sync.c
|
|
|
|
+++ examples/loadables/sync.c 2006-09-25 11:58:50.000000000 +0000
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -24,10 +24,13 @@
|
2006-12-15 18:03:59 +01:00
|
|
|
#include <unistd.h>
|
|
|
|
#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;
|
|
|
|
{
|
2010-02-18 12:17:29 +01:00
|
|
|
--- examples/loadables/tee.c
|
|
|
|
+++ examples/loadables/tee.c 2006-09-25 11:54:21.000000000 +0000
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -38,8 +38,10 @@
|
|
|
|
#include <signal.h>
|
2006-12-15 18:03:59 +01:00
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
-#include "builtins.h"
|
|
|
|
#include "shell.h"
|
|
|
|
+#include "builtins.h"
|
|
|
|
+#include "builtins/builtext.h"
|
|
|
|
+#include "builtins/common.h"
|
|
|
|
#include "bashgetopt.h"
|
2009-03-03 18:12:53 +01:00
|
|
|
#include "common.h"
|
2006-12-15 18:03:59 +01:00
|
|
|
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -61,6 +63,7 @@ extern volatile sig_atomic_t interrupt_i
|
2006-12-15 18:03:59 +01:00
|
|
|
|
|
|
|
extern char *strerror ();
|
|
|
|
|
|
|
|
+int
|
|
|
|
tee_builtin (list)
|
|
|
|
WORD_LIST *list;
|
|
|
|
{
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -69,8 +72,6 @@ tee_builtin (list)
|
2006-12-15 18:03:59 +01:00
|
|
|
FLIST *fl;
|
|
|
|
char *buf, *bp;
|
|
|
|
|
|
|
|
- char *t;
|
|
|
|
-
|
|
|
|
reset_internal_getopt ();
|
|
|
|
append = nointr = 0;
|
|
|
|
tee_flist = (FLIST *)NULL;
|
2010-02-18 12:17:29 +01:00
|
|
|
--- examples/loadables/template.c
|
|
|
|
+++ examples/loadables/template.c 2006-09-25 11:40:33.000000000 +0000
|
2006-12-15 18:03:59 +01:00
|
|
|
@@ -11,8 +11,10 @@
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
-#include "builtins.h"
|
|
|
|
#include "shell.h"
|
|
|
|
+#include "builtins.h"
|
|
|
|
+#include "builtins/builtext.h"
|
|
|
|
+#include "builtins/common.h"
|
|
|
|
#include "bashgetopt.h"
|
|
|
|
|
|
|
|
#if !defined (errno)
|
2010-02-18 12:17:29 +01:00
|
|
|
--- examples/loadables/truefalse.c
|
|
|
|
+++ examples/loadables/truefalse.c 2006-09-25 11:40:42.000000000 +0000
|
2014-10-22 14:53:54 +02:00
|
|
|
@@ -20,31 +20,37 @@
|
2009-03-03 18:12:53 +01:00
|
|
|
|
|
|
|
#include <config.h>
|
2006-12-15 18:03:59 +01:00
|
|
|
|
|
|
|
+#ifdef HAVE_CONFIG_H
|
|
|
|
+# include <config.h>
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
#include "bashtypes.h"
|
|
|
|
#include "shell.h"
|
|
|
|
#include "builtins.h"
|
|
|
|
+#include "builtins/builtext.h"
|
|
|
|
+#include "builtins/common.h"
|
2009-03-03 18:12:53 +01:00
|
|
|
#include "common.h"
|
2006-12-15 18:03:59 +01:00
|
|
|
|
|
|
|
-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;
|
2014-10-22 14:53:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
-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.",
|
2010-02-18 12:17:29 +01:00
|
|
|
--- examples/loadables/tty.c
|
|
|
|
+++ examples/loadables/tty.c 2006-09-25 11:49:53.000000000 +0000
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -23,13 +23,16 @@
|
2006-12-15 18:03:59 +01:00
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
-#include "builtins.h"
|
|
|
|
#include "shell.h"
|
|
|
|
+#include "builtins.h"
|
|
|
|
+#include "builtins/builtext.h"
|
|
|
|
+#include "builtins/common.h"
|
|
|
|
#include "bashgetopt.h"
|
2009-03-03 18:12:53 +01:00
|
|
|
#include "common.h"
|
2006-12-15 18:03:59 +01:00
|
|
|
|
|
|
|
extern char *ttyname ();
|
|
|
|
|
|
|
|
+int
|
|
|
|
tty_builtin (list)
|
|
|
|
WORD_LIST *list;
|
|
|
|
{
|
2010-02-18 12:17:29 +01:00
|
|
|
--- examples/loadables/uname.c
|
|
|
|
+++ examples/loadables/uname.c 2006-09-25 11:58:18.000000000 +0000
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -42,8 +42,10 @@ struct utsname {
|
2006-12-15 18:03:59 +01:00
|
|
|
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
-#include "builtins.h"
|
|
|
|
#include "shell.h"
|
|
|
|
+#include "builtins.h"
|
|
|
|
+#include "builtins/builtext.h"
|
|
|
|
+#include "builtins/common.h"
|
|
|
|
#include "bashgetopt.h"
|
2009-03-03 18:12:53 +01:00
|
|
|
#include "common.h"
|
2006-12-15 18:03:59 +01:00
|
|
|
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -63,10 +65,11 @@ static void uprint();
|
2006-12-15 18:03:59 +01:00
|
|
|
|
|
|
|
static int uname_flags;
|
|
|
|
|
|
|
|
+int
|
|
|
|
uname_builtin (list)
|
|
|
|
WORD_LIST *list;
|
|
|
|
{
|
|
|
|
- int opt, r;
|
|
|
|
+ int opt;
|
|
|
|
struct utsname uninfo;
|
|
|
|
|
|
|
|
uname_flags = 0;
|
2010-02-18 12:17:29 +01:00
|
|
|
--- examples/loadables/unlink.c
|
|
|
|
+++ examples/loadables/unlink.c 2006-09-25 11:59:37.000000000 +0000
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -30,14 +30,17 @@
|
2006-12-15 18:03:59 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
-#include "builtins.h"
|
|
|
|
#include "shell.h"
|
|
|
|
+#include "builtins.h"
|
|
|
|
+#include "builtins/builtext.h"
|
|
|
|
+#include "builtins/common.h"
|
2009-03-03 18:12:53 +01:00
|
|
|
#include "common.h"
|
2006-12-15 18:03:59 +01:00
|
|
|
|
|
|
|
#ifndef errno
|
|
|
|
extern int errno;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+int
|
|
|
|
unlink_builtin (list)
|
|
|
|
WORD_LIST *list;
|
|
|
|
{
|
2010-02-18 12:17:29 +01:00
|
|
|
--- examples/loadables/whoami.c
|
|
|
|
+++ examples/loadables/whoami.c 2006-09-25 11:57:54.000000000 +0000
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -23,11 +23,14 @@
|
2006-12-15 18:03:59 +01:00
|
|
|
#include <config.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
-#include "builtins.h"
|
|
|
|
#include "shell.h"
|
|
|
|
+#include "builtins.h"
|
|
|
|
+#include "builtins/builtext.h"
|
|
|
|
+#include "builtins/common.h"
|
|
|
|
#include "bashgetopt.h"
|
2009-03-03 18:12:53 +01:00
|
|
|
#include "common.h"
|
2006-12-15 18:03:59 +01:00
|
|
|
|
|
|
|
+int
|
|
|
|
whoami_builtin (list)
|
|
|
|
WORD_LIST *list;
|
|
|
|
{
|
2010-02-18 12:17:29 +01:00
|
|
|
--- shell.h
|
|
|
|
+++ shell.h 2009-08-26 11:13:08.000000000 +0000
|
2009-03-03 18:12:53 +01:00
|
|
|
@@ -22,6 +22,9 @@
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+#include <sys/types.h>
|
|
|
|
+#include <unistd.h>
|
|
|
|
+
|
|
|
|
#include "bashjmp.h"
|
|
|
|
|
|
|
|
#include "command.h"
|