if (!ansi_color)
const_color = "0;33"; /* Orange/Brown for Ubuntu */
-#elif defined(TARGET_ARCH)
-
- if (!pretty_name)
- const_pretty = "Arch Linux";
-
- if (!ansi_color)
- const_color = "1;36"; /* Cyan for Arch */
#endif
if (!pretty_name && !const_pretty)
return strdup(s);
}
+char *normalize_env_assignment(const char *s) {
+ char *name, *value, *p, *r;
+
+ p = strchr(s, '=');
+
+ if (!p) {
+ if (!(r = strdup(s)))
+ return NULL;
+
+ return strstrip(r);
+ }
+
+ if (!(name = strndup(s, p - s)))
+ return NULL;
+
+ if (!(p = strdup(p+1))) {
+ free(name);
+ return NULL;
+ }
+
+ value = unquote(strstrip(p), QUOTES);
+ free(p);
+
+ if (!value) {
+ free(p);
+ free(name);
+ return NULL;
+ }
+
+ if (asprintf(&r, "%s=%s", name, value) < 0)
+ r = NULL;
+
+ free(value);
+ free(name);
+
+ return r;
+}
+
int wait_for_terminate(pid_t pid, siginfo_t *status) {
assert(pid >= 1);
assert(status);
}
void freeze(void) {
+ sync();
+
for (;;)
pause();
}
}
DIR *xopendirat(int fd, const char *name, int flags) {
- return fdopendir(openat(fd, name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|flags));
+ int nfd;
+ DIR *d;
+
+ if ((nfd = openat(fd, name, O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC|flags)) < 0)
+ return NULL;
+
+ if (!(d = fdopendir(nfd))) {
+ close_nointr_nofail(nfd);
+ return NULL;
+ }
+
+ return d;
}
int signal_from_string_try_harder(const char *s) {
/* FIXME: Proper handling of /dev/console would be cool */
- return "TERM=vt100-nav";
+ return "TERM=vt100";
}
static const char *const ioprio_class_table[] = {