Added DebugBreak.
[wine] / server / main.c
1 /*
2  * Server main function
3  *
4  * Copyright (C) 1998 Alexandre Julliard
5  */
6
7 #include <ctype.h>
8 #include <fcntl.h>
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <unistd.h>
12
13 #include "server.h"
14 #include "object.h"
15 #include "thread.h"
16
17 int main( int argc, char *argv[] )
18 {
19     int fd;
20
21     if (argc != 2) goto error;
22     if (!isdigit( *argv[1] )) goto error;
23     fd = atoi( argv[1] );
24     /* make sure the fd is valid */
25     if (fcntl( fd, F_GETFL, 0 ) == -1) goto error;
26
27     debug_level = 1;
28
29     if (debug_level) fprintf( stderr, "Server: starting (pid=%d)\n", getpid() );
30     create_initial_thread( fd );
31     if (debug_level) fprintf( stderr, "Server: exiting (pid=%d)\n", getpid() );
32
33 #ifdef DEBUG_OBJECTS
34     dump_objects();  /* dump any remaining objects */
35 #endif
36
37     exit(0);
38
39  error:    
40     fprintf( stderr, "%s: must be run from Wine.\n", argv[0] );
41     exit(1);
42 }