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.18 by root, Thu Sep 2 07:44:40 2004 UTC vs.
Revision 1.21 by root, Thu Jul 7 19:37:47 2005 UTC

194 } 194 }
195 195
196 term->log_hook = 0; 196 term->log_hook = 0;
197 197
198 environ = old_environ; 198 environ = old_environ;
199 chdir ("/");
199 200
200 if (!success) 201 if (!success)
201 term->destroy (); 202 term->destroy ();
202 203
203 send ("END"); send (success ? 1 : 0); 204 send ("END"); send (success ? 1 : 0);
208 } 209 }
209 else 210 else
210 return err (); 211 return err ();
211} 212}
212 213
214int opt_fork, opt_opendisplay, opt_quiet;
215
213int 216int
214main (int argc, const char *const *argv) 217main (int argc, const char *const *argv)
215{ 218{
219 for (int i = 1; i < argc; i++)
220 {
221 if (!strcmp (argv [i], "-f") || !strcmp (argv [i], "--fork"))
222 opt_fork = 1;
223 else if (!strcmp (argv [i], "-o") || !strcmp (argv [i], "--opendisplay"))
224 opt_opendisplay = 1;
225 else if (!strcmp (argv [i], "-q") || !strcmp (argv [i], "--quiet"))
226 opt_quiet = 1;
227 else
228 {
229 rxvt_log ("%s: unknown option '%s', aborting.\n", argv [0], argv [i]);
230 return EXIT_FAILURE;
231 }
232 }
233
216 rxvt_init (); 234 rxvt_init ();
235
236 chdir ("/");
237
238 if (opt_opendisplay)
239 displays.get (getenv ("DISPLAY")); // open display and never release it
217 240
218 char *sockname = rxvt_connection::unix_sockname (); 241 char *sockname = rxvt_connection::unix_sockname ();
219 unix_listener l (sockname); 242 unix_listener l (sockname);
243
244 if (!opt_quiet)
245 {
220 printf ("rxvt-unicode daemon listening on %s.\n", sockname); 246 printf ("rxvt-unicode daemon listening on %s.\n", sockname);
247 fflush (stdout);
248 }
249
221 free (sockname); 250 free (sockname);
222 251
252 if (opt_fork)
253 {
254 pid_t pid = fork ();
255
256 if (pid < 0)
257 {
258 rxvt_log ("unable to fork daemon, aborting.\n");
259 return EXIT_FAILURE;
260 }
261 else if (pid > 0)
262 _exit (EXIT_SUCCESS);
263 }
264
223 io_manager::loop (); 265 io_manager::loop ();
224 266
225 return EXIT_SUCCESS; 267 return EXIT_SUCCESS;
226} 268}
227 269

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines