Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Jul 2010 02:26:59 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r210228 - head/usr.bin/systat
Message-ID:  <201007190226.o6J2QxLE031798@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Mon Jul 19 02:26:59 2010
New Revision: 210228
URL: http://svn.freebsd.org/changeset/base/210228

Log:
  Partially revert r209312, restoring ability to fit "stray irqX" names into
  into available 10 characters by dropping "irq" in the middle of string.

Modified:
  head/usr.bin/systat/vmstat.c

Modified: head/usr.bin/systat/vmstat.c
==============================================================================
--- head/usr.bin/systat/vmstat.c	Sun Jul 18 22:35:46 2010	(r210227)
+++ head/usr.bin/systat/vmstat.c	Mon Jul 19 02:26:59 2010	(r210228)
@@ -259,18 +259,22 @@ initkre(void)
 					cp1 = cp1 + 2;
 					cp2 = strdup(cp);
 					bcopy(cp1, cp, sz - (cp1 - cp) + 1);
-					/* If line is long - drop "irq",
-					   if too long - drop "irqN". */
-					if (sz <= 10 + 1) {
-						strcat(cp, " ");
-						strcat(cp, cp2);
-					} else if (sz <= 10 + 4) {
+					if (sz <= 10 + 4) {
 						strcat(cp, " ");
 						strcat(cp, cp2 + 3);
 					}
 					free(cp2);
 				}
 			}
+
+			/*
+			 * Convert "name irqN" to "name N" if the former is
+			 * longer than the field width.
+			 */
+			if ((cp1 = strstr(cp, "irq")) != NULL &&
+			    strlen(cp) > 10)
+				bcopy(cp1 + 3, cp1, strlen(cp1 + 3) + 1);
+
 			intrname[i] = cp;
 			cp = nextcp;
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007190226.o6J2QxLE031798>