Add reuseable abstraction over fork/exec/dup2 (#211)

This commit is contained in:
N-R-K
2022-02-20 15:54:29 +00:00
committed by GitHub
parent 3cf4fc5e81
commit ad95012be9
3 changed files with 113 additions and 45 deletions

13
nsxiv.h
View File

@ -342,6 +342,17 @@ typedef struct {
int stlen;
} r_dir_t;
typedef struct {
int readfd;
int writefd;
pid_t pid;
} spawn_t;
enum {
X_READ = (1 << 0),
X_WRITE = (1 << 1)
};
extern const char *progname;
void* emalloc(size_t);
@ -353,6 +364,8 @@ int r_opendir(r_dir_t*, const char*, bool);
int r_closedir(r_dir_t*);
char* r_readdir(r_dir_t*, bool);
int r_mkdir(char*);
void construct_argv(char**, unsigned int, ...);
spawn_t spawn(const char*, char *const [], unsigned int);
/* window.c */