From Mailer-Daemon@East.Sun.COM  Mon Feb 23 11:55:55 1998
Received: from mercury.Sun.COM (mercury.Sun.COM [192.9.25.1])
          by hub.freebsd.org (8.8.8/8.8.8) with SMTP id LAA29029
          for <FreeBSD-gnats-submit@freebsd.org>; Mon, 23 Feb 1998 11:55:54 -0800 (PST)
          (envelope-from Mailer-Daemon@East.Sun.COM)
Received: from East.Sun.COM ([129.148.1.241]) by mercury.Sun.COM (SMI-8.6/mail.byaddr) with SMTP id LAA21734 for <FreeBSD-gnats-submit@freebsd.org>; Mon, 23 Feb 1998 11:43:02 -0800
Received: from suneast.East.Sun.COM by East.Sun.COM (SMI-8.6/SMI-5.3)
	id OAA03165; Mon, 23 Feb 1998 14:42:56 -0500
Received: from compound.east.sun.com by suneast.East.Sun.COM (SMI-8.6/SMI-SVR4)
	id OAA08309; Mon, 23 Feb 1998 14:42:39 -0500
Received: (from alk@localhost) by compound.east.sun.com (8.8.8/8.7.3) id LAA07107; Mon, 23 Feb 1998 11:41:59 -0600 (CST)
Message-Id: <199802231741.LAA07107@compound.east.sun.com>
Date: Mon, 23 Feb 1998 11:41:59 -0600 (CST)
From: Tony Kimball <alk@East.Sun.COM>
Reply-To: alk@East.Sun.COM
To: FreeBSD-gnats-submit@freebsd.org
Subject: uname '-p' option
X-Send-Pr-Version: 3.2

>Number:         5826
>Category:       bin
>Synopsis:       cross-platform script compatibility
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    steve
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Feb 23 12:00:00 PST 1998
>Closed-Date:    Tue Feb 24 08:58:05 PST 1998
>Last-Modified:  Tue Feb 24 08:58:48 PST 1998
>Originator:     Tony Kimball
>Release:        FreeBSD 3.0-CURRENT i386
>Organization:
Dis
>Environment:


>Description:

I find many SVR4 scripts using the -p option of uname to get
BSD uname -m functionality.  Here's a one-line to provide 
script-compatibility.

>How-To-Repeat:

>Fix:
	
; cd usr.bin/uname; cvs diff -c3 uname.c
Index: uname.c
===================================================================
RCS file: /work/repository/FreeBSD/src/usr.bin/uname/uname.c,v
retrieving revision 1.2
diff -c -3 -r1.2 uname.c
*** uname.c	1997/03/29 04:33:22	1.2
--- uname.c	1998/02/23 17:36:09
***************
*** 72,77 ****
--- 72,78 ----
  		case 'a':
  			flags |= (MFLAG | NFLAG | RFLAG | SFLAG | VFLAG);
  			break;
+ 		case 'p':
  		case 'm':
  			flags |= MFLAG;
  			break;
>Release-Note:
>Audit-Trail:

From: Steve Price <sprice@hiwaay.net>
To: alk@East.Sun.COM, freebsd-gnats-submit@FreeBSD.ORG
Cc:  Subject: Re: bin/5826: uname '-p' option
Date: Mon, 23 Feb 1998 16:21:44 -0600

 > I find many SVR4 scripts using the -p option of uname to get
 > BSD uname -m functionality.  Here's a one-line to provide
 > script-compatibility.
 
 Actually I think the intent of the -p option is to show
 the processor type of the machine, at least according to
 a Digital box running OSF1.  Maybe the attached patch 
 would be more appropriate?
 
 Steve
 
 Index: uname.1
 ===================================================================
 RCS file: /u/FreeBSD/cvs/src/usr.bin/uname/uname.1,v
 retrieving revision 1.5
 diff -u -r1.5 uname.1
 --- uname.1	1997/08/20 11:03:54	1.5
 +++ uname.1	1998/02/23 22:17:58
 @@ -39,7 +39,7 @@
  .Nd display information about the system
  .Sh SYNOPSIS
  .Nm
 -.Op Fl amnrsv
 +.Op Fl amnprsv
  .Sh DESCRIPTION
  The
  .Nm
 @@ -54,6 +54,7 @@
  Behave as though the options
  .Fl m ,
  .Fl n ,
 +.Fl p ,
  .Fl r ,
  .Fl s ,
  and
 @@ -63,6 +64,8 @@
  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
 +Write the processor type to standard output.
  .It Fl r
  Write the current release level of the operating system
  to standard output.
 Index: uname.c
 ===================================================================
 RCS file: /u/FreeBSD/cvs/src/usr.bin/uname/uname.c,v
 retrieving revision 1.2
 diff -u -r1.2 uname.c
 --- uname.c	1997/03/29 04:33:22	1.2
 +++ uname.c	1998/02/23 22:19:01
 @@ -61,13 +61,14 @@
  #define	RFLAG	0x04
  #define	SFLAG	0x08
  #define	VFLAG	0x10
 +#define	PFLAG   0x20
  	u_int flags;
  	int ch, mib[2];
  	size_t len, tlen;
  	char *p, *prefix, buf[1024];
  
  	flags = 0;
 -	while ((ch = getopt(argc, argv, "amnrsv")) != -1)
 +	while ((ch = getopt(argc, argv, "amnprsv")) != -1)
  		switch(ch) {
  		case 'a':
  			flags |= (MFLAG | NFLAG | RFLAG | SFLAG | VFLAG);
 @@ -78,6 +79,9 @@
  		case 'n':
  			flags |= NFLAG;
  			break;
 +		case 'p':
 +			flags |= PFLAG;
 +			break;
  		case 'r':
  			flags |= RFLAG;
  			break;
 @@ -145,6 +149,15 @@
  	if (flags & MFLAG) {
  		mib[0] = CTL_HW;
  		mib[1] = HW_MACHINE;
 +		len = sizeof(buf);
 +		if (sysctl(mib, 2, &buf, &len, NULL, 0) == -1)
 +			err(1, "sysctl");
 +		(void)printf("%s%.*s", prefix, len, buf);
 +		prefix = " ";
 +	}
 +	if (flags & PFLAG) {
 +		mib[0] = CTL_HW;
 +		mib[1] = HW_MODEL;
  		len = sizeof(buf);
  		if (sysctl(mib, 2, &buf, &len, NULL, 0) == -1)
  			err(1, "sysctl");
State-Changed-From-To: open->closed 
State-Changed-By: steve 
State-Changed-When: Tue Feb 24 08:58:05 PST 1998 
State-Changed-Why:  
New -p option added as requested.  Thanks! 


Responsible-Changed-From-To: freebsd-bugs->steve 
Responsible-Changed-By: steve 
Responsible-Changed-When: Tue Feb 24 08:58:05 PST 1998 
Responsible-Changed-Why:  
>Unformatted:
