summaryrefslogtreecommitdiff
path: root/src/whatis.c
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2019-02-04 13:16:40 +0000
committerColin Watson <cjwatson@debian.org>2019-02-04 13:16:41 +0000
commit7589519b4ca87bc9559765a52a302befefbe3f4a (patch)
tree6bf5b764212157b2a4824f6fa239228e6ec5a346 /src/whatis.c
parent74aa94f78dc7be7b5f97be5dd390dc74fc77cb8b (diff)
Use bool for boolean command-line options
* include/manconfig.h.in (debug_level): Change type to bool. Update all definitions and users. * lib/encodings.c (get_roff_encoding): Change type of "found" to bool. * libdb/db_lookup.c (dblookup_all, dblookup_exact): Change "match_case" parameter type to bool. Update all callers. (dblookup_pattern): Change "match_case", "pattern_regex", and "try_descriptions" parameter types to bool. Update all callers. * libdb/db_storage.h (dblookup_all, dblookup_exact, dblookup_pattern): Update prototypes. * src/descriptions_store.c (store_descriptions): Change types of "found_real_page" and "found_external" to bool. * src/lexgrog_test.c (main): Change types of "some_failed" and "found" to bool. * src/man.c (parse_opt): Change types of "apropos" and "whatis" to bool. (add_roff_line_length): Change "save_cat_p" parameter type to bool *. Update all callers. (make_browser): Change "found_percent_s" type to bool. (display): Change "display_to_stdout" type to bool. (try_db): Change "found_stale" type to bool. (local_man_loop): Change "local_mf" type to bool. (main): Change "found_subpage" type to bool. * src/manp.c (read_config_file): Change "optional" parameter type to bool. Update all callers. * src/manp.h (read_config_file): Update prototype. * src/check_mandirs.c (opt_test, force_rescan): Change types to bool. Update all users. * src/globbing_test.c (match_case, regex_opt, wildcard): Likewise. * src/lexgrog_test.c (parse_man, parse_cat, show_whatis, show_filters): Likewise. * src/man.c (disable_cache, troff, global_apropos, print_where, print_where_cat, catman, local_man_file, findall, update, match_case, regex_opt, wildcard, names_only, no_hyphenation, no_justification, subpages, ascii, save_cat, ditroff, htmlout): Likewise. * src/mandb.c (opt_test, force_rescan, check_for_strays, purge, user, create): Likewise. * src/manp.c (disable_cache): Likewise. * src/manpath.c (cat, global): Likewise. * src/whatis.c (am_apropos, regex_opt, exact, wildcard, require_all, long_output): Likewise.
Diffstat (limited to 'src/whatis.c')
-rw-r--r--src/whatis.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/src/whatis.c b/src/whatis.c
index e137ce61..1d529245 100644
--- a/src/whatis.c
+++ b/src/whatis.c
@@ -89,7 +89,7 @@ extern char *user_config_file;
static char **keywords;
static int num_keywords;
-int am_apropos;
+bool am_apropos;
char *database;
int quiet = 1;
man_sandbox *sandbox;
@@ -99,14 +99,14 @@ iconv_t conv_to_locale;
#endif /* HAVE_ICONV */
static regex_t *preg;
-static int regex_opt;
-static int exact;
+static bool regex_opt;
+static bool exact;
-static int wildcard;
+static bool wildcard;
-static int require_all;
+static bool require_all;
-static int long_output;
+static bool long_output;
static char **sections;
@@ -171,33 +171,33 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state)
{
switch (key) {
case 'd':
- debug_level = 1;
+ debug_level = true;
return 0;
case 'v':
quiet = 0;
return 0;
case 'r':
- regex_opt = 1;
+ regex_opt = true;
return 0;
case 'e':
/* Only makes sense for apropos, but has
* historically been accepted by whatis anyway.
*/
- regex_opt = 0;
- exact = 1;
+ regex_opt = false;
+ exact = true;
return 0;
case 'w':
- regex_opt = 0;
- wildcard = 1;
+ regex_opt = false;
+ wildcard = true;
return 0;
case 'a':
if (am_apropos)
- require_all = 1;
+ require_all = true;
else
argp_usage (state);
return 0;
case 'l':
- long_output = 1;
+ long_output = true;
return 0;
case 's':
sections = split_sections (arg);
@@ -216,11 +216,11 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state)
return 0;
case 'f':
/* helpful override if program name detection fails */
- am_apropos = 0;
+ am_apropos = false;
return 0;
case 'k':
/* helpful override if program name detection fails */
- am_apropos = 1;
+ am_apropos = true;
return 0;
case 'h':
argp_state_help (state, state->out_stream,
@@ -237,7 +237,7 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state)
exit (FAIL);
case ARGP_KEY_SUCCESS:
if (am_apropos && !exact && !wildcard)
- regex_opt = 1;
+ regex_opt = true;
return 0;
}
return ARGP_ERR_UNKNOWN;
@@ -391,7 +391,7 @@ static struct mandata *resolve_pointers (MYDBM_FILE dbf, struct mandata *info,
* arbitrary: it's just there to avoid an infinite loop.
*/
newpage = info->pointer;
- info = dblookup_exact (dbf, newpage, info->ext, 1);
+ info = dblookup_exact (dbf, newpage, info->ext, true);
for (rounds = 0; rounds < 10; rounds++) {
struct mandata *newinfo;
@@ -404,7 +404,7 @@ static struct mandata *resolve_pointers (MYDBM_FILE dbf, struct mandata *info,
STREQ (info->pointer, newpage)))
return info;
- newinfo = dblookup_exact (dbf, info->pointer, info->ext, 1);
+ newinfo = dblookup_exact (dbf, info->pointer, info->ext, true);
free_mandata_struct (info);
info = newinfo;
}
@@ -507,7 +507,7 @@ static int do_whatis_section (MYDBM_FILE dbf,
struct mandata *info;
int count = 0;
- infos = dblookup_all (dbf, page, section, 0);
+ infos = dblookup_all (dbf, page, section, false);
GL_LIST_FOREACH_START (infos, info) {
display (dbf, info, page);
count++;
@@ -900,11 +900,11 @@ int main (int argc, char *argv[])
set_program_name (argv[0]);
program_base_name = base_name (program_name);
if (STREQ (program_base_name, APROPOS_NAME)) {
- am_apropos = 1;
+ am_apropos = true;
argp_program_version = "apropos " PACKAGE_VERSION;
} else {
struct argp_option *optionp;
- am_apropos = 0;
+ am_apropos = false;
argp_program_version = "whatis " PACKAGE_VERSION;
for (optionp = (struct argp_option *) whatis_argp.options;
optionp->name || optionp->key || optionp->arg ||