From 76c99f3c0a3c69e6a64d98e03ac34f51ac50d8ba Mon Sep 17 00:00:00 2001 From: wsanchez Date: Thu, 8 Oct 1998 01:36:04 +0000 Subject: [PATCH] We can't define MACHINE from a makefile in Rhapsody, because you might be cross compiling, or building a fat (multi-architecture) binary. Our compiler defines __ARCHITECTURE__ for this use. Fixed an off-by-one error that may occasionally cause man to seg fault. Found by using a special strict malloc() implementation. --- usr.bin/man/man.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/usr.bin/man/man.c b/usr.bin/man/man.c index 08792fe4f536..22976df5b229 100644 --- a/usr.bin/man/man.c +++ b/usr.bin/man/man.c @@ -1,4 +1,4 @@ -/* $NetBSD: man.c,v 1.13 1998/08/25 20:59:39 ross Exp $ */ +/* $NetBSD: man.c,v 1.14 1998/10/08 01:36:04 wsanchez Exp $ */ /* * Copyright (c) 1987, 1993, 1994, 1995 @@ -44,7 +44,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 1993, 1994, 1995\n\ #if 0 static char sccsid[] = "@(#)man.c 8.17 (Berkeley) 1/31/95"; #else -__RCSID("$NetBSD: man.c,v 1.13 1998/08/25 20:59:39 ross Exp $"); +__RCSID("$NetBSD: man.c,v 1.14 1998/10/08 01:36:04 wsanchez Exp $"); #endif #endif /* not lint */ @@ -66,6 +66,10 @@ __RCSID("$NetBSD: man.c,v 1.13 1998/08/25 20:59:39 ross Exp $"); #include "config.h" #include "pathnames.h" +#ifndef MACHINE +#define MACHINE __ARCHITECTURE__ +#endif + int f_all, f_where; int main __P((int, char **)); @@ -355,7 +359,7 @@ main(argc, argv) p += len; *p++ = ' '; } - *p = '\0'; + *--p = '\0'; /* Use system(3) in case someone's pager is "pager arg1 arg2". */ (void)system(cmd);