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 <kzak@redhat.com>
This commit is contained in:
Karel Zak 2007-07-11 12:37:40 +02:00
parent 7dff8582f8
commit 6a97809b9f
6 changed files with 88 additions and 3 deletions

View File

@ -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.
----------------------------

View File

@ -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

View File

@ -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

View File

@ -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

40
sys-utils/arch.1 Normal file
View File

@ -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)

35
sys-utils/arch.c Normal file
View File

@ -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;
}