From ead9dfe985f4da7c14ccb9df469bbbd336420f75 Mon Sep 17 00:00:00 2001 From: wpaul Date: Tue, 25 Jul 1995 22:44:14 +0000 Subject: main.c: - use daemon() to daemonify ourselves - the 'Usage' printf() was missing an argument - remove declaration of rindex and #include instead bootparam.c: - get rid of local declarations of YP functions and include headers from /usr/include/rpcsvc instead. --- usr.sbin/bootparamd/bootparamd/bootparamd.c | 8 +++----- usr.sbin/bootparamd/bootparamd/main.c | 25 ++++++------------------- 2 files changed, 9 insertions(+), 24 deletions(-) (limited to 'usr.sbin/bootparamd') diff --git a/usr.sbin/bootparamd/bootparamd/bootparamd.c b/usr.sbin/bootparamd/bootparamd/bootparamd.c index ed088be..02c2f67 100644 --- a/usr.sbin/bootparamd/bootparamd/bootparamd.c +++ b/usr.sbin/bootparamd/bootparamd/bootparamd.c @@ -5,12 +5,14 @@ use and modify. Please send modifications and/or suggestions + bug fixes to Klas Heggemann - $Id: bootparamd.c,v 1.1.1.1 1995/02/26 23:40:52 wpaul Exp $ + $Id: bootparamd.c,v 1.2 1995/05/30 03:46:27 rgrimes Exp $ */ #include +#include +#include #include "bootparam_prot.h" #include #include @@ -174,8 +176,6 @@ char *fileid, *buffer; char *where; static char *result; int resultlen; - extern int yp_get_default_domain(); - extern int yp_match(); static char *yp_domain; int ch, pch, fid_len, res = 0; @@ -271,8 +271,6 @@ char *hostname; int res = 0; static char *result; int resultlen; - extern int yp_get_default_domain(); - extern int yp_match(); static char *yp_domain; /* struct hostent *cmp_he;*/ diff --git a/usr.sbin/bootparamd/bootparamd/main.c b/usr.sbin/bootparamd/bootparamd/main.c index 1e3d30f..b8d8629 100644 --- a/usr.sbin/bootparamd/bootparamd/main.c +++ b/usr.sbin/bootparamd/bootparamd/main.c @@ -6,12 +6,13 @@ use and modify. Please send modifications and/or suggestions + bug fixes to Klas Heggemann - $Id: main.c,v 1.1.1.1 1995/02/26 23:40:52 wpaul Exp $ + $Id: main.c,v 1.2 1995/05/30 03:46:28 rgrimes Exp $ */ -#include #include +#include +#include #include #include #include "bootparam_prot.h" @@ -38,8 +39,7 @@ int argc; char **argv; { SVCXPRT *transp; - int i,s, pid; - char *rindex(); + int i; struct hostent *he; struct stat buf; char *optstring; @@ -82,7 +82,7 @@ char **argv; break; default: fprintf(stderr, - "Usage: %s [-d ] [ -s ] [ -r router ] [ -f bootparmsfile ]\n"); + "Usage: %s [-d ] [ -s ] [ -r router ] [ -f bootparmsfile ]\n", progname); exit(1); } @@ -99,23 +99,10 @@ char **argv; } if (!debug) { - pid = fork(); - if ( pid < 0) { + if (daemon(0,0)) { perror("bootparamd: fork"); exit(1); } - if (pid) exit(0); /* parent */ - - /* child */ - for ( s = 0; s < 20 ; s++) close(s); - open("/", 0); - dup2(0, 1); - dup2(0, 2); - s = open("/dev/tty",2); - if ( s >= 0 ) { - ioctl(s, TIOCNOTTY, 0); - close(s); - } } -- cgit v1.1