From 37c1f13f2733353ca603f6afb0f5f44eb4db3834 Mon Sep 17 00:00:00 2001 From: Ted Lemon Date: Mon, 16 Apr 2001 22:07:33 +0000 Subject: [PATCH] Add nowait flag. Remove -D flag. --- client/dhclient.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/client/dhclient.c b/client/dhclient.c index cbcda20e..364505e1 100644 --- a/client/dhclient.c +++ b/client/dhclient.c @@ -41,7 +41,7 @@ #ifndef lint static char ocopyright[] = -"$Id: dhclient.c,v 1.128 2001/04/09 00:34:06 mellon Exp $ Copyright (c) 1995-2001 Internet Software Consortium. All rights reserved.\n"; +"$Id: dhclient.c,v 1.129 2001/04/16 22:07:33 mellon Exp $ Copyright (c) 1995-2001 Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -79,11 +79,11 @@ static char url [] = "For info, please visit http://www.isc.org/products/DHCP"; u_int16_t local_port; u_int16_t remote_port; int no_daemon; -int save_scripts; struct string_list *client_env; int client_env_count; int onetry; int quiet; +int nowait; static void usage PROTO ((void)); @@ -159,8 +159,6 @@ int main (argc, argv, envp) ntohs (local_port)); } else if (!strcmp (argv [i], "-d")) { no_daemon = 1; - } else if (!strcmp (argv [i], "-D")) { - save_scripts = 1; } else if (!strcmp (argv [i], "-pf")) { if (++i == argc) usage (); @@ -216,6 +214,8 @@ int main (argc, argv, envp) } else if (!strcmp (argv [i], "--version")) { log_info ("isc-dhclient-%s", DHCP_VERSION); exit (0); + } else if (!strcmp (argv [i], "-nw")) { + nowait = 1; } else { struct interface_info *tmp = (struct interface_info *)0; status = interface_allocate (&tmp, MDL); @@ -451,9 +451,14 @@ int main (argc, argv, envp) dmalloc_outstanding = 0; #endif + /* If we're not supposed to wait before getting the address, + don't. */ + if (nowait) + go_daemon (); + /* If we're not going to daemonize, write the pid file now. */ - if (no_daemon) + if (no_daemon || nowait) write_client_pid_file (); /* Start dispatching packets and timeouts... */ @@ -470,7 +475,7 @@ static void usage () log_info (arr); log_info (url); - log_error ("Usage: dhclient [-1dDqr] [-p ] %s", + log_error ("Usage: dhclient [-1dqr] [-nw] [-p ] %s", "[-s server]"); log_error (" [-cf config-file] [-lf lease-file]%s", "[-pf pid-file] [-e VAR=val]");