* plocate.1: Document this new behavior.
* plocate.cpp (do_search_file, main): Exit with code 1 if no matches were found.
This behavior is consistent with that of mlocate except with --limit=0, which
plocate rejects.
bit set to access the index (which is built as root), but by
testing visibility as the calling user.
+.SH EXIT STATUS
+.B plocate
+exits with 0 to indicate that a match was found or that
+.B --help
+or
+.B --version
+were passed. Otherwise,
+.B plocate
+exits with status code 1, indicating that an error occurred or that no matches were found.
+
.SH OPTIONS
.TP
\fB\-A\fR, \fB\-\-all\fR
if (only_count) {
printf("0\n");
}
- exit(0);
+ exit(1);
}
}
}
}
if (needles.empty()) {
fprintf(stderr, "plocate: no pattern to search for specified\n");
- exit(0);
+ exit(1);
}
if (dbpaths.empty()) {
if (only_count) {
printf("%" PRId64 "\n", matched);
}
+
+ return matched == 0;
}