hlswmaster/src/main.c
2006-02-02 16:24:06 +01:00

78 lines
1.5 KiB
C

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <pthread.h>
#include <getopt.h>
#include "hlswmaster.h"
static struct option opts[] = {
{"config", 1, 0, 'c'},
{"user", 1, 0, 'u'},
{"debug", 1, 0, 'd'},
{"no-daemon", 0, 0, 'f'},
{"help", 0, 0, 'h'},
{0, 0, 0, 0}
};
int main(int argc, char *argv[]) {
int arg = 0, code = 0;
pthread_t thread1, thread2, thread3, thread4;
while (code != -1) {
code = getopt_long(argc, argv, "c:u:d:fh", opts, &arg);
switch (code) {
case 'c': /* config */
break;
case 'u': /* user */
break;
case 'd': /* debug */
break;
case 'f': /* no-daemon */
break;
case 'h': /* help */
printf("Usage: hlsw-master [options]\n"
"Options: \n"
" --config -c configfile use this configfile\n"
" --user -u username change uid to username\n"
" --debug -d debuglevel level: 0 - 7\n"
" --no-daemon -f do not fork\n"
" --help -h this help\n"
"\n");
exit(0);
break;
case '?': /* error */
exit(-1);
break;
default: /* unknown / all options parsed */
break;
}
}
plugin_load("plugins/quake3.so");
scan_init();
pthread_create(&thread1, NULL, (void *)&scan_transmit, NULL);
pthread_create(&thread2, NULL, (void *)&scan_receive, NULL);
pthread_create(&thread3, NULL, (void *)&server_collector, NULL);
pthread_create(&thread4, NULL, (void *)&client_handler, NULL);
sleep(9999);
scan_exit();
return 0;
}