int64_t limit_matches = numeric_limits<int64_t>::max();
int64_t limit_left = numeric_limits<int64_t>::max();
int64_t limit_matches = numeric_limits<int64_t>::max();
int64_t limit_left = numeric_limits<int64_t>::max();
for (const char *filename = block.data();
filename != block.data() + block.size();
filename += strlen(filename) + 1) {
for (const char *filename = block.data();
filename != block.data() + block.size();
filename += strlen(filename) + 1) {
// the pattern and done a union of them, but that's a lot of
// work for fairly unclear gain.)
uint64_t matched = scan_all_docids(needles, fd, corpus);
// the pattern and done a union of them, but that's a lot of
// work for fairly unclear gain.)
uint64_t matched = scan_all_docids(needles, fd, corpus);
const unsigned char *pldata = reinterpret_cast<const unsigned char *>(s.data());
size_t num = trgmptr.num_docids;
decoded.resize(num);
const unsigned char *pldata = reinterpret_cast<const unsigned char *>(s.data());
size_t num = trgmptr.num_docids;
decoded.resize(num);
" -c, --count print number of matches instead of the matches\n"
" -d, --database DBPATH search for files in DBPATH\n"
" (default is " DEFAULT_DBPATH ")\n"
" -c, --count print number of matches instead of the matches\n"
" -d, --database DBPATH search for files in DBPATH\n"
" (default is " DEFAULT_DBPATH ")\n"
" -0, --null delimit matches by NUL instead of newline\n"
" -r, --regexp interpret patterns as basic regexps (slow)\n"
" --regex interpret patterns as extended regexps (slow)\n"
" -0, --null delimit matches by NUL instead of newline\n"
" -r, --regexp interpret patterns as basic regexps (slow)\n"
" --regex interpret patterns as extended regexps (slow)\n"
int main(int argc, char **argv)
{
constexpr int EXTENDED_REGEX = 1000;
int main(int argc, char **argv)
{
constexpr int EXTENDED_REGEX = 1000;
static const struct option long_options[] = {
{ "help", no_argument, 0, 'h' },
{ "count", no_argument, 0, 'c' },
static const struct option long_options[] = {
{ "help", no_argument, 0, 'h' },
{ "count", no_argument, 0, 'c' },
{ "database", required_argument, 0, 'd' },
{ "ignore-case", no_argument, 0, 'i' },
{ "limit", required_argument, 0, 'l' },
{ "database", required_argument, 0, 'd' },
{ "ignore-case", no_argument, 0, 'i' },
{ "limit", required_argument, 0, 'l' },
{ "version", no_argument, 0, 'V' },
{ "regexp", no_argument, 0, 'r' },
{ "regex", no_argument, 0, EXTENDED_REGEX },
{ "version", no_argument, 0, 'V' },
{ "regexp", no_argument, 0, 'r' },
{ "regex", no_argument, 0, EXTENDED_REGEX },
{ "debug", no_argument, 0, 'D' }, // Not documented.
{ "debug", no_argument, 0, 'D' }, // Not documented.
- int c = getopt_long(argc, argv, "cd:hil:n:0VD", long_options, &option_index);
+ int c = getopt_long(argc, argv, "bcd:hil:n:0rwVD", long_options, &option_index);
// Debug information would leak information about which files exist,
// so drop setgid before we open the file; one would either need to run
// Debug information would leak information about which files exist,
// so drop setgid before we open the file; one would either need to run
- // as root, or use a locally-built file.
+ // as root, or use a locally-built file. Doing the same thing for
+ // flush_cache is mostly paranoia, in an attempt to prevent random users
+ // from making plocate slow for everyone else.