/* vi: set sw=4 ts=4: */
-/* uname -- print system information
+/*
+ * uname -- print system information
* Copyright (C) 1989-1999 Free Software Foundation, Inc.
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
* Fix handling of -a to not print "unknown", add -o and -i support.
*/
//config:config UNAME
-//config: bool "uname"
+//config: bool "uname (3.7 kb)"
//config: default y
//config: help
-//config: uname is used to print system information.
+//config: uname is used to print system information.
//config:
//config:config UNAME_OSNAME
//config: string "Operating system name"
//config: default "GNU/Linux"
//config: depends on UNAME
//config: help
-//config: Sets the operating system name reported by uname -o. The
-//config: default is "GNU/Linux".
+//config: Sets the operating system name reported by uname -o. The
+//config: default is "GNU/Linux".
//config:
//can't use "ARCH" for this applet, all hell breaks loose in build system :)
-//config:config BBARCH
-//config: bool "arch"
+//config:config BB_ARCH
+//config: bool "arch (1.6 kb)"
//config: default y
//config: help
-//config: Same as uname -m.
+//config: Same as uname -m.
-//applet:IF_UNAME(APPLET(uname, BB_DIR_BIN, BB_SUID_DROP))
-// APPLET_ODDNAME:name main location suid_type help
-//applet:IF_BBARCH(APPLET_ODDNAME(arch, uname, BB_DIR_BIN, BB_SUID_DROP, arch))
+// APPLET_NOFORK:name main location suid_type help
+//applet:IF_UNAME(APPLET_NOFORK( uname, uname, BB_DIR_BIN, BB_SUID_DROP, uname))
+//applet:IF_BB_ARCH(APPLET_NOFORK(arch, uname, BB_DIR_BIN, BB_SUID_DROP, arch))
-//kbuild:lib-$(CONFIG_UNAME) += uname.o
-//kbuild:lib-$(CONFIG_BBARCH) += uname.o
+//kbuild:lib-$(CONFIG_UNAME) += uname.o
+//kbuild:lib-$(CONFIG_BB_ARCH) += uname.o
/* BB_AUDIT SUSv3 compliant */
/* http://www.opengroup.org/onlinepubs/007904975/utilities/uname.html */
{
uname_info_t uname_info;
IF_UNAME(const char *unknown_str = "unknown";)
- unsigned toprint;
-
- toprint = (1 << 4); /* "arch" = "uname -m" */
-
#if ENABLE_UNAME
- if (!ENABLE_BBARCH || applet_name[0] == 'u') {
+ unsigned toprint = (1 << 4); /* "arch" = "uname -m" */
+
+ if (!ENABLE_BB_ARCH || applet_name[0] == 'u') {
# if ENABLE_LONG_OPTS
static const char uname_longopts[] ALIGN1 =
/* name, has_arg, val */
"operating-system\0" No_argument "o"
;
# endif
- IF_LONG_OPTS(applet_long_options = uname_longopts);
- toprint = getopt32(argv, options);
+ toprint = getopt32long(argv, options, uname_longopts);
if (argv[optind]) { /* coreutils-6.9 compat */
bb_show_usage();
}
}
}
#endif
- if (ENABLE_BBARCH && (!ENABLE_UNAME || applet_name[0] == 'a')) {
+ if (ENABLE_BB_ARCH && (!ENABLE_UNAME || applet_name[0] == 'a')) {
puts(uname_info.name.machine);
} else {
#if ENABLE_UNAME
strcpy(uname_info.processor, unknown_str);
strcpy(uname_info.platform, unknown_str);
strcpy(uname_info.os, CONFIG_UNAME_OSNAME);
-# if 0
+# if ENABLE_FEDORA_COMPAT
/* Fedora does something like this */
strcpy(uname_info.processor, uname_info.name.machine);
strcpy(uname_info.platform, uname_info.name.machine);