From cc7c9e8d558897da27bd4659127b8f0946755733 Mon Sep 17 00:00:00 2001 From: venaas Date: Thu, 3 May 2007 13:34:50 +0000 Subject: using debug functions in main() git-svn-id: https://svn.testnett.uninett.no/radsecproxy/trunk@67 e88ac4ed-0b26-0410-9574-a7f39faa03bf --- Makefile | 4 ++-- radsecproxy.c | 30 ++++++------------------------ 2 files changed, 8 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index 6a72e8e..8fbec05 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ CFLAGS = -g -Wall -pedantic -pthread LDFLAGS = -lssl -OBJ = util.o radsecproxy.o +OBJ = util.o debug.o radsecproxy.o all: radsecproxy -radsecproxy: $(OBJ) radsecproxy.o +radsecproxy: $(OBJ) $(CC) $(CFLAGS) $(OBJ) $(LDFLAGS) -o radsecproxy clean: rm -f $(OBJ) radsecproxy diff --git a/radsecproxy.c b/radsecproxy.c index adbea4a..cbf5afd 100644 --- a/radsecproxy.c +++ b/radsecproxy.c @@ -49,6 +49,7 @@ #include #include #include "radsecproxy.h" +#include "debug.h" static struct options options; static struct client *clients; @@ -1923,32 +1924,13 @@ void getmainconfig(const char *configfile) { fclose(f); } -#if 0 -void parseargs(int argc, char **argv) { - int c; - - while ((c = getopt(argc, argv, "p:")) != -1) { - switch (c) { - case 'p': - udp_server_port = optarg; - break; - default: - goto usage; - } - } - - return; - - usage: - printf("radsecproxy [ -p UDP-port ]\n"); - exit(1); -} -#endif - int main(int argc, char **argv) { pthread_t udpserverth; /* pthread_attr_t joinable; */ int i; + + debug(DBG_INFO, "debug test info"); + debug(DBG_WARN, "debug test warn"); /* parseargs(argc, argv); */ getmainconfig(CONFIG_MAIN); @@ -1961,7 +1943,7 @@ int main(int argc, char **argv) { if (client_udp_count) { udp_server_listen = server_create('U'); if (pthread_create(&udpserverth, NULL /*&joinable*/, udpserverrd, NULL)) - errx("pthread_create failed"); + debug(DBG_ERR, "pthread_create failed"); } if (client_tls_count || server_tls_count) @@ -1969,7 +1951,7 @@ int main(int argc, char **argv) { for (i = 0; i < server_count; i++) if (pthread_create(&servers[i].clientth, NULL, clientwr, (void *)&servers[i])) - errx("pthread_create failed"); + debug(DBG_ERR, "pthread_create failed"); if (client_tls_count) { tcp_server_listen = server_create('T'); -- cgit v1.1