*
* Copyright 1999 George Staikos
*
- * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
+ * Licensed under GPLv2 or later, see file LICENSE in this source tree.
*
* Changelog:
* v1.01 - added -p <preload> to preload values from a file
* v1.01.1 - busybox applet aware by <solar@gentoo.org>
*/
+//usage:#define sysctl_trivial_usage
+//usage: "[OPTIONS] [VALUE]..."
+//usage:#define sysctl_full_usage "\n\n"
+//usage: "Configure kernel parameters at runtime\n"
+//usage: "\n -n Don't print key names"
+//usage: "\n -e Don't warn about unknown keys"
+//usage: "\n -w Change sysctl setting"
+//usage: "\n -p FILE Load sysctl settings from FILE (default /etc/sysctl.conf)"
+//usage: "\n -a Display all values"
+//usage: "\n -A Display all values in table form"
+//usage:
+//usage:#define sysctl_example_usage
+//usage: "sysctl [-n] [-e] variable...\n"
+//usage: "sysctl [-n] [-e] -w variable=value...\n"
+//usage: "sysctl [-n] [-e] -a\n"
+//usage: "sysctl [-n] [-e] -p file (default /etc/sysctl.conf)\n"
+//usage: "sysctl [-n] [-e] -A\n"
+
#include "libbb.h"
enum {
*cptr = '\0';
//bb_error_msg("trying:'%s'", name);
if (access(name, F_OK) == 0) {
- if (cptr != end) /* prevent trailing '/' */
- *cptr = '/';
+ *cptr = '/';
//bb_error_msg("replaced:'%s'", name);
last_good = cptr;
goto again;
retval = EXIT_FAILURE;
goto end;
}
- value = cptr + 1; /* point to the value in name=value */
+ value = cptr + 1; /* point to the value in name=value */
if (setting == cptr || !*value) {
bb_error_msg("error: malformed setting '%s'", outname);
retval = EXIT_FAILURE;
//TODO: comment may be only at line start. "var=1 #abc" - "1 #abc" is the value
// (but _whitespace_ from ends should be trimmed first (and we do it right))
//TODO: "var==1" is mishandled (must use "=1" as a value, but uses "1")
+// can it be fixed by removing PARSE_COLLAPSE bit?
while (config_read(parser, token, 2, 2, "# \t=", PARSE_NORMAL)) {
char *tp;
sysctl_dots_to_slashes(token[0]);