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

Comparing rxvt-unicode/src/rxvtd.C (file contents):
Revision 1.23 by root, Wed Jan 11 00:59:58 2006 UTC vs.
Revision 1.26 by root, Sun Jan 22 00:36:59 2006 UTC

71}; 71};
72 72
73unix_listener::unix_listener (const char *sockname) 73unix_listener::unix_listener (const char *sockname)
74: accept_ev (this, &unix_listener::accept_cb) 74: accept_ev (this, &unix_listener::accept_cb)
75{ 75{
76 if ((fd = socket (PF_UNIX, SOCK_STREAM, 0)) < 0) 76 if ((fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0)
77 { 77 {
78 perror ("unable to create listening socket"); 78 perror ("unable to create listening socket");
79 exit (EXIT_FAILURE); 79 exit (EXIT_FAILURE);
80 } 80 }
81 81
118 } 118 }
119} 119}
120 120
121int server::getfd (int remote_fd) 121int server::getfd (int remote_fd)
122{ 122{
123#if ENABLE_FRILLS && HAVE_UNIX_FDPASS
124 send ("GETFD"); 123 send ("GETFD");
125 send (remote_fd); 124 send (remote_fd);
126 return rxvt_recv_fd (fd); 125 return rxvt_recv_fd (fd);
127#else
128 return -1;
129#endif
130} 126}
131 127
132void server::log_msg (const char *msg) 128void server::log_msg (const char *msg)
133{ 129{
134 send ("MSG"), send (msg); 130 send ("MSG"), send (msg);
170 return err (); 166 return err ();
171 167
172 if (!strcmp (tok, "END")) 168 if (!strcmp (tok, "END"))
173 break; 169 break;
174 else if (!strcmp (tok, "ENV") && recv (tok)) 170 else if (!strcmp (tok, "ENV") && recv (tok))
175 envv->push_back (tok.get ()); 171 envv->push_back (strdup (tok));
176 else if (!strcmp (tok, "CWD") && recv (tok)) 172 else if (!strcmp (tok, "CWD") && recv (tok))
177 { 173 {
178 if (chdir (tok)) 174 if (chdir (tok))
179 err ("unable to change to working directory to '%s': %s", 175 err ("unable to change to working directory to '%s': %s",
180 (char *)tok, strerror (errno)); 176 (char *)tok, strerror (errno));
181 } 177 }
182 else if (!strcmp (tok, "ARG") && recv (tok)) 178 else if (!strcmp (tok, "ARG") && recv (tok))
183 argv->push_back (tok.get ()); 179 argv->push_back (strdup (tok));
184 else 180 else
185 return err ("protocol error: unexpected NEW token"); 181 return err ("protocol error: unexpected NEW token");
186 } 182 }
187 183
188 envv->push_back (0); 184 envv->push_back (0);
190 { 186 {
191 rxvt_term *term = new rxvt_term; 187 rxvt_term *term = new rxvt_term;
192 188
193 term->log_hook = &log_cb; 189 term->log_hook = &log_cb;
194 term->getfd_hook = &getfd_cb; 190 term->getfd_hook = &getfd_cb;
195 term->argv = argv;
196 term->envv = envv;
197 191
198 bool success; 192 bool success;
199 193
200 try 194 try
201 { 195 {
202 success = term->init (argv->size (), argv->begin ()); 196 success = term->init (argv, envv);
203 } 197 }
204 catch (const class rxvt_failure_exception &e) 198 catch (const class rxvt_failure_exception &e)
205 { 199 {
206 success = false; 200 success = false;
207 } 201 }
226int opt_fork, opt_opendisplay, opt_quiet; 220int opt_fork, opt_opendisplay, opt_quiet;
227 221
228int 222int
229main (int argc, const char *const *argv) 223main (int argc, const char *const *argv)
230{ 224{
225 rxvt_init ();
226
231 for (int i = 1; i < argc; i++) 227 for (int i = 1; i < argc; i++)
232 { 228 {
233 if (!strcmp (argv [i], "-f") || !strcmp (argv [i], "--fork")) 229 if (!strcmp (argv [i], "-f") || !strcmp (argv [i], "--fork"))
234 opt_fork = 1; 230 opt_fork = 1;
235 else if (!strcmp (argv [i], "-o") || !strcmp (argv [i], "--opendisplay")) 231 else if (!strcmp (argv [i], "-o") || !strcmp (argv [i], "--opendisplay"))
241 rxvt_log ("%s: unknown option '%s', aborting.\n", argv [0], argv [i]); 237 rxvt_log ("%s: unknown option '%s', aborting.\n", argv [0], argv [i]);
242 return EXIT_FAILURE; 238 return EXIT_FAILURE;
243 } 239 }
244 } 240 }
245 241
246 rxvt_init ();
247
248 chdir ("/"); 242 chdir ("/");
249 243
250 if (opt_opendisplay) 244 if (opt_opendisplay)
251 displays.get (getenv ("DISPLAY")); // open display and never release it 245 displays.get (getenv ("DISPLAY")); // open display and never release it
252 246

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines