From 18077452ddac7ba83f535c045a062164b2c58056 Mon Sep 17 00:00:00 2001 From: mrg Date: Fri, 19 Jul 2002 10:05:34 +0000 Subject: [PATCH] add a "-s " argument to mopd so that it doesn't require one place files in /tftpboot/mop. --- mopd/mopd.8 | 15 ++++++++++++--- mopd/mopd.c | 10 +++++++--- mopd/process.c | 7 ++++--- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/mopd/mopd.8 b/mopd/mopd.8 index f443f82..9edf7eb 100644 --- a/mopd/mopd.8 +++ b/mopd/mopd.8 @@ -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 diff --git a/mopd/mopd.c b/mopd/mopd.c index 3882b42..1443df1 100644 --- a/mopd/mopd.c +++ b/mopd/mopd.c @@ -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 #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; diff --git a/mopd/process.c b/mopd/process.c index 1214bf4..2993eee 100644 --- a/mopd/process.c +++ b/mopd/process.c @@ -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 #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);