#include <stdlib.h>
#include <unistd.h>
#include <err.h>
+#ifdef __APPLE__
+#include <string.h>
+#endif /* __APPLE__ */
#include <sys/sysctl.h>
#include <sys/utsname.h>
&len, NULL, 0) < 0)
err(EXIT_FAILURE, "sysctl");
}
-#else /* __APPLE__ */
+#endif /* !__APPLE__ */
+
+#ifdef __APPLE__
/*
* Let's allow the user to override the output of uname via the shell environment.
* This is a useful feature for cross-compiling (eg. during an OS bringup).
s = getenv ("UNAME_VERSION"); if (s) strncpy (u.version, s, sizeof (u.version));
s = getenv ("UNAME_MACHINE"); if (s) strncpy (u.machine, s, sizeof (u.machine));
}
-#endif /* !__APPLE__ */
+#endif /* __APPLE__ */
if (print_mask & PRINT_SYSNAME) {
space++;
#ifndef __APPLE__
fputs(machine_arch, stdout);
#else
-#if defined(__ppc__)
+#if defined(__ppc__) || defined(__ppc64__)
fputs("powerpc", stdout);
-#elif defined(__i386__)
+#elif defined (__i386__) || defined(__x86_64__)
fputs("i386", stdout);
+#elif defined(__arm__)
+ fputs("arm", stdout);
#else
fputs("unknown", stdout);
#endif