add a "-s <mopdir>" argument to mopd so that it doesn't require one place

files in /tftpboot/mop.
This commit is contained in:
mrg 2002-07-19 10:05:34 +00:00
parent f72ad6b998
commit 65b6526e06
3 changed files with 23 additions and 9 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: mopd.8,v 1.5 2002/06/07 11:23:55 wiz Exp $
.\" $NetBSD: mopd.8,v 1.6 2002/07/19 10:05:34 mrg Exp $
.\"
.\" Copyright (c) 1993-96 Mats O Jansson. All rights reserved.
.\"
@ -35,6 +35,7 @@
.Sh SYNOPSIS
.Nm
.Op Fl adf
.Op Fl s Ar mopdir
.Op Ar interface
.Sh DESCRIPTION
.Nm
@ -53,8 +54,11 @@ must know what image to load.
Upon receiving a request,
.Nm
checks if the requested file exists in
.Pa /tftpboot/mop ,
the filename is normaly uppercase and with an extension of
.Pa /tftpboot/mop
(unless the
.Fl s
option is given, see below) the filename is normaly uppercase and with an
extension of
.Pa .SYS .
If the filename isn't given, the ethernet address of the target is used as
filename, e.g.
@ -84,6 +88,11 @@ Run in debug mode, with all the output to stdout. The process will run in
the foreground.
.It Fl f
Run in the foreground.
.It Fl s
Change the directory to look for files in from
.Pa /tftpboot/mop
to
.Ar mopdir .
.El
.Sh FILES
.Bl -tag -width Pa -compact

View File

@ -1,4 +1,4 @@
/* $NetBSD: mopd.c,v 1.8 2001/02/19 23:22:45 cgd Exp $ */
/* $NetBSD: mopd.c,v 1.9 2002/07/19 10:05:34 mrg Exp $ */
/*
* Copyright (c) 1993-96 Mats O Jansson. All rights reserved.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: mopd.c,v 1.8 2001/02/19 23:22:45 cgd Exp $");
__RCSID("$NetBSD: mopd.c,v 1.9 2002/07/19 10:05:34 mrg Exp $");
#endif
/*
@ -72,6 +72,7 @@ int VersionFlag = 0; /* print version */
int Not3Flag = 0; /* Not MOP V3 messages. */
int Not4Flag = 0; /* Not MOP V4 messages. */
int promisc = 1; /* Need promisc mode */
char *MopdDir = MOP_FILE_PATH; /* Path to mop directory */
int
main(argc, argv)
@ -83,7 +84,7 @@ main(argc, argv)
extern char version[];
while ((c = getopt(argc, argv, "34adfv")) != -1)
while ((c = getopt(argc, argv, "34adfs:v")) != -1)
switch (c) {
case '3':
Not3Flag++;
@ -100,6 +101,9 @@ main(argc, argv)
case 'f':
ForegroundFlag++;
break;
case 's':
MopdDir = optarg;
break;
case 'v':
VersionFlag++;
break;

View File

@ -1,4 +1,4 @@
/* $NetBSD: process.c,v 1.12 2002/07/13 11:35:35 itojun Exp $ */
/* $NetBSD: process.c,v 1.13 2002/07/19 10:05:34 mrg Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: process.c,v 1.12 2002/07/13 11:35:35 itojun Exp $");
__RCSID("$NetBSD: process.c,v 1.13 2002/07/19 10:05:34 mrg Exp $");
#endif
#include "os.h"
@ -49,6 +49,7 @@ __RCSID("$NetBSD: process.c,v 1.12 2002/07/13 11:35:35 itojun Exp $");
extern u_char buf[];
extern int DebugFlag;
extern char *MopdDir;
struct dllist dllist[MAXDL]; /* dump/load list */
extern char dl_mcst[]; /* Dump/Load Multicast */
@ -533,7 +534,7 @@ mopProcessDL(fd, ii, pkt, index, dst, src, trans, len)
mopProcessInfo(pkt,index,moplen,dl_rpr,trans);
snprintf(filename, sizeof(filename), "%s/%s.SYS",
MOP_FILE_PATH, pfile);
MopdDir, pfile);
if ((mopCmpEAddr(dst,dl_mcst) == 0)) {
if ((nfd = open(filename, O_RDONLY, 0)) != -1) {
close(nfd);