summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authornyan <nyan@FreeBSD.org>2002-01-14 12:49:46 +0000
committernyan <nyan@FreeBSD.org>2002-01-14 12:49:46 +0000
commit17695fee4f64b737e01b211fba218ed62dc54685 (patch)
tree877f5b215ce53faaf3495463bc291f7bf1cbdb9f /usr.bin
parent3748cc3d0f9ceca9247772a2fd73027f6fe915fa (diff)
downloadFreeBSD-src-17695fee4f64b737e01b211fba218ed62dc54685.zip
FreeBSD-src-17695fee4f64b737e01b211fba218ed62dc54685.tar.gz
'uname -p' prints the value of hw.machine_arch instead of hw.machine.
Reviewed by: imp No response from: -arch MFC after: 3 weeks
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/uname/uname.14
-rw-r--r--usr.bin/uname/uname.c22
2 files changed, 18 insertions, 8 deletions
diff --git a/usr.bin/uname/uname.1 b/usr.bin/uname/uname.1
index 5ac8966..ebaf4ea 100644
--- a/usr.bin/uname/uname.1
+++ b/usr.bin/uname/uname.1
@@ -65,9 +65,7 @@ Write the type of the current hardware platform to standard output.
.It Fl n
Write the name of the system to standard output.
.It Fl p
-Writes out the same value as
-.Fl m .
-This option is provided for backward compatibility with SVR4.
+Write the type of the machine processor architecture to standard output.
.It Fl r
Write the current release level of the operating system
to standard output.
diff --git a/usr.bin/uname/uname.c b/usr.bin/uname/uname.c
index acb0e3a..4502ba3 100644
--- a/usr.bin/uname/uname.c
+++ b/usr.bin/uname/uname.c
@@ -62,9 +62,10 @@ main(argc, argv)
{
#define MFLAG 0x01
#define NFLAG 0x02
-#define RFLAG 0x04
-#define SFLAG 0x08
-#define VFLAG 0x10
+#define PFLAG 0x04
+#define RFLAG 0x08
+#define SFLAG 0x10
+#define VFLAG 0x20
u_int flags;
int ch, mib[2];
size_t len, tlen;
@@ -77,13 +78,15 @@ main(argc, argv)
case 'a':
flags |= (MFLAG | NFLAG | RFLAG | SFLAG | VFLAG);
break;
- case 'p':
case 'm':
flags |= MFLAG;
break;
case 'n':
flags |= NFLAG;
break;
+ case 'p':
+ flags |= PFLAG;
+ break;
case 'r':
flags |= RFLAG;
break;
@@ -157,6 +160,15 @@ main(argc, argv)
(void)printf("%s%.*s", prefix, (int)len, buf);
prefix = " ";
}
+ if (flags & PFLAG) {
+ mib[0] = CTL_HW;
+ mib[1] = HW_MACHINE_ARCH;
+ len = sizeof(buf);
+ if (sysctl(mib, 2, &buf, &len, NULL, 0) == -1)
+ err(1, "sysctl");
+ (void)printf("%s%.*s", prefix, (int)len, buf);
+ prefix = " ";
+ }
(void)printf("\n");
exit (0);
}
@@ -164,6 +176,6 @@ main(argc, argv)
void
usage()
{
- (void)fprintf(stderr, "usage: uname [-amnrsv]\n");
+ (void)fprintf(stderr, "usage: uname [-amnprsv]\n");
exit(1);
}
OpenPOWER on IntegriCloud