Use uname(3) to determine MACHINE type.

This commit is contained in:
tsutsui 2000-01-09 04:54:53 +00:00
parent 2c4bbb1b26
commit 5cb06e6456
3 changed files with 35 additions and 19 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: crunchgen.c,v 1.11 1999/06/21 05:57:10 cgd Exp $ */
/* $NetBSD: crunchgen.c,v 1.12 2000/01/09 04:54:53 tsutsui Exp $ */
/*
* Copyright (c) 1994 University of Maryland
* All Rights Reserved.
@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: crunchgen.c,v 1.11 1999/06/21 05:57:10 cgd Exp $");
__RCSID("$NetBSD: crunchgen.c,v 1.12 2000/01/09 04:54:53 tsutsui Exp $");
#endif
#include <stdlib.h>
@ -45,6 +45,7 @@ __RCSID("$NetBSD: crunchgen.c,v 1.11 1999/06/21 05:57:10 cgd Exp $");
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/param.h>
#include <sys/utsname.h>
#define CRUNCH_VERSION "0.2"
@ -117,8 +118,15 @@ int main(int argc, char **argv)
extern int optind;
extern char *optarg;
if ((machine = getenv("MACHINE")) == NULL)
machine = MACHINE;
if ((machine = getenv("MACHINE")) == NULL) {
struct utsname utsname;
if (uname(&utsname) == -1) {
perror("uname");
exit(1);
}
machine = utsname.machine;
}
verbose = 1;
readcache = 1;
*outmkname = *outcfname = *execfname = '\0';

View File

@ -1,4 +1,4 @@
/* $NetBSD: man.c,v 1.21 1999/11/02 10:56:51 lukem Exp $ */
/* $NetBSD: man.c,v 1.22 2000/01/09 04:54:54 tsutsui Exp $ */
/*
* Copyright (c) 1987, 1993, 1994, 1995
@ -44,12 +44,13 @@ __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.21 1999/11/02 10:56:51 lukem Exp $");
__RCSID("$NetBSD: man.c,v 1.22 2000/01/09 04:54:54 tsutsui Exp $");
#endif
#endif /* not lint */
#include <sys/param.h>
#include <sys/queue.h>
#include <sys/utsname.h>
#include <ctype.h>
#include <err.h>
@ -66,10 +67,6 @@ __RCSID("$NetBSD: man.c,v 1.21 1999/11/02 10:56:51 lukem Exp $");
#include "config.h"
#include "pathnames.h"
#ifndef MACHINE
#define MACHINE __ARCHITECTURE__
#endif
int f_all, f_where;
int main __P((int, char **));
@ -162,8 +159,15 @@ main(argc, argv)
config(conffile);
/* Get the machine type. */
if ((machine = getenv("MACHINE")) == NULL)
machine = MACHINE;
if ((machine = getenv("MACHINE")) == NULL) {
struct utsname utsname;
if (uname(&utsname) == -1) {
perror("uname");
exit(1);
}
machine = utsname.machine;
}
/* If there's no _default list, create an empty one. */
if ((defp = getlist("_default")) == NULL)

View File

@ -1,4 +1,4 @@
/* $NetBSD: catman.c,v 1.13 1999/04/20 14:22:32 mycroft Exp $ */
/* $NetBSD: catman.c,v 1.14 2000/01/09 04:54:54 tsutsui Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -41,6 +41,7 @@
#include <sys/param.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/utsname.h>
#include <ctype.h>
#include <dirent.h>
#include <err.h>
@ -57,10 +58,6 @@
#include "config.h"
#include "pathnames.h"
#ifndef MACHINE
#define MACHINE __ARCHITECTURE__
#endif
int f_nowhatis = 0;
int f_noaction = 0;
int f_noformat = 0;
@ -156,8 +153,15 @@ setdefentries(m_path, m_add, sections)
int i;
/* Get the machine type. */
if ((machine = getenv("MACHINE")) == NULL)
machine = MACHINE;
if ((machine = getenv("MACHINE")) == NULL) {
struct utsname utsname;
if (uname(&utsname) == -1) {
perror("uname");
exit(1);
}
machine = utsname.machine;
}
/* If there's no _default list, create an empty one. */
if ((defp = getlist("_default")) == NULL)