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.20 by root, Mon Feb 14 20:46:47 2005 UTC vs.
Revision 1.21 by root, Thu Jul 7 19:37:47 2005 UTC

209 } 209 }
210 else 210 else
211 return err (); 211 return err ();
212} 212}
213 213
214int opt_fork, opt_opendisplay, opt_quiet;
215
214int 216int
215main (int argc, const char *const *argv) 217main (int argc, const char *const *argv)
216{ 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
217 rxvt_init (); 234 rxvt_init ();
218 235
219 chdir ("/"); 236 chdir ("/");
237
238 if (opt_opendisplay)
239 displays.get (getenv ("DISPLAY")); // open display and never release it
220 240
221 char *sockname = rxvt_connection::unix_sockname (); 241 char *sockname = rxvt_connection::unix_sockname ();
222 unix_listener l (sockname); 242 unix_listener l (sockname);
243
244 if (!opt_quiet)
245 {
223 printf ("rxvt-unicode daemon listening on %s.\n", sockname); 246 printf ("rxvt-unicode daemon listening on %s.\n", sockname);
224 fflush (stdout); 247 fflush (stdout);
248 }
249
225 free (sockname); 250 free (sockname);
226 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
227 io_manager::loop (); 265 io_manager::loop ();
228 266
229 return EXIT_SUCCESS; 267 return EXIT_SUCCESS;
230} 268}
231 269

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines