Adder logger
This commit is contained in:
39
runstabber.c
39
runstabber.c
@@ -1,6 +1,41 @@
|
||||
#include <glib.h>
|
||||
#include <stdlib.h>
|
||||
#include <stabber.h>
|
||||
|
||||
int main(void)
|
||||
|
||||
int
|
||||
main(int argc , char *argv[])
|
||||
{
|
||||
return stabber_start(5230);
|
||||
int port = 0;
|
||||
|
||||
GOptionEntry entries[] =
|
||||
{
|
||||
{ "port", 'p', 0, G_OPTION_ARG_INT, &port, "Listen port", NULL },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
GError *error = NULL;
|
||||
GOptionContext *context;
|
||||
|
||||
context = g_option_context_new(NULL);
|
||||
g_option_context_add_main_entries(context, entries, NULL);
|
||||
if (!g_option_context_parse(context, &argc, &argv, &error)) {
|
||||
g_print("%s\n", error->message);
|
||||
g_option_context_free(context);
|
||||
g_error_free(error);
|
||||
return 1;
|
||||
}
|
||||
|
||||
g_option_context_free(context);
|
||||
|
||||
if (port == 0) {
|
||||
port = 5230;
|
||||
}
|
||||
|
||||
|
||||
if (argc == 2) {
|
||||
port = atoi(argv[1]);
|
||||
}
|
||||
|
||||
return stabber_start(port);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user