equal
deleted
inserted
replaced
12 #include "variables.h" |
12 #include "variables.h" |
13 |
13 |
14 #include <sys/types.h> |
14 #include <sys/types.h> |
15 #include <unistd.h> |
15 #include <unistd.h> |
16 |
16 |
17 void DedicatedFork(void) |
17 #if defined(SUNOS) && !defined(_LP64) && !defined(_I32LPx) |
|
18 /* Solaris has, in certain situation, pid_t defined as long, while in other |
|
19 * cases it has it defined as int... this handles all cases nicely. */ |
|
20 # define PRINTF_PID_T "%ld" |
|
21 #else |
|
22 # define PRINTF_PID_T "%d" |
|
23 #endif |
|
24 |
|
25 void DedicatedFork() |
18 { |
26 { |
19 /* Fork the program */ |
27 /* Fork the program */ |
20 pid_t pid = fork(); |
28 pid_t pid = fork(); |
21 switch (pid) { |
29 switch (pid) { |
22 case -1: |
30 case -1: |
45 } |
53 } |
46 |
54 |
47 default: |
55 default: |
48 /* We're the parent */ |
56 /* We're the parent */ |
49 printf("Loading dedicated server...\n"); |
57 printf("Loading dedicated server...\n"); |
50 printf(" - Forked to background with pid %d\n", pid); |
58 printf(" - Forked to background with pid " PRINTF_PID_T "\n", pid); |
51 exit(0); |
59 exit(0); |
52 } |
60 } |
53 } |
61 } |
54 #endif |
62 #endif |
55 |
63 |
56 #else |
64 #else |
57 |
65 |
58 void DedicatedFork(void) {} |
66 void DedicatedFork() {} |
59 |
67 |
60 #endif /* ENABLE_NETWORK */ |
68 #endif /* ENABLE_NETWORK */ |