mschorm / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone
169b953
--- util-linux-2.13-pre1/sys-utils/Makefile.am.arch	2005-08-16 12:54:22.000000000 +0200
169b953
+++ util-linux-2.13-pre1/sys-utils/Makefile.am	2005-08-16 12:55:00.000000000 +0200
169b953
@@ -1,6 +1,6 @@
169b953
 include $(top_srcdir)/config/include-Makefile.am
169b953
 
169b953
-bin_PROGRAMS = dmesg
169b953
+bin_PROGRAMS = dmesg arch
169b953
 
169b953
 usrbin_PROGRAMS = cytune flock ipcrm ipcs renice setsid
169b953
 
169b953
@@ -8,7 +8,7 @@
169b953
 
169b953
 usrsbin_PROGRAMS = readprofile tunelp
169b953
 
169b953
-man_MANS = flock.1 readprofile.1 \
169b953
+man_MANS = flock.1 readprofile.1 arch.1 \
169b953
 	ctrlaltdel.8 cytune.8 dmesg.8 ipcrm.8 ipcs.8 renice.8 \
169b953
 	setsid.8 tunelp.8
169b953
 
169b953
--- util-linux-2.13-pre1/sys-utils/arch.1.arch	2005-08-16 12:55:34.000000000 +0200
169b953
+++ util-linux-2.13-pre1/sys-utils/arch.1	2005-08-16 12:59:51.000000000 +0200
169b953
@@ -0,0 +1,34 @@
169b953
+.\" arch.1 -- 
169b953
+.\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu)
169b953
+.\" Public domain: may be freely distributed.
169b953
+.TH ARCH 1 "4 July 1997" "Linux 2.0" "Linux Programmer's Manual"
169b953
+.SH NAME
169b953
+arch \- print machine architecture
169b953
+.SH SYNOPSIS
169b953
+.B arch
169b953
+.SH DESCRIPTION
169b953
+.B arch
169b953
+is deprecated command since release util-linux 2.13. Use
169b953
+.BR "uname -m" .
169b953
+
169b953
+On current Linux systems,
169b953
+.B arch
169b953
+prints things such as "i386", "i486", "i586", "alpha", "sparc",
169b953
+"arm", "m68k", "mips", "ppc".
169b953
+.SH SEE ALSO
169b953
+.BR uname (1),
169b953
+.BR uname (2)
169b953
+.\"
169b953
+.\" Details:
169b953
+.\" arch prints the machine part of the system_utsname struct
169b953
+.\" This struct is defined in version.c, and this field is
169b953
+.\" initialized with UTS_MACHINE, which is defined as $ARCH
169b953
+.\" in the main Makefile.
169b953
+.\" That gives the possibilities 
169b953
+.\" alpha    arm      i386     m68k     mips     ppc      sparc    sparc64
169b953
+.\"
169b953
+.\" If Makefile is not edited, ARCH is guessed by
169b953
+.\" ARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/)
169b953
+.\" Then how come we get these i586 values?
169b953
+.\" Well, the routine check_bugs() does system_utsname.machine[1] = '0' + x86;
169b953
+.\" (called in init/main.c, defined in ./include/asm-i386/bugs.h)
169b953
--- util-linux-2.13-pre1/sys-utils/arch.c.arch	2005-08-16 12:55:43.000000000 +0200
169b953
+++ util-linux-2.13-pre1/sys-utils/arch.c	1999-07-09 04:56:41.000000000 +0200
169b953
@@ -0,0 +1,35 @@
169b953
+/* arch -- print machine architecture information
169b953
+ * Created: Mon Dec 20 12:27:15 1993 by faith@cs.unc.edu
169b953
+ * Revised: Mon Dec 20 12:29:23 1993 by faith@cs.unc.edu
169b953
+ * Copyright 1993 Rickard E. Faith (faith@cs.unc.edu)
169b953
+
169b953
+ * This program is free software; you can redistribute it and/or modify it
169b953
+ * under the terms of the GNU General Public License as published by the
169b953
+ * Free Software Foundation; either version 2, or (at your option) any
169b953
+ * later version.
169b953
+
169b953
+ * This program is distributed in the hope that it will be useful, but
169b953
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
169b953
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
169b953
+ * General Public License for more details.
169b953
+
169b953
+ * You should have received a copy of the GNU General Public License along
169b953
+ * with this program; if not, write to the Free Software Foundation, Inc.,
169b953
+ * 675 Mass Ave, Cambridge, MA 02139, USA.  */
169b953
+
169b953
+#include <stdio.h>
169b953
+#include <sys/utsname.h>
169b953
+
169b953
+int main (void)
169b953
+{
169b953
+  struct utsname utsbuf;
169b953
+
169b953
+  if (uname( &utsbuf )) {
169b953
+     perror( "arch" );
169b953
+     return 1;
169b953
+  }
169b953
+
169b953
+  printf( "%s\n", utsbuf.machine );
169b953
+
169b953
+  return 0;
169b953
+}