Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Use uname(3) to determine MACHINE type.
details: https://anonhg.NetBSD.org/src/rev/699f05b80ed4
branches: trunk
changeset: 480312:699f05b80ed4
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sun Jan 09 04:54:53 2000 +0000
description:
Use uname(3) to determine MACHINE type.
diffstat:
usr.bin/crunch/crunchgen/crunchgen.c | 16 ++++++++++++----
usr.bin/man/man.c | 20 ++++++++++++--------
usr.sbin/catman/catman.c | 18 +++++++++++-------
3 files changed, 35 insertions(+), 19 deletions(-)
diffs (143 lines):
diff -r 4cdcb836c207 -r 699f05b80ed4 usr.bin/crunch/crunchgen/crunchgen.c
--- a/usr.bin/crunch/crunchgen/crunchgen.c Sun Jan 09 04:35:13 2000 +0000
+++ b/usr.bin/crunch/crunchgen/crunchgen.c Sun Jan 09 04:54:53 2000 +0000
@@ -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 @@
#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 @@
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';
diff -r 4cdcb836c207 -r 699f05b80ed4 usr.bin/man/man.c
--- a/usr.bin/man/man.c Sun Jan 09 04:35:13 2000 +0000
+++ b/usr.bin/man/man.c Sun Jan 09 04:54:53 2000 +0000
@@ -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 @@
#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 @@
#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 @@
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)
diff -r 4cdcb836c207 -r 699f05b80ed4 usr.sbin/catman/catman.c
--- a/usr.sbin/catman/catman.c Sun Jan 09 04:35:13 2000 +0000
+++ b/usr.sbin/catman/catman.c Sun Jan 09 04:54:53 2000 +0000
@@ -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 @@
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)
Home |
Main Index |
Thread Index |
Old Index