X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=shell%2Fshell_common.c;h=98d862744432d25be36bceeac57e3de12a612a5f;hb=3df1410a00a7a57f3a43373c00cdea2031d7d70c;hp=51c92d60e98acd6a4f3d1631318e5bdccedf1bb8;hpb=7ce209b9d4f6053b7e6d07dec66e382bc3614c35;p=oweals%2Fbusybox.git diff --git a/shell/shell_common.c b/shell/shell_common.c index 51c92d60e..98d862744 100644 --- a/shell/shell_common.c +++ b/shell/shell_common.c @@ -18,8 +18,10 @@ */ #include "libbb.h" #include "shell_common.h" +#include /* getrlimit */ const char defifsvar[] ALIGN1 = "IFS= \t\n"; +const char defoptindvar[] ALIGN1 = "OPTIND=1"; int FAST_FUNC is_well_formed_var_name(const char *s, char terminator) @@ -36,7 +38,7 @@ int FAST_FUNC is_well_formed_var_name(const char *s, char terminator) /* read builtin */ -/* Needs to be interruptible: shell mush handle traps and shell-special signals +/* Needs to be interruptible: shell must handle traps and shell-special signals * while inside read. To implement this, be sure to not loop on EINTR * and return errno == EINTR reliably. */ @@ -169,7 +171,7 @@ shell_builtin_read(void FAST_FUNC (*setvar)(const char *name, const char *val), int timeout; if ((bufpos & 0xff) == 0) - buffer = xrealloc(buffer, bufpos + 0x100); + buffer = xrealloc(buffer, bufpos + 0x101); timeout = -1; if (end_ms) { @@ -327,7 +329,7 @@ enum { }; /* "-": treat args as parameters of option with ASCII code 1 */ -static const char ulimit_opt_string[] = "-HSa" +static const char ulimit_opt_string[] ALIGN1 = "-HSa" #ifdef RLIMIT_FSIZE "f::" #endif @@ -379,7 +381,7 @@ static void printlim(unsigned opts, const struct rlimit *limit, val = limit->rlim_cur; if (val == RLIM_INFINITY) - printf("unlimited\n"); + puts("unlimited"); else { val >>= l->factor_shift; printf("%llu\n", (long long) val); @@ -492,7 +494,6 @@ shell_builtin_ulimit(char **argv) /* bad option. getopt already complained. */ break; } - } /* while (there are options) */ return 0;