[Midnightbsd-cvs] src: usr.bin/catman: sync with freebsd

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Fri Mar 27 18:24:34 EDT 2009


Log Message:
-----------
sync with freebsd

Modified Files:
--------------
    src/usr.bin/catman:
        catman.1 (r1.1.1.1 -> r1.2)
        catman.c (r1.1.1.1 -> r1.2)

-------------- next part --------------
Index: catman.c
===================================================================
RCS file: /home/cvs/src/usr.bin/catman/catman.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L usr.bin/catman/catman.c -L usr.bin/catman/catman.c -u -r1.1.1.1 -r1.2
--- usr.bin/catman/catman.c
+++ usr.bin/catman/catman.c
@@ -27,11 +27,12 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/usr.bin/catman/catman.c,v 1.13 2005/05/21 09:55:05 ru Exp $");
+__FBSDID("$FreeBSD: src/usr.bin/catman/catman.c,v 1.14 2005/12/05 14:22:12 ru Exp $");
 
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/param.h>
+#include <sys/utsname.h>
 
 #include <ctype.h>
 #include <dirent.h>
@@ -65,7 +66,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 const char *machine;
+static const char *machine, *machine_arch;
 static int exit_code;		/* exit code to use when finished */
 
 /*
@@ -634,7 +635,7 @@
 		process_section(dir_name, section);
 	} else {
 		struct dirent **entries;
-		char *machine_dir;
+		char *machine_dir, *arch_dir;
 		int nsections;
 		int i;
 
@@ -651,6 +652,13 @@
 			if (test_path(machine_dir, NULL) & TEST_DIR)
 				process_section(dir_name, machine_dir);
 			free(machine_dir);
+			if (strcmp(machine_arch, machine) != 0) {
+				asprintf(&arch_dir, "%s/%s", entries[i]->d_name,
+				    machine_arch);
+				if (test_path(arch_dir, NULL) & TEST_DIR)
+					process_section(dir_name, arch_dir);
+				free(arch_dir);
+			}
 			free(entries[i]);
 		}
 		free(entries);
@@ -791,8 +799,16 @@
 	signal(SIGQUIT, trap_signal);
 	signal(SIGTERM, trap_signal);
 
-	if ((machine = getenv("MACHINE")) == NULL)
-		machine = MACHINE;
+	if ((machine = getenv("MACHINE")) == NULL) {
+		static struct utsname utsname;
+
+		if (uname(&utsname) == -1)
+			err(1, "uname");
+		machine = utsname.machine;
+	}
+
+	if ((machine_arch = getenv("MACHINE_ARCH")) == NULL)
+		machine_arch = MACHINE_ARCH;
 
 	if (optind == argc) {
 		const char *manpath = getenv("MANPATH");
Index: catman.1
===================================================================
RCS file: /home/cvs/src/usr.bin/catman/catman.1,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L usr.bin/catman/catman.1 -L usr.bin/catman/catman.1 -u -r1.1.1.1 -r1.2
--- usr.bin/catman/catman.1
+++ usr.bin/catman/catman.1
@@ -22,9 +22,9 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/usr.bin/catman/catman.1,v 1.5 2005/01/17 07:44:13 ru Exp $
+.\" $FreeBSD: src/usr.bin/catman/catman.1,v 1.6 2005/12/05 14:22:12 ru Exp $
 .\"
-.Dd December 22, 2004
+.Dd December 3, 2005
 .Dt CATMAN 1
 .Os
 .Sh NAME
@@ -80,6 +80,9 @@
 .It Ev MACHINE
 If set, overrides the current machine type when searching for
 machine specific man page subdirectories.
+.It Ev MACHINE_ARCH
+If set, overrides the current architecture when searching for
+architecture specific man page subdirectories.
 .It Ev MANPATH
 Determines the set of directories to be processed if none are given on
 the command line.


More information about the Midnightbsd-cvs mailing list