summaryrefslogtreecommitdiffstats
path: root/sdpd
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-01-14 00:04:48 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-01-14 00:04:48 +0000
commit70fcd297bce634b8a1b117c3b27784995a8c652a (patch)
treebcc002898cacfba6fcc9163a4ad583bcfc8f7148 /sdpd
parent54b33571eb8833f86d17957ff5a3309512aab57b (diff)
Make debug information optional
Diffstat (limited to 'sdpd')
-rw-r--r--sdpd/main.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/sdpd/main.c b/sdpd/main.c
index 7e97d3f9..1154547b 100644
--- a/sdpd/main.c
+++ b/sdpd/main.c
@@ -51,6 +51,11 @@ static void sig_hup(int sig)
{
}
+static void sig_debug(int sig)
+{
+ toggle_debug();
+}
+
static void usage(void)
{
printf("sdpd - SDP daemon ver %s\n", VERSION);
@@ -72,14 +77,18 @@ int main(int argc, char *argv[])
struct sigaction sa;
uint16_t mtu = 0;
uint32_t flags = SDP_SERVER_COMPAT;
- int opt, daemonize = 1;
+ int opt, daemonize = 1, debug = 0;
- while ((opt = getopt_long(argc, argv, "nm:pM", main_options, NULL)) != -1) {
+ while ((opt = getopt_long(argc, argv, "ndm:pM", main_options, NULL)) != -1) {
switch (opt) {
case 'n':
daemonize = 0;
break;
+ case 'd':
+ debug = 1;
+ break;
+
case 'm':
mtu = atoi(optarg);
break;
@@ -115,10 +124,18 @@ int main(int argc, char *argv[])
sa.sa_handler = sig_hup;
sigaction(SIGHUP, &sa, NULL);
+ sa.sa_handler = sig_debug;
+ sigaction(SIGUSR2, &sa, NULL);
+
sa.sa_handler = SIG_IGN;
sigaction(SIGCHLD, &sa, NULL);
sigaction(SIGPIPE, &sa, NULL);
+ if (debug) {
+ info("Enabling debug information");
+ enable_debug();
+ }
+
event_loop = g_main_loop_new(NULL, FALSE);
if (start_sdp_server(mtu, flags) < 0) {