traceroute: fix help text to not show -6 when traceroute6 is off
[oweals/busybox.git] / editors / awk.c
index d15dbb3e5dedc8a6e659fd8373cdf82065366561..ce6c9b726d80c4cefb74d48dc4e79ecbe69a442f 100644 (file)
@@ -765,11 +765,9 @@ static var *setvar_u(var *v, const char *value)
 /* set array element to user string */
 static void setari_u(var *a, int idx, const char *s)
 {
-       char sidx[sizeof(int)*3 + 1];
        var *v;
 
-       sprintf(sidx, "%d", idx);
-       v = findvar(iamarray(a), sidx);
+       v = findvar(iamarray(a), itoa(idx));
        setvar_u(v, s);
 }
 
@@ -2033,7 +2031,6 @@ static NOINLINE var *exec_builtin(node *op, var *res)
 {
 #define tspl (G.exec_builtin__tspl)
 
-       int (*to_xxx)(int);
        var *tv;
        node *an[4];
        var *av[4];
@@ -2063,7 +2060,8 @@ static NOINLINE var *exec_builtin(node *op, var *res)
        if ((uint32_t)nargs < (info >> 30))
                syntax_error(EMSG_TOO_FEW_ARGS);
 
-       switch (info & OPNMASK) {
+       info &= OPNMASK;
+       switch (info) {
 
        case B_a2:
 #if ENABLE_FEATURE_AWK_LIBM
@@ -2128,15 +2126,12 @@ static NOINLINE var *exec_builtin(node *op, var *res)
                break;
 
        case B_lo:
-               to_xxx = tolower;
-               goto lo_cont;
-
        case B_up:
-               to_xxx = toupper;
- lo_cont:
                s1 = s = xstrdup(as[0]);
                while (*s1) {
-                       *s1 = (*to_xxx)(*s1);
+                       //*s1 = (info == B_up) ? toupper(*s1) : tolower(*s1);
+                       if ((unsigned char)((*s1 | 0x20) - 'a') <= ('z' - 'a'))
+                               *s1 = (info == B_up) ? (*s1 & 0xdf) : (*s1 | 0x20);
                        s1++;
                }
                setvar_p(res, s);
@@ -2557,7 +2552,7 @@ static var *evaluate(node *op, var *res)
                                break;
 
                        case F_sy:
-                               fflush(NULL);
+                               fflush_all();
                                R.d = (ENABLE_FEATURE_ALLOW_EXEC && L.s && *L.s)
                                                ? (system(L.s) >> 8) : 0;
                                break;
@@ -2570,7 +2565,7 @@ static var *evaluate(node *op, var *res)
                                                X.rsm = newfile(L.s);
                                                fflush(X.rsm->F);
                                        } else {
-                                               fflush(NULL);
+                                               fflush_all();
                                        }
                                }
                                break;