ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtc.C
(Generate patch)

Comparing rxvt-unicode/src/rxvtc.C (file contents):
Revision 1.4 by pcg, Thu Nov 27 10:12:10 2003 UTC vs.
Revision 1.7 by pcg, Fri Feb 13 12:16:21 2004 UTC

14 14
15client::client () 15client::client ()
16{ 16{
17 if ((fd = socket (PF_LOCAL, SOCK_STREAM, 0)) < 0) 17 if ((fd = socket (PF_LOCAL, SOCK_STREAM, 0)) < 0)
18 { 18 {
19 perror ("unable to create listening socket"); 19 perror ("unable to create communications socket");
20 exit (EXIT_FAILURE); 20 exit (EXIT_FAILURE);
21 } 21 }
22 22
23 char *sockname = rxvt_connection::unix_sockname (); 23 char *sockname = rxvt_connection::unix_sockname ();
24 sockaddr_un sa; 24 sockaddr_un sa;
26 strcpy (sa.sun_path, sockname); 26 strcpy (sa.sun_path, sockname);
27 free (sockname); 27 free (sockname);
28 28
29 if (connect (fd, (sockaddr *)&sa, sizeof (sa))) 29 if (connect (fd, (sockaddr *)&sa, sizeof (sa)))
30 { 30 {
31 perror ("unable to bind listening socket"); 31 perror ("unable to connect to rxvtd");
32 exit (EXIT_FAILURE); 32 exit (EXIT_FAILURE);
33 } 33 }
34} 34}
35 35
36extern char **environ; 36extern char **environ;
37 37
38int 38int
39main(int argc, const char *const *argv) 39main (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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines