bool is_device_path(const char *path);
int dir_is_empty(const char *path);
+char* dirname_malloc(const char *path);
void rename_process(const char name[8]);
int get_user_creds(const char **username, uid_t *uid, gid_t *gid, const char **home, const char **shell);
int get_group_creds(const char **groupname, gid_t *gid);
+int in_gid(gid_t gid);
int in_group(const char *name);
char* uid_to_name(uid_t uid);
+char* gid_to_name(gid_t gid);
int glob_exists(const char *path);
void warn_melody(void);
-int get_shell(char **ret);
int get_home_dir(char **ret);
static inline void freep(void *p) {
#define FOREACH_DIRENT(de, d, on_error) \
for (errno = 0, de = readdir(d);; errno = 0, de = readdir(d)) \
if (!de) { \
- if (errno != 0) { \
+ if (errno > 0) { \
on_error; \
} \
break; \
char *hexmem(const void *p, size_t l);
char *strextend(char **x, ...);
+char *strrep(const char *s, unsigned n);