summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMats O Jansson <maja@cvs.openbsd.org>2006-04-29 16:26:57 +0000
committerMats O Jansson <maja@cvs.openbsd.org>2006-04-29 16:26:57 +0000
commit57dd93e4e7b3aa19bad96b65e1df36af2e725b69 (patch)
treed89d9eaba5cb7b4bff4f5516b7958d0166cf6dca /usr.sbin
parent657af46631787afef0ccb38c58cfa95066cdcf49 (diff)
Change the compile time option -DINFO into a runtime option to get ride
of some lint warnings. -moj
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/mopd/common/file.c226
-rw-r--r--usr.sbin/mopd/common/file.h12
-rw-r--r--usr.sbin/mopd/mopa.out/mopa.out.c6
-rw-r--r--usr.sbin/mopd/mopchk/Makefile4
-rw-r--r--usr.sbin/mopd/mopchk/mopchk.c13
-rw-r--r--usr.sbin/mopd/mopd/process.c6
-rw-r--r--usr.sbin/mopd/otherOS/Makefile4
7 files changed, 137 insertions, 134 deletions
diff --git a/usr.sbin/mopd/common/file.c b/usr.sbin/mopd/common/file.c
index 6fd8336a895..5c0f02df2ba 100644
--- a/usr.sbin/mopd/common/file.c
+++ b/usr.sbin/mopd/common/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.10 2006/04/20 08:52:52 maja Exp $ */
+/* $OpenBSD: file.c,v 1.11 2006/04/29 16:26:56 maja Exp $ */
/*
* Copyright (c) 1995-96 Mats O Jansson. All rights reserved.
@@ -26,13 +26,15 @@
#ifndef lint
static const char rcsid[] =
- "$OpenBSD: file.c,v 1.10 2006/04/20 08:52:52 maja Exp $";
+ "$OpenBSD: file.c,v 1.11 2006/04/29 16:26:56 maja Exp $";
#endif
#include "os.h"
#include "common/common.h"
#include "common/mopdef.h"
+#define INFO_PRINT 1
+
#ifndef NOAOUT
#if defined(__NetBSD__) || defined(__OpenBSD__)
#include <sys/exec_aout.h>
@@ -145,7 +147,7 @@ CheckMopFile(int fd)
}
int
-GetMopFileInfo(int fd, u_long *load, u_long *xfr)
+GetMopFileInfo(int fd, u_long *load, u_long *xfr, int info)
{
u_char header[512];
short image_type;
@@ -170,13 +172,13 @@ GetMopFileInfo(int fd, u_long *load, u_long *xfr)
header[iha + IHA_L_TFRADR1 + 2] * 0x10000 +
header[iha + IHA_L_TFRADR1 + 1] * 0x100 +
header[iha + IHA_L_TFRADR1]) & 0x7fffffff;
-#ifdef INFO
- printf("Native Image (VAX)\n");
- printf("Header Block Count: %lu\n", hbcnt);
- printf("Image Size: %08lx\n", isize);
- printf("Load Address: %08lx\n", load_addr);
- printf("Transfer Address: %08lx\n", xfr_addr);
-#endif
+ if (info == INFO_PRINT) {
+ printf("Native Image (VAX)\n");
+ printf("Header Block Count: %lu\n", hbcnt);
+ printf("Image Size: %08lx\n", isize);
+ printf("Load Address: %08lx\n", load_addr);
+ printf("Transfer Address: %08lx\n", xfr_addr);
+ }
break;
case IHD_C_RSX: /* RSX image produced by TKB */
hbcnt = header[L_BBLK + 1] * 256 + header[L_BBLK];
@@ -184,28 +186,28 @@ GetMopFileInfo(int fd, u_long *load, u_long *xfr)
64;
load_addr = header[L_BSA+1] * 256 + header[L_BSA];
xfr_addr = header[L_BXFR+1] * 256 + header[L_BXFR];
-#ifdef INFO
- printf("RSX Image\n");
- printf("Header Block Count: %lu\n",hbcnt);
- printf("Image Size: %08lx\n", isize);
- printf("Load Address: %08lx\n", load_addr);
- printf("Transfer Address: %08lx\n", xfr_addr);
-#endif
+ if (info == INFO_PRINT) {
+ printf("RSX Image\n");
+ printf("Header Block Count: %lu\n",hbcnt);
+ printf("Image Size: %08lx\n", isize);
+ printf("Load Address: %08lx\n", load_addr);
+ printf("Transfer Address: %08lx\n", xfr_addr);
+ }
break;
case IHD_C_BPA: /* BASIC plus analog */
-#ifdef INFO
- printf("BASIC-Plus Image, not supported\n");
-#endif
+ if (info == INFO_PRINT) {
+ printf("BASIC-Plus Image, not supported\n");
+ }
return (-1);
case IHD_C_ALIAS: /* Alias */
-#ifdef INFO
- printf("Alias, not supported\n");
-#endif
+ if (info == INFO_PRINT) {
+ printf("Alias, not supported\n");
+ }
return (-1);
case IHD_C_CLI: /* Image is CLI */
-#ifdef INFO
- printf("CLI, not supported\n");
-#endif
+ if (info == INFO_PRINT) {
+ printf("CLI, not supported\n");
+ }
return (-1);
case IHD_C_PMAX: /* PMAX system image */
isd = header[IHD_W_SIZE+1] * 256 + header[IHD_W_SIZE];
@@ -220,13 +222,13 @@ GetMopFileInfo(int fd, u_long *load, u_long *xfr)
header[iha + IHA_L_TFRADR1 + 2] * 0x10000 +
header[iha + IHA_L_TFRADR1 + 1] * 0x100 +
header[iha + IHA_L_TFRADR1]);
-#ifdef INFO
- printf("PMAX Image \n");
- printf("Header Block Count: %lu\n", hbcnt);
- printf("Image Size: %08lx\n", isize);
- printf("Load Address: %08lx\n", load_addr);
- printf("Transfer Address: %08lx\n", xfr_addr);
-#endif
+ if (info == INFO_PRINT) {
+ printf("PMAX Image \n");
+ printf("Header Block Count: %lu\n", hbcnt);
+ printf("Image Size: %08lx\n", isize);
+ printf("Load Address: %08lx\n", load_addr);
+ printf("Transfer Address: %08lx\n", xfr_addr);
+ }
break;
case IHD_C_ALPHA: /* ALPHA system image */
isd = (header[EIHD_L_ISDOFF + 3] * 0x1000000 +
@@ -243,18 +245,18 @@ GetMopFileInfo(int fd, u_long *load, u_long *xfr)
header[isd+EISD_L_SECSIZE]);
load_addr = 0;
xfr_addr = 0;
-#ifdef INFO
- printf("Alpha Image \n");
- printf("Header Block Count: %lu\n", hbcnt);
- printf("Image Size: %08lx\n", isize);
- printf("Load Address: %08lx\n", load_addr);
- printf("Transfer Address: %08lx\n", xfr_addr);
-#endif
+ if (info == INFO_PRINT) {
+ printf("Alpha Image \n");
+ printf("Header Block Count: %lu\n", hbcnt);
+ printf("Image Size: %08lx\n", isize);
+ printf("Load Address: %08lx\n", load_addr);
+ printf("Transfer Address: %08lx\n", xfr_addr);
+ }
break;
default:
-#ifdef INFO
- printf("Unknown Image (%d)\n", image_type);
-#endif
+ if (info == INFO_PRINT) {
+ printf("Unknown Image (%d)\n", image_type);
+ }
return (-1);
}
@@ -396,10 +398,10 @@ CheckAOutFile(int fd)
lseek(fd, 0, SEEK_SET);
- mid = getMID(mid, N_GETMID(ex));
+ mid = getMID(mid, (int)N_GETMID(ex));
if (mid == -1)
- mid = getMID(mid, N_GETMID(ex_swap));
+ mid = getMID(mid, (int)N_GETMID(ex_swap));
if (mid != -1)
return (0);
@@ -411,7 +413,7 @@ CheckAOutFile(int fd)
int
GetAOutFileInfo(int fd, u_long *load, u_long *xfr, u_long *a_text,
u_long *a_text_fill, u_long *a_data, u_long *a_data_fill, u_long *a_bss,
- u_long *a_bss_fill, int *aout)
+ u_long *a_bss_fill, int *aout, int info)
{
#ifdef NOAOUT
return (-1);
@@ -430,10 +432,10 @@ GetAOutFileInfo(int fd, u_long *load, u_long *xfr, u_long *a_text,
mopFileSwapX(&ex_swap, 0, 4);
- mid = getMID(mid, N_GETMID(ex));
+ mid = getMID(mid, (int)N_GETMID(ex));
if (mid == -1) {
- mid = getMID(mid, N_GETMID(ex_swap));
+ mid = getMID(mid, (int)N_GETMID(ex_swap));
if (mid != -1)
mopFileSwapX(&ex, 0, 4);
}
@@ -491,84 +493,84 @@ GetAOutFileInfo(int fd, u_long *load, u_long *xfr, u_long *a_text,
break;
}
-#ifdef INFO
- printf("a.out image (");
- switch (N_GETMID(ex)) {
- case MID_I386:
- printf("i386");
- break;
+ if (info == INFO_PRINT) {
+ printf("a.out image (");
+ switch (N_GETMID(ex)) {
+ case MID_I386:
+ printf("i386");
+ break;
#ifdef MID_M68K
- case MID_M68K:
- printf("m68k");
- break;
+ case MID_M68K:
+ printf("m68k");
+ break;
#endif
#ifdef MID_M68K4K
- case MID_M68K4K:
- printf("m68k 4k");
- break;
+ case MID_M68K4K:
+ printf("m68k 4k");
+ break;
#endif
#ifdef MID_NS32532
- case MID_NS32532:
- printf("pc532");
- break;
+ case MID_NS32532:
+ printf("pc532");
+ break;
#endif
- case MID_SPARC:
- printf("sparc");
- break;
+ case MID_SPARC:
+ printf("sparc");
+ break;
#ifdef MID_PMAX
- case MID_PMAX:
- printf("pmax");
- break;
+ case MID_PMAX:
+ printf("pmax");
+ break;
#endif
#ifdef MID_VAX
- case MID_VAX:
- printf("vax");
- break;
+ case MID_VAX:
+ printf("vax");
+ break;
#endif
#ifdef MID_ALPHA
- case MID_ALPHA:
- printf("alpha");
- break;
+ case MID_ALPHA:
+ printf("alpha");
+ break;
#endif
#ifdef MID_MIPS
- case MID_MIPS:
- printf("mips");
- break;
+ case MID_MIPS:
+ printf("mips");
+ break;
#endif
#ifdef MID_ARM6
- case MID_ARM6:
- printf("arm32");
- break;
+ case MID_ARM6:
+ printf("arm32");
+ break;
#endif
- default:
- break;
- }
- printf(") Magic: ");
- switch (N_GETMAGIC (ex)) {
- case OMAGIC:
- printf("OMAGIC");
- break;
- case NMAGIC:
- printf("NMAGIC");
- break;
- case ZMAGIC:
- printf("ZMAGIC");
- break;
- case QMAGIC:
- printf("QMAGIC");
- break;
- default:
- printf("Unknown %d",N_GETMAGIC (ex));
+ default:
+ break;
+ }
+ printf(") Magic: ");
+ switch (N_GETMAGIC (ex)) {
+ case OMAGIC:
+ printf("OMAGIC");
+ break;
+ case NMAGIC:
+ printf("NMAGIC");
+ break;
+ case ZMAGIC:
+ printf("ZMAGIC");
+ break;
+ case QMAGIC:
+ printf("QMAGIC");
+ break;
+ default:
+ printf("Unknown %d",N_GETMAGIC (ex));
+ }
+ printf("\n");
+ printf("Size of text: %08x\n", ex.a_text);
+ printf("Size of data: %08x\n", ex.a_data);
+ printf("Size of bss: %08x\n", ex.a_bss);
+ printf("Size of symbol tab: %08x\n", ex.a_syms);
+ printf("Transfer Address: %08x\n", ex.a_entry);
+ printf("Size of reloc text: %08x\n", ex.a_trsize);
+ printf("Size of reloc data: %08x\n", ex.a_drsize);
}
- printf("\n");
- printf("Size of text: %08x\n", ex.a_text);
- printf("Size of data: %08x\n", ex.a_data);
- printf("Size of bss: %08x\n", ex.a_bss);
- printf("Size of symbol tab: %08x\n", ex.a_syms);
- printf("Transfer Address: %08x\n", ex.a_entry);
- printf("Size of reloc text: %08x\n", ex.a_trsize);
- printf("Size of reloc data: %08x\n", ex.a_drsize);
-#endif
magic = N_GETMAGIC(ex);
clbytes = getCLBYTES(mid);
clofset = clbytes - 1;
@@ -629,7 +631,7 @@ GetAOutFileInfo(int fd, u_long *load, u_long *xfr, u_long *a_text,
int
GetFileInfo(int fd, u_long *load, u_long *xfr, int *aout, u_long *a_text,
u_long *a_text_fill, u_long *a_data, u_long *a_data_fill, u_long *a_bss,
- u_long *a_bss_fill)
+ u_long *a_bss_fill, int info)
{
int err;
@@ -637,14 +639,14 @@ GetFileInfo(int fd, u_long *load, u_long *xfr, int *aout, u_long *a_text,
if (err == 0) {
err = GetAOutFileInfo(fd, load, xfr, a_text, a_text_fill,
- a_data, a_data_fill, a_bss, a_bss_fill, aout);
+ a_data, a_data_fill, a_bss, a_bss_fill, aout, info);
if (err != 0)
return (-1);
} else {
err = CheckMopFile(fd);
if (err == 0) {
- err = GetMopFileInfo(fd, load, xfr);
+ err = GetMopFileInfo(fd, load, xfr, info);
if (err != 0)
return (-1);
*aout = -1;
diff --git a/usr.sbin/mopd/common/file.h b/usr.sbin/mopd/common/file.h
index cca0e122175..5f719b0be03 100644
--- a/usr.sbin/mopd/common/file.h
+++ b/usr.sbin/mopd/common/file.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.h,v 1.9 2004/04/14 20:37:28 henning Exp $ */
+/* $OpenBSD: file.h,v 1.10 2006/04/29 16:26:56 maja Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@@ -23,25 +23,27 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $OpenBSD: file.h,v 1.9 2004/04/14 20:37:28 henning Exp $
+ * $OpenBSD: file.h,v 1.10 2006/04/29 16:26:56 maja Exp $
*
*/
#ifndef _FILE_H_
#define _FILE_H_
+#define INFO_PRINT 1
+
void mopFilePutLX(u_char *, int, u_long, int);
void mopFilePutBX(u_char *, int, u_long, int);
u_long mopFileGetLX(void *, int, int);
u_long mopFileGetBX(void *, int, int);
void mopFileSwapX(void *, int, int);
int CheckMopFile(int);
-int GetMopFileInfo(int, u_long *, u_long *);
+int GetMopFileInfo(int, u_long *, u_long *, int);
int CheckAOutFile(int);
int GetAOutFileInfo(int, u_long *, u_long *, u_long *, u_long *,
- u_long *, u_long *, u_long *, u_long *, int *);
+ u_long *, u_long *, u_long *, u_long *, int *, int);
int GetFileInfo(int, u_long *, u_long *, int *, u_long *, u_long *,
- u_long *, u_long *, u_long *, u_long *);
+ u_long *, u_long *, u_long *, u_long *, int);
ssize_t mopFileRead(struct dllist *, u_char *);
#endif /* _FILE_H_ */
diff --git a/usr.sbin/mopd/mopa.out/mopa.out.c b/usr.sbin/mopd/mopa.out/mopa.out.c
index b96781350a3..b3e2191dfcb 100644
--- a/usr.sbin/mopd/mopa.out/mopa.out.c
+++ b/usr.sbin/mopd/mopa.out/mopa.out.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mopa.out.c,v 1.7 2006/04/17 16:23:01 deraadt Exp $ */
+/* $OpenBSD: mopa.out.c,v 1.8 2006/04/29 16:26:56 maja Exp $ */
/* mopa.out - Convert a Unix format kernel into something that
* can be transferred via MOP.
@@ -48,7 +48,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$OpenBSD: mopa.out.c,v 1.7 2006/04/17 16:23:01 deraadt Exp $";
+static const char rcsid[] = "$OpenBSD: mopa.out.c,v 1.8 2006/04/29 16:26:56 maja Exp $";
#endif
#include "os.h"
@@ -101,7 +101,7 @@ main (int argc, char **argv)
&dl.aout,
&dl.a_text,&dl.a_text_fill,
&dl.a_data,&dl.a_data_fill,
- &dl.a_bss ,&dl.a_bss_fill );
+ &dl.a_bss ,&dl.a_bss_fill, 0);
if (dl.aout == -1) {
fprintf(stderr,"%s: not an a.out file\n",argv[1]);
diff --git a/usr.sbin/mopd/mopchk/Makefile b/usr.sbin/mopd/mopchk/Makefile
index 3187edb9543..99f0b25eceb 100644
--- a/usr.sbin/mopd/mopchk/Makefile
+++ b/usr.sbin/mopd/mopchk/Makefile
@@ -1,8 +1,8 @@
-# $OpenBSD: Makefile,v 1.3 2002/05/11 00:20:20 espie Exp $
+# $OpenBSD: Makefile,v 1.4 2006/04/29 16:26:56 maja Exp $
PROG= mopchk
SRCS= mopchk.c device.c version.c pf.c loop-bsd.c file.c
-CFLAGS+= -I${.CURDIR} -I${.CURDIR}/.. -I${.CURDIR}/../common -DINFO
+CFLAGS+= -I${.CURDIR} -I${.CURDIR}/.. -I${.CURDIR}/../common
CLEANFILES= version.c version.h
DPADD= ${LIBKVM}
LDADD= -lkvm
diff --git a/usr.sbin/mopd/mopchk/mopchk.c b/usr.sbin/mopd/mopchk/mopchk.c
index 883270a0952..4f5811b1710 100644
--- a/usr.sbin/mopd/mopchk/mopchk.c
+++ b/usr.sbin/mopd/mopchk/mopchk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mopchk.c,v 1.11 2006/04/17 10:30:31 maja Exp $ */
+/* $OpenBSD: mopchk.c,v 1.12 2006/04/29 16:26:56 maja Exp $ */
/*
* Copyright (c) 1995-96 Mats O Jansson. All rights reserved.
@@ -25,7 +25,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$OpenBSD: mopchk.c,v 1.11 2006/04/17 10:30:31 maja Exp $";
+static const char rcsid[] = "$OpenBSD: mopchk.c,v 1.12 2006/04/29 16:26:56 maja Exp $";
#endif
/*
@@ -42,8 +42,7 @@ static const char rcsid[] = "$OpenBSD: mopchk.c,v 1.11 2006/04/17 10:30:31 maja
#include "common/file.h"
/*
- * The list of all interfaces that are being listened to. rarp_loop()
- * "selects" on the descriptors in this list.
+ * The list of all interfaces that are being listened to.
*/
struct if_info *iflist;
@@ -127,8 +126,8 @@ main(argc, argv)
} else {
err = CheckAOutFile(fd);
if (err == 0) {
- if (GetAOutFileInfo(fd, 0, 0, 0, 0,
- 0, 0, 0, 0, &aout) < 0) {
+ if (GetAOutFileInfo(fd, 0, 0, 0, 0, 0, 0, 0, 0,
+ &aout, INFO_PRINT) < 0) {
printf("Some failure in GetAOutFileInfo\n");
aout = -1;
}
@@ -138,7 +137,7 @@ main(argc, argv)
if (aout == -1)
err = CheckMopFile(fd);
if (aout == -1 && err == 0) {
- if (GetMopFileInfo(fd, 0, 0) < 0) {
+ if (GetMopFileInfo(fd, 0, 0, INFO_PRINT) < 0) {
printf("Some failure in GetMopFileInfo\n");
}
};
diff --git a/usr.sbin/mopd/mopd/process.c b/usr.sbin/mopd/mopd/process.c
index 344d5242304..67e2d68918d 100644
--- a/usr.sbin/mopd/mopd/process.c
+++ b/usr.sbin/mopd/mopd/process.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: process.c,v 1.16 2006/04/17 18:55:36 maja Exp $ */
+/* $OpenBSD: process.c,v 1.17 2006/04/29 16:26:56 maja Exp $ */
/*
* Copyright (c) 1993-95 Mats O Jansson. All rights reserved.
@@ -26,7 +26,7 @@
#ifndef lint
static const char rcsid[] =
- "$OpenBSD: process.c,v 1.16 2006/04/17 18:55:36 maja Exp $";
+ "$OpenBSD: process.c,v 1.17 2006/04/29 16:26:56 maja Exp $";
#endif
#include "os.h"
@@ -196,7 +196,7 @@ mopStartLoad(u_char *dst, u_char *src, struct dllist *dl_rpr, int trans)
&dllist[slot].xferaddr, &dllist[slot].aout,
&dllist[slot].a_text, &dllist[slot].a_text_fill,
&dllist[slot].a_data, &dllist[slot].a_data_fill,
- &dllist[slot].a_bss, &dllist[slot].a_bss_fill);
+ &dllist[slot].a_bss, &dllist[slot].a_bss_fill, 0);
dllist[slot].nloadaddr = dllist[slot].loadaddr;
dllist[slot].lseek = lseek(dllist[slot].ldfd, 0L, SEEK_CUR);
diff --git a/usr.sbin/mopd/otherOS/Makefile b/usr.sbin/mopd/otherOS/Makefile
index 6028f3927db..72781085a23 100644
--- a/usr.sbin/mopd/otherOS/Makefile
+++ b/usr.sbin/mopd/otherOS/Makefile
@@ -1,7 +1,7 @@
# Copyright (c) 1993-1994 Mats O Jansson, Stockholm, Sweden
# All rights reserved.
#
-# @(#) $OpenBSD: Makefile,v 1.4 2002/06/10 21:05:25 maja Exp $
+# @(#) $OpenBSD: Makefile,v 1.5 2006/04/29 16:26:56 maja Exp $
# Script (or program) that returns the machine and os types,
# or jsut edit in the name yourself.
@@ -13,7 +13,7 @@ CCOPT = -O
INCLUDES = -I..
#rs6000-aix3#DEFINES = -D_AIX -D_BSD
-#mopchk#SPEC_FLAGS= -DINFO -DNODL -DNOAOUT
+#mopchk#SPEC_FLAGS= -DNODL -DNOAOUT
#mopd#SPEC_FLAGS= -DNOAOUT
#mopprobe#SPEC_FLAGS= -DNODL
#moptrace#SPEC_FLAGS=