-void do_build(const char *infile, const char *outfile, int block_size, bool plaintext)
+void do_build(const char *infile, const char *outfile, int block_size, bool plaintext, bool check_visibility)
- DatabaseBuilder db(outfile, /*owner=*/-1, block_size, dictionary, /*check_visibility=*/true);
+ DatabaseBuilder db(outfile, /*owner=*/-1, block_size, dictionary, check_visibility);
DatabaseReceiver *corpus = db.start_corpus(/*store_dir_times=*/false);
if (plaintext) {
read_plaintext(infp, corpus);
DatabaseReceiver *corpus = db.start_corpus(/*store_dir_times=*/false);
if (plaintext) {
read_plaintext(infp, corpus);
"\n"
" -b, --block-size SIZE number of filenames to store in each block (default 32)\n"
" -p, --plaintext input is a plaintext file, not an mlocate database\n"
"\n"
" -b, --block-size SIZE number of filenames to store in each block (default 32)\n"
" -p, --plaintext input is a plaintext file, not an mlocate database\n"
int main(int argc, char **argv)
{
static const struct option long_options[] = {
{ "block-size", required_argument, 0, 'b' },
{ "plaintext", no_argument, 0, 'p' },
int main(int argc, char **argv)
{
static const struct option long_options[] = {
{ "block-size", required_argument, 0, 'b' },
{ "plaintext", no_argument, 0, 'p' },
{ "help", no_argument, 0, 'h' },
{ "version", no_argument, 0, 'V' },
{ "debug", no_argument, 0, 'D' }, // Not documented.
{ "help", no_argument, 0, 'h' },
{ "version", no_argument, 0, 'V' },
{ "debug", no_argument, 0, 'D' }, // Not documented.
- int c = getopt_long(argc, argv, "b:hpVD", long_options, &option_index);
+ int c = getopt_long(argc, argv, "b:hpl:VD", long_options, &option_index);
+ case 'l':
+ if (!parse_bool(optarg, &check_visibility) != 0) {
+ fprintf(stderr, "plocate-build: invalid value `%s' for --%s\n",
+ optarg, "require-visibility");
+ exit(EXIT_FAILURE);
+ }
+ break;
- do_build(argv[optind], argv[optind + 1], block_size, plaintext);
+ do_build(argv[optind], argv[optind + 1], block_size, plaintext, check_visibility);