Blame SOURCES/pinfo-0.6.9-mansection.patch

92a3ce
--- pinfo-0.6.9/src/manual.c.mansection	2006-03-16 15:14:30.000000000 +0100
92a3ce
+++ pinfo-0.6.9/src/manual.c	2007-02-23 14:52:30.000000000 +0100
92a3ce
@@ -167,16 +167,29 @@
92a3ce
 	}
92a3ce
 	i = len;
92a3ce
 	/* find the beginning of the last token */
92a3ce
-	for (i = len - 1;(i > 0) &&(!isspace(name1[i])); i--);
92a3ce
-
92a3ce
-	/* if we've found space, then we move to the first nonspace character */
92a3ce
-	if (i > 0)
92a3ce
-		i++;
92a3ce
+	for (i = len - 1;(i >= 0) &&(!isspace(name1[i])); i--)
92a3ce
+		;
92a3ce
+	i++;
92a3ce
 
92a3ce
 	/* filename->name */
92a3ce
-	strcpy(manualhistory[0].name, &name1[i]);
92a3ce
+	snprintf(manualhistory[0].name, 256, "%s", &name1[i]);
92a3ce
+
92a3ce
 	/* section unknown */
92a3ce
-	strcpy(manualhistory[0].sect, "");
92a3ce
+	manualhistory[0].sect[0] = 0;
92a3ce
+
92a3ce
+	/* try to find section */
92a3ce
+	if (i > 1) {
92a3ce
+		for (i--; (i >= 0) && isspace(name1[i]); i--)
92a3ce
+			;
92a3ce
+		if (i >= 0) {
92a3ce
+			name1[i + 1] = 0;
92a3ce
+			for (; (i >= 0) && !isspace(name1[i]); i--)
92a3ce
+				;
92a3ce
+			i++;
92a3ce
+			snprintf(manualhistory[0].sect, 32, "%s", &name1[i]);
92a3ce
+		}
92a3ce
+	}
92a3ce
+
92a3ce
 	/* selected unknown */
92a3ce
 	manualhistory[0].selected = -1;
92a3ce
 	/* pos=0 */