Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-6]: src Pull up following revision(s) (requested by tron in ticke...



details:   https://anonhg.NetBSD.org/src/rev/17085ec1338d
branches:  netbsd-6
changeset: 775476:17085ec1338d
user:      riz <riz%NetBSD.org@localhost>
date:      Tue Nov 20 23:11:47 2012 +0000

description:
Pull up following revision(s) (requested by tron in ticket #676):
        usr.sbin/makemandb/apropos.c: revision 1.7
        usr.sbin/makemandb/makemandb.8: revision 1.3
        usr.sbin/makemandb/makemandb.8: revision 1.4
        usr.sbin/makemandb/makemandb.8: revision 1.5
        etc/rc.d/makemandb: revision 1.4
        etc/weekly: revision 1.29
        usr.sbin/makemandb/makemandb.c: revision 1.10
        usr.sbin/makemandb/makemandb.c: revision 1.11
        usr.sbin/makemandb/makemandb.c: revision 1.12
        usr.sbin/makemandb/makemandb.c: revision 1.13
        usr.sbin/makemandb/makemandb.c: revision 1.14
        usr.sbin/makemandb/apropos.1: revision 1.5
        etc/daily: revision 1.87
Add HISTORY section. From Abhinav Upadhyay in private mail.
Sync with reality, From Abhinav Upadhyay in private mail.
Fix typo in a message.
Bug fix for PR 46733:
 > makemandb always reports the same number for "Total Number of new or
 > updated pages enountered" and "Total number of (hard or symbolic)
 > links found".
Patch from Abhinav Upadhyay.
Sort options in SYNOPSIS.
Sync usage with manpage.
Add -Q flag:
Print only fatal error messages (i.e., when the database is left in
an inconsistent state and needs manual intervention).
>From Abhinav Upadhyay <er.abhinav.upadhyay%gmail.com@localhost>.
Use new makemandb -Q flag to be really quiet.
Fix usage, from Abhinav Upadhyay <er.abhinav.upadhyay%gmail.com@localhost>.
Use emalloc in one more place, like the rest of the code does.
>From Abhinav Upadhyay <er.abhinav.upadhyay%gmail.com@localhost>.

diffstat:

 etc/daily                      |    4 +-
 etc/rc.d/makemandb             |    4 +-
 etc/weekly                     |    4 +-
 usr.sbin/makemandb/apropos.1   |   11 +++-
 usr.sbin/makemandb/apropos.c   |    6 +-
 usr.sbin/makemandb/makemandb.8 |   18 +++++-
 usr.sbin/makemandb/makemandb.c |  104 ++++++++++++++++++++++++++--------------
 7 files changed, 99 insertions(+), 52 deletions(-)

diffs (truncated from 522 to 300 lines):

diff -r 0582c3e43e34 -r 17085ec1338d etc/daily
--- a/etc/daily Tue Nov 20 22:33:37 2012 +0000
+++ b/etc/daily Tue Nov 20 23:11:47 2012 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh -
 #
-#      $NetBSD: daily,v 1.80.2.5 2012/08/08 14:49:24 martin Exp $
+#      $NetBSD: daily,v 1.80.2.6 2012/11/20 23:11:47 riz Exp $
 #      @(#)daily       8.2 (Berkeley) 1/25/94
 #
 
@@ -304,7 +304,7 @@
        if [ -f /etc/man.conf -a -x /usr/sbin/makemandb ]; then
                echo ""
                echo "Updating man page index:"
-               (umask 022; nice -n 5 /usr/sbin/makemandb -q)
+               (umask 022; nice -n 5 /usr/sbin/makemandb -Q)
        fi
 fi
 
diff -r 0582c3e43e34 -r 17085ec1338d etc/rc.d/makemandb
--- a/etc/rc.d/makemandb        Tue Nov 20 22:33:37 2012 +0000
+++ b/etc/rc.d/makemandb        Tue Nov 20 23:11:47 2012 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: makemandb,v 1.1.2.1 2012/06/24 16:31:52 jdc Exp $
+# $NetBSD: makemandb,v 1.1.2.2 2012/11/20 23:11:47 riz Exp $
 #
 
 # PROVIDE: makemandb
@@ -18,7 +18,7 @@
 makemandb_start()
 {
        # Initiate update build in the background
-       nice -n 5 /usr/sbin/makemandb -q > /dev/null 2>&1 &
+       nice -n 5 /usr/sbin/makemandb -Q > /dev/null 2>&1 &
 }
 
 load_rc_config $name
diff -r 0582c3e43e34 -r 17085ec1338d etc/weekly
--- a/etc/weekly        Tue Nov 20 22:33:37 2012 +0000
+++ b/etc/weekly        Tue Nov 20 23:11:47 2012 +0000
@@ -1,6 +1,6 @@
 #!/bin/sh -
 #
-#      $NetBSD: weekly,v 1.25.2.3 2012/11/18 19:07:00 msaitoh Exp $
+#      $NetBSD: weekly,v 1.25.2.4 2012/11/20 23:11:47 riz Exp $
 #      from: @(#)weekly        8.2 (Berkeley) 1/2/94
 #
 
@@ -94,7 +94,7 @@
        echo ""
        if [ -f /etc/man.conf -a -x /usr/sbin/makemandb ]; then
                echo "Rebuilding man page index:"
-               (umask 022; nice -n 5 /usr/sbin/makemandb -f -q)
+               (umask 022; nice -n 5 /usr/sbin/makemandb -f -Q)
        else
                echo "Not rebuilding man page index"
        fi
diff -r 0582c3e43e34 -r 17085ec1338d usr.sbin/makemandb/apropos.1
--- a/usr.sbin/makemandb/apropos.1      Tue Nov 20 22:33:37 2012 +0000
+++ b/usr.sbin/makemandb/apropos.1      Tue Nov 20 23:11:47 2012 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: apropos.1,v 1.2.2.2 2012/02/20 22:04:30 sborrill Exp $
+.\" $NetBSD: apropos.1,v 1.2.2.3 2012/11/20 23:11:47 riz Exp $
 .\"
 .\" Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadhyay%gmail.com@localhost>
 .\" All rights reserved.
@@ -29,7 +29,7 @@
 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd February 20, 2012
+.Dd April 21, 2012
 .Dt APROPOS 1
 .Os
 .Sh NAME
@@ -114,5 +114,12 @@
 .Xr man 1 ,
 .Xr whatis 1 ,
 .Xr makemandb 8
+.Sh HISTORY
+The
+.Nm
+command appeared in 3.0BSD.
+It was rewritten in
+.Nx 6.0
+to support full text search using Sqlite.
 .Sh AUTHORS
 .An Abhinav Upadhyay
diff -r 0582c3e43e34 -r 17085ec1338d usr.sbin/makemandb/apropos.c
--- a/usr.sbin/makemandb/apropos.c      Tue Nov 20 22:33:37 2012 +0000
+++ b/usr.sbin/makemandb/apropos.c      Tue Nov 20 23:11:47 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: apropos.c,v 1.4.2.2 2012/04/19 20:03:00 riz Exp $      */
+/*     $NetBSD: apropos.c,v 1.4.2.3 2012/11/20 23:11:47 riz Exp $      */
 /*-
  * Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadhyay%gmail.com@localhost>
  * All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: apropos.c,v 1.4.2.2 2012/04/19 20:03:00 riz Exp $");
+__RCSID("$NetBSD: apropos.c,v 1.4.2.3 2012/11/20 23:11:47 riz Exp $");
 
 #include <err.h>
 #include <search.h>
@@ -277,7 +277,7 @@
 usage(void)
 {
        fprintf(stderr,
-               "Usage: %s [-n Number of records] [-p] [-123456789] [-S machine] query\n",
+               "Usage: %s [-n Number of records] [-123456789Ccp] [-S machine] query\n",
                getprogname());
        exit(1);
 }
diff -r 0582c3e43e34 -r 17085ec1338d usr.sbin/makemandb/makemandb.8
--- a/usr.sbin/makemandb/makemandb.8    Tue Nov 20 22:33:37 2012 +0000
+++ b/usr.sbin/makemandb/makemandb.8    Tue Nov 20 23:11:47 2012 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: makemandb.8,v 1.1.2.1 2012/02/20 22:04:30 sborrill Exp $
+.\" $NetBSD: makemandb.8,v 1.1.2.2 2012/11/20 23:11:47 riz Exp $
 .\"
 .\" Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadhyay%gmail.com@localhost>
 .\" All rights reserved.
@@ -29,7 +29,7 @@
 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd February 20, 2012
+.Dd August 29, 2012
 .Dt MAKEMANDB 8
 .Os
 .Sh NAME
@@ -37,8 +37,8 @@
 .Nd parse the manual pages and build a search index over them
 .Sh SYNOPSIS
 .Nm
+.Op Fl floQqv
 .Op Fl C Ar path
-.Op Fl floqv
 .Sh DESCRIPTION
 The
 .Nm
@@ -71,11 +71,15 @@
 Use this option to optimize the index for speed and also
 to significantly reduce disk space usage.
 This is a somewhat expensive operation.
+.It Fl Q
+Print only fatal error messages (i.e., when the database is left in
+an inconsistent state and needs manual intervention).
 .It Fl q
-Print only error messages and no status updates.
+Print only warnings and error messages but no status updates.
 .It Fl v
 Enable verbose output.
-This prints the name of every file being parsed.
+This prints the name of every file being parsed
+and a summary at the end of the index update.
 .El
 .Pp
 As the database file is stored under
@@ -94,7 +98,11 @@
 .It Li env Ta The ENVIRONMENT section.
 .It Li files Ta The FILES section.
 .It Li exit_status Ta The EXIT STATUS section.
+.It Li diagnostics Ta The DIAGNOSTICS section.
 .It Li errors Ta The ERRORS section.
+.It Li md5_hash Ta  MD5 checksum of the man page.
+.It Li machine Ta The machine architecture (if any) for which the man
+page is relevant.
 .El
 .Sh FILES
 .Bl -hang -width /var/db/man.db -compact
diff -r 0582c3e43e34 -r 17085ec1338d usr.sbin/makemandb/makemandb.c
--- a/usr.sbin/makemandb/makemandb.c    Tue Nov 20 22:33:37 2012 +0000
+++ b/usr.sbin/makemandb/makemandb.c    Tue Nov 20 23:11:47 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: makemandb.c,v 1.2.2.5 2012/05/09 03:41:00 riz Exp $    */
+/*     $NetBSD: makemandb.c,v 1.2.2.6 2012/11/20 23:11:47 riz Exp $    */
 /*
  * Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadhyay%gmail.com@localhost>
  * Copyright (c) 2011 Kristaps Dzonsons <kristaps%bsd.lv@localhost>
@@ -17,7 +17,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: makemandb.c,v 1.2.2.5 2012/05/09 03:41:00 riz Exp $");
+__RCSID("$NetBSD: makemandb.c,v 1.2.2.6 2012/11/20 23:11:47 riz Exp $");
 
 #include <sys/stat.h>
 #include <sys/types.h>
@@ -304,7 +304,7 @@
        size_t linesize;
        struct mandb_rec rec;
 
-       while ((ch = getopt(argc, argv, "C:floqv")) != -1) {
+       while ((ch = getopt(argc, argv, "C:floQqv")) != -1) {
                switch (ch) {
                case 'C':
                        manconf = optarg;
@@ -319,8 +319,11 @@
                case 'o':
                        mflags.optimize = 1;
                        break;
+               case 'Q':
+                       mflags.verbosity = 0;
+                       break;
                case 'q':
-                       mflags.verbosity = 0;
+                       mflags.verbosity = 1;
                        break;
                case 'v':
                        mflags.verbosity = 2;
@@ -358,7 +361,7 @@
        if (manconf) {
                char *arg;
                size_t command_len = shquote(manconf, NULL, 0) + 1;
-               arg = malloc(command_len );
+               arg = emalloc(command_len);
                shquote(manconf, arg, command_len);
                easprintf(&command, "man -p -C %s", arg);
                free(arg);
@@ -417,6 +420,8 @@
                err(EXIT_FAILURE, "pclose error");
        }
 
+       if (mflags.verbosity)
+               printf("Performing index update\n");
        update_db(db, mp, &rec);
        mparse_free(mp);
        free_secbuffs(&rec);
@@ -451,7 +456,8 @@
        char *buf;
 
        if (stat(file, &sb) < 0) {
-               warn("stat failed: %s", file);
+               if (mflags.verbosity)
+                       warn("stat failed: %s", file);
                return;
        }
        
@@ -464,7 +470,8 @@
        /* If it is a directory, traverse it recursively */
        if (S_ISDIR(sb.st_mode)) {
                if ((dp = opendir(file)) == NULL) {
-                       warn("opendir error: %s", file);
+                       if (mflags.verbosity)
+                               warn("opendir error: %s", file);
                        return;
                }
                
@@ -503,14 +510,16 @@
                 " :mtime, :parent, :file)";
        rc = sqlite3_prepare_v2(db, sqlstr, -1, &stmt, NULL);
        if (rc != SQLITE_OK) {
-               warnx("%s", sqlite3_errmsg(db));
+               if (mflags.verbosity)
+                       warnx("%s", sqlite3_errmsg(db));
                return;
        }
 
        idx = sqlite3_bind_parameter_index(stmt, ":device");
        rc = sqlite3_bind_int64(stmt, idx, device_cache);
        if (rc != SQLITE_OK) {
-               warnx("%s", sqlite3_errmsg(db));
+               if (mflags.verbosity)
+                       warnx("%s", sqlite3_errmsg(db));
                sqlite3_finalize(stmt);
                return;
        }
@@ -518,7 +527,8 @@
        idx = sqlite3_bind_parameter_index(stmt, ":inode");
        rc = sqlite3_bind_int64(stmt, idx, inode_cache);
        if (rc != SQLITE_OK) {
-               warnx("%s", sqlite3_errmsg(db));
+               if (mflags.verbosity)
+                       warnx("%s", sqlite3_errmsg(db));
                sqlite3_finalize(stmt);
                return;
        }
@@ -526,7 +536,8 @@
        idx = sqlite3_bind_parameter_index(stmt, ":mtime");
        rc = sqlite3_bind_int64(stmt, idx, mtime_cache);
        if (rc != SQLITE_OK) {
-               warnx("%s", sqlite3_errmsg(db));
+               if (mflags.verbosity)
+                       warnx("%s", sqlite3_errmsg(db));
                sqlite3_finalize(stmt);
                return;
        }
@@ -534,7 +545,8 @@
        idx = sqlite3_bind_parameter_index(stmt, ":parent");
        rc = sqlite3_bind_text(stmt, idx, parent, -1, NULL);
        if (rc != SQLITE_OK) {
-               warnx("%s", sqlite3_errmsg(db));
+               if (mflags.verbosity)
+                       warnx("%s", sqlite3_errmsg(db));



Home | Main Index | Thread Index | Old Index