- use daemon() to daemonify ourselves
- the 'Usage' printf() was missing an argument
- remove declaration of rindex and #include <string.h> instead

bootparam.c:
- get rid of local declarations of YP functions and include headers
from /usr/include/rpcsvc instead.
This commit is contained in:
Bill Paul 1995-07-25 22:44:14 +00:00
parent 1c85ed9abd
commit 3ad4ec7c21
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=9718
2 changed files with 9 additions and 24 deletions

View File

@ -5,12 +5,14 @@ use and modify. Please send modifications and/or suggestions + bug fixes to
Klas Heggemann <klas@nada.kth.se>
$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 <rpc/rpc.h>
#include <rpcsvc/yp_prot.h>
#include <rpcsvc/ypclnt.h>
#include "bootparam_prot.h"
#include <stdio.h>
#include <sys/types.h>
@ -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;*/

View File

@ -6,12 +6,13 @@ use and modify. Please send modifications and/or suggestions + bug fixes to
Klas Heggemann <klas@nada.kth.se>
$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 <syslog.h>
#include <stdio.h>
#include <string.h>
#include <syslog.h>
#include <sys/ioctl.h>
#include <rpc/rpc.h>
#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);
}
}