wok view busybox/stuff/busybox-1.27-arch.u @ rev 20235

busybox: add arch (uname -m alias)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Mar 05 15:52:59 2018 +0100 (24 months ago)
parents
children
line source
1 --- busybox-1.27.2/coreutils/uname.c.org
2 +++ busybox-1.27.2/coreutils/uname.c
3 @@ -55,10 +55,18 @@
4 //config: help
5 //config: Sets the operating system name reported by uname -o. The
6 //config: default is "GNU/Linux".
7 +//config:
8 +//config:config ARCH_ALIAS
9 +//config: bool "arch alias"
10 +//config: default y
11 +//config: help
12 +//config: arch is an alias to uname -m.
14 -//applet:IF_UNAME(APPLET(uname, BB_DIR_BIN, BB_SUID_DROP))
15 +//applet:IF_UNAME(APPLET_NOEXEC(uname, uname, BB_DIR_BIN, BB_SUID_DROP, uname))
16 +//applet:IF_ARCH_ALIAS(APPLET_NOEXEC(arch, uname, BB_DIR_BIN, BB_SUID_DROP, arch))
18 //kbuild:lib-$(CONFIG_UNAME) += uname.o
19 +//kbuild:lib-$(CONFIG_ARCH_ALIAS) += uname.o
21 /* BB_AUDIT SUSv3 compliant */
22 /* http://www.opengroup.org/onlinepubs/007904975/utilities/uname.html */
23 @@ -80,6 +88,11 @@
24 //usage:#define uname_example_usage
25 //usage: "$ uname -a\n"
26 //usage: "Linux debian 2.4.23 #2 Tue Dec 23 17:09:10 MST 2003 i686 GNU/Linux\n"
27 +//usage:
28 +//usage:#define arch_trivial_usage
29 +//usage:
30 +//usage:#define arch_full_usage "\n\n"
31 +//usage: "arch is an alias for uname -m"
33 #include "libbb.h"
34 /* After libbb.h, since it needs sys/types.h on some systems */
35 @@ -147,6 +160,12 @@
36 toprint = 1;
37 }
39 + if (ENABLE_ARCH_ALIAS
40 + && (!ENABLE_UNAME || !applet_name[4])
41 + ) { /* we are "arch" */
42 + toprint = (1 << 4);
43 + }
44 +
45 uname(&uname_info.name); /* never fails */
47 #if defined(__sparc__) && defined(__linux__)