… | |
… | |
34 | } |
34 | } |
35 | |
35 | |
36 | extern char **environ; |
36 | extern char **environ; |
37 | |
37 | |
38 | int |
38 | int |
39 | main(int argc, const char *const *argv) |
39 | main (int argc, const char *const *argv) |
40 | { |
40 | { |
41 | client c; |
41 | client c; |
42 | char buf[PATH_MAX]; |
42 | char buf[PATH_MAX]; |
43 | |
43 | |
44 | { |
44 | { |
45 | sigset_t ss; |
45 | sigset_t ss; |
46 | |
46 | |
|
|
47 | sigemptyset (&ss); |
47 | sigaddset (&ss, SIGHUP); |
48 | sigaddset (&ss, SIGHUP); |
48 | sigprocmask (SIG_BLOCK, &ss, 0); |
49 | sigprocmask (SIG_BLOCK, &ss, 0); |
49 | } |
50 | } |
50 | |
51 | |
51 | c.send ("NEW"); |
52 | c.send ("NEW"); |
52 | // instead of getcwd we could opendir(".") and pass the fd for fchdir *g* |
53 | // instead of getcwd we could opendir (".") and pass the fd for fchdir *g* |
53 | c.send ("CWD"), c.send (getcwd (buf, sizeof (buf))); |
54 | c.send ("CWD"), c.send (getcwd (buf, sizeof (buf))); |
54 | |
55 | |
55 | for (char **var = environ; *environ; environ++) |
56 | for (char **var = environ; *environ; environ++) |
56 | c.send ("ENV"), c.send (*environ); |
57 | c.send ("ENV"), c.send (*environ); |
57 | |
58 | |