[Midnightbsd-cvs] src: usr.bin/makewhatis:

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Wed Mar 25 18:19:40 EDT 2009


Log Message:
-----------


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

-------------- next part --------------
Index: makewhatis.c
===================================================================
RCS file: /home/cvs/src/usr.bin/makewhatis/makewhatis.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L usr.bin/makewhatis/makewhatis.c -L usr.bin/makewhatis/makewhatis.c -u -r1.1.1.1 -r1.2
--- usr.bin/makewhatis/makewhatis.c
+++ usr.bin/makewhatis/makewhatis.c
@@ -27,12 +27,13 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/usr.bin/makewhatis/makewhatis.c,v 1.9 2002/09/04 23:29:04 dwmalone Exp $");
+__FBSDID("$FreeBSD: src/usr.bin/makewhatis/makewhatis.c,v 1.10.2.1 2007/10/18 12:55:27 edwin Exp $");
 
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/param.h>
 #include <sys/queue.h>
+#include <sys/utsname.h>
 
 #include <ctype.h>
 #include <dirent.h>
@@ -98,7 +99,7 @@
 static char *common_output;		/* -o option: the single output file */
 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 */
 static SLIST_HEAD(, visited_dir) visited_dirs =
@@ -725,6 +726,8 @@
 		case STATE_MANSTYLE:
 			if (strncmp(line, ".SH", 3) == 0)
 				break;
+			if (strncmp(line, ".SS", 3) == 0)
+				break;
 			trim_rhs(line);
 			if (strcmp(line, ".") == 0)
 				continue;
@@ -921,6 +924,12 @@
 		    entries[i]->d_name, machine);
 		if (stat(section_dir, &st) == 0 && S_ISDIR(st.st_mode))
 			process_section(section_dir);
+		if (strcmp(machine_arch, machine) != 0) {
+			snprintf(section_dir, sizeof section_dir, "%s/%s/%s",
+			    dir_name, entries[i]->d_name, machine_arch);
+			if (stat(section_dir, &st) == 0 && S_ISDIR(st.st_mode))
+				process_section(section_dir);
+		}
 		free(entries[i]);
 	}
 	free(entries);
@@ -1011,8 +1020,16 @@
 	whatis_proto = new_sbuf();
 	whatis_final = new_sbuf();
 
-	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 (common_output != NULL && (fp = open_output(common_output)) == NULL)
 		err(1, "%s", common_output);
Index: makewhatis.1
===================================================================
RCS file: /home/cvs/src/usr.bin/makewhatis/makewhatis.1,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L usr.bin/makewhatis/makewhatis.1 -L usr.bin/makewhatis/makewhatis.1 -u -r1.1.1.1 -r1.2
--- usr.bin/makewhatis/makewhatis.1
+++ usr.bin/makewhatis/makewhatis.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/makewhatis/makewhatis.1,v 1.4 2005/01/17 07:44:22 ru Exp $
+.\" $FreeBSD: src/usr.bin/makewhatis/makewhatis.1,v 1.5 2005/12/05 14:22:12 ru Exp $
 .\"
-.Dd May 12, 2002
+.Dd December 3, 2005
 .Dt MAKEWHATIS 1
 .Os
 .Sh NAME
@@ -98,6 +98,9 @@
 .It Ev MACHINE
 If set, its value is used to override the current
 machine type when searching machine specific subdirectories.
+.It Ev MACHINE_ARCH
+If set, its value is used to override the current
+architecture when searching architecture specific 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