diff options
author | Roy Marples <roy@marples.name> | 2007-11-23 12:04:11 +0000 |
---|---|---|
committer | Roy Marples <roy@marples.name> | 2007-11-23 12:04:11 +0000 |
commit | d81def80b00a3dbcb4f8980f4503c4d659b48a2a (patch) | |
tree | 64a5df4281620cacbc1f03838d42e88167886fc9 /src/librc-misc.c | |
parent | f077f179edaeb746b267421baa29ec751c38b713 (diff) |
Move /etc/conf.d/rc to /etc/rc.conf.
Lowercase all configurable variables, non configurations remain uppercase.
Replace rc_env_bool with rc_yesno.
Split localmount info procfs (Linux) and dumpon, savecore (BSD)
Diffstat (limited to 'src/librc-misc.c')
-rw-r--r-- | src/librc-misc.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/src/librc-misc.c b/src/librc-misc.c index d63dc182..a8c9f33d 100644 --- a/src/librc-misc.c +++ b/src/librc-misc.c @@ -32,33 +32,28 @@ #include "librc.h" -bool rc_env_bool (const char *var) +bool rc_yesno (const char *value) { - char *v; - - if (! var) - return (false); - - if (! (v = getenv (var))) { - errno = ENOENT; + if (! value) { + errno = EINVAL; return (false); } - if (strcasecmp (v, "true") == 0 || - strcasecmp (v, "y") == 0 || - strcasecmp (v, "yes") == 0 || - strcasecmp (v, "1") == 0) + if (strcasecmp (value, "yes") == 0 || + strcasecmp (value, "y") == 0 || + strcasecmp (value, "true") == 0 || + strcasecmp (value, "1") == 0) return (true); - if (strcasecmp (v, "false") != 0 && - strcasecmp (v, "n") != 0 && - strcasecmp (v, "no") != 0 && - strcasecmp (v, "0") != 0) + if (strcasecmp (value, "no") != 0 && + strcasecmp (value, "n") != 0 && + strcasecmp (value, "false") != 0 && + strcasecmp (value, "0") != 0) errno = EINVAL; return (false); } -librc_hidden_def(rc_env_bool) +librc_hidden_def(rc_yesno) char *rc_strcatpaths (const char *path1, const char *paths, ...) { |