summaryrefslogtreecommitdiffstats
path: root/sdpd
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2006-11-17 19:02:42 +0000
committerMarcel Holtmann <marcel@holtmann.org>2006-11-17 19:02:42 +0000
commit24f75e0b15d73034bf75058f86d545fcb58314f0 (patch)
treefb82545c1a1ecdd938fd1032f6694277e499c437 /sdpd
parentf16a4ebd9b71a929aef6cea1052941702ff39c36 (diff)
Another logging update
Diffstat (limited to 'sdpd')
-rw-r--r--sdpd/main.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/sdpd/main.c b/sdpd/main.c
index 3065e200..9e3391a9 100644
--- a/sdpd/main.c
+++ b/sdpd/main.c
@@ -393,10 +393,9 @@ static void check_active(fd_set *mask, int num)
static void usage(void)
{
- printf("sdpd version %s\n", VERSION);
- printf("Usage:\n"
- "sdpd [-n]\n"
- );
+ printf("sdpd - SDP daemon ver %s\n", VERSION);
+ printf("Usage: \n");
+ printf("\tsdpd [-n]\n");
}
static struct option main_options[] = {
@@ -415,24 +414,34 @@ int main(int argc, char *argv[])
int daemonize = 1, public = 0, master = 0;
int opt;
- while ((opt = getopt_long(argc, argv, "nm:pM", main_options, NULL)) != -1)
+ while ((opt = getopt_long(argc, argv, "nm:pM", main_options, NULL)) != -1) {
switch (opt) {
case 'n':
daemonize = 0;
break;
+
case 'm':
mtu = atoi(optarg);
break;
+
case 'p':
public = 1;
break;
+
case 'M':
master = 1;
break;
+
default:
usage();
- exit(0);
+ exit(1);
}
+ }
+
+ if (daemonize && daemon(0, 0)) {
+ error("Server startup failed: %s (%d)", strerror(errno), errno);
+ exit(1);
+ }
start_logging("sdpd", "Bluetooth SDP daemon");
@@ -440,17 +449,9 @@ int main(int argc, char *argv[])
enable_debug();
#endif
- if (daemonize && daemon(0, 0)) {
- error("Server startup failed: %s (%d)", strerror(errno), errno);
- return -1;
- }
-
- argc -= optind;
- argv += optind;
-
if (init_server(mtu, master, public) < 0) {
error("Server initialization failed");
- return -1;
+ exit(1);
}
signal(SIGINT, sig_term);