| @@ -1,33 +1,33 @@ | | | @@ -1,33 +1,33 @@ |
1 | /* $NetBSD: makemandb.c,v 1.10 2012/07/08 23:18:23 uwe Exp $ */ | | 1 | /* $NetBSD: makemandb.c,v 1.11 2012/08/11 21:07:13 wiz Exp $ */ |
2 | /* | | 2 | /* |
3 | * Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadhyay@gmail.com> | | 3 | * Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadhyay@gmail.com> |
4 | * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv> | | 4 | * Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv> |
5 | * | | 5 | * |
6 | * Permission to use, copy, modify, and distribute this software for any | | 6 | * Permission to use, copy, modify, and distribute this software for any |
7 | * purpose with or without fee is hereby granted, provided that the above | | 7 | * purpose with or without fee is hereby granted, provided that the above |
8 | * copyright notice and this permission notice appear in all copies. | | 8 | * copyright notice and this permission notice appear in all copies. |
9 | * | | 9 | * |
10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | | 10 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | | 11 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | | 12 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | | 13 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | | 14 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | | 15 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | | 16 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
17 | */ | | 17 | */ |
18 | | | 18 | |
19 | #include <sys/cdefs.h> | | 19 | #include <sys/cdefs.h> |
20 | __RCSID("$NetBSD: makemandb.c,v 1.10 2012/07/08 23:18:23 uwe Exp $"); | | 20 | __RCSID("$NetBSD: makemandb.c,v 1.11 2012/08/11 21:07:13 wiz Exp $"); |
21 | | | 21 | |
22 | #include <sys/stat.h> | | 22 | #include <sys/stat.h> |
23 | #include <sys/types.h> | | 23 | #include <sys/types.h> |
24 | | | 24 | |
25 | #include <assert.h> | | 25 | #include <assert.h> |
26 | #include <ctype.h> | | 26 | #include <ctype.h> |
27 | #include <dirent.h> | | 27 | #include <dirent.h> |
28 | #include <err.h> | | 28 | #include <err.h> |
29 | #include <archive.h> | | 29 | #include <archive.h> |
30 | #include <libgen.h> | | 30 | #include <libgen.h> |
31 | #include <md5.h> | | 31 | #include <md5.h> |
32 | #include <stdio.h> | | 32 | #include <stdio.h> |
33 | #include <stdlib.h> | | 33 | #include <stdlib.h> |
| @@ -754,32 +754,32 @@ update_db(sqlite3 *db, struct mparse *mp | | | @@ -754,32 +754,32 @@ update_db(sqlite3 *db, struct mparse *mp |
754 | warnx("Error in indexing %s", file); | | 754 | warnx("Error in indexing %s", file); |
755 | err_count++; | | 755 | err_count++; |
756 | } else { | | 756 | } else { |
757 | new_count++; | | 757 | new_count++; |
758 | } | | 758 | } |
759 | } | | 759 | } |
760 | } | | 760 | } |
761 | free(buf); | | 761 | free(buf); |
762 | | | 762 | |
763 | sqlite3_finalize(stmt); | | 763 | sqlite3_finalize(stmt); |
764 | | | 764 | |
765 | if (mflags.verbosity) { | | 765 | if (mflags.verbosity) { |
766 | printf("Total Number of new or updated pages encountered = %d\n" | | 766 | printf("Total Number of new or updated pages encountered = %d\n" |
| | | 767 | "Total number of (hard or symbolic) links found = %d\n" |
767 | "Total number of pages that were successfully" | | 768 | "Total number of pages that were successfully" |
768 | " indexed/updated = %d\n" | | 769 | " indexed/updated = %d\n" |
769 | "Total number of (hard or symbolic) links found = %d\n" | | | |
770 | "Total number of pages that could not be indexed" | | 770 | "Total number of pages that could not be indexed" |
771 | " due to errors = %d\n", | | 771 | " due to errors = %d\n", |
772 | total_count, new_count, link_count, err_count); | | 772 | total_count - link_count, link_count, new_count, err_count); |
773 | } | | 773 | } |
774 | | | 774 | |
775 | if (mflags.recreate) | | 775 | if (mflags.recreate) |
776 | return; | | 776 | return; |
777 | | | 777 | |
778 | if (mflags.verbosity) | | 778 | if (mflags.verbosity) |
779 | printf("Deleting stale index entries\n"); | | 779 | printf("Deleting stale index entries\n"); |
780 | | | 780 | |
781 | sqlstr = "DELETE FROM mandb_meta WHERE file NOT IN" | | 781 | sqlstr = "DELETE FROM mandb_meta WHERE file NOT IN" |
782 | " (SELECT file FROM metadb.file_cache);" | | 782 | " (SELECT file FROM metadb.file_cache);" |
783 | "DELETE FROM mandb_links WHERE md5_hash NOT IN" | | 783 | "DELETE FROM mandb_links WHERE md5_hash NOT IN" |
784 | " (SELECT md5_hash from mandb_meta);" | | 784 | " (SELECT md5_hash from mandb_meta);" |
785 | "DROP TABLE metadb.file_cache;" | | 785 | "DROP TABLE metadb.file_cache;" |