From 1ed2fb40c919a25fe6920680cf898d0b4870c60e Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 18 Jun 2010 14:09:48 +0200 Subject: ash: cosmetics, no code changes Signed-off-by: Denys Vlasenko --- shell/ash.c | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) (limited to 'shell/ash.c') diff --git a/shell/ash.c b/shell/ash.c index 90680e8..fcaa7b1 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -46,6 +46,7 @@ #include #include #include +#include #include "shell_common.h" #include "math.h" @@ -7310,7 +7311,7 @@ shellexec(char **argv, const char *path, int idx) #endif clearredir(/*drop:*/ 1); - envp = listvars(VEXPORT, VUNSET, 0); + envp = listvars(VEXPORT, VUNSET, /*end:*/ NULL); if (strchr(argv[0], '/') != NULL #if ENABLE_FEATURE_SH_STANDALONE || (applet_no = find_applet_by_name(argv[0])) >= 0 @@ -12468,7 +12469,7 @@ unsetfunc(const char *name) struct tblentry *cmdp; cmdp = cmdlookup(name, 0); - if (cmdp!= NULL && cmdp->cmdtype == CMDFUNCTION) + if (cmdp != NULL && cmdp->cmdtype == CMDFUNCTION) delete_cmd_entry(); } @@ -12485,7 +12486,7 @@ unsetcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) int flag = 0; int ret = 0; - while ((i = nextopt("vf")) != '\0') { + while ((i = nextopt("vf")) != 0) { flag = i; } @@ -12502,11 +12503,6 @@ unsetcmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) return ret & 1; } - -/* setmode.c */ - -#include - static const unsigned char timescmd_str[] ALIGN1 = { ' ', offsetof(struct tms, tms_utime), '\n', offsetof(struct tms, tms_stime), @@ -12514,7 +12510,6 @@ static const unsigned char timescmd_str[] ALIGN1 = { '\n', offsetof(struct tms, tms_cstime), 0 }; - static int FAST_FUNC timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) { @@ -12533,14 +12528,15 @@ timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) s/60, s%60, ((t - s * clk_tck) * 1000) / clk_tck, p[0]); - } while (*(p += 2)); + p += 2; + } while (*p); return 0; } #if ENABLE_SH_MATH_SUPPORT /* - * The let builtin. partial stolen from GNU Bash, the Bourne Again SHell. + * The let builtin. Partially stolen from GNU Bash, the Bourne Again SHell. * Copyright (C) 1987, 1989, 1991 Free Software Foundation, Inc. * * Copyright (C) 2003 Vladimir Oleynik @@ -12559,18 +12555,6 @@ letcmd(int argc UNUSED_PARAM, char **argv) return !i; } -#endif /* SH_MATH_SUPPORT */ - - -/* ============ miscbltin.c - * - * Miscellaneous builtins. - */ - -#undef rflag - -#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 1 -typedef enum __rlimit_resource rlim_t; #endif /* -- cgit v1.1 From 7df28bbb8fa3ba2878c288401c898ec477e55df1 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 18 Jun 2010 14:23:47 +0200 Subject: ash: fix unset in standalone mode Signed-off-by: Denys Vlasenko --- shell/ash.c | 1 + 1 file changed, 1 insertion(+) (limited to 'shell/ash.c') diff --git a/shell/ash.c b/shell/ash.c index fcaa7b1..74fe861 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -7252,6 +7252,7 @@ tryexec(IF_FEATURE_SH_STANDALONE(int applet_no,) char *cmd, char **argv, char ** #if ENABLE_FEATURE_SH_STANDALONE if (applet_no >= 0) { if (APPLET_IS_NOEXEC(applet_no)) { + clearenv(); while (*envp) putenv(*envp++); run_applet_no_and_exit(applet_no, argv); -- cgit v1.1 From b87c17cd16f1b23a07a65ee90a3e30a49992fa51 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 18 Jun 2010 15:15:24 +0200 Subject: *: stop defining _GNU_SOURCE in source files, it's in CFLAGS anyway Signed-off-by: Denys Vlasenko --- shell/ash.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'shell/ash.c') diff --git a/shell/ash.c b/shell/ash.c index 74fe861..1717407 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -36,12 +36,6 @@ #define JOBS ENABLE_ASH_JOB_CONTROL -#if DEBUG -# ifndef _GNU_SOURCE -# define _GNU_SOURCE -# endif -#endif - #include "busybox.h" /* for applet_names */ #include #include -- cgit v1.1 From 8cd9f343e74ca65f36c42a44e845716ba5411663 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 18 Jun 2010 15:36:48 +0200 Subject: ash: times builtin: use unsigned type; take free-of-charge modulo Signed-off-by: Denys Vlasenko --- shell/ash.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'shell/ash.c') diff --git a/shell/ash.c b/shell/ash.c index 1717407..f581b5b 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -12508,7 +12508,7 @@ static const unsigned char timescmd_str[] ALIGN1 = { static int FAST_FUNC timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) { - long clk_tck, s, t; + unsigned long clk_tck, s, t; const unsigned char *p; struct tms buf; @@ -12519,9 +12519,10 @@ timescmd(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) do { t = *(clock_t *)(((char *) &buf) + p[1]); s = t / clk_tck; - out1fmt("%ldm%ld.%.3lds%c", - s/60, s%60, - ((t - s * clk_tck) * 1000) / clk_tck, + t = t % clk_tck; + out1fmt("%lum%lu.%03lus%c", + s / 60, s % 60, + (t * 1000) / clk_tck, p[0]); p += 2; } while (*p); -- cgit v1.1