File: | src/switch.c |
Location: | line 1234, column 16 |
Description: | Null pointer passed as an argument to a 'nonnull' parameter |
1 | /* | |||
2 | * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application | |||
3 | * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org> | |||
4 | * | |||
5 | * Version: MPL 1.1 | |||
6 | * | |||
7 | * The contents of this file are subject to the Mozilla Public License Version | |||
8 | * 1.1 (the "License"); you may not use this file except in compliance with | |||
9 | * the License. You may obtain a copy of the License at | |||
10 | * http://www.mozilla.org/MPL/ | |||
11 | * | |||
12 | * Software distributed under the License is distributed on an "AS IS" basis, | |||
13 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License | |||
14 | * for the specific language governing rights and limitations under the | |||
15 | * License. | |||
16 | * | |||
17 | * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application | |||
18 | * | |||
19 | * The Initial Developer of the Original Code is | |||
20 | * Anthony Minessale II <anthm@freeswitch.org> | |||
21 | * Portions created by the Initial Developer are Copyright (C) | |||
22 | * the Initial Developer. All Rights Reserved. | |||
23 | * | |||
24 | * Contributor(s): | |||
25 | * | |||
26 | * Anthony Minessale II <anthm@freeswitch.org> | |||
27 | * Michael Jerris <mike@jerris.com> | |||
28 | * Pawel Pierscionek <pawel@voiceworks.pl> | |||
29 | * Bret McDanel <trixter AT 0xdecafbad.com> | |||
30 | * | |||
31 | * | |||
32 | * switch.c -- Main | |||
33 | * | |||
34 | */ | |||
35 | ||||
36 | #ifndef _XOPEN_SOURCE700 | |||
37 | #define _XOPEN_SOURCE700 600 | |||
38 | #endif | |||
39 | ||||
40 | #ifndef WIN32 | |||
41 | #include <poll.h> | |||
42 | #ifdef HAVE_SETRLIMIT1 | |||
43 | #include <sys/resource.h> | |||
44 | #endif | |||
45 | #endif | |||
46 | ||||
47 | #ifdef __linux__1 | |||
48 | #include <sys/prctl.h> | |||
49 | #endif | |||
50 | ||||
51 | #include <switch.h> | |||
52 | #include "private/switch_core_pvt.h" | |||
53 | ||||
54 | /* pid filename: Stores the process id of the freeswitch process */ | |||
55 | #define PIDFILE"freeswitch.pid" "freeswitch.pid" | |||
56 | static char *pfile = PIDFILE"freeswitch.pid"; | |||
57 | static int system_ready = 0; | |||
58 | ||||
59 | /* Picky compiler */ | |||
60 | #ifdef __ICC | |||
61 | #pragma warning (disable:167) | |||
62 | #endif | |||
63 | ||||
64 | #ifdef WIN32 | |||
65 | /* If we are a windows service, what should we be called */ | |||
66 | #define SERVICENAME_DEFAULT "FreeSWITCH" | |||
67 | #define SERVICENAME_MAXLEN 256 | |||
68 | static char service_name[SERVICENAME_MAXLEN]; | |||
69 | static switch_core_flag_t service_flags = SCF_NONE; | |||
70 | #include <winsock2.h> | |||
71 | #include <windows.h> | |||
72 | ||||
73 | /* event to signal shutdown (for you unix people, this is like a pthread_cond) */ | |||
74 | static HANDLE shutdown_event; | |||
75 | ||||
76 | #ifndef PATH_MAX4096 | |||
77 | #define PATH_MAX4096 256 | |||
78 | #endif | |||
79 | #endif | |||
80 | ||||
81 | /* signal handler for when freeswitch is running in background mode. | |||
82 | * signal triggers the shutdown of freeswitch | |||
83 | # */ | |||
84 | static void handle_SIGILL(int sig) | |||
85 | { | |||
86 | int32_t arg = 0; | |||
87 | if (sig) {}; | |||
88 | /* send shutdown signal to the freeswitch core */ | |||
89 | switch_core_session_ctl(SCSC_SHUTDOWN, &arg); | |||
90 | return; | |||
91 | } | |||
92 | ||||
93 | #ifndef WIN32 | |||
94 | ||||
95 | static void handle_SIGCHLD(int sig) | |||
96 | { | |||
97 | int status = 0; | |||
98 | int pid = 0; | |||
99 | ||||
100 | if (sig) {}; | |||
101 | ||||
102 | pid = wait(&status); | |||
103 | if (pid > 0) { | |||
104 | system_ready = -1; | |||
105 | } | |||
106 | ||||
107 | return; | |||
108 | } | |||
109 | #endif | |||
110 | ||||
111 | /* kill a freeswitch process running in background mode */ | |||
112 | static int freeswitch_kill_background() | |||
113 | { | |||
114 | FILE *f; /* FILE handle to open the pid file */ | |||
115 | char path[PATH_MAX4096] = ""; /* full path of the PID file */ | |||
116 | pid_t pid = 0; /* pid from the pid file */ | |||
117 | ||||
118 | /* set the globals so we can use the global paths. */ | |||
119 | switch_core_set_globals(); | |||
120 | ||||
121 | /* get the full path of the pid file. */ | |||
122 | switch_snprintf(path, sizeof(path), "%s%s%s", SWITCH_GLOBAL_dirs.run_dir, SWITCH_PATH_SEPARATOR"/", pfile); | |||
123 | ||||
124 | /* open the pid file */ | |||
125 | if ((f = fopen(path, "r")) == 0) { | |||
126 | /* pid file does not exist */ | |||
127 | fprintf(stderrstderr, "Cannot open pid file %s.\n", path); | |||
128 | return 255; | |||
129 | } | |||
130 | ||||
131 | /* pull the pid from the file */ | |||
132 | if (fscanf(f, "%d", (int *) (intptr_t) & pid) != 1) { | |||
133 | switch_log_printf(SWITCH_CHANNEL_LOGSWITCH_CHANNEL_ID_LOG, "src/switch.c", (const char *)__func__ , 133, ((void*)0), SWITCH_LOG_ERROR, "Unable to get the pid!\n"); | |||
134 | } | |||
135 | ||||
136 | /* if we have a valid pid */ | |||
137 | if (pid > 0) { | |||
138 | ||||
139 | /* kill the freeswitch running at the pid we found */ | |||
140 | fprintf(stderrstderr, "Killing: %d\n", (int) pid); | |||
141 | #ifdef WIN32 | |||
142 | /* for windows we need the event to signal for shutting down a background FreeSWITCH */ | |||
143 | snprintf(path, sizeof(path), "Global\\Freeswitch.%d", pid); | |||
144 | ||||
145 | /* open the event so we can signal it */ | |||
146 | shutdown_event = OpenEvent(EVENT_MODIFY_STATE, FALSE0, path); | |||
147 | ||||
148 | /* did we successfully open the event */ | |||
149 | if (!shutdown_event) { | |||
150 | /* we can't get the event, so we can't signal the process to shutdown */ | |||
151 | fprintf(stderrstderr, "ERROR: Can't Shutdown: %d\n", (int) pid); | |||
152 | } else { | |||
153 | /* signal the event to shutdown */ | |||
154 | SetEvent(shutdown_event); | |||
155 | /* cleanup */ | |||
156 | CloseHandle(shutdown_event); | |||
157 | } | |||
158 | #else | |||
159 | /* for unix, send the signal to kill. */ | |||
160 | kill(pid, SIGTERM15); | |||
161 | #endif | |||
162 | } | |||
163 | ||||
164 | /* be nice and close the file handle to the pid file */ | |||
165 | fclose(f); | |||
166 | ||||
167 | return 0; | |||
168 | } | |||
169 | ||||
170 | #ifdef WIN32 | |||
171 | ||||
172 | /* we need these vars to handle the service */ | |||
173 | SERVICE_STATUS_HANDLE hStatus; | |||
174 | SERVICE_STATUS status; | |||
175 | ||||
176 | /* Handler function for service start/stop from the service */ | |||
177 | void WINAPI ServiceCtrlHandler(DWORD control) | |||
178 | { | |||
179 | switch (control) { | |||
180 | case SERVICE_CONTROL_SHUTDOWN: | |||
181 | case SERVICE_CONTROL_STOP: | |||
182 | /* Shutdown freeswitch */ | |||
183 | switch_core_destroy(); | |||
184 | /* set service status values */ | |||
185 | status.dwCurrentState = SERVICE_STOPPED; | |||
186 | status.dwWin32ExitCode = 0; | |||
187 | status.dwCheckPoint = 0; | |||
188 | status.dwWaitHint = 0; | |||
189 | break; | |||
190 | case SERVICE_CONTROL_INTERROGATE: | |||
191 | /* we already set the service status every time it changes. */ | |||
192 | /* if there are other times we change it and don't update, we should do so here */ | |||
193 | break; | |||
194 | } | |||
195 | ||||
196 | SetServiceStatus(hStatus, &status); | |||
197 | } | |||
198 | ||||
199 | /* the main service entry point */ | |||
200 | void WINAPI service_main(DWORD numArgs, char **args) | |||
201 | { | |||
202 | switch_core_flag_t flags = SCF_USE_SQL | SCF_USE_AUTO_NAT | SCF_USE_NAT_MAPPING | SCF_CALIBRATE_CLOCK | SCF_USE_CLOCK_RT; | |||
203 | const char *err = NULL((void*)0); /* error value for return from freeswitch initialization */ | |||
204 | ||||
205 | /* Override flags if they have been set earlier */ | |||
206 | if (service_flags != SCF_NONE) | |||
207 | flags = service_flags; | |||
208 | ||||
209 | /* we have to initialize the service-specific stuff */ | |||
210 | memset(&status, 0, sizeof(SERVICE_STATUS)); | |||
211 | status.dwServiceType = SERVICE_WIN32; | |||
212 | status.dwCurrentState = SERVICE_START_PENDING; | |||
213 | status.dwControlsAccepted = SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN; | |||
214 | ||||
215 | /* register our handler for service control messages */ | |||
216 | hStatus = RegisterServiceCtrlHandler(service_name, &ServiceCtrlHandler); | |||
217 | ||||
218 | /* update the service status */ | |||
219 | SetServiceStatus(hStatus, &status); | |||
220 | ||||
221 | switch_core_set_globals(); | |||
222 | ||||
223 | /* attempt to initialize freeswitch and load modules */ | |||
224 | if (switch_core_init_and_modload(flags, SWITCH_FALSE, &err) != SWITCH_STATUS_SUCCESS) { | |||
225 | /* freeswitch did not start successfully */ | |||
226 | status.dwCurrentState = SERVICE_STOPPED; | |||
227 | } else { | |||
228 | /* freeswitch started */ | |||
229 | status.dwCurrentState = SERVICE_RUNNING; | |||
230 | } | |||
231 | ||||
232 | /* update the service status */ | |||
233 | SetServiceStatus(hStatus, &status); | |||
234 | } | |||
235 | ||||
236 | #else | |||
237 | ||||
238 | static int check_fd(int fd, int ms) | |||
239 | { | |||
240 | struct pollfd pfds[2] = { { 0 } }; | |||
241 | int s, r = 0, i = 0; | |||
242 | ||||
243 | pfds[0].fd = fd; | |||
244 | pfds[0].events = POLLIN0x001 | POLLERR0x008; | |||
245 | s = poll(pfds, 1, ms); | |||
246 | ||||
247 | if (s == 0 || s == -1) { | |||
248 | r = s; | |||
249 | } else { | |||
250 | r = -1; | |||
251 | ||||
252 | if ((pfds[0].revents & POLLIN0x001)) { | |||
253 | if ((i = read(fd, &r, sizeof(r))) > -1) { | |||
254 | (void)write(fd, &r, sizeof(r)); | |||
255 | } | |||
256 | } | |||
257 | } | |||
258 | ||||
259 | return r; | |||
260 | } | |||
261 | ||||
262 | static void daemonize(int *fds) | |||
263 | { | |||
264 | int fd; | |||
265 | pid_t pid; | |||
266 | unsigned int sanity = 60; | |||
267 | ||||
268 | if (!fds) { | |||
269 | switch (fork()) { | |||
270 | case 0: /* child process */ | |||
271 | break; | |||
272 | case -1: | |||
273 | fprintf(stderrstderr, "Error Backgrounding (fork)! %d - %s\n", errno(*__errno_location ()), strerror(errno(*__errno_location ()))); | |||
274 | exit(EXIT_SUCCESS0); | |||
275 | break; | |||
276 | default: /* parent process */ | |||
277 | exit(EXIT_SUCCESS0); | |||
278 | } | |||
279 | ||||
280 | if (setsid() < 0) { | |||
281 | fprintf(stderrstderr, "Error Backgrounding (setsid)! %d - %s\n", errno(*__errno_location ()), strerror(errno(*__errno_location ()))); | |||
282 | exit(EXIT_SUCCESS0); | |||
283 | } | |||
284 | } | |||
285 | ||||
286 | pid = switch_fork(); | |||
287 | ||||
288 | switch (pid) { | |||
289 | case 0: /* child process */ | |||
290 | if (fds) { | |||
291 | close(fds[0]); | |||
292 | } | |||
293 | break; | |||
294 | case -1: | |||
295 | fprintf(stderrstderr, "Error Backgrounding (fork2)! %d - %s\n", errno(*__errno_location ()), strerror(errno(*__errno_location ()))); | |||
296 | exit(EXIT_SUCCESS0); | |||
297 | break; | |||
298 | default: /* parent process */ | |||
299 | fprintf(stderrstderr, "%d Backgrounding.\n", (int) pid); | |||
300 | ||||
301 | if (fds) { | |||
302 | char *o; | |||
303 | ||||
304 | close(fds[1]); | |||
305 | ||||
306 | if ((o = getenv("FREESWITCH_BG_TIMEOUT"))) { | |||
307 | int tmp = atoi(o); | |||
308 | if (tmp > 0) { | |||
309 | sanity = tmp; | |||
310 | } | |||
311 | } | |||
312 | ||||
313 | do { | |||
314 | system_ready = check_fd(fds[0], 2000); | |||
315 | ||||
316 | if (system_ready == 0) { | |||
317 | printf("FreeSWITCH[%d] Waiting for background process pid:%d to be ready.....\n", (int)getpid(), (int) pid); | |||
318 | } | |||
319 | ||||
320 | } while (--sanity && system_ready == 0); | |||
321 | ||||
322 | shutdown(fds[0], 2); | |||
323 | close(fds[0]); | |||
324 | fds[0] = -1; | |||
325 | ||||
326 | ||||
327 | if (system_ready < 0) { | |||
328 | printf("FreeSWITCH[%d] Error starting system! pid:%d\n", (int)getpid(), (int) pid); | |||
329 | kill(pid, 9); | |||
330 | exit(EXIT_FAILURE1); | |||
331 | } | |||
332 | ||||
333 | printf("FreeSWITCH[%d] System Ready pid:%d\n", (int) getpid(), (int) pid); | |||
334 | } | |||
335 | ||||
336 | exit(EXIT_SUCCESS0); | |||
337 | } | |||
338 | ||||
339 | if (fds) { | |||
340 | setsid(); | |||
341 | } | |||
342 | /* redirect std* to null */ | |||
343 | fd = open("/dev/null", O_RDONLY00); | |||
344 | switch_assert( fd >= 0 )((fd >= 0) ? (void) (0) : __assert_fail ("fd >= 0", "src/switch.c" , 344, __PRETTY_FUNCTION__)); | |||
345 | if (fd != 0) { | |||
346 | dup2(fd, 0); | |||
347 | close(fd); | |||
348 | } | |||
349 | ||||
350 | fd = open("/dev/null", O_WRONLY01); | |||
351 | switch_assert( fd >= 0 )((fd >= 0) ? (void) (0) : __assert_fail ("fd >= 0", "src/switch.c" , 351, __PRETTY_FUNCTION__)); | |||
352 | if (fd != 1) { | |||
353 | dup2(fd, 1); | |||
354 | close(fd); | |||
355 | } | |||
356 | ||||
357 | fd = open("/dev/null", O_WRONLY01); | |||
358 | switch_assert( fd >= 0 )((fd >= 0) ? (void) (0) : __assert_fail ("fd >= 0", "src/switch.c" , 358, __PRETTY_FUNCTION__)); | |||
359 | if (fd != 2) { | |||
360 | dup2(fd, 2); | |||
361 | close(fd); | |||
362 | } | |||
363 | return; | |||
364 | } | |||
365 | ||||
366 | static pid_t reincarnate_child = 0; | |||
367 | static void reincarnate_handle_sigterm (int sig) { | |||
368 | if (!sig) return; | |||
369 | if (reincarnate_child) kill(reincarnate_child, sig); | |||
370 | return; | |||
371 | } | |||
372 | ||||
373 | static void reincarnate_protect(char **argv) { | |||
374 | int i; struct sigaction sa, sa_dfl, sa4_prev, sa15_prev, sa17_prev; | |||
375 | memset(&sa, 0, sizeof(sa)); memset(&sa_dfl, 0, sizeof(sa_dfl)); | |||
376 | sa.sa_handler__sigaction_handler.sa_handler = reincarnate_handle_sigterm; | |||
377 | sa_dfl.sa_handler__sigaction_handler.sa_handler = SIG_DFL((__sighandler_t) 0); | |||
378 | refork: | |||
379 | if ((i=fork())) { /* parent */ | |||
380 | int s; pid_t r; | |||
381 | reincarnate_child = i; | |||
382 | sigaction(SIGILL4, &sa, &sa4_prev); | |||
383 | sigaction(SIGTERM15, &sa, &sa15_prev); | |||
384 | sigaction(SIGCHLD17, &sa_dfl, &sa17_prev); | |||
385 | rewait: | |||
386 | r = waitpid(i, &s, 0); | |||
387 | if (r == (pid_t)-1) { | |||
388 | if (errno(*__errno_location ()) == EINTR4) goto rewait; | |||
389 | exit(EXIT_FAILURE1); | |||
390 | } | |||
391 | if (r != i) goto rewait; | |||
392 | if (WIFEXITED(s)((((__extension__ (((union { __typeof(s) __in; int __i; }) { . __in = (s) }).__i))) & 0x7f) == 0) | |||
393 | && (WEXITSTATUS(s)((((__extension__ (((union { __typeof(s) __in; int __i; }) { . __in = (s) }).__i))) & 0xff00) >> 8) == EXIT_SUCCESS0 | |||
394 | || WEXITSTATUS(s)((((__extension__ (((union { __typeof(s) __in; int __i; }) { . __in = (s) }).__i))) & 0xff00) >> 8) == EXIT_FAILURE1)) { | |||
395 | exit(WEXITSTATUS(s)((((__extension__ (((union { __typeof(s) __in; int __i; }) { . __in = (s) }).__i))) & 0xff00) >> 8)); | |||
396 | } | |||
397 | if (WIFEXITED(s)((((__extension__ (((union { __typeof(s) __in; int __i; }) { . __in = (s) }).__i))) & 0x7f) == 0) || WIFSIGNALED(s)(((signed char) ((((__extension__ (((union { __typeof(s) __in ; int __i; }) { .__in = (s) }).__i))) & 0x7f) + 1) >> 1) > 0)) { | |||
398 | sigaction(SIGILL4, &sa4_prev, NULL((void*)0)); | |||
399 | sigaction(SIGTERM15, &sa15_prev, NULL((void*)0)); | |||
400 | sigaction(SIGCHLD17, &sa17_prev, NULL((void*)0)); | |||
401 | if (argv) { | |||
402 | if (execv(argv[0], argv) == -1) { | |||
403 | char buf[256]; | |||
404 | fprintf(stderrstderr, "Reincarnate execv() failed: %d %s\n", errno(*__errno_location ()), | |||
405 | switch_strerror_r(errno(*__errno_location ()), buf, sizeof(buf))); | |||
406 | } | |||
407 | fprintf(stderrstderr, "Trying reincarnate-reexec plan B...\n"); | |||
408 | if (execvp(argv[0], argv) == -1) { | |||
409 | char buf[256]; | |||
410 | fprintf(stderrstderr, "Reincarnate execvp() failed: %d %s\n", errno(*__errno_location ()), | |||
411 | switch_strerror_r(errno(*__errno_location ()), buf, sizeof(buf))); | |||
412 | } | |||
413 | fprintf(stderrstderr, "Falling back to normal reincarnate behavior...\n"); | |||
414 | goto refork; | |||
415 | } else goto refork; | |||
416 | } | |||
417 | goto rewait; | |||
418 | } else { /* child */ | |||
419 | #ifdef __linux__1 | |||
420 | prctl(PR_SET_PDEATHSIG1, SIGTERM15); | |||
421 | #endif | |||
422 | } | |||
423 | } | |||
424 | ||||
425 | #endif | |||
426 | ||||
427 | static const char usage[] = | |||
428 | "Usage: freeswitch [OPTIONS]\n\n" | |||
429 | "These are the optional arguments you can pass to freeswitch:\n" | |||
430 | #ifdef WIN32 | |||
431 | "\t-service [name] -- start freeswitch as a service, cannot be used if loaded as a console app\n" | |||
432 | "\t-install [name] -- install freeswitch as a service, with optional service name\n" | |||
433 | "\t-uninstall -- remove freeswitch as a service\n" | |||
434 | "\t-monotonic-clock -- use monotonic clock as timer source\n" | |||
435 | #else | |||
436 | "\t-nf -- no forking\n" | |||
437 | "\t-reincarnate -- restart the switch on an uncontrolled exit\n" | |||
438 | "\t-reincarnate-reexec -- run execv on a restart (helpful for upgrades)\n" | |||
439 | "\t-u [user] -- specify user to switch to\n" | |||
440 | "\t-g [group] -- specify group to switch to\n" | |||
441 | #endif | |||
442 | #ifdef HAVE_SETRLIMIT1 | |||
443 | #ifndef FS_64BIT1 | |||
444 | "\t-waste -- allow memory waste\n" | |||
445 | #endif | |||
446 | "\t-core -- dump cores\n" | |||
447 | #endif | |||
448 | "\t-help -- this message\n" | |||
449 | "\t-version -- print the version and exit\n" | |||
450 | "\t-rp -- enable high(realtime) priority settings\n" | |||
451 | "\t-lp -- enable low priority settings\n" | |||
452 | "\t-np -- enable normal priority settings\n" | |||
453 | "\t-vg -- run under valgrind\n" | |||
454 | "\t-nosql -- disable internal sql scoreboard\n" | |||
455 | "\t-heavy-timer -- Heavy Timer, possibly more accurate but at a cost\n" | |||
456 | "\t-nonat -- disable auto nat detection\n" | |||
457 | "\t-nonatmap -- disable auto nat port mapping\n" | |||
458 | "\t-nocal -- disable clock calibration\n" | |||
459 | "\t-nort -- disable clock clock_realtime\n" | |||
460 | "\t-stop -- stop freeswitch\n" | |||
461 | "\t-nc -- do not output to a console and background\n" | |||
462 | #ifndef WIN32 | |||
463 | "\t-ncwait -- do not output to a console and background but wait until the system is ready before exiting (implies -nc)\n" | |||
464 | #endif | |||
465 | "\t-c -- output to a console and stay in the foreground\n" | |||
466 | "\n\tOptions to control locations of files:\n" | |||
467 | "\t-base [basedir] -- alternate prefix directory\n" | |||
468 | "\t-cfgname [filename] -- alternate filename for FreeSWITCH main configuration file\n" | |||
469 | "\t-conf [confdir] -- alternate directory for FreeSWITCH configuration files\n" | |||
470 | "\t-log [logdir] -- alternate directory for logfiles\n" | |||
471 | "\t-run [rundir] -- alternate directory for runtime files\n" | |||
472 | "\t-db [dbdir] -- alternate directory for the internal database\n" | |||
473 | "\t-mod [moddir] -- alternate directory for modules\n" | |||
474 | "\t-htdocs [htdocsdir] -- alternate directory for htdocs\n" | |||
475 | "\t-scripts [scriptsdir] -- alternate directory for scripts\n" | |||
476 | "\t-temp [directory] -- alternate directory for temporary files\n" | |||
477 | "\t-grammar [directory] -- alternate directory for grammar files\n" | |||
478 | "\t-certs [directory] -- alternate directory for certificates\n" | |||
479 | "\t-recordings [directory] -- alternate directory for recordings\n" | |||
480 | "\t-storage [directory] -- alternate directory for voicemail storage\n" | |||
481 | "\t-cache [directory] -- alternate directory for cache files\n" | |||
482 | "\t-sounds [directory] -- alternate directory for sound files\n"; | |||
483 | ||||
484 | ||||
485 | /** | |||
486 | * Check if value string starts with "-" | |||
487 | */ | |||
488 | static switch_bool_t is_option(const char *p) | |||
489 | { | |||
490 | /* skip whitespaces */ | |||
491 | while ((*p == 13) || (*p == 10) || (*p == 9) || (*p == 32) || (*p == 11)) p++; | |||
492 | return (p[0] == '-'); | |||
493 | } | |||
494 | ||||
495 | ||||
496 | /* the main application entry point */ | |||
497 | int main(int argc, char *argv[]) | |||
498 | { | |||
499 | char pid_path[PATH_MAX4096] = ""; /* full path to the pid file */ | |||
500 | char pid_buffer[32] = ""; /* pid string */ | |||
501 | char old_pid_buffer[32] = ""; /* pid string */ | |||
502 | switch_size_t pid_len, old_pid_len; | |||
503 | const char *err = NULL((void*)0); /* error value for return from freeswitch initialization */ | |||
504 | #ifndef WIN32 | |||
505 | switch_bool_t nf = SWITCH_FALSE; /* TRUE if we are running in nofork mode */ | |||
506 | switch_bool_t do_wait = SWITCH_FALSE; | |||
507 | char *runas_user = NULL((void*)0); | |||
508 | char *runas_group = NULL((void*)0); | |||
509 | switch_bool_t reincarnate = SWITCH_FALSE, reincarnate_reexec = SWITCH_FALSE; | |||
510 | int fds[2] = { 0, 0 }; | |||
511 | #else | |||
512 | switch_bool_t win32_service = SWITCH_FALSE; | |||
513 | #endif | |||
514 | switch_bool_t nc = SWITCH_FALSE; /* TRUE if we are running in noconsole mode */ | |||
515 | pid_t pid = 0; | |||
516 | int i, x; | |||
517 | char *opts; | |||
518 | char opts_str[1024] = ""; | |||
519 | char *local_argv[1024] = { 0 }; | |||
520 | int local_argc = argc; | |||
521 | char *arg_argv[128] = { 0 }; | |||
522 | int alt_dirs = 0, log_set = 0, run_set = 0, do_kill = 0; | |||
523 | int priority = 0; | |||
524 | #ifdef __sun | |||
525 | switch_core_flag_t flags = SCF_USE_SQL; | |||
526 | #else | |||
527 | switch_core_flag_t flags = SCF_USE_SQL | SCF_USE_AUTO_NAT | SCF_USE_NAT_MAPPING | SCF_CALIBRATE_CLOCK | SCF_USE_CLOCK_RT; | |||
528 | #endif | |||
529 | int ret = 0; | |||
530 | switch_status_t destroy_status; | |||
531 | switch_file_t *fd; | |||
532 | switch_memory_pool_t *pool = NULL((void*)0); | |||
533 | #ifdef HAVE_SETRLIMIT1 | |||
534 | #ifndef FS_64BIT1 | |||
535 | switch_bool_t waste = SWITCH_FALSE; | |||
536 | #endif | |||
537 | #endif | |||
538 | ||||
539 | for (x = 0; x < argc; x++) { | |||
| ||||
540 | local_argv[x] = argv[x]; | |||
541 | } | |||
542 | ||||
543 | if ((opts = getenv("FREESWITCH_OPTS"))) { | |||
544 | strncpy(opts_str, opts, sizeof(opts_str) - 1)__builtin_strncpy (opts_str, opts, sizeof(opts_str) - 1); | |||
545 | i = switch_separate_string(opts_str, ' ', arg_argv, (sizeof(arg_argv) / sizeof(arg_argv[0]))); | |||
546 | for (x = 0; x < i; x++) { | |||
547 | local_argv[local_argc++] = arg_argv[x]; | |||
548 | } | |||
549 | } | |||
550 | ||||
551 | if (local_argv[0] && strstr(local_argv[0], "freeswitchd")) { | |||
552 | nc = SWITCH_TRUE; | |||
553 | } | |||
554 | ||||
555 | for (x = 1; x < local_argc; x++) { | |||
556 | ||||
557 | if (switch_strlen_zero(local_argv[x])_zstr(local_argv[x])) | |||
558 | continue; | |||
559 | ||||
560 | if (!strcmp(local_argv[x], "-help")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-help") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-help"), (!((size_t)(const void *)((local_argv[x]) + 1) - ( size_t)(const void *)(local_argv[x]) == 1) || __s1_len >= 4 ) && (!((size_t)(const void *)(("-help") + 1) - (size_t )(const void *)("-help") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[x], "-help") : (__builtin_constant_p (local_argv [x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-help") && ((size_t)(const void *)(("-help") + 1) - (size_t)(const void *)("-help") == 1) ? __builtin_strcmp (local_argv [x], "-help") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-help"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv [x]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-help") && ((size_t)(const void *)(("-help") + 1) - (size_t)(const void *)("-help") == 1) && (__s2_len = __builtin_strlen ("-help"), __s2_len < 4) ? (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv [x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-help") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv [x]); int __result = (((const unsigned char *) (const char *) ("-help"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-help"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-help"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-help" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-help")))); }) || !strcmp(local_argv[x], "-h")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-h") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-h"), (!((size_t)(const void *)((local_argv[x]) + 1) - (size_t )(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-h") + 1) - (size_t)(const void * )("-h") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv [x], "-h") : (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-h" ) && ((size_t)(const void *)(("-h") + 1) - (size_t)(const void *)("-h") == 1) ? __builtin_strcmp (local_argv[x], "-h") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-h"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv[x]))[3] - __s2[3]); } } __result ; }))) : (__builtin_constant_p ("-h") && ((size_t)(const void *)(("-h") + 1) - (size_t)(const void *)("-h") == 1) && (__s2_len = __builtin_strlen ("-h"), __s2_len < 4) ? (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv [x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-h") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv[x ]); int __result = (((const unsigned char *) (const char *) ( "-h"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-h"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-h"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-h" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-h")))); }) || !strcmp(local_argv[x], "-?")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-?") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-?"), (!((size_t)(const void *)((local_argv[x]) + 1) - (size_t )(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-?") + 1) - (size_t)(const void * )("-?") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv [x], "-?") : (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-?" ) && ((size_t)(const void *)(("-?") + 1) - (size_t)(const void *)("-?") == 1) ? __builtin_strcmp (local_argv[x], "-?") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-?"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv[x]))[3] - __s2[3]); } } __result ; }))) : (__builtin_constant_p ("-?") && ((size_t)(const void *)(("-?") + 1) - (size_t)(const void *)("-?") == 1) && (__s2_len = __builtin_strlen ("-?"), __s2_len < 4) ? (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv [x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-?") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv[x ]); int __result = (((const unsigned char *) (const char *) ( "-?"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-?"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-?"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-?" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-?")))); })) { | |||
561 | printf("%s\n", usage); | |||
562 | exit(EXIT_SUCCESS0); | |||
563 | } | |||
564 | #ifdef WIN32 | |||
565 | if (x == 1 && !strcmp(local_argv[x], "-service")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-service") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-service"), (!((size_t)(const void *)(( local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *) (("-service") + 1) - (size_t)(const void *)("-service") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[x], "-service" ) : (__builtin_constant_p (local_argv[x]) && ((size_t )(const void *)((local_argv[x]) + 1) - (size_t)(const void *) (local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-service" ) && ((size_t)(const void *)(("-service") + 1) - (size_t )(const void *)("-service") == 1) ? __builtin_strcmp (local_argv [x], "-service") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-service"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv [x]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-service") && ((size_t)(const void *)(("-service") + 1) - (size_t)(const void *)("-service") == 1) && ( __s2_len = __builtin_strlen ("-service"), __s2_len < 4) ? ( __builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv [x]) == 1) ? __builtin_strcmp (local_argv[x], "-service") : ( - (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv[x]); int __result = (((const unsigned char *) (const char *) ("-service"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = ( ((const unsigned char *) (const char *) ("-service"))[1] - __s2 [1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ("-service"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-service"))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-service")))); })) { | |||
566 | /* New installs will always have the service name specified, but keep a default for compat */ | |||
567 | x++; | |||
568 | if (!switch_strlen_zero(local_argv[x])_zstr(local_argv[x])) { | |||
569 | switch_copy_string(service_name, local_argv[x], SERVICENAME_MAXLEN); | |||
570 | } else { | |||
571 | switch_copy_string(service_name, SERVICENAME_DEFAULT, SERVICENAME_MAXLEN); | |||
572 | } | |||
573 | ||||
574 | win32_service = SWITCH_TRUE; | |||
575 | continue; | |||
576 | } | |||
577 | ||||
578 | else if (x == 1 && !strcmp(local_argv[x], "-install")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-install") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-install"), (!((size_t)(const void *)(( local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *) (("-install") + 1) - (size_t)(const void *)("-install") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[x], "-install" ) : (__builtin_constant_p (local_argv[x]) && ((size_t )(const void *)((local_argv[x]) + 1) - (size_t)(const void *) (local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-install" ) && ((size_t)(const void *)(("-install") + 1) - (size_t )(const void *)("-install") == 1) ? __builtin_strcmp (local_argv [x], "-install") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-install"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv [x]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-install") && ((size_t)(const void *)(("-install") + 1) - (size_t)(const void *)("-install") == 1) && ( __s2_len = __builtin_strlen ("-install"), __s2_len < 4) ? ( __builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv [x]) == 1) ? __builtin_strcmp (local_argv[x], "-install") : ( - (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv[x]); int __result = (((const unsigned char *) (const char *) ("-install"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = ( ((const unsigned char *) (const char *) ("-install"))[1] - __s2 [1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ("-install"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-install"))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-install")))); })) { | |||
579 | char servicePath[PATH_MAX4096]; | |||
580 | char exePath[PATH_MAX4096]; | |||
581 | SC_HANDLE hService; | |||
582 | SC_HANDLE hSCManager; | |||
583 | SERVICE_DESCRIPTION desc; | |||
584 | desc.lpDescription = "The FreeSWITCH service."; | |||
585 | ||||
586 | x++; | |||
587 | if (!switch_strlen_zero(local_argv[x])_zstr(local_argv[x])) { | |||
588 | switch_copy_string(service_name, local_argv[x], SERVICENAME_MAXLEN); | |||
589 | } else { | |||
590 | switch_copy_string(service_name, SERVICENAME_DEFAULT, SERVICENAME_MAXLEN); | |||
591 | } | |||
592 | ||||
593 | GetModuleFileName(NULL((void*)0), exePath, sizeof(exePath)); | |||
594 | snprintf(servicePath, sizeof(servicePath), "%s -service %s", exePath, service_name); | |||
595 | ||||
596 | /* Perform service installation */ | |||
597 | ||||
598 | hSCManager = OpenSCManager(NULL((void*)0), NULL((void*)0), SC_MANAGER_ALL_ACCESS); | |||
599 | if (!hSCManager) { | |||
600 | fprintf(stderrstderr, "Could not open service manager (%u).\n", GetLastError()); | |||
601 | exit(EXIT_FAILURE1); | |||
602 | } | |||
603 | ||||
604 | hService = CreateService(hSCManager, service_name, service_name, GENERIC_READ | GENERIC_EXECUTE | SERVICE_CHANGE_CONFIG, SERVICE_WIN32_OWN_PROCESS, SERVICE_AUTO_START, SERVICE_ERROR_IGNORE, | |||
605 | servicePath, NULL((void*)0), NULL((void*)0), NULL((void*)0), NULL((void*)0), /* Service start name */ NULL((void*)0)); | |||
606 | if (!hService) { | |||
607 | fprintf(stderrstderr, "Error creating freeswitch service (%u).\n", GetLastError()); | |||
608 | CloseServiceHandle(hSCManager); | |||
609 | exit(EXIT_FAILURE1); | |||
610 | } | |||
611 | ||||
612 | /* Set desc, and don't care if it succeeds */ | |||
613 | if (!ChangeServiceConfig2(hService, SERVICE_CONFIG_DESCRIPTION, &desc)) { | |||
614 | fprintf(stderrstderr, "FreeSWITCH installed, but could not set the service description (%u).\n", GetLastError()); | |||
615 | } | |||
616 | ||||
617 | CloseServiceHandle(hService); | |||
618 | CloseServiceHandle(hSCManager); | |||
619 | exit(EXIT_SUCCESS0); | |||
620 | } | |||
621 | ||||
622 | else if (x == 1 && !strcmp(local_argv[x], "-uninstall")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-uninstall" ) && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-uninstall"), (!((size_t)(const void *) ((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-uninstall") + 1) - (size_t)(const void *)("-uninstall" ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[ x], "-uninstall") : (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-uninstall" ) && ((size_t)(const void *)(("-uninstall") + 1) - (size_t )(const void *)("-uninstall") == 1) ? __builtin_strcmp (local_argv [x], "-uninstall") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-uninstall"); int __result = (((const unsigned char *) (const char *) (local_argv [x]))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv [x]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-uninstall") && ((size_t)(const void *)(("-uninstall" ) + 1) - (size_t)(const void *)("-uninstall") == 1) && (__s2_len = __builtin_strlen ("-uninstall"), __s2_len < 4 ) ? (__builtin_constant_p (local_argv[x]) && ((size_t )(const void *)((local_argv[x]) + 1) - (size_t)(const void *) (local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-uninstall" ) : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv[x]); int __result = (((const unsigned char *) (const char *) ("-uninstall"))[0] - __s2[0] ); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ("-uninstall"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ("-uninstall"))[2 ] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-uninstall"))[3 ] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-uninstall")))); })) { | |||
623 | SC_HANDLE hService; | |||
624 | SC_HANDLE hSCManager; | |||
625 | BOOL deleted; | |||
626 | ||||
627 | x++; | |||
628 | if (!switch_strlen_zero(local_argv[x])_zstr(local_argv[x])) { | |||
629 | switch_copy_string(service_name, local_argv[x], SERVICENAME_MAXLEN); | |||
630 | } else { | |||
631 | switch_copy_string(service_name, SERVICENAME_DEFAULT, SERVICENAME_MAXLEN); | |||
632 | } | |||
633 | ||||
634 | /* Do the uninstallation */ | |||
635 | hSCManager = OpenSCManager(NULL((void*)0), NULL((void*)0), SC_MANAGER_ALL_ACCESS); | |||
636 | if (!hSCManager) { | |||
637 | fprintf(stderrstderr, "Could not open service manager (%u).\n", GetLastError()); | |||
638 | exit(EXIT_FAILURE1); | |||
639 | } | |||
640 | ||||
641 | hService = OpenService(hSCManager, service_name, DELETE); | |||
642 | if (!hService) { | |||
643 | fprintf(stderrstderr, "Error opening service (%u).\n", GetLastError()); | |||
644 | CloseServiceHandle(hSCManager); | |||
645 | exit(EXIT_FAILURE1); | |||
646 | } | |||
647 | ||||
648 | /* remove the service! */ | |||
649 | deleted = DeleteService(hService); | |||
650 | if (!deleted) { | |||
651 | fprintf(stderrstderr, "Error deleting service (%u).\n", GetLastError()); | |||
652 | } | |||
653 | ||||
654 | CloseServiceHandle(hService); | |||
655 | CloseServiceHandle(hSCManager); | |||
656 | exit(deleted ? EXIT_SUCCESS0 : EXIT_FAILURE1); | |||
657 | } | |||
658 | ||||
659 | else if (!strcmp(local_argv[x], "-monotonic-clock")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-monotonic-clock" ) && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-monotonic-clock"), (!((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[ x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-monotonic-clock") + 1) - (size_t)(const void *)("-monotonic-clock" ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[ x], "-monotonic-clock") : (__builtin_constant_p (local_argv[x ]) && ((size_t)(const void *)((local_argv[x]) + 1) - ( size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-monotonic-clock") && ((size_t)(const void *)(("-monotonic-clock" ) + 1) - (size_t)(const void *)("-monotonic-clock") == 1) ? __builtin_strcmp (local_argv[x], "-monotonic-clock") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-monotonic-clock"); int __result = (((const unsigned char * ) (const char *) (local_argv[x]))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv[x]))[3] - __s2[3]); } } __result ; }))) : (__builtin_constant_p ("-monotonic-clock") && ((size_t)(const void *)(("-monotonic-clock") + 1) - (size_t) (const void *)("-monotonic-clock") == 1) && (__s2_len = __builtin_strlen ("-monotonic-clock"), __s2_len < 4) ? ( __builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv [x]) == 1) ? __builtin_strcmp (local_argv[x], "-monotonic-clock" ) : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv[x]); int __result = (((const unsigned char *) (const char *) ("-monotonic-clock"))[0] - __s2 [0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ("-monotonic-clock" ))[1] - __s2[1]); if (__s2_len > 1 && __result == 0 ) { __result = (((const unsigned char *) (const char *) ("-monotonic-clock" ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0 ) __result = (((const unsigned char *) (const char *) ("-monotonic-clock" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-monotonic-clock")))); })) { | |||
660 | flags |= SCF_USE_WIN32_MONOTONIC; | |||
661 | } | |||
662 | #else | |||
663 | else if (!strcmp(local_argv[x], "-u")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-u") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-u"), (!((size_t)(const void *)((local_argv[x]) + 1) - (size_t )(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-u") + 1) - (size_t)(const void * )("-u") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv [x], "-u") : (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-u" ) && ((size_t)(const void *)(("-u") + 1) - (size_t)(const void *)("-u") == 1) ? __builtin_strcmp (local_argv[x], "-u") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-u"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv[x]))[3] - __s2[3]); } } __result ; }))) : (__builtin_constant_p ("-u") && ((size_t)(const void *)(("-u") + 1) - (size_t)(const void *)("-u") == 1) && (__s2_len = __builtin_strlen ("-u"), __s2_len < 4) ? (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv [x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-u") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv[x ]); int __result = (((const unsigned char *) (const char *) ( "-u"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-u"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-u"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-u" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-u")))); })) { | |||
664 | x++; | |||
665 | if (switch_strlen_zero(local_argv[x])_zstr(local_argv[x]) || is_option(local_argv[x])) { | |||
666 | fprintf(stderrstderr, "Option '%s' requires an argument!\n", local_argv[x - 1]); | |||
667 | exit(EXIT_FAILURE1); | |||
668 | } | |||
669 | runas_user = local_argv[x]; | |||
670 | } | |||
671 | ||||
672 | else if (!strcmp(local_argv[x], "-g")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-g") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-g"), (!((size_t)(const void *)((local_argv[x]) + 1) - (size_t )(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-g") + 1) - (size_t)(const void * )("-g") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv [x], "-g") : (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-g" ) && ((size_t)(const void *)(("-g") + 1) - (size_t)(const void *)("-g") == 1) ? __builtin_strcmp (local_argv[x], "-g") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-g"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv[x]))[3] - __s2[3]); } } __result ; }))) : (__builtin_constant_p ("-g") && ((size_t)(const void *)(("-g") + 1) - (size_t)(const void *)("-g") == 1) && (__s2_len = __builtin_strlen ("-g"), __s2_len < 4) ? (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv [x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-g") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv[x ]); int __result = (((const unsigned char *) (const char *) ( "-g"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-g"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-g"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-g" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-g")))); })) { | |||
673 | x++; | |||
674 | if (switch_strlen_zero(local_argv[x])_zstr(local_argv[x]) || is_option(local_argv[x])) { | |||
675 | fprintf(stderrstderr, "Option '%s' requires an argument!\n", local_argv[x - 1]); | |||
676 | exit(EXIT_FAILURE1); | |||
677 | } | |||
678 | runas_group = local_argv[x]; | |||
679 | } | |||
680 | ||||
681 | else if (!strcmp(local_argv[x], "-nf")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-nf") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-nf"), (!((size_t)(const void *)((local_argv[x]) + 1) - (size_t )(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-nf") + 1) - (size_t)(const void *)("-nf") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv [x], "-nf") : (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-nf" ) && ((size_t)(const void *)(("-nf") + 1) - (size_t)( const void *)("-nf") == 1) ? __builtin_strcmp (local_argv[x], "-nf") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-nf"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[0] - __s2[0 ]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-nf" ) && ((size_t)(const void *)(("-nf") + 1) - (size_t)( const void *)("-nf") == 1) && (__s2_len = __builtin_strlen ("-nf"), __s2_len < 4) ? (__builtin_constant_p (local_argv [x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-nf") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv [x]); int __result = (((const unsigned char *) (const char *) ("-nf"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-nf"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-nf"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-nf" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-nf")))); })) { | |||
682 | nf = SWITCH_TRUE; | |||
683 | } | |||
684 | ||||
685 | else if (!strcmp(local_argv[x], "-reincarnate")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-reincarnate" ) && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-reincarnate"), (!((size_t)(const void * )((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x] ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-reincarnate") + 1) - (size_t)(const void *)("-reincarnate" ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[ x], "-reincarnate") : (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-reincarnate" ) && ((size_t)(const void *)(("-reincarnate") + 1) - ( size_t)(const void *)("-reincarnate") == 1) ? __builtin_strcmp (local_argv[x], "-reincarnate") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-reincarnate" ); int __result = (((const unsigned char *) (const char *) (local_argv [x]))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv [x]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-reincarnate") && ((size_t)(const void *)(("-reincarnate" ) + 1) - (size_t)(const void *)("-reincarnate") == 1) && (__s2_len = __builtin_strlen ("-reincarnate"), __s2_len < 4) ? (__builtin_constant_p (local_argv[x]) && ((size_t )(const void *)((local_argv[x]) + 1) - (size_t)(const void *) (local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-reincarnate" ) : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv[x]); int __result = (((const unsigned char *) (const char *) ("-reincarnate"))[0] - __s2[ 0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ("-reincarnate")) [1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ("-reincarnate" ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0 ) __result = (((const unsigned char *) (const char *) ("-reincarnate" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-reincarnate")))); })) { | |||
686 | reincarnate = SWITCH_TRUE; | |||
687 | } | |||
688 | else if (!strcmp(local_argv[x], "-reincarnate-reexec")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-reincarnate-reexec" ) && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-reincarnate-reexec"), (!((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv [x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-reincarnate-reexec") + 1) - (size_t)(const void *)("-reincarnate-reexec" ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[ x], "-reincarnate-reexec") : (__builtin_constant_p (local_argv [x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-reincarnate-reexec") && ((size_t)(const void *)(( "-reincarnate-reexec") + 1) - (size_t)(const void *)("-reincarnate-reexec" ) == 1) ? __builtin_strcmp (local_argv[x], "-reincarnate-reexec" ) : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-reincarnate-reexec"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv [x]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-reincarnate-reexec") && ((size_t)(const void *)(( "-reincarnate-reexec") + 1) - (size_t)(const void *)("-reincarnate-reexec" ) == 1) && (__s2_len = __builtin_strlen ("-reincarnate-reexec" ), __s2_len < 4) ? (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[ x], "-reincarnate-reexec") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv [x]); int __result = (((const unsigned char *) (const char *) ("-reincarnate-reexec"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ("-reincarnate-reexec"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ("-reincarnate-reexec"))[2] - __s2[2] ); if (__s2_len > 2 && __result == 0) __result = ( ((const unsigned char *) (const char *) ("-reincarnate-reexec" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-reincarnate-reexec")))); })) { | |||
689 | reincarnate = SWITCH_TRUE; | |||
690 | reincarnate_reexec = SWITCH_TRUE; | |||
691 | } | |||
692 | ||||
693 | else if (!strcmp(local_argv[x], "-version")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-version") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-version"), (!((size_t)(const void *)(( local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *) (("-version") + 1) - (size_t)(const void *)("-version") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[x], "-version" ) : (__builtin_constant_p (local_argv[x]) && ((size_t )(const void *)((local_argv[x]) + 1) - (size_t)(const void *) (local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-version" ) && ((size_t)(const void *)(("-version") + 1) - (size_t )(const void *)("-version") == 1) ? __builtin_strcmp (local_argv [x], "-version") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-version"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv [x]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-version") && ((size_t)(const void *)(("-version") + 1) - (size_t)(const void *)("-version") == 1) && ( __s2_len = __builtin_strlen ("-version"), __s2_len < 4) ? ( __builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv [x]) == 1) ? __builtin_strcmp (local_argv[x], "-version") : ( - (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv[x]); int __result = (((const unsigned char *) (const char *) ("-version"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = ( ((const unsigned char *) (const char *) ("-version"))[1] - __s2 [1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ("-version"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-version"))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-version")))); })) { | |||
694 | fprintf(stdoutstdout, "FreeSWITCH version: %s (%s)\n", switch_version_full(), switch_version_revision_human()); | |||
695 | exit(EXIT_SUCCESS0); | |||
696 | } | |||
697 | #endif | |||
698 | #ifdef HAVE_SETRLIMIT1 | |||
699 | else if (!strcmp(local_argv[x], "-core")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-core") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-core"), (!((size_t)(const void *)((local_argv[x]) + 1) - ( size_t)(const void *)(local_argv[x]) == 1) || __s1_len >= 4 ) && (!((size_t)(const void *)(("-core") + 1) - (size_t )(const void *)("-core") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[x], "-core") : (__builtin_constant_p (local_argv [x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-core") && ((size_t)(const void *)(("-core") + 1) - (size_t)(const void *)("-core") == 1) ? __builtin_strcmp (local_argv [x], "-core") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-core"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv [x]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-core") && ((size_t)(const void *)(("-core") + 1) - (size_t)(const void *)("-core") == 1) && (__s2_len = __builtin_strlen ("-core"), __s2_len < 4) ? (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv [x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-core") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv [x]); int __result = (((const unsigned char *) (const char *) ("-core"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-core"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-core"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-core" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-core")))); })) { | |||
700 | struct rlimit rlp; | |||
701 | memset(&rlp, 0, sizeof(rlp)); | |||
702 | rlp.rlim_cur = RLIM_INFINITY((__rlim_t) -1); | |||
703 | rlp.rlim_max = RLIM_INFINITY((__rlim_t) -1); | |||
704 | setrlimit(RLIMIT_CORERLIMIT_CORE, &rlp); | |||
705 | } | |||
706 | ||||
707 | else if (!strcmp(local_argv[x], "-waste")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-waste") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-waste"), (!((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-waste") + 1) - (size_t )(const void *)("-waste") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[x], "-waste") : (__builtin_constant_p (local_argv [x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-waste") && ((size_t)(const void *)(("-waste") + 1 ) - (size_t)(const void *)("-waste") == 1) ? __builtin_strcmp (local_argv[x], "-waste") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-waste" ); int __result = (((const unsigned char *) (const char *) (local_argv [x]))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv [x]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-waste") && ((size_t)(const void *)(("-waste") + 1 ) - (size_t)(const void *)("-waste") == 1) && (__s2_len = __builtin_strlen ("-waste"), __s2_len < 4) ? (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv [x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-waste") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv [x]); int __result = (((const unsigned char *) (const char *) ("-waste"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-waste"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-waste"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-waste" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-waste")))); })) { | |||
708 | #ifndef FS_64BIT1 | |||
709 | fprintf(stderrstderr, "WARNING: Wasting up to 8 megs of memory per thread.\n"); | |||
710 | sleep(2); | |||
711 | waste = SWITCH_TRUE; | |||
712 | #endif | |||
713 | } | |||
714 | ||||
715 | else if (!strcmp(local_argv[x], "-no-auto-stack")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-no-auto-stack" ) && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-no-auto-stack"), (!((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[ x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-no-auto-stack") + 1) - (size_t)(const void *)("-no-auto-stack" ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[ x], "-no-auto-stack") : (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t )(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-no-auto-stack" ) && ((size_t)(const void *)(("-no-auto-stack") + 1) - (size_t)(const void *)("-no-auto-stack") == 1) ? __builtin_strcmp (local_argv[x], "-no-auto-stack") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-no-auto-stack" ); int __result = (((const unsigned char *) (const char *) (local_argv [x]))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv [x]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-no-auto-stack") && ((size_t)(const void *)(("-no-auto-stack" ) + 1) - (size_t)(const void *)("-no-auto-stack") == 1) && (__s2_len = __builtin_strlen ("-no-auto-stack"), __s2_len < 4) ? (__builtin_constant_p (local_argv[x]) && ((size_t )(const void *)((local_argv[x]) + 1) - (size_t)(const void *) (local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-no-auto-stack" ) : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv[x]); int __result = (((const unsigned char *) (const char *) ("-no-auto-stack"))[0] - __s2 [0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ("-no-auto-stack" ))[1] - __s2[1]); if (__s2_len > 1 && __result == 0 ) { __result = (((const unsigned char *) (const char *) ("-no-auto-stack" ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0 ) __result = (((const unsigned char *) (const char *) ("-no-auto-stack" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-no-auto-stack")))); })) { | |||
716 | #ifndef FS_64BIT1 | |||
717 | waste = SWITCH_TRUE; | |||
718 | #endif | |||
719 | } | |||
720 | #endif | |||
721 | else if (!strcmp(local_argv[x], "-hp")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-hp") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-hp"), (!((size_t)(const void *)((local_argv[x]) + 1) - (size_t )(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-hp") + 1) - (size_t)(const void *)("-hp") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv [x], "-hp") : (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-hp" ) && ((size_t)(const void *)(("-hp") + 1) - (size_t)( const void *)("-hp") == 1) ? __builtin_strcmp (local_argv[x], "-hp") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-hp"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[0] - __s2[0 ]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-hp" ) && ((size_t)(const void *)(("-hp") + 1) - (size_t)( const void *)("-hp") == 1) && (__s2_len = __builtin_strlen ("-hp"), __s2_len < 4) ? (__builtin_constant_p (local_argv [x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-hp") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv [x]); int __result = (((const unsigned char *) (const char *) ("-hp"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-hp"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-hp"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-hp" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-hp")))); }) || !strcmp(local_argv[x], "-rp")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-rp") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-rp"), (!((size_t)(const void *)((local_argv[x]) + 1) - (size_t )(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-rp") + 1) - (size_t)(const void *)("-rp") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv [x], "-rp") : (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-rp" ) && ((size_t)(const void *)(("-rp") + 1) - (size_t)( const void *)("-rp") == 1) ? __builtin_strcmp (local_argv[x], "-rp") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-rp"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[0] - __s2[0 ]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-rp" ) && ((size_t)(const void *)(("-rp") + 1) - (size_t)( const void *)("-rp") == 1) && (__s2_len = __builtin_strlen ("-rp"), __s2_len < 4) ? (__builtin_constant_p (local_argv [x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-rp") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv [x]); int __result = (((const unsigned char *) (const char *) ("-rp"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-rp"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-rp"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-rp" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-rp")))); })) { | |||
722 | priority = 2; | |||
723 | } | |||
724 | ||||
725 | else if (!strcmp(local_argv[x], "-lp")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-lp") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-lp"), (!((size_t)(const void *)((local_argv[x]) + 1) - (size_t )(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-lp") + 1) - (size_t)(const void *)("-lp") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv [x], "-lp") : (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-lp" ) && ((size_t)(const void *)(("-lp") + 1) - (size_t)( const void *)("-lp") == 1) ? __builtin_strcmp (local_argv[x], "-lp") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-lp"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[0] - __s2[0 ]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-lp" ) && ((size_t)(const void *)(("-lp") + 1) - (size_t)( const void *)("-lp") == 1) && (__s2_len = __builtin_strlen ("-lp"), __s2_len < 4) ? (__builtin_constant_p (local_argv [x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-lp") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv [x]); int __result = (((const unsigned char *) (const char *) ("-lp"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-lp"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-lp"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-lp" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-lp")))); })) { | |||
726 | priority = -1; | |||
727 | } | |||
728 | ||||
729 | else if (!strcmp(local_argv[x], "-np")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-np") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-np"), (!((size_t)(const void *)((local_argv[x]) + 1) - (size_t )(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-np") + 1) - (size_t)(const void *)("-np") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv [x], "-np") : (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-np" ) && ((size_t)(const void *)(("-np") + 1) - (size_t)( const void *)("-np") == 1) ? __builtin_strcmp (local_argv[x], "-np") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-np"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[0] - __s2[0 ]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-np" ) && ((size_t)(const void *)(("-np") + 1) - (size_t)( const void *)("-np") == 1) && (__s2_len = __builtin_strlen ("-np"), __s2_len < 4) ? (__builtin_constant_p (local_argv [x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-np") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv [x]); int __result = (((const unsigned char *) (const char *) ("-np"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-np"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-np"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-np" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-np")))); })) { | |||
730 | priority = 1; | |||
731 | } | |||
732 | ||||
733 | else if (!strcmp(local_argv[x], "-nosql")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-nosql") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-nosql"), (!((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-nosql") + 1) - (size_t )(const void *)("-nosql") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[x], "-nosql") : (__builtin_constant_p (local_argv [x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-nosql") && ((size_t)(const void *)(("-nosql") + 1 ) - (size_t)(const void *)("-nosql") == 1) ? __builtin_strcmp (local_argv[x], "-nosql") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-nosql" ); int __result = (((const unsigned char *) (const char *) (local_argv [x]))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv [x]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-nosql") && ((size_t)(const void *)(("-nosql") + 1 ) - (size_t)(const void *)("-nosql") == 1) && (__s2_len = __builtin_strlen ("-nosql"), __s2_len < 4) ? (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv [x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-nosql") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv [x]); int __result = (((const unsigned char *) (const char *) ("-nosql"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-nosql"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-nosql"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-nosql" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-nosql")))); })) { | |||
734 | flags &= ~SCF_USE_SQL; | |||
735 | } | |||
736 | ||||
737 | else if (!strcmp(local_argv[x], "-nonat")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-nonat") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-nonat"), (!((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-nonat") + 1) - (size_t )(const void *)("-nonat") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[x], "-nonat") : (__builtin_constant_p (local_argv [x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-nonat") && ((size_t)(const void *)(("-nonat") + 1 ) - (size_t)(const void *)("-nonat") == 1) ? __builtin_strcmp (local_argv[x], "-nonat") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-nonat" ); int __result = (((const unsigned char *) (const char *) (local_argv [x]))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv [x]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-nonat") && ((size_t)(const void *)(("-nonat") + 1 ) - (size_t)(const void *)("-nonat") == 1) && (__s2_len = __builtin_strlen ("-nonat"), __s2_len < 4) ? (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv [x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-nonat") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv [x]); int __result = (((const unsigned char *) (const char *) ("-nonat"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-nonat"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-nonat"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-nonat" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-nonat")))); })) { | |||
738 | flags &= ~SCF_USE_AUTO_NAT; | |||
739 | } | |||
740 | ||||
741 | else if (!strcmp(local_argv[x], "-nonatmap")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-nonatmap" ) && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-nonatmap"), (!((size_t)(const void *)( (local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *) (("-nonatmap") + 1) - (size_t)(const void *)("-nonatmap") == 1 ) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[x], "-nonatmap" ) : (__builtin_constant_p (local_argv[x]) && ((size_t )(const void *)((local_argv[x]) + 1) - (size_t)(const void *) (local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-nonatmap" ) && ((size_t)(const void *)(("-nonatmap") + 1) - (size_t )(const void *)("-nonatmap") == 1) ? __builtin_strcmp (local_argv [x], "-nonatmap") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-nonatmap"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv [x]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-nonatmap") && ((size_t)(const void *)(("-nonatmap" ) + 1) - (size_t)(const void *)("-nonatmap") == 1) && (__s2_len = __builtin_strlen ("-nonatmap"), __s2_len < 4) ? (__builtin_constant_p (local_argv[x]) && ((size_t) (const void *)((local_argv[x]) + 1) - (size_t)(const void *)( local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-nonatmap" ) : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv[x]); int __result = (((const unsigned char *) (const char *) ("-nonatmap"))[0] - __s2[0]) ; if (__s2_len > 0 && __result == 0) { __result = ( ((const unsigned char *) (const char *) ("-nonatmap"))[1] - __s2 [1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ("-nonatmap"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-nonatmap"))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-nonatmap")))); })) { | |||
742 | flags &= ~SCF_USE_NAT_MAPPING; | |||
743 | } | |||
744 | ||||
745 | else if (!strcmp(local_argv[x], "-heavy-timer")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-heavy-timer" ) && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-heavy-timer"), (!((size_t)(const void * )((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x] ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-heavy-timer") + 1) - (size_t)(const void *)("-heavy-timer" ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[ x], "-heavy-timer") : (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-heavy-timer" ) && ((size_t)(const void *)(("-heavy-timer") + 1) - ( size_t)(const void *)("-heavy-timer") == 1) ? __builtin_strcmp (local_argv[x], "-heavy-timer") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-heavy-timer" ); int __result = (((const unsigned char *) (const char *) (local_argv [x]))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv [x]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-heavy-timer") && ((size_t)(const void *)(("-heavy-timer" ) + 1) - (size_t)(const void *)("-heavy-timer") == 1) && (__s2_len = __builtin_strlen ("-heavy-timer"), __s2_len < 4) ? (__builtin_constant_p (local_argv[x]) && ((size_t )(const void *)((local_argv[x]) + 1) - (size_t)(const void *) (local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-heavy-timer" ) : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv[x]); int __result = (((const unsigned char *) (const char *) ("-heavy-timer"))[0] - __s2[ 0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ("-heavy-timer")) [1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ("-heavy-timer" ))[2] - __s2[2]); if (__s2_len > 2 && __result == 0 ) __result = (((const unsigned char *) (const char *) ("-heavy-timer" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-heavy-timer")))); })) { | |||
746 | flags |= SCF_USE_HEAVY_TIMING; | |||
747 | } | |||
748 | ||||
749 | else if (!strcmp(local_argv[x], "-nort")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-nort") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-nort"), (!((size_t)(const void *)((local_argv[x]) + 1) - ( size_t)(const void *)(local_argv[x]) == 1) || __s1_len >= 4 ) && (!((size_t)(const void *)(("-nort") + 1) - (size_t )(const void *)("-nort") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[x], "-nort") : (__builtin_constant_p (local_argv [x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-nort") && ((size_t)(const void *)(("-nort") + 1) - (size_t)(const void *)("-nort") == 1) ? __builtin_strcmp (local_argv [x], "-nort") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-nort"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv [x]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-nort") && ((size_t)(const void *)(("-nort") + 1) - (size_t)(const void *)("-nort") == 1) && (__s2_len = __builtin_strlen ("-nort"), __s2_len < 4) ? (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv [x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-nort") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv [x]); int __result = (((const unsigned char *) (const char *) ("-nort"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-nort"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-nort"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-nort" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-nort")))); })) { | |||
750 | flags &= ~SCF_USE_CLOCK_RT; | |||
751 | } | |||
752 | ||||
753 | else if (!strcmp(local_argv[x], "-nocal")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-nocal") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-nocal"), (!((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-nocal") + 1) - (size_t )(const void *)("-nocal") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[x], "-nocal") : (__builtin_constant_p (local_argv [x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-nocal") && ((size_t)(const void *)(("-nocal") + 1 ) - (size_t)(const void *)("-nocal") == 1) ? __builtin_strcmp (local_argv[x], "-nocal") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-nocal" ); int __result = (((const unsigned char *) (const char *) (local_argv [x]))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv [x]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-nocal") && ((size_t)(const void *)(("-nocal") + 1 ) - (size_t)(const void *)("-nocal") == 1) && (__s2_len = __builtin_strlen ("-nocal"), __s2_len < 4) ? (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv [x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-nocal") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv [x]); int __result = (((const unsigned char *) (const char *) ("-nocal"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-nocal"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-nocal"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-nocal" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-nocal")))); })) { | |||
754 | flags &= ~SCF_CALIBRATE_CLOCK; | |||
755 | } | |||
756 | ||||
757 | else if (!strcmp(local_argv[x], "-vg")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-vg") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-vg"), (!((size_t)(const void *)((local_argv[x]) + 1) - (size_t )(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-vg") + 1) - (size_t)(const void *)("-vg") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv [x], "-vg") : (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-vg" ) && ((size_t)(const void *)(("-vg") + 1) - (size_t)( const void *)("-vg") == 1) ? __builtin_strcmp (local_argv[x], "-vg") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-vg"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[0] - __s2[0 ]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-vg" ) && ((size_t)(const void *)(("-vg") + 1) - (size_t)( const void *)("-vg") == 1) && (__s2_len = __builtin_strlen ("-vg"), __s2_len < 4) ? (__builtin_constant_p (local_argv [x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-vg") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv [x]); int __result = (((const unsigned char *) (const char *) ("-vg"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-vg"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-vg"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-vg" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-vg")))); })) { | |||
758 | flags |= SCF_VG; | |||
759 | } | |||
760 | ||||
761 | else if (!strcmp(local_argv[x], "-stop")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-stop") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-stop"), (!((size_t)(const void *)((local_argv[x]) + 1) - ( size_t)(const void *)(local_argv[x]) == 1) || __s1_len >= 4 ) && (!((size_t)(const void *)(("-stop") + 1) - (size_t )(const void *)("-stop") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[x], "-stop") : (__builtin_constant_p (local_argv [x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-stop") && ((size_t)(const void *)(("-stop") + 1) - (size_t)(const void *)("-stop") == 1) ? __builtin_strcmp (local_argv [x], "-stop") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-stop"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv [x]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-stop") && ((size_t)(const void *)(("-stop") + 1) - (size_t)(const void *)("-stop") == 1) && (__s2_len = __builtin_strlen ("-stop"), __s2_len < 4) ? (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv [x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-stop") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv [x]); int __result = (((const unsigned char *) (const char *) ("-stop"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-stop"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-stop"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-stop" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-stop")))); })) { | |||
762 | do_kill = SWITCH_TRUE; | |||
763 | } | |||
764 | ||||
765 | else if (!strcmp(local_argv[x], "-nc")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-nc") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-nc"), (!((size_t)(const void *)((local_argv[x]) + 1) - (size_t )(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-nc") + 1) - (size_t)(const void *)("-nc") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv [x], "-nc") : (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-nc" ) && ((size_t)(const void *)(("-nc") + 1) - (size_t)( const void *)("-nc") == 1) ? __builtin_strcmp (local_argv[x], "-nc") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-nc"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[0] - __s2[0 ]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-nc" ) && ((size_t)(const void *)(("-nc") + 1) - (size_t)( const void *)("-nc") == 1) && (__s2_len = __builtin_strlen ("-nc"), __s2_len < 4) ? (__builtin_constant_p (local_argv [x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-nc") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv [x]); int __result = (((const unsigned char *) (const char *) ("-nc"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-nc"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-nc"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-nc" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-nc")))); })) { | |||
766 | nc = SWITCH_TRUE; | |||
767 | } | |||
768 | #ifndef WIN32 | |||
769 | else if (!strcmp(local_argv[x], "-ncwait")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-ncwait") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-ncwait"), (!((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-ncwait") + 1) - ( size_t)(const void *)("-ncwait") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[x], "-ncwait") : (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv [x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4 ) ? (__builtin_constant_p ("-ncwait") && ((size_t)(const void *)(("-ncwait") + 1) - (size_t)(const void *)("-ncwait") == 1) ? __builtin_strcmp (local_argv[x], "-ncwait") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-ncwait"); int __result = (((const unsigned char * ) (const char *) (local_argv[x]))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv[x]))[3] - __s2[3]); } } __result ; }))) : (__builtin_constant_p ("-ncwait") && ((size_t )(const void *)(("-ncwait") + 1) - (size_t)(const void *)("-ncwait" ) == 1) && (__s2_len = __builtin_strlen ("-ncwait"), __s2_len < 4) ? (__builtin_constant_p (local_argv[x]) && ( (size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-ncwait" ) : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv[x]); int __result = (((const unsigned char *) (const char *) ("-ncwait"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ("-ncwait"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ("-ncwait"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-ncwait"))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv[x], "-ncwait" )))); })) { | |||
770 | nc = SWITCH_TRUE; | |||
771 | do_wait = SWITCH_TRUE; | |||
772 | } | |||
773 | #endif | |||
774 | else if (!strcmp(local_argv[x], "-c")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-c") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-c"), (!((size_t)(const void *)((local_argv[x]) + 1) - (size_t )(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-c") + 1) - (size_t)(const void * )("-c") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv [x], "-c") : (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-c" ) && ((size_t)(const void *)(("-c") + 1) - (size_t)(const void *)("-c") == 1) ? __builtin_strcmp (local_argv[x], "-c") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-c"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv[x]))[3] - __s2[3]); } } __result ; }))) : (__builtin_constant_p ("-c") && ((size_t)(const void *)(("-c") + 1) - (size_t)(const void *)("-c") == 1) && (__s2_len = __builtin_strlen ("-c"), __s2_len < 4) ? (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv [x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-c") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv[x ]); int __result = (((const unsigned char *) (const char *) ( "-c"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-c"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-c"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-c" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-c")))); })) { | |||
775 | nc = SWITCH_FALSE; | |||
776 | } | |||
777 | ||||
778 | else if (!strcmp(local_argv[x], "-conf")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-conf") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-conf"), (!((size_t)(const void *)((local_argv[x]) + 1) - ( size_t)(const void *)(local_argv[x]) == 1) || __s1_len >= 4 ) && (!((size_t)(const void *)(("-conf") + 1) - (size_t )(const void *)("-conf") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[x], "-conf") : (__builtin_constant_p (local_argv [x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-conf") && ((size_t)(const void *)(("-conf") + 1) - (size_t)(const void *)("-conf") == 1) ? __builtin_strcmp (local_argv [x], "-conf") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-conf"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv [x]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-conf") && ((size_t)(const void *)(("-conf") + 1) - (size_t)(const void *)("-conf") == 1) && (__s2_len = __builtin_strlen ("-conf"), __s2_len < 4) ? (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv [x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-conf") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv [x]); int __result = (((const unsigned char *) (const char *) ("-conf"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-conf"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-conf"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-conf" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-conf")))); })) { | |||
779 | x++; | |||
780 | if (switch_strlen_zero(local_argv[x])_zstr(local_argv[x]) || is_option(local_argv[x])) { | |||
781 | fprintf(stderrstderr, "When using -conf you must specify a config directory\n"); | |||
782 | return 255; | |||
783 | } | |||
784 | ||||
785 | SWITCH_GLOBAL_dirs.conf_dir = (char *) malloc(strlen(local_argv[x]) + 1); | |||
786 | if (!SWITCH_GLOBAL_dirs.conf_dir) { | |||
787 | fprintf(stderrstderr, "Allocation error\n"); | |||
788 | return 255; | |||
789 | } | |||
790 | strcpy(SWITCH_GLOBAL_dirs.conf_dir, local_argv[x]); | |||
791 | alt_dirs++; | |||
792 | } | |||
793 | ||||
794 | else if (!strcmp(local_argv[x], "-mod")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-mod") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-mod"), (!((size_t)(const void *)((local_argv[x]) + 1) - ( size_t)(const void *)(local_argv[x]) == 1) || __s1_len >= 4 ) && (!((size_t)(const void *)(("-mod") + 1) - (size_t )(const void *)("-mod") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[x], "-mod") : (__builtin_constant_p (local_argv[ x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-mod") && ((size_t)(const void *)(("-mod") + 1) - ( size_t)(const void *)("-mod") == 1) ? __builtin_strcmp (local_argv [x], "-mod") : (__extension__ ({ const unsigned char *__s2 = ( const unsigned char *) (const char *) ("-mod"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv [x]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-mod") && ((size_t)(const void *)(("-mod") + 1) - ( size_t)(const void *)("-mod") == 1) && (__s2_len = __builtin_strlen ("-mod"), __s2_len < 4) ? (__builtin_constant_p (local_argv [x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-mod") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv [x]); int __result = (((const unsigned char *) (const char *) ("-mod"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-mod"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-mod"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-mod" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-mod")))); })) { | |||
795 | x++; | |||
796 | if (switch_strlen_zero(local_argv[x])_zstr(local_argv[x]) || is_option(local_argv[x])) { | |||
797 | fprintf(stderrstderr, "When using -mod you must specify a module directory\n"); | |||
798 | return 255; | |||
799 | } | |||
800 | ||||
801 | SWITCH_GLOBAL_dirs.mod_dir = (char *) malloc(strlen(local_argv[x]) + 1); | |||
802 | if (!SWITCH_GLOBAL_dirs.mod_dir) { | |||
803 | fprintf(stderrstderr, "Allocation error\n"); | |||
804 | return 255; | |||
805 | } | |||
806 | strcpy(SWITCH_GLOBAL_dirs.mod_dir, local_argv[x]); | |||
807 | } | |||
808 | ||||
809 | else if (!strcmp(local_argv[x], "-log")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-log") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-log"), (!((size_t)(const void *)((local_argv[x]) + 1) - ( size_t)(const void *)(local_argv[x]) == 1) || __s1_len >= 4 ) && (!((size_t)(const void *)(("-log") + 1) - (size_t )(const void *)("-log") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[x], "-log") : (__builtin_constant_p (local_argv[ x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-log") && ((size_t)(const void *)(("-log") + 1) - ( size_t)(const void *)("-log") == 1) ? __builtin_strcmp (local_argv [x], "-log") : (__extension__ ({ const unsigned char *__s2 = ( const unsigned char *) (const char *) ("-log"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv [x]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-log") && ((size_t)(const void *)(("-log") + 1) - ( size_t)(const void *)("-log") == 1) && (__s2_len = __builtin_strlen ("-log"), __s2_len < 4) ? (__builtin_constant_p (local_argv [x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-log") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv [x]); int __result = (((const unsigned char *) (const char *) ("-log"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-log"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-log"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-log" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-log")))); })) { | |||
810 | x++; | |||
811 | if (switch_strlen_zero(local_argv[x])_zstr(local_argv[x]) || is_option(local_argv[x])) { | |||
812 | fprintf(stderrstderr, "When using -log you must specify a log directory\n"); | |||
813 | return 255; | |||
814 | } | |||
815 | ||||
816 | SWITCH_GLOBAL_dirs.log_dir = (char *) malloc(strlen(local_argv[x]) + 1); | |||
817 | if (!SWITCH_GLOBAL_dirs.log_dir) { | |||
818 | fprintf(stderrstderr, "Allocation error\n"); | |||
819 | return 255; | |||
820 | } | |||
821 | strcpy(SWITCH_GLOBAL_dirs.log_dir, local_argv[x]); | |||
822 | alt_dirs++; | |||
823 | log_set = SWITCH_TRUE; | |||
824 | } | |||
825 | ||||
826 | else if (!strcmp(local_argv[x], "-run")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-run") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-run"), (!((size_t)(const void *)((local_argv[x]) + 1) - ( size_t)(const void *)(local_argv[x]) == 1) || __s1_len >= 4 ) && (!((size_t)(const void *)(("-run") + 1) - (size_t )(const void *)("-run") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[x], "-run") : (__builtin_constant_p (local_argv[ x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-run") && ((size_t)(const void *)(("-run") + 1) - ( size_t)(const void *)("-run") == 1) ? __builtin_strcmp (local_argv [x], "-run") : (__extension__ ({ const unsigned char *__s2 = ( const unsigned char *) (const char *) ("-run"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv [x]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-run") && ((size_t)(const void *)(("-run") + 1) - ( size_t)(const void *)("-run") == 1) && (__s2_len = __builtin_strlen ("-run"), __s2_len < 4) ? (__builtin_constant_p (local_argv [x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-run") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv [x]); int __result = (((const unsigned char *) (const char *) ("-run"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-run"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-run"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-run" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-run")))); })) { | |||
827 | x++; | |||
828 | if (switch_strlen_zero(local_argv[x])_zstr(local_argv[x]) || is_option(local_argv[x])) { | |||
829 | fprintf(stderrstderr, "When using -run you must specify a pid directory\n"); | |||
830 | return 255; | |||
831 | } | |||
832 | ||||
833 | SWITCH_GLOBAL_dirs.run_dir = (char *) malloc(strlen(local_argv[x]) + 1); | |||
834 | if (!SWITCH_GLOBAL_dirs.run_dir) { | |||
835 | fprintf(stderrstderr, "Allocation error\n"); | |||
836 | return 255; | |||
837 | } | |||
838 | strcpy(SWITCH_GLOBAL_dirs.run_dir, local_argv[x]); | |||
839 | run_set = SWITCH_TRUE; | |||
840 | } | |||
841 | ||||
842 | else if (!strcmp(local_argv[x], "-db")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-db") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-db"), (!((size_t)(const void *)((local_argv[x]) + 1) - (size_t )(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-db") + 1) - (size_t)(const void *)("-db") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv [x], "-db") : (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-db" ) && ((size_t)(const void *)(("-db") + 1) - (size_t)( const void *)("-db") == 1) ? __builtin_strcmp (local_argv[x], "-db") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-db"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[0] - __s2[0 ]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-db" ) && ((size_t)(const void *)(("-db") + 1) - (size_t)( const void *)("-db") == 1) && (__s2_len = __builtin_strlen ("-db"), __s2_len < 4) ? (__builtin_constant_p (local_argv [x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-db") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv [x]); int __result = (((const unsigned char *) (const char *) ("-db"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-db"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-db"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-db" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-db")))); })) { | |||
843 | x++; | |||
844 | if (switch_strlen_zero(local_argv[x])_zstr(local_argv[x]) || is_option(local_argv[x])) { | |||
845 | fprintf(stderrstderr, "When using -db you must specify a db directory\n"); | |||
846 | return 255; | |||
847 | } | |||
848 | ||||
849 | SWITCH_GLOBAL_dirs.db_dir = (char *) malloc(strlen(local_argv[x]) + 1); | |||
850 | if (!SWITCH_GLOBAL_dirs.db_dir) { | |||
851 | fprintf(stderrstderr, "Allocation error\n"); | |||
852 | return 255; | |||
853 | } | |||
854 | strcpy(SWITCH_GLOBAL_dirs.db_dir, local_argv[x]); | |||
855 | alt_dirs++; | |||
856 | } | |||
857 | ||||
858 | else if (!strcmp(local_argv[x], "-scripts")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-scripts") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-scripts"), (!((size_t)(const void *)(( local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *) (("-scripts") + 1) - (size_t)(const void *)("-scripts") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[x], "-scripts" ) : (__builtin_constant_p (local_argv[x]) && ((size_t )(const void *)((local_argv[x]) + 1) - (size_t)(const void *) (local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-scripts" ) && ((size_t)(const void *)(("-scripts") + 1) - (size_t )(const void *)("-scripts") == 1) ? __builtin_strcmp (local_argv [x], "-scripts") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-scripts"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv [x]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-scripts") && ((size_t)(const void *)(("-scripts") + 1) - (size_t)(const void *)("-scripts") == 1) && ( __s2_len = __builtin_strlen ("-scripts"), __s2_len < 4) ? ( __builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv [x]) == 1) ? __builtin_strcmp (local_argv[x], "-scripts") : ( - (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv[x]); int __result = (((const unsigned char *) (const char *) ("-scripts"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = ( ((const unsigned char *) (const char *) ("-scripts"))[1] - __s2 [1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ("-scripts"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-scripts"))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-scripts")))); })) { | |||
859 | x++; | |||
860 | if (switch_strlen_zero(local_argv[x])_zstr(local_argv[x]) || is_option(local_argv[x])) { | |||
861 | fprintf(stderrstderr, "When using -scripts you must specify a scripts directory\n"); | |||
862 | return 255; | |||
863 | } | |||
864 | ||||
865 | SWITCH_GLOBAL_dirs.script_dir = (char *) malloc(strlen(local_argv[x]) + 1); | |||
866 | if (!SWITCH_GLOBAL_dirs.script_dir) { | |||
867 | fprintf(stderrstderr, "Allocation error\n"); | |||
868 | return 255; | |||
869 | } | |||
870 | strcpy(SWITCH_GLOBAL_dirs.script_dir, local_argv[x]); | |||
871 | } | |||
872 | ||||
873 | else if (!strcmp(local_argv[x], "-htdocs")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-htdocs") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-htdocs"), (!((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-htdocs") + 1) - ( size_t)(const void *)("-htdocs") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[x], "-htdocs") : (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv [x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4 ) ? (__builtin_constant_p ("-htdocs") && ((size_t)(const void *)(("-htdocs") + 1) - (size_t)(const void *)("-htdocs") == 1) ? __builtin_strcmp (local_argv[x], "-htdocs") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-htdocs"); int __result = (((const unsigned char * ) (const char *) (local_argv[x]))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv[x]))[3] - __s2[3]); } } __result ; }))) : (__builtin_constant_p ("-htdocs") && ((size_t )(const void *)(("-htdocs") + 1) - (size_t)(const void *)("-htdocs" ) == 1) && (__s2_len = __builtin_strlen ("-htdocs"), __s2_len < 4) ? (__builtin_constant_p (local_argv[x]) && ( (size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-htdocs" ) : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv[x]); int __result = (((const unsigned char *) (const char *) ("-htdocs"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ("-htdocs"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ("-htdocs"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-htdocs"))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv[x], "-htdocs" )))); })) { | |||
874 | x++; | |||
875 | if (switch_strlen_zero(local_argv[x])_zstr(local_argv[x]) || is_option(local_argv[x])) { | |||
876 | fprintf(stderrstderr, "When using -htdocs you must specify a htdocs directory\n"); | |||
877 | return 255; | |||
878 | } | |||
879 | ||||
880 | SWITCH_GLOBAL_dirs.htdocs_dir = (char *) malloc(strlen(local_argv[x]) + 1); | |||
881 | if (!SWITCH_GLOBAL_dirs.htdocs_dir) { | |||
882 | fprintf(stderrstderr, "Allocation error\n"); | |||
883 | return 255; | |||
884 | } | |||
885 | strcpy(SWITCH_GLOBAL_dirs.htdocs_dir, local_argv[x]); | |||
886 | } | |||
887 | ||||
888 | else if (!strcmp(local_argv[x], "-base")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-base") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-base"), (!((size_t)(const void *)((local_argv[x]) + 1) - ( size_t)(const void *)(local_argv[x]) == 1) || __s1_len >= 4 ) && (!((size_t)(const void *)(("-base") + 1) - (size_t )(const void *)("-base") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[x], "-base") : (__builtin_constant_p (local_argv [x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-base") && ((size_t)(const void *)(("-base") + 1) - (size_t)(const void *)("-base") == 1) ? __builtin_strcmp (local_argv [x], "-base") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-base"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv [x]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-base") && ((size_t)(const void *)(("-base") + 1) - (size_t)(const void *)("-base") == 1) && (__s2_len = __builtin_strlen ("-base"), __s2_len < 4) ? (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv [x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-base") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv [x]); int __result = (((const unsigned char *) (const char *) ("-base"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-base"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-base"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-base" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-base")))); })) { | |||
889 | x++; | |||
890 | if (switch_strlen_zero(local_argv[x])_zstr(local_argv[x]) || is_option(local_argv[x])) { | |||
891 | fprintf(stderrstderr, "When using -base you must specify a base directory\n"); | |||
892 | return 255; | |||
893 | } | |||
894 | ||||
895 | SWITCH_GLOBAL_dirs.base_dir = (char *) malloc(strlen(local_argv[x]) + 1); | |||
896 | if (!SWITCH_GLOBAL_dirs.base_dir) { | |||
897 | fprintf(stderrstderr, "Allocation error\n"); | |||
898 | return 255; | |||
899 | } | |||
900 | strcpy(SWITCH_GLOBAL_dirs.base_dir, local_argv[x]); | |||
901 | } | |||
902 | ||||
903 | else if (!strcmp(local_argv[x], "-temp")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-temp") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-temp"), (!((size_t)(const void *)((local_argv[x]) + 1) - ( size_t)(const void *)(local_argv[x]) == 1) || __s1_len >= 4 ) && (!((size_t)(const void *)(("-temp") + 1) - (size_t )(const void *)("-temp") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[x], "-temp") : (__builtin_constant_p (local_argv [x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-temp") && ((size_t)(const void *)(("-temp") + 1) - (size_t)(const void *)("-temp") == 1) ? __builtin_strcmp (local_argv [x], "-temp") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-temp"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv [x]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-temp") && ((size_t)(const void *)(("-temp") + 1) - (size_t)(const void *)("-temp") == 1) && (__s2_len = __builtin_strlen ("-temp"), __s2_len < 4) ? (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv [x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-temp") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv [x]); int __result = (((const unsigned char *) (const char *) ("-temp"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-temp"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-temp"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-temp" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-temp")))); })) { | |||
904 | x++; | |||
905 | if (switch_strlen_zero(local_argv[x])_zstr(local_argv[x]) || is_option(local_argv[x])) { | |||
906 | fprintf(stderrstderr, "When using -temp you must specify a temp directory\n"); | |||
907 | return 255; | |||
908 | } | |||
909 | ||||
910 | SWITCH_GLOBAL_dirs.temp_dir = (char *) malloc(strlen(local_argv[x]) + 1); | |||
911 | if (!SWITCH_GLOBAL_dirs.temp_dir) { | |||
912 | fprintf(stderrstderr, "Allocation error\n"); | |||
913 | return 255; | |||
914 | } | |||
915 | strcpy(SWITCH_GLOBAL_dirs.temp_dir, local_argv[x]); | |||
916 | } | |||
917 | ||||
918 | else if (!strcmp(local_argv[x], "-storage")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-storage") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-storage"), (!((size_t)(const void *)(( local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *) (("-storage") + 1) - (size_t)(const void *)("-storage") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[x], "-storage" ) : (__builtin_constant_p (local_argv[x]) && ((size_t )(const void *)((local_argv[x]) + 1) - (size_t)(const void *) (local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-storage" ) && ((size_t)(const void *)(("-storage") + 1) - (size_t )(const void *)("-storage") == 1) ? __builtin_strcmp (local_argv [x], "-storage") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-storage"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv [x]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-storage") && ((size_t)(const void *)(("-storage") + 1) - (size_t)(const void *)("-storage") == 1) && ( __s2_len = __builtin_strlen ("-storage"), __s2_len < 4) ? ( __builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv [x]) == 1) ? __builtin_strcmp (local_argv[x], "-storage") : ( - (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv[x]); int __result = (((const unsigned char *) (const char *) ("-storage"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = ( ((const unsigned char *) (const char *) ("-storage"))[1] - __s2 [1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ("-storage"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-storage"))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-storage")))); })) { | |||
919 | x++; | |||
920 | if (switch_strlen_zero(local_argv[x])_zstr(local_argv[x]) || is_option(local_argv[x])) { | |||
921 | fprintf(stderrstderr, "When using -storage you must specify a storage directory\n"); | |||
922 | return 255; | |||
923 | } | |||
924 | ||||
925 | SWITCH_GLOBAL_dirs.storage_dir = (char *) malloc(strlen(local_argv[x]) + 1); | |||
926 | if (!SWITCH_GLOBAL_dirs.storage_dir) { | |||
927 | fprintf(stderrstderr, "Allocation error\n"); | |||
928 | return 255; | |||
929 | } | |||
930 | strcpy(SWITCH_GLOBAL_dirs.storage_dir, local_argv[x]); | |||
931 | } | |||
932 | ||||
933 | else if (!strcmp(local_argv[x], "-cache")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-cache") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-cache"), (!((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-cache") + 1) - (size_t )(const void *)("-cache") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[x], "-cache") : (__builtin_constant_p (local_argv [x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-cache") && ((size_t)(const void *)(("-cache") + 1 ) - (size_t)(const void *)("-cache") == 1) ? __builtin_strcmp (local_argv[x], "-cache") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-cache" ); int __result = (((const unsigned char *) (const char *) (local_argv [x]))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv [x]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-cache") && ((size_t)(const void *)(("-cache") + 1 ) - (size_t)(const void *)("-cache") == 1) && (__s2_len = __builtin_strlen ("-cache"), __s2_len < 4) ? (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv [x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-cache") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv [x]); int __result = (((const unsigned char *) (const char *) ("-cache"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-cache"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-cache"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-cache" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-cache")))); })) { | |||
934 | x++; | |||
935 | if (switch_strlen_zero(local_argv[x])_zstr(local_argv[x]) || is_option(local_argv[x])) { | |||
936 | fprintf(stderrstderr, "When using -cache you must specify a cache directory\n"); | |||
937 | return 255; | |||
938 | } | |||
939 | ||||
940 | SWITCH_GLOBAL_dirs.cache_dir = (char *) malloc(strlen(local_argv[x]) + 1); | |||
941 | if (!SWITCH_GLOBAL_dirs.cache_dir) { | |||
942 | fprintf(stderrstderr, "Allocation error\n"); | |||
943 | return 255; | |||
944 | } | |||
945 | strcpy(SWITCH_GLOBAL_dirs.cache_dir, local_argv[x]); | |||
946 | } | |||
947 | ||||
948 | else if (!strcmp(local_argv[x], "-recordings")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-recordings" ) && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-recordings"), (!((size_t)(const void * )((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x] ) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-recordings") + 1) - (size_t)(const void *)("-recordings" ) == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[ x], "-recordings") : (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-recordings" ) && ((size_t)(const void *)(("-recordings") + 1) - ( size_t)(const void *)("-recordings") == 1) ? __builtin_strcmp (local_argv[x], "-recordings") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-recordings" ); int __result = (((const unsigned char *) (const char *) (local_argv [x]))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv [x]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-recordings") && ((size_t)(const void *)(("-recordings" ) + 1) - (size_t)(const void *)("-recordings") == 1) && (__s2_len = __builtin_strlen ("-recordings"), __s2_len < 4 ) ? (__builtin_constant_p (local_argv[x]) && ((size_t )(const void *)((local_argv[x]) + 1) - (size_t)(const void *) (local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-recordings" ) : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv[x]); int __result = (((const unsigned char *) (const char *) ("-recordings"))[0] - __s2[0 ]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ("-recordings"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ("-recordings"))[ 2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-recordings"))[ 3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-recordings")))); })) { | |||
949 | x++; | |||
950 | if (switch_strlen_zero(local_argv[x])_zstr(local_argv[x]) || is_option(local_argv[x])) { | |||
951 | fprintf(stderrstderr, "When using -recordings you must specify a recording directory\n"); | |||
952 | return 255; | |||
953 | } | |||
954 | ||||
955 | SWITCH_GLOBAL_dirs.recordings_dir = (char *) malloc(strlen(local_argv[x]) + 1); | |||
956 | if (!SWITCH_GLOBAL_dirs.recordings_dir) { | |||
957 | fprintf(stderrstderr, "Allocation error\n"); | |||
958 | return 255; | |||
959 | } | |||
960 | strcpy(SWITCH_GLOBAL_dirs.recordings_dir, local_argv[x]); | |||
961 | } | |||
962 | ||||
963 | else if (!strcmp(local_argv[x], "-grammar")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-grammar") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-grammar"), (!((size_t)(const void *)(( local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *) (("-grammar") + 1) - (size_t)(const void *)("-grammar") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[x], "-grammar" ) : (__builtin_constant_p (local_argv[x]) && ((size_t )(const void *)((local_argv[x]) + 1) - (size_t)(const void *) (local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-grammar" ) && ((size_t)(const void *)(("-grammar") + 1) - (size_t )(const void *)("-grammar") == 1) ? __builtin_strcmp (local_argv [x], "-grammar") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-grammar"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv [x]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-grammar") && ((size_t)(const void *)(("-grammar") + 1) - (size_t)(const void *)("-grammar") == 1) && ( __s2_len = __builtin_strlen ("-grammar"), __s2_len < 4) ? ( __builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv [x]) == 1) ? __builtin_strcmp (local_argv[x], "-grammar") : ( - (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv[x]); int __result = (((const unsigned char *) (const char *) ("-grammar"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = ( ((const unsigned char *) (const char *) ("-grammar"))[1] - __s2 [1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ("-grammar"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-grammar"))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-grammar")))); })) { | |||
964 | x++; | |||
965 | if (switch_strlen_zero(local_argv[x])_zstr(local_argv[x]) || is_option(local_argv[x])) { | |||
966 | fprintf(stderrstderr, "When using -grammar you must specify a grammar directory\n"); | |||
967 | return 255; | |||
968 | } | |||
969 | ||||
970 | SWITCH_GLOBAL_dirs.grammar_dir = (char *) malloc(strlen(local_argv[x]) + 1); | |||
971 | if (!SWITCH_GLOBAL_dirs.grammar_dir) { | |||
972 | fprintf(stderrstderr, "Allocation error\n"); | |||
973 | return 255; | |||
974 | } | |||
975 | strcpy(SWITCH_GLOBAL_dirs.grammar_dir, local_argv[x]); | |||
976 | } | |||
977 | ||||
978 | else if (!strcmp(local_argv[x], "-certs")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-certs") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-certs"), (!((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-certs") + 1) - (size_t )(const void *)("-certs") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[x], "-certs") : (__builtin_constant_p (local_argv [x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-certs") && ((size_t)(const void *)(("-certs") + 1 ) - (size_t)(const void *)("-certs") == 1) ? __builtin_strcmp (local_argv[x], "-certs") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-certs" ); int __result = (((const unsigned char *) (const char *) (local_argv [x]))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv [x]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-certs") && ((size_t)(const void *)(("-certs") + 1 ) - (size_t)(const void *)("-certs") == 1) && (__s2_len = __builtin_strlen ("-certs"), __s2_len < 4) ? (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv [x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-certs") : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv [x]); int __result = (((const unsigned char *) (const char *) ("-certs"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-certs"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ( "-certs"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-certs" ))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-certs")))); })) { | |||
979 | x++; | |||
980 | if (switch_strlen_zero(local_argv[x])_zstr(local_argv[x]) || is_option(local_argv[x])) { | |||
981 | fprintf(stderrstderr, "When using -certs you must specify a certificates directory\n"); | |||
982 | return 255; | |||
983 | } | |||
984 | ||||
985 | SWITCH_GLOBAL_dirs.certs_dir = (char *) malloc(strlen(local_argv[x]) + 1); | |||
986 | if (!SWITCH_GLOBAL_dirs.certs_dir) { | |||
987 | fprintf(stderrstderr, "Allocation error\n"); | |||
988 | return 255; | |||
989 | } | |||
990 | strcpy(SWITCH_GLOBAL_dirs.certs_dir, local_argv[x]); | |||
991 | } | |||
992 | ||||
993 | else if (!strcmp(local_argv[x], "-sounds")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-sounds") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-sounds"), (!((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-sounds") + 1) - ( size_t)(const void *)("-sounds") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[x], "-sounds") : (__builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv [x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4 ) ? (__builtin_constant_p ("-sounds") && ((size_t)(const void *)(("-sounds") + 1) - (size_t)(const void *)("-sounds") == 1) ? __builtin_strcmp (local_argv[x], "-sounds") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-sounds"); int __result = (((const unsigned char * ) (const char *) (local_argv[x]))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv[x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv[x]))[3] - __s2[3]); } } __result ; }))) : (__builtin_constant_p ("-sounds") && ((size_t )(const void *)(("-sounds") + 1) - (size_t)(const void *)("-sounds" ) == 1) && (__s2_len = __builtin_strlen ("-sounds"), __s2_len < 4) ? (__builtin_constant_p (local_argv[x]) && ( (size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) ? __builtin_strcmp (local_argv[x], "-sounds" ) : (- (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv[x]); int __result = (((const unsigned char *) (const char *) ("-sounds"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) ("-sounds"))[1] - __s2[1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ("-sounds"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-sounds"))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv[x], "-sounds" )))); })) { | |||
994 | x++; | |||
995 | if (switch_strlen_zero(local_argv[x])_zstr(local_argv[x]) || is_option(local_argv[x])) { | |||
996 | fprintf(stderrstderr, "When using -sounds you must specify a sounds directory\n"); | |||
997 | return 255; | |||
998 | } | |||
999 | ||||
1000 | SWITCH_GLOBAL_dirs.sounds_dir = (char *) malloc(strlen(local_argv[x]) + 1); | |||
1001 | if (!SWITCH_GLOBAL_dirs.sounds_dir) { | |||
1002 | fprintf(stderrstderr, "Allocation error\n"); | |||
1003 | return 255; | |||
1004 | } | |||
1005 | strcpy(SWITCH_GLOBAL_dirs.sounds_dir, local_argv[x]); | |||
1006 | } | |||
1007 | ||||
1008 | else if (!strcmp(local_argv[x], "-cfgname")__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (local_argv[x]) && __builtin_constant_p ("-cfgname") && (__s1_len = __builtin_strlen (local_argv[x]), __s2_len = __builtin_strlen ("-cfgname"), (!((size_t)(const void *)(( local_argv[x]) + 1) - (size_t)(const void *)(local_argv[x]) == 1) || __s1_len >= 4) && (!((size_t)(const void *) (("-cfgname") + 1) - (size_t)(const void *)("-cfgname") == 1) || __s2_len >= 4)) ? __builtin_strcmp (local_argv[x], "-cfgname" ) : (__builtin_constant_p (local_argv[x]) && ((size_t )(const void *)((local_argv[x]) + 1) - (size_t)(const void *) (local_argv[x]) == 1) && (__s1_len = __builtin_strlen (local_argv[x]), __s1_len < 4) ? (__builtin_constant_p ("-cfgname" ) && ((size_t)(const void *)(("-cfgname") + 1) - (size_t )(const void *)("-cfgname") == 1) ? __builtin_strcmp (local_argv [x], "-cfgname") : (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) ("-cfgname"); int __result = (((const unsigned char *) (const char *) (local_argv[x]))[ 0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) (local_argv [x]))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) (local_argv [x]))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-cfgname") && ((size_t)(const void *)(("-cfgname") + 1) - (size_t)(const void *)("-cfgname") == 1) && ( __s2_len = __builtin_strlen ("-cfgname"), __s2_len < 4) ? ( __builtin_constant_p (local_argv[x]) && ((size_t)(const void *)((local_argv[x]) + 1) - (size_t)(const void *)(local_argv [x]) == 1) ? __builtin_strcmp (local_argv[x], "-cfgname") : ( - (__extension__ ({ const unsigned char *__s2 = (const unsigned char *) (const char *) (local_argv[x]); int __result = (((const unsigned char *) (const char *) ("-cfgname"))[0] - __s2[0]); if (__s2_len > 0 && __result == 0) { __result = ( ((const unsigned char *) (const char *) ("-cfgname"))[1] - __s2 [1]); if (__s2_len > 1 && __result == 0) { __result = (((const unsigned char *) (const char *) ("-cfgname"))[2] - __s2[2]); if (__s2_len > 2 && __result == 0) __result = (((const unsigned char *) (const char *) ("-cfgname"))[3] - __s2[3]); } } __result; })))) : __builtin_strcmp (local_argv [x], "-cfgname")))); })) { | |||
1009 | x++; | |||
1010 | if (switch_strlen_zero(local_argv[x])_zstr(local_argv[x]) || is_option(local_argv[x])) { | |||
1011 | fprintf(stderrstderr, "When using -cfgname you must specify a filename\n"); | |||
1012 | return 255; | |||
1013 | } | |||
1014 | ||||
1015 | SWITCH_GLOBAL_filenames.conf_name = (char *) malloc(strlen(local_argv[x]) + 1); | |||
1016 | if (!SWITCH_GLOBAL_filenames.conf_name) { | |||
1017 | fprintf(stderrstderr, "Allocation error\n"); | |||
1018 | return 255; | |||
1019 | } | |||
1020 | strcpy(SWITCH_GLOBAL_filenames.conf_name, local_argv[x]); | |||
1021 | } | |||
1022 | ||||
1023 | /* Unknown option (always last!) */ | |||
1024 | else { | |||
1025 | fprintf(stderrstderr, "Unknown option '%s', see '%s -help' for a list of valid options\n", | |||
1026 | local_argv[x], local_argv[0]); | |||
1027 | exit(EXIT_FAILURE1); | |||
1028 | } | |||
1029 | } | |||
1030 | ||||
1031 | if (log_set && !run_set) { | |||
1032 | SWITCH_GLOBAL_dirs.run_dir = (char *) malloc(strlen(SWITCH_GLOBAL_dirs.log_dir) + 1); | |||
1033 | if (!SWITCH_GLOBAL_dirs.run_dir) { | |||
1034 | fprintf(stderrstderr, "Allocation error\n"); | |||
1035 | return 255; | |||
1036 | } | |||
1037 | strcpy(SWITCH_GLOBAL_dirs.run_dir, SWITCH_GLOBAL_dirs.log_dir); | |||
1038 | } | |||
1039 | ||||
1040 | if (do_kill) { | |||
1041 | return freeswitch_kill_background(); | |||
1042 | } | |||
1043 | ||||
1044 | if (apr_initialize() != SWITCH_STATUS_SUCCESS) { | |||
1045 | fprintf(stderrstderr, "FATAL ERROR! Could not initialize APR\n"); | |||
1046 | return 255; | |||
1047 | } | |||
1048 | ||||
1049 | if (alt_dirs && alt_dirs != 3) { | |||
1050 | fprintf(stderrstderr, "You must specify all or none of -conf, -log, and -db\n"); | |||
1051 | return 255; | |||
1052 | } | |||
1053 | ||||
1054 | #ifndef FS_64BIT1 | |||
1055 | #if defined(HAVE_SETRLIMIT1) && !defined(__sun) | |||
1056 | if (!waste && !(flags & SCF_VG)) { | |||
1057 | struct rlimit rlp; | |||
1058 | ||||
1059 | memset(&rlp, 0, sizeof(rlp)); | |||
1060 | getrlimit(RLIMIT_STACKRLIMIT_STACK, &rlp); | |||
1061 | ||||
1062 | if (rlp.rlim_cur != SWITCH_THREAD_STACKSIZE240 * 1024) { | |||
1063 | char buf[1024] = ""; | |||
1064 | int i = 0; | |||
1065 | ||||
1066 | memset(&rlp, 0, sizeof(rlp)); | |||
1067 | rlp.rlim_cur = SWITCH_THREAD_STACKSIZE240 * 1024; | |||
1068 | rlp.rlim_max = SWITCH_SYSTEM_THREAD_STACKSIZE8192 * 1024; | |||
1069 | setrlimit(RLIMIT_STACKRLIMIT_STACK, &rlp); | |||
1070 | ||||
1071 | apr_terminate(); | |||
1072 | if (argv) ret = (int) execv(argv[0], argv); | |||
1073 | ||||
1074 | for (i = 0; i < argc; i++) { | |||
1075 | switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s ", argv[i]); | |||
1076 | } | |||
1077 | ||||
1078 | return system(buf); | |||
1079 | } | |||
1080 | } | |||
1081 | #endif | |||
1082 | #endif | |||
1083 | signal(SIGILL4, handle_SIGILL); | |||
1084 | signal(SIGTERM15, handle_SIGILL); | |||
1085 | #ifndef WIN32 | |||
1086 | if (do_wait) { | |||
1087 | if (pipe(fds)) { | |||
1088 | fprintf(stderrstderr, "System Error!\n"); | |||
1089 | exit(-1); | |||
1090 | } | |||
1091 | ||||
1092 | signal(SIGCHLD17, handle_SIGCHLD); | |||
1093 | } | |||
1094 | #endif | |||
1095 | ||||
1096 | if (nc) { | |||
1097 | #ifdef WIN32 | |||
1098 | FreeConsole(); | |||
1099 | #else | |||
1100 | if (!nf) { | |||
1101 | daemonize(do_wait ? fds : NULL((void*)0)); | |||
1102 | } | |||
1103 | #endif | |||
1104 | } | |||
1105 | #ifndef WIN32 | |||
1106 | if (reincarnate) | |||
1107 | reincarnate_protect(reincarnate_reexec ? argv : NULL((void*)0)); | |||
1108 | #endif | |||
1109 | ||||
1110 | switch (priority) { | |||
1111 | case 2: | |||
1112 | set_realtime_priority(); | |||
1113 | break; | |||
1114 | case 1: | |||
1115 | set_normal_priority(); | |||
1116 | break; | |||
1117 | case -1: | |||
1118 | set_low_priority(); | |||
1119 | break; | |||
1120 | default: | |||
1121 | set_auto_priority(); | |||
1122 | break; | |||
1123 | } | |||
1124 | ||||
1125 | switch_core_setrlimits(); | |||
1126 | ||||
1127 | ||||
1128 | #ifndef WIN32 | |||
1129 | if (runas_user || runas_group) { | |||
1130 | if (change_user_group(runas_user, runas_group) < 0) { | |||
1131 | fprintf(stderrstderr, "Failed to switch user [%s] / group [%s]\n", | |||
1132 | switch_strlen_zero(runas_user)_zstr(runas_user) ? "-" : runas_user, | |||
1133 | switch_strlen_zero(runas_group)_zstr(runas_group) ? "-" : runas_group); | |||
1134 | return 255; | |||
1135 | } | |||
1136 | } | |||
1137 | #else | |||
1138 | if (win32_service) { | |||
1139 | /* Attempt to start service */ | |||
1140 | SERVICE_TABLE_ENTRY dispatchTable[] = { | |||
1141 | {service_name, &service_main} | |||
1142 | , | |||
1143 | {NULL((void*)0), NULL((void*)0)} | |||
1144 | }; | |||
1145 | service_flags = flags; /* copy parsed flags for service startup */ | |||
1146 | ||||
1147 | if (StartServiceCtrlDispatcher(dispatchTable) == 0) { | |||
1148 | /* Not loaded as a service */ | |||
1149 | fprintf(stderrstderr, "Error Freeswitch loaded as a console app with -service option\n"); | |||
1150 | fprintf(stderrstderr, "To install the service load freeswitch with -install\n"); | |||
1151 | } | |||
1152 | exit(EXIT_SUCCESS0); | |||
1153 | } | |||
1154 | #endif | |||
1155 | ||||
1156 | switch_core_set_globals(); | |||
1157 | ||||
1158 | pid = getpid(); | |||
1159 | ||||
1160 | memset(pid_buffer, 0, sizeof(pid_buffer)); | |||
1161 | switch_snprintf(pid_path, sizeof(pid_path), "%s%s%s", SWITCH_GLOBAL_dirs.run_dir, SWITCH_PATH_SEPARATOR"/", pfile); | |||
1162 | switch_snprintf(pid_buffer, sizeof(pid_buffer), "%d", pid); | |||
1163 | pid_len = strlen(pid_buffer); | |||
1164 | ||||
1165 | apr_pool_create(&pool, NULL)apr_pool_create_ex(&pool, ((void*)0), ((void*)0), ((void* )0)); | |||
1166 | ||||
1167 | switch_dir_make_recursive(SWITCH_GLOBAL_dirs.run_dir, SWITCH_DEFAULT_DIR_PERMS0x0400 | 0x0200 | 0x0100 | 0x0040 | 0x0010, pool); | |||
1168 | ||||
1169 | if (switch_file_open(&fd, pid_path, SWITCH_FOPEN_READ0x00001, SWITCH_FPROT_UREAD0x0400 | SWITCH_FPROT_UWRITE0x0200, pool) == SWITCH_STATUS_SUCCESS) { | |||
1170 | ||||
1171 | old_pid_len = sizeof(old_pid_buffer) -1; | |||
1172 | switch_file_read(fd, old_pid_buffer, &old_pid_len); | |||
1173 | switch_file_close(fd); | |||
1174 | } | |||
1175 | ||||
1176 | if (switch_file_open(&fd, | |||
1177 | pid_path, | |||
1178 | SWITCH_FOPEN_WRITE0x00002 | SWITCH_FOPEN_CREATE0x00004 | SWITCH_FOPEN_TRUNCATE0x00010, | |||
1179 | SWITCH_FPROT_UREAD0x0400 | SWITCH_FPROT_UWRITE0x0200, pool) != SWITCH_STATUS_SUCCESS) { | |||
1180 | fprintf(stderrstderr, "Cannot open pid file %s.\n", pid_path); | |||
1181 | return 255; | |||
1182 | } | |||
1183 | ||||
1184 | if (switch_file_lock(fd, SWITCH_FLOCK_EXCLUSIVE2 | SWITCH_FLOCK_NONBLOCK0x0010) != SWITCH_STATUS_SUCCESS) { | |||
1185 | fprintf(stderrstderr, "Cannot lock pid file %s.\n", pid_path); | |||
1186 | old_pid_len = strlen(old_pid_buffer); | |||
1187 | if (strlen(old_pid_buffer)) { | |||
1188 | switch_file_write(fd, old_pid_buffer, &old_pid_len); | |||
1189 | } | |||
1190 | return 255; | |||
1191 | } | |||
1192 | ||||
1193 | switch_file_write(fd, pid_buffer, &pid_len); | |||
1194 | ||||
1195 | if (switch_core_init_and_modload(flags, nc ? SWITCH_FALSE : SWITCH_TRUE, &err) != SWITCH_STATUS_SUCCESS) { | |||
1196 | fprintf(stderrstderr, "Cannot Initialize [%s]\n", err); | |||
1197 | return 255; | |||
1198 | } | |||
1199 | ||||
1200 | #ifndef WIN32 | |||
1201 | if (do_wait) { | |||
1202 | if (fds[1] > -1) { | |||
1203 | int i, v = 1; | |||
1204 | ||||
1205 | if ((i = write(fds[1], &v, sizeof(v))) < 0) { | |||
1206 | fprintf(stderrstderr, "System Error [%s]\n", strerror(errno(*__errno_location ()))); | |||
1207 | } else { | |||
1208 | (void)read(fds[1], &v, sizeof(v)); | |||
1209 | } | |||
1210 | ||||
1211 | shutdown(fds[1], 2); | |||
1212 | close(fds[1]); | |||
1213 | fds[1] = -1; | |||
1214 | } | |||
1215 | } | |||
1216 | #endif | |||
1217 | ||||
1218 | switch_core_runtime_loop(nc); | |||
1219 | ||||
1220 | destroy_status = switch_core_destroy(); | |||
1221 | ||||
1222 | switch_file_close(fd); | |||
1223 | apr_pool_destroy(pool); | |||
1224 | ||||
1225 | if (unlink(pid_path) != 0) { | |||
1226 | fprintf(stderrstderr, "Failed to delete pid file [%s]\n", pid_path); | |||
1227 | } | |||
1228 | ||||
1229 | if (destroy_status == SWITCH_STATUS_RESTART) { | |||
1230 | char buf[1024] = ""; | |||
1231 | int j = 0; | |||
1232 | ||||
1233 | switch_sleep(1000000); | |||
1234 | if (!argv || execv(argv[0], argv) == -1) { | |||
| ||||
1235 | fprintf(stderrstderr, "Restart Failed [%s] resorting to plan b\n", strerror(errno(*__errno_location ()))); | |||
1236 | for (j = 0; j < argc; j++) { | |||
1237 | switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "%s ", argv[j]); | |||
1238 | } | |||
1239 | ret = system(buf); | |||
1240 | } | |||
1241 | } | |||
1242 | ||||
1243 | return ret; | |||
1244 | } | |||
1245 | ||||
1246 | ||||
1247 | /* For Emacs: | |||
1248 | * Local Variables: | |||
1249 | * mode:c | |||
1250 | * indent-tabs-mode:t | |||
1251 | * tab-width:4 | |||
1252 | * c-basic-offset:4 | |||
1253 | * End: | |||
1254 | * For VIM: | |||
1255 | * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet: | |||
1256 | */ |