… | |
… | |
39 | client (); |
39 | client (); |
40 | }; |
40 | }; |
41 | |
41 | |
42 | client::client () |
42 | client::client () |
43 | { |
43 | { |
44 | if ((fd = socket (PF_UNIX, SOCK_STREAM, 0)) < 0) |
44 | if ((fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) |
45 | { |
45 | { |
46 | perror ("unable to create communications socket"); |
46 | perror ("unable to create communications socket"); |
47 | exit (EXIT_FAILURE); |
47 | exit (EXIT_FAILURE); |
48 | } |
48 | } |
49 | |
49 | |
… | |
… | |
108 | fprintf (stderr, "protocol error: unexpected eof from server.\n"); |
108 | fprintf (stderr, "protocol error: unexpected eof from server.\n"); |
109 | break; |
109 | break; |
110 | } |
110 | } |
111 | else if (!strcmp (tok, "MSG") && c.recv (tok)) |
111 | else if (!strcmp (tok, "MSG") && c.recv (tok)) |
112 | fprintf (stderr, "%s", (const char *)tok); |
112 | fprintf (stderr, "%s", (const char *)tok); |
113 | #if ENABLE_FRILLS && HAVE_UNIX_FDPASS |
|
|
114 | else if (!strcmp (tok, "GETFD") && c.recv (cint)) |
113 | else if (!strcmp (tok, "GETFD") && c.recv (cint)) |
115 | { |
114 | { |
116 | if (rxvt_send_fd (c.fd, cint) < 0) |
115 | if (rxvt_send_fd (c.fd, cint) < 0) |
117 | { |
116 | { |
118 | fprintf (stderr, "unable to send fd %d: ", cint); perror (0); |
117 | fprintf (stderr, "unable to send fd %d: ", cint); perror (0); |
119 | exit (EXIT_FAILURE); |
118 | exit (EXIT_FAILURE); |
120 | } |
119 | } |
121 | } |
120 | } |
122 | #endif |
|
|
123 | else if (!strcmp (tok, "END")) |
121 | else if (!strcmp (tok, "END")) |
124 | { |
122 | { |
125 | int success; |
123 | int success; |
|
|
124 | |
126 | if (c.recv (success)) |
125 | if (c.recv (success)) |
127 | exit (success ? EXIT_SUCCESS : EXIT_FAILURE); |
126 | exit (success ? EXIT_SUCCESS : EXIT_FAILURE); |
128 | } |
127 | } |
129 | else |
128 | else |
130 | { |
129 | { |