Ignore:
Timestamp:
Jan 1, 2014, 12:47:38 AM (6 years ago)
Author:
bruno
Message:
  • Update mindi-busybox to 1.21.1
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mindi-busybox/procps/sysctl.c

    r2725 r3232  
    1212 */
    1313
     14//usage:#define sysctl_trivial_usage
     15//usage:       "[OPTIONS] [KEY[=VALUE]]..."
     16//usage:#define sysctl_full_usage "\n\n"
     17//usage:       "Show/set kernel parameters\n"
     18//usage:     "\n    -e  Don't warn about unknown keys"
     19//usage:     "\n    -n  Don't show key names"
     20//usage:     "\n    -a  Show all values"
     21/* Same as -a, no need to show it */
     22/* //usage:     "\n -A  Show all values in table form" */
     23//usage:     "\n    -w  Set values"
     24//usage:     "\n    -p FILE Set values from FILE (default /etc/sysctl.conf)"
     25//usage:     "\n    -q      Set values silently"
     26//usage:
     27//usage:#define sysctl_example_usage
     28//usage:       "sysctl [-n] [-e] variable...\n"
     29//usage:       "sysctl [-n] [-e] [-q] -w variable=value...\n"
     30//usage:       "sysctl [-n] [-e] -a\n"
     31//usage:       "sysctl [-n] [-e] [-q] -p file   (default /etc/sysctl.conf)\n"
     32//usage:       "sysctl [-n] [-e] -A\n"
     33
    1434#include "libbb.h"
    1535
     
    2040    FLAG_SHOW_ALL        = 1 << 3,
    2141    FLAG_PRELOAD_FILE    = 1 << 4,
     42/* TODO: procps 3.2.8 seems to not require -w for KEY=VAL to work: */
    2243    FLAG_WRITE           = 1 << 5,
     44    FLAG_QUIET           = 1 << 6,
    2345};
    24 #define OPTION_STR "neAapw"
     46#define OPTION_STR "neAapwq"
    2547
    2648static void sysctl_dots_to_slashes(char *name)
     
    127149        xwrite_str(fd, value);
    128150        close(fd);
    129         if (option_mask32 & FLAG_SHOW_KEYS)
    130             printf("%s = ", outname);
    131         puts(value);
     151        if (!(option_mask32 & FLAG_QUIET)) {
     152            if (option_mask32 & FLAG_SHOW_KEYS)
     153                printf("%s = ", outname);
     154            puts(value);
     155        }
    132156    } else {
    133157        char c;
     
    182206            /* if path was ".", drop "./" prefix: */
    183207            retval |= sysctl_act_recursive((next[0] == '.' && next[1] == '/') ?
    184                         next + 2 : next);
     208                    next + 2 : next);
    185209            free(next);
    186210        }
     
    207231    /* Must do it _after_ config_open(): */
    208232    xchdir("/proc/sys");
    209     /* xchroot(".") - if you are paranoid */
     233    /* xchroot("/proc/sys") - if you are paranoid */
    210234
    211235//TODO: ';' is comment char too
     
    243267    }
    244268    xchdir("/proc/sys");
    245     /* xchroot(".") - if you are paranoid */
     269    /* xchroot("/proc/sys") - if you are paranoid */
    246270    if (opt & (FLAG_TABLE_FORMAT | FLAG_SHOW_ALL)) {
    247271        return sysctl_act_recursive(".");
Note: See TracChangeset for help on using the changeset viewer.