Subject: Re: "name" versus "banner-name" (almost trivia)
To: NetBSD port-sparc64 mailing list <port-sparc64@netbsd.org>
From: Julian Coleman <jdc@coris.org.uk>
List: port-sparc64
Date: 12/30/2007 12:24:47
After a comment that it would be better to keep the "name" as well as showing
the "banner-name", the appended patch displays:

  mainbus0 (root): SUNW,UltraAX-i2 (Sun Fire V120): hostid 83683549

on my V120.  The "banner-name" is displayed up to the first '('.

Thanks,

J

  - - 8< - - - - - - - - - - - - - Cut here - - - - - - - - - - - - - >8 - -
--- autoconf.c.dist	2007-12-08 18:53:17.000000000 +0000
+++ autoconf.c	2007-12-30 12:05:17.000000000 +0000
@@ -135,6 +135,7 @@
 #define	OFPATHLEN	128
 #define	OFNODEKEY	"OFpnode"
 
+char	machine_banner[100];
 char	machine_model[100];
 char	ofbootpath[OFPATHLEN], *ofboottarget, *ofbootpartition;
 int	ofbootpackage;
@@ -516,6 +517,7 @@
 	struct mainbus_attach_args ma;
 	char sbuf[32];
 	const char *const *ssp, *sp = NULL;
+	char *c;
 	int node0, node, rv, i;
 
 	static const char *const openboot_special[] = {
@@ -534,9 +536,26 @@
 		NULL
 	};
 
+	if (OF_getprop(findroot(), "banner-name", machine_banner,
+	    sizeof machine_banner) < 0)
+		i = 0;
+	else {
+		i = 1;
+		if (((c = strchr(machine_banner, '(')) != NULL) &&
+		    c != &machine_banner[0]) {
+				while (*c == '(' || *c == ' ') {
+					*c = '\0';
+					c--;
+				}
+			}
+	}
 	OF_getprop(findroot(), "name", machine_model, sizeof machine_model);
 	prom_getidprom();
-	printf(": %s: hostid %lx\n", machine_model, hostid);
+	if (i)
+		printf(": %s (%s): hostid %lx\n", machine_model,
+		    machine_banner, hostid);
+	else
+		printf(": %s: hostid %lx\n", machine_model, hostid);
 
 	/*
 	 * Locate and configure the ``early'' devices.  These must be
  - - 8< - - - - - - - - - - - - - Cut here - - - - - - - - - - - - - >8 - -

-- 
  My other computer also runs NetBSD    /        Sailing at Newbiggin
        http://www.netbsd.org/        /   http://www.newbigginsailingclub.org/