From 2ad374bc2b239b5fdee0b348c90869530b68e85c Mon Sep 17 00:00:00 2001 From: Ted Lemon Date: Mon, 29 Mar 1999 22:31:41 +0000 Subject: [PATCH] Add -pf option, update usage message. --- server/dhcpd.c | 48 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/server/dhcpd.c b/server/dhcpd.c index 1ff8013ba..a053513e8 100644 --- a/server/dhcpd.c +++ b/server/dhcpd.c @@ -42,19 +42,19 @@ #ifndef lint static char ocopyright[] = -"$Id: dhcpd.c,v 1.45.2.19 1999/03/26 17:39:19 mellon Exp $ Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium."; +"$Id: dhcpd.c,v 1.45.2.20 1999/03/29 22:31:41 mellon Exp $ Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium."; #endif static char copyright[] = "Copyright 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium."; static char arr [] = "All rights reserved."; -static char message [] = "Internet Software Consortium DHCP Server V2.0b1pl19 "; -static char contrib [] = "\nPlease contribute if you find this software useful."; -static char url [] = "For info, please visit http://www.isc.org/dhcp-contrib.html\n"; +static char message [] = "Internet Software Consortium DHCP Server V2.0b1pl20"; +static char contrib [] = "Please contribute if you find this software useful."; +static char url [] = "For info, please visit http://www.isc.org/dhcp-contrib.html"; #include "dhcpd.h" -static void usage PROTO ((void)); +static void usage PROTO ((char *)); TIME cur_time; struct group root_group; @@ -82,7 +82,7 @@ int main (argc, argv, envp) { int i, status; struct servent *ent; - char *s; + char *s, *appname; int cftest = 0; #ifndef DEBUG int pidfilewritten = 0; @@ -92,12 +92,18 @@ int main (argc, argv, envp) #endif int quiet = 0; + appname = strchr (argv [0], '/'); + if (!appname) + appname = argv [0]; + else + appname++; + /* Initially, log errors to stderr as well as to syslogd. */ #ifdef SYSLOG_4_2 - openlog ("dhcpd", LOG_NDELAY); + openlog (appname, LOG_NDELAY); log_priority = DHCPD_LOG_FACILITY; #else - openlog ("dhcpd", LOG_NDELAY, DHCPD_LOG_FACILITY); + openlog (appname, LOG_NDELAY, DHCPD_LOG_FACILITY); #endif #ifndef DEBUG @@ -134,11 +140,15 @@ int main (argc, argv, envp) log_perror = -1; } else if (!strcmp (argv [i], "-cf")) { if (++i == argc) - usage (); + usage (appname); path_dhcpd_conf = argv [i]; + } else if (!strcmp (argv [i], "-pf")) { + if (++i == argc) + usage (appname); + path_dhcpd_pid = argv [i]; } else if (!strcmp (argv [i], "-lf")) { if (++i == argc) - usage (); + usage (appname); path_dhcpd_db = argv [i]; } else if (!strcmp (argv [i], "-t")) { /* test configurations only */ @@ -151,7 +161,7 @@ int main (argc, argv, envp) quiet = 1; quiet_interface_discovery = 1; } else if (argv [i][0] == '-') { - usage (); + usage (appname); } else { struct interface_info *tmp = ((struct interface_info *) @@ -171,8 +181,10 @@ int main (argc, argv, envp) note (message); note (copyright); note (arr); + note (""); note (contrib); note (url); + note (""); } /* Default to the DHCP/BOOTP port. */ @@ -284,14 +296,20 @@ int main (argc, argv, envp) /* Print usage message. */ -static void usage () +static void usage (appname) + char *appname; { note (message); note (copyright); note (arr); - - error ("Usage: dhcpd [-p ] [-d] [-f] [-cf config-file]%s", - "\n [-lf lease-file] [if0 [...ifN]]"); + note (""); + note (contrib); + note (url); + note (""); + + warn ("Usage: %s [-p ] [-d] [-f] [-cf config-file]", + appname); + error(" [-lf lease-file] [-pf pidfile] [if0 [...ifN]]"); } void cleanup () -- 2.47.3