* Now does proper error checking on i/o. Plus some further space savings.
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/types.h>
#include <sys/utsname.h>
#include "libbb.h"
char processor[8]; /* for "unknown" */
} uname_info_t;
-static const char options[] = "snrvmpa";
-static const unsigned short int utsname_offset[] = {
+static const char options[] ALIGN1 = "snrvmpa";
+static const unsigned short utsname_offset[] ALIGN2 = {
offsetof(uname_info_t,name.sysname),
offsetof(uname_info_t,name.nodename),
offsetof(uname_info_t,name.release),
offsetof(uname_info_t,processor)
};
-int uname_main(int argc, char **argv);
+int uname_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int uname_main(int argc, char **argv)
{
uname_info_t uname_info;
const unsigned short int *delta;
char toprint;
- toprint = getopt32(argc, argv, options);
+ toprint = getopt32(argv, options);
if (argc != optind) {
bb_show_usage();
if (toprint & 1) {
printf(((char *)(&uname_info)) + *delta);
if (toprint > 1) {
- putchar(' ');
+ bb_putchar(' ');
}
}
++delta;
} while (toprint >>= 1);
- putchar('\n');
+ bb_putchar('\n');
fflush_stdout_and_exit(EXIT_SUCCESS);
}