3
0
forked from pool/util-linux
util-linux/util-linux-2.13-sys_utils_arch.patch

106 lines
3.4 KiB
Diff

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