From: Karel Zak Date: Wed, 11 Jul 2007 10:37:40 +0000 (+0200) Subject: sys-utils: add arch(1) back to the official tree X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6a97809b9fc9bb4113e1ecfa95d68536b0a720a8;p=util-linux sys-utils: add arch(1) back to the official tree This patch add arch(1) back to util-linux source code tree, but the command is not installed by defautl. For more details see "./configure --help". The arch command is deprecated in favor of "uname -m" (coreutils). The latest (6.9+) version of coreutils also supports arch(1) as an alias to "uname -a". Please, if you need arch(1) use the coreutils implementation. Signed-off-by: Karel Zak --- diff --git a/DEPRECATED b/DEPRECATED index aa08f9ad..592009d4 100644 --- a/DEPRECATED +++ b/DEPRECATED @@ -22,9 +22,9 @@ Why: useless for kernel >= 2.6.9 What: arch(1) command When: 2.14 -Why: deprecated in favor of uname(1) from coreutils +Why: deprecated in favor of uname(1) or arch(1) from coreutils - The arch(1) has been moved (during 2.13 development cycle) to coreutuls + The arch(1) has been added (during 2.13 development cycle) to coreutuls where it will be maintained as an alias for uname(1) command. ---------------------------- diff --git a/configure.ac b/configure.ac index 0af567a0..c1c59650 100644 --- a/configure.ac +++ b/configure.ac @@ -246,6 +246,11 @@ UTIL_SET_ARCH(PPC, ppc*|powerpc*) UTIL_SET_ARCH(M68K, m68*) UTIL_SET_ARCH(MIPS, mips*) +AC_ARG_ENABLE([arch], + AS_HELP_STRING([--enable-arch], [do build arch]), + [], enable_arch=no +) +AM_CONDITIONAL(BUILD_ARCH, test x$enable_arch = xyes) AC_ARG_ENABLE([agetty], AS_HELP_STRING([--disable-agetty], [do not build agetty]), @@ -253,7 +258,6 @@ AC_ARG_ENABLE([agetty], ) AM_CONDITIONAL(BUILD_AGETTY, test x$enable_agetty = xyes) - AC_ARG_ENABLE([cramfs], AS_HELP_STRING([--disable-cramfs], [do not build fsck.cramfs, mkfs.cramfs]), [], enable_cramfs=check diff --git a/po/POTFILES.in b/po/POTFILES.in index 306b77a6..adf0aaec 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -88,6 +88,7 @@ partx/unixware.c schedutils/chrt.c schedutils/ionice.c schedutils/taskset.c +sys-utils/arch.c sys-utils/ctrlaltdel.c sys-utils/cytune.c sys-utils/dmesg.c diff --git a/sys-utils/Makefile.am b/sys-utils/Makefile.am index 77b1725e..535f0f26 100644 --- a/sys-utils/Makefile.am +++ b/sys-utils/Makefile.am @@ -18,6 +18,11 @@ man_MANS = flock.1 readprofile.1 \ info_TEXINFOS = ipc.texi +if BUILD_ARCH +bin_PROGRAMS += arch +man_MANS += arch.1 +endif + if BUILD_RDEV if ARCH_I86 usrsbinexec_PROGRAMS += rdev diff --git a/sys-utils/arch.1 b/sys-utils/arch.1 new file mode 100644 index 00000000..344f560a --- /dev/null +++ b/sys-utils/arch.1 @@ -0,0 +1,40 @@ +.\" 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 deprecated command since release util-linux 2.13. Use +.BR "uname -m" +or use +.BR arch +from the coreutils package. + +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) +.SH AVAILABILITY +The arch command is part of the util-linux-ng package and is available from +ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/. +.\" +.\" 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) diff --git a/sys-utils/arch.c b/sys-utils/arch.c new file mode 100644 index 00000000..33dff304 --- /dev/null +++ b/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 +#include + +int main (void) +{ + struct utsname utsbuf; + + if (uname( &utsbuf )) { + perror( "arch" ); + return 1; + } + + printf( "%s\n", utsbuf.machine ); + + return 0; +}