int parse_env_file(
const char *fname,
- const char *seperator, ...) {
+ const char *separator, ...) {
int r = 0;
char *contents, *p;
assert(fname);
- assert(seperator);
+ assert(separator);
if ((r = read_full_file(fname, &contents)) < 0)
return r;
for (;;) {
const char *key = NULL;
- p += strspn(p, seperator);
+ p += strspn(p, separator);
p += strspn(p, WHITESPACE);
if (!*p)
va_list ap;
char **value;
- va_start(ap, seperator);
+ va_start(ap, separator);
while ((key = va_arg(ap, char *))) {
size_t n;
char *v;
continue;
p += n + 1;
- n = strcspn(p, seperator);
+ n = strcspn(p, separator);
if (n >= 2 &&
strchr(QUOTES, p[0]) &&
}
if (!key)
- p += strcspn(p, seperator);
+ p += strcspn(p, separator);
}
fail:
}
+void freeze(void) {
+ for (;;)
+ pause();
+}
+
+bool null_or_empty(struct stat *st) {
+ assert(st);
+
+ if (S_ISREG(st->st_mode) && st->st_size <= 0)
+ return true;
+
+ /* /dev/null has major/minor of 1:3 */
+ if (S_ISCHR(st->st_mode) &&
+ major(st->st_rdev) == 1 &&
+ minor(st->st_rdev) == 3)
+ return true;
+
+ return false;
+}
+
static const char *const ioprio_class_table[] = {
[IOPRIO_CLASS_NONE] = "none",
[IOPRIO_CLASS_RT] = "realtime",