summaryrefslogtreecommitdiff
path: root/src/librc
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2008-05-12 23:00:05 +0000
committerRoy Marples <roy@marples.name>2008-05-12 23:00:05 +0000
commit6d5d655b5212672319780e7c25a4da955eebcf75 (patch)
tree93d749ce39c5d94e5f1e80bccd99c6a68dbea621 /src/librc
parent0f51f3e8632553e769766ab559dcc6de6cf5abc5 (diff)
downloadopenrc-6d5d655b5212672319780e7c25a4da955eebcf75.tar.gz
openrc-6d5d655b5212672319780e7c25a4da955eebcf75.tar.bz2
openrc-6d5d655b5212672319780e7c25a4da955eebcf75.tar.xz
Style.
Diffstat (limited to 'src/librc')
-rw-r--r--src/librc/librc-misc.c38
1 files changed, 19 insertions, 19 deletions
diff --git a/src/librc/librc-misc.c b/src/librc/librc-misc.c
index 4aef3c0..c9fa965 100644
--- a/src/librc/librc-misc.c
+++ b/src/librc/librc-misc.c
@@ -31,30 +31,30 @@
#include "librc.h"
-bool rc_yesno (const char *value)
+bool rc_yesno(const char *value)
{
- if (! value) {
+ if (!value) {
errno = ENOENT;
return false;
}
- if (strcasecmp (value, "yes") == 0 ||
- strcasecmp (value, "y") == 0 ||
- strcasecmp (value, "true") == 0 ||
- strcasecmp (value, "1") == 0)
+ if (strcasecmp(value, "yes") == 0 ||
+ strcasecmp(value, "y") == 0 ||
+ strcasecmp(value, "true") == 0 ||
+ strcasecmp(value, "1") == 0)
return true;
- if (strcasecmp (value, "no") != 0 &&
- strcasecmp (value, "n") != 0 &&
- strcasecmp (value, "false") != 0 &&
- strcasecmp (value, "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_yesno)
-ssize_t rc_getline (char **line, size_t *len, FILE *fp)
+ssize_t rc_getline(char **line, size_t *len, FILE *fp)
{
char *p;
size_t last = 0;
@@ -71,7 +71,7 @@ ssize_t rc_getline (char **line, size_t *len, FILE *fp)
memset(p, 0, BUFSIZ);
fgets(p, BUFSIZ, fp);
last += strlen(p);
- } while (! feof(fp) && (*line)[last - 1] != '\n');
+ } while (!feof(fp) && (*line)[last - 1] != '\n');
/* Trim the trailing newline */
if (**line && (*line)[last - 1] == '\n')
@@ -108,7 +108,7 @@ RC_STRINGLIST *rc_config_list(const char *file)
if (token[strlen(token) - 1] == '\n')
token[strlen(token) - 1] = 0;
- if (! list)
+ if (!list)
list = rc_stringlist_new();
rc_stringlist_add(list, token);
}
@@ -135,7 +135,7 @@ RC_STRINGLIST *rc_config_load(const char *file)
char *p;
list = rc_config_list(file);
- if (! list)
+ if (!list)
return NULL;
config = rc_stringlist_new();
@@ -157,15 +157,15 @@ RC_STRINGLIST *rc_config_load(const char *file)
/* Drop a newline if that's all we have */
if (token) {
- i = strlen (token) - 1;
+ i = strlen(token) - 1;
if (token[i] == '\n')
token[i] = 0;
- i = strlen (entry) + strlen (token) + 2;
+ i = strlen(entry) + strlen(token) + 2;
newline = xmalloc(sizeof(char) * i);
snprintf(newline, i, "%s=%s", entry, token);
} else {
- i = strlen (entry) + 2;
+ i = strlen(entry) + 2;
newline = xmalloc(sizeof(char) * i);
snprintf(newline, i, "%s=", entry);
}
@@ -176,7 +176,7 @@ RC_STRINGLIST *rc_config_load(const char *file)
TAILQ_FOREACH(cline, config, entries) {
p = strchr(cline->value, '=');
if (p && strncmp(entry, cline->value,
- (size_t) (p - cline->value)) == 0)
+ (size_t)(p - cline->value)) == 0)
{
/* We have a match now - to save time we directly replace it */
free(cline->value);
@@ -186,7 +186,7 @@ RC_STRINGLIST *rc_config_load(const char *file)
}
}
- if (! replaced) {
+ if (!replaced) {
rc_stringlist_add(config, newline);
free(newline);
}