Date: Sat, 12 Jan 2002 17:32:48 +0900 (JST) From: Takahashi Yoshihiro <nyan@FreeBSD.org> To: ru@FreeBSD.org Cc: kato@FreeBSD.org, arch@FreeBSD.org Subject: Re: hw.machine on PC98 Message-ID: <20020112.173248.74673114.yosihiro@cc.kogakuin.ac.jp> In-Reply-To: <20011217192100.A31562@sunbay.com> References: <20011214173056.A94075@sunbay.com> <20011217.233630.74667853.yosihiro@cc.kogakuin.ac.jp> <20011217192100.A31562@sunbay.com>
next in thread | previous in thread | raw e-mail | index | archive | help
----Next_Part(Sat_Jan_12_17:32:48_2002_364)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit In article <20011217192100.A31562@sunbay.com> Ruslan Ermilov <ru@FreeBSD.ORG> writes: > uname -m should print the value of hw.machine > uname -p should print the value of hw.machine_arch > > I will probably add the -p option handling, if nobody beats me to it. I have made a patch to add -p option to uname(1) for printing machine_arch. If it has no problem, I will commit it. --- TAKAHASHI Yoshihiro THE CENTER for INFORMATION SCIENCE, Kogakuin Univ. ----Next_Part(Sat_Jan_12_17:32:48_2002_364)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="uname.diff" Index: uname.1 =================================================================== RCS file: /home/ncvs/src/usr.bin/uname/uname.1,v retrieving revision 1.9 diff -u -r1.9 uname.1 --- uname.1 15 Aug 2001 09:09:44 -0000 1.9 +++ uname.1 12 Jan 2002 08:04:47 -0000 @@ -65,9 +65,7 @@ .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. Index: uname.c =================================================================== RCS file: /home/ncvs/src/usr.bin/uname/uname.c,v retrieving revision 1.5 diff -u -r1.5 uname.c --- uname.c 11 Dec 2001 23:16:25 -0000 1.5 +++ uname.c 12 Jan 2002 08:05:52 -0000 @@ -62,9 +62,10 @@ { #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 @@ 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 @@ (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 @@ void usage() { - (void)fprintf(stderr, "usage: uname [-amnrsv]\n"); + (void)fprintf(stderr, "usage: uname [-amnprsv]\n"); exit(1); } ----Next_Part(Sat_Jan_12_17:32:48_2002_364)---- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020112.173248.74673114.yosihiro>