aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2019-10-08 14:35:50 -0500
committerRob Landley <rob@landley.net>2019-10-08 14:35:50 -0500
commitfd49d56c459dea8dc1a436a55d8092f9668b9848 (patch)
treecf95e1a9910ed0d070f427a1d6c303459134c2c4 /toys
parent511e6a97d4b7f7f258e847a75adf728e9753a340 (diff)
downloadtoybox-fd49d56c459dea8dc1a436a55d8092f9668b9848.tar.gz
Add arch command.
Diffstat (limited to 'toys')
-rw-r--r--toys/posix/uname.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/toys/posix/uname.c b/toys/posix/uname.c
index a1338415..d93fc7a3 100644
--- a/toys/posix/uname.c
+++ b/toys/posix/uname.c
@@ -5,6 +5,15 @@
* See http://opengroup.org/onlinepubs/9699919799/utilities/uname.html
USE_UNAME(NEWTOY(uname, "oamvrns[+os]", TOYFLAG_BIN))
+USE_ARCH(NEWTOY(arch, 0, TOYFLAG_USR|TOYFLAG_BIN))
+
+config ARCH
+ bool "arch"
+ default y
+ help
+ usage: arch
+
+ Print machine (hardware) name, same as uname -m.
config UNAME
bool "uname"
@@ -23,6 +32,7 @@ config UNAME
*/
#define FOR_uname
+#define FORCE_FLAGS
#include "toys.h"
// If a 32 bit x86 build environment working in a chroot under an x86-64
@@ -72,3 +82,9 @@ void uname_main(void)
}
putchar('\n');
}
+
+void arch_main(void)
+{
+ toys.optflags = FLAG_m;
+ uname_main();
+}