4 * Copyright (C) 1998 Alexandre Julliard
20 /* command-line options */
22 int persistent_server = 0;
25 /* FIXME: should probably use getopt, and add a (more complete?) help option */
27 static void usage(const char *exeName)
29 fprintf(stderr, "\nusage: %s [options]\n\n", exeName);
30 fprintf(stderr, "options:\n");
31 fprintf(stderr, " -d<n> set debug level to <n>\n");
32 fprintf(stderr, " -p make server persistent\n");
33 fprintf(stderr, " -h display this help message\n");
34 fprintf(stderr, "\n");
37 static void parse_args( int argc, char *argv[] )
40 for (i = 1; i < argc; i++)
42 if (argv[i][0] == '-')
47 if (isdigit(argv[i][2])) debug_level = atoi( argv[i] + 2 );
55 persistent_server = 1;
58 fprintf( stderr, "Unknown option '%s'\n", argv[i] );
65 fprintf( stderr, "Unknown argument '%s'. Your version of wine may be too old.\n", argv[i] );
72 static void sigterm_handler()
74 exit(1); /* make sure atexit functions get called */
77 /* initialize signal handling */
78 static void signal_init(void)
80 signal( SIGPIPE, SIG_IGN );
81 signal( SIGHUP, sigterm_handler );
82 signal( SIGINT, sigterm_handler );
83 signal( SIGQUIT, sigterm_handler );
84 signal( SIGTERM, sigterm_handler );
85 signal( SIGABRT, sigterm_handler );
88 int main( int argc, char *argv[] )
90 parse_args( argc, argv );
93 setvbuf( stderr, NULL, _IOLBF, 0 );
95 if (debug_level) fprintf( stderr, "Server: starting (pid=%ld)\n", (long) getpid() );
99 if (debug_level) fprintf( stderr, "Server: exiting (pid=%ld)\n", (long) getpid() );
103 dump_objects(); /* dump any remaining objects */