--- rxvt-unicode/src/rxvtc.C 2003/11/24 19:52:16 1.2 +++ rxvt-unicode/src/rxvtc.C 2003/11/27 10:12:10 1.4 @@ -4,6 +4,7 @@ #include #include +#include #include #include @@ -19,10 +20,11 @@ exit (EXIT_FAILURE); } + char *sockname = rxvt_connection::unix_sockname (); sockaddr_un sa; - sa.sun_family = AF_UNIX; - strcpy (sa.sun_path, rxvt_connection::unix_sockname ()); + strcpy (sa.sun_path, sockname); + free (sockname); if (connect (fd, (sockaddr *)&sa, sizeof (sa))) { @@ -31,17 +33,28 @@ } } +extern char **environ; + int main(int argc, const char *const *argv) { client c; char buf[PATH_MAX]; + { + sigset_t ss; + + sigaddset (&ss, SIGHUP); + sigprocmask (SIG_BLOCK, &ss, 0); + } + c.send ("NEW"); - c.send ("DISPLAY"), c.send (getenv ("DISPLAY")); // instead of getcwd we could opendir(".") and pass the fd for fchdir *g* c.send ("CWD"), c.send (getcwd (buf, sizeof (buf))); + for (char **var = environ; *environ; environ++) + c.send ("ENV"), c.send (*environ); + for (int i = 0; i < argc; i++) c.send ("ARG"), c.send (argv[i]);