summaryrefslogtreecommitdiff
path: root/dhcpctl
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2015-09-12 19:18:50 +0200
committerFrancis Dupont <fdupont@isc.org>2015-09-12 19:18:50 +0200
commit646acb59b4ca20967aff71a3b15f013b391e4376 (patch)
tree4d42a5d44de36e2c30684dca0a1f135ce0511653 /dhcpctl
parent7da1ac2bc68d6e65ee240d3f98a9ed67483db804 (diff)
downloadisc-dhcp-646acb59b4ca20967aff71a3b15f013b391e4376.tar.gz
Merged #38692 (use program base name in (sys)log)
Diffstat (limited to 'dhcpctl')
-rw-r--r--dhcpctl/omshell.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/dhcpctl/omshell.c b/dhcpctl/omshell.c
index 44fd2726..adf4b9ae 100644
--- a/dhcpctl/omshell.c
+++ b/dhcpctl/omshell.c
@@ -3,7 +3,7 @@
Examine and modify omapi objects. */
/*
- * Copyright (c) 2009-2011,2013,2014 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2009-2011,2013-2015 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2001-2003 by Internet Software Consortium
*
@@ -39,6 +39,7 @@
#include <syslog.h>
#include "dhcpctl.h"
#include "dhcpd.h"
+#include <isc/file.h>
/* Fixups */
isc_result_t find_class (struct class **c, const char *n, const char *f, int l)
@@ -63,7 +64,7 @@ int check_collection (struct packet *p, struct lease *l, struct collection *c)
}
void classify (struct packet *packet, struct class *class) { }
-static void usage (char *s) {
+static void usage (const char *s) {
fprintf (stderr, "Usage: %s\n", s);
exit (1);
}
@@ -94,13 +95,21 @@ main(int argc, char **argv) {
char s1[1024];
int connected = 0;
char hex_buf[1025];
+ char *progname;
+
+#ifdef OLD_LOG_NAME
+ progname = "omshell";
+#else
+ progname = argv[0];
+#endif
for (i = 1; i < argc; i++) {
- usage(argv[0]);
+ usage(isc_file_basename(progname));
}
/* Initially, log errors to stderr as well as to syslogd. */
- openlog ("omshell", DHCP_LOG_OPTIONS, DHCPD_LOG_FACILITY);
+ openlog (isc_file_basename(progname),
+ DHCP_LOG_OPTIONS, DHCPD_LOG_FACILITY);
status = dhcpctl_initialize ();
if (status != ISC_R_SUCCESS) {
fprintf (stderr, "dhcpctl_initialize: %s\n",