svn commit: trunk/busybox/shell
vda at busybox.net
vda at busybox.net
Wed May 2 15:34:50 UTC 2007
Author: vda
Date: 2007-05-02 08:34:47 -0700 (Wed, 02 May 2007)
New Revision: 18538
Log:
hush: fix incorrect exitcodes without job control
Modified:
trunk/busybox/shell/hush.c
Changeset:
Modified: trunk/busybox/shell/hush.c
===================================================================
--- trunk/busybox/shell/hush.c 2007-05-02 08:10:22 UTC (rev 18537)
+++ trunk/busybox/shell/hush.c 2007-05-02 15:34:47 UTC (rev 18538)
@@ -110,8 +110,8 @@
* output pretty */
static const struct {
int mode;
- int default_fd;
- const char *descrip;
+ signed char default_fd;
+ char descrip[3];
} redir_table[] = {
{ 0, 0, "()" },
{ O_RDONLY, 0, "<" },
@@ -255,7 +255,8 @@
static const char *PS2;
#endif
-static struct variables shell_ver = { NULL, "HUSH_VERSION", "0.01", 1, 1 };
+#define HUSH_VER_STR "0.02"
+static struct variables shell_ver = { NULL, "HUSH_VERSION", HUSH_VER_STR, 1, 1 };
static struct variables *top_vars = &shell_ver;
#define B_CHUNK 100
@@ -296,12 +297,6 @@
int (*function) (char **argv); /* function ptr */
};
-/* belongs in busybox.h */
-static int max(int a, int b)
-{
- return (a > b) ? a : b;
-}
-
#ifdef DEBUG_SHELL
#define debug_printf(...) fprintf(stderr, __VA_ARGS__)
/* broken, of course, but OK for testing */
@@ -590,14 +585,14 @@
sigexit(- (exitcode & 0xff));
}
-#else /* !INTERACTIVE */
+#else /* !JOB */
#define set_fatal_sighandler(handler) ((void)0)
#define set_jobctrl_sighandler(handler) ((void)0)
#define set_misc_sighandler(handler) ((void)0)
-#define hush_exit(e) exit(-(e))
+#define hush_exit(e) exit(e)
-#endif /* INTERACTIVE */
+#endif /* JOB */
static const char *set_cwd(void)
@@ -957,7 +952,7 @@
if (o->length + len > o->maxlen) {
char *old_data = o->data;
/* assert(data == NULL || o->maxlen != 0); */
- o->maxlen += max(2*len, B_CHUNK);
+ o->maxlen += (2*len > B_CHUNK ? 2*len : B_CHUNK);
o->data = realloc(o->data, 1 + o->maxlen);
if (o->data == NULL) {
free(old_data);
@@ -3299,7 +3294,7 @@
hush_exit(xfunc_error_retval);
}
#if !ENABLE_FEATURE_SH_EXTRA_QUIET
- printf("\n\n%s hush - the humble shell v0.02\n", BB_BANNER);
+ printf("\n\n%s hush - the humble shell v"HUSH_VER_STR"\n", BB_BANNER);
printf("Enter 'help' for a list of built-in commands.\n\n");
#endif
}
More information about the busybox-cvs
mailing list