4 * Copyright (C) 1998 Alexandre Julliard
20 /* command-line options */
22 int persistent_server = 0;
24 unsigned int server_start_ticks = 0;
27 /* FIXME: should probably use getopt, and add a help option */
28 static void parse_args( int argc, char *argv[] )
31 for (i = 1; i < argc; i++)
33 if (argv[i][0] == '-')
38 if (isdigit(argv[i][2])) debug_level = atoi( argv[i] + 2 );
42 persistent_server = 1;
45 fprintf( stderr, "Unknown option '%s'\n", argv[i] );
51 fprintf( stderr, "Unknown argument '%s'. Your version of wine may be too old.\n", argv[i] );
57 static void sigterm_handler()
59 exit(1); /* make sure atexit functions get called */
62 /* initialize signal handling */
63 static void signal_init(void)
65 signal( SIGPIPE, SIG_IGN );
66 signal( SIGHUP, sigterm_handler );
67 signal( SIGINT, sigterm_handler );
68 signal( SIGQUIT, sigterm_handler );
69 signal( SIGTERM, sigterm_handler );
70 signal( SIGABRT, sigterm_handler );
73 /* get server start ticks used to calculate GetTickCount() in Wine clients */
74 static void get_start_ticks(void)
77 gettimeofday( &t, NULL );
78 server_start_ticks = (t.tv_sec * 1000) + (t.tv_usec / 1000);
81 int main( int argc, char *argv[] )
83 parse_args( argc, argv );
86 setvbuf( stderr, NULL, _IOLBF, 0 );
88 if (debug_level) fprintf( stderr, "Server: starting (pid=%ld)\n", (long) getpid() );
93 if (debug_level) fprintf( stderr, "Server: exiting (pid=%ld)\n", (long) getpid() );
97 dump_objects(); /* dump any remaining objects */