bin/72243: catman not creating cat pages for machine specifc man pages.

Scot W. Hetzel swhetzel at gmail.com
Fri Oct 1 20:00:43 PDT 2004


>Number:         72243
>Category:       bin
>Synopsis:       catman not creating cat pages for machine specifc man pages.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 02 03:00:42 GMT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Scot W. Hetzel
>Release:        FreeBSD 5.3-BETA6 i386
>Organization:
>Environment:
System: FreeBSD northstar.hetzel.org 5.3-BETA6 FreeBSD 5.3-BETA6 #3: Fri Oct 1 07:25:33 CDT 2004 root at northstar.hetzel.org:/usr/obj/usr/src/5x/sys/GENERIC i386

>Description:
	When you run catman, it fails to populate the machine specific cat pages.

>How-To-Repeat:
	# ls /usr/share/man/{man,cat}8/i386
	/usr/share/man/cat8/i386:

	/usr/share/man/man8/i386:
	apm.8.gz        apmconf.8.gz    apmd.8.gz       sconfig.8.gz    wlconfig.8.gz
	# echo catman | nice -5 su -m man
	# ls /usr/share/man/{man,cat}8/i386
        /usr/share/man/cat8/i386:

        /usr/share/man/man8/i386:
        apm.8.gz        apmconf.8.gz    apmd.8.gz       sconfig.8.gz    wlconfig.8.gz

	No cat pages were created for the man8/i386 man pages

>Fix:

	With the following patch, catman now creates the machine specific cat pages.

	#echo catman | nice -5 su -m man
	# ls /usr/share/man/{man,cat}8/i386
	/usr/share/man/cat8/i386:
	apm.8.gz        apmconf.8.gz    apmd.8.gz       sconfig.8.gz    wlconfig.8.gz

	/usr/share/man/man8/i386:
	apm.8.gz        apmconf.8.gz    apmd.8.gz       sconfig.8.gz    wlconfig.8.gz

	
--- patch begins here ---
Index: catman.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/catman/catman.c,v
retrieving revision 1.9
diff -u -r1.9 catman.c
--- catman.c	10 Jun 2003 02:18:00 -0000	1.9
+++ catman.c	2 Oct 2004 01:44:52 -0000
@@ -64,6 +64,7 @@
 static int rm_junk;		/* -r flag: remove garbage pages */
 static char *locale;		/* user's locale if -L is used */
 static char *lang_locale;	/* short form of locale */
+static char *machine;
 static int exit_code;		/* exit code to use when finished */
 
 /*
@@ -655,7 +656,20 @@
 			return;
 		}
 		for (i = 0; i < nsections; i++) {
+			char machine_dir[MAXPATHLEN];
+			struct stat st;
+
 			process_section(dir_name, entries[i]->d_name);
+
+			snprintf(machine_dir, sizeof machine_dir, "%s/%s/%s",
+				dir_name, entries[i]->d_name, machine);
+
+			if (stat(machine_dir, &st) == 0 && S_ISDIR(st.st_mode)) {
+				snprintf(machine_dir, sizeof machine_dir,
+					"%s/%s", entries[i]->d_name, machine);
+				process_section(dir_name, machine_dir);
+			}
+
 			free(entries[i]);
 		}
 		free(entries);
@@ -789,6 +803,10 @@
 	signal(SIGHUP, trap_signal);
 	signal(SIGQUIT, trap_signal);
 	signal(SIGTERM, trap_signal);
+
+	if ((machine = getenv("MACHINE")) == NULL)
+		machine = MACHINE;
+
 	if (optind == argc) {
 		const char *manpath = getenv("MANPATH");
 		if (manpath == NULL)
--- patch ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list