summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2022-10-08 01:10:22 +0100
committerColin Watson <cjwatson@debian.org>2022-10-08 01:10:23 +0100
commita9327d495b2e8dc3b555adf8b7579a4f85e56116 (patch)
tree941cde7fdc9ebabd7b6d716e87aedaee5feb7fcc
parentf5f47aa0a2b05722c59c55ce31d411461f47e3c4 (diff)
Convert many more ints to bools
I don't expect this to make a significant runtime difference, but it makes some things easier to analyse visually. * lib/cleanup.c (do_cleanups_sigsafe): Change `in_sighandler` parameter type to bool. Update all callers. (push_cleanup): Change `handler_installed` local variable type to bool. * lib/cleanup.h (do_cleanups_sigsafe): Update prototype. * lib/compression.c (comp_info): Change `want_stem` parameter type to bool. Update all callers. * lib/compression.h (comp_info): Update prototype. * lib/sandbox.c (seccomp_filter_unavailable): Change type to bool. Update all references. (make_seccomp_filter): Change `permissive` parameter type to bool. Update all callers. (_sandbox_load): Likewise. * lib/util.c (remove_directory): Change `recurse` parameter type to bool. Update all callers. * lib/util.h (remove_directory): Update prototype. * libdb/db_gdbm.c (opening): Change type to bool. Update all references. * libdb/db_store.c (compare_ids): Change `promote_links` parameter type to bool. Update all callers. * libdb/db_storage.h (compare_ids): Update prototype. * src/catman.c (parse_for_sec): Change `message` local variable type to bool. (check_access): Change return type to bool. (purge_whatis): Change `cat` parameter type to bool. Update all callers. (check_multi_key): Change return type to bool. * src/descriptions.c (parse_descriptions): Change `seen_base` local variable type to bool. * src/globbing.c (look_for_file): Change `cat` parameter type to bool. Update all callers. * src/globbing.h (look_for_file): Update prototype. * src/lexgrog.l (fill_mode, waiting_for_quote): Change types to bool. Update all references. * src/man.c (skip, created_tmp_cat): Change types to bool. Update all references. (run_mandb): Change `create` parameter type to bool. Update all callers. (squeeze_blank_lines): Change `in_blank_line` and `got_blank_line` local variable types to bool. (display): Change `format` and `printed` local variable types to bool. (convert_name): Change `fsstnd` parameter type to bool. Update all callers. (add_candidate): Change `dupcand` local variable type to bool. (main): Change `maybe_section` local variable type to bool. * src/manp.c (add_sections): Change `user` parameter type to bool. Update all callers. (add_def): Likewise. (add_mandb_map): Likewise. (add_to_dirlist): Likewise. (read_config_file): Change `done` local variable type to bool. (get_manpath_from_path): Change `mandatory` parameter type to bool. Update all callers. * src/manp.h (get_manpath_from_path): Update prototype. * src/whatis.c (do_apropos): Change `matched` local variable type to bool. * src/zsoelim.l (no_newline): Change type to bool. Update all references. (zsoelim_open_file): Change return type to true. * src/zsoelim.h (zsoelim_open_file): Update prototype.
-rw-r--r--lib/cleanup.c11
-rw-r--r--lib/cleanup.h4
-rw-r--r--lib/compression.c3
-rw-r--r--lib/compression.h4
-rw-r--r--lib/filenames.c2
-rw-r--r--lib/sandbox.c23
-rw-r--r--lib/util.c3
-rw-r--r--lib/util.h4
-rw-r--r--libdb/db_gdbm.c6
-rw-r--r--libdb/db_storage.h4
-rw-r--r--libdb/db_store.c11
-rw-r--r--src/catman.c11
-rw-r--r--src/check_mandirs.c20
-rw-r--r--src/descriptions.c5
-rw-r--r--src/globbing.c2
-rw-r--r--src/globbing.h4
-rw-r--r--src/globbing_test.c2
-rw-r--r--src/lexgrog.l19
-rw-r--r--src/man-recode.c2
-rw-r--r--src/man.c87
-rw-r--r--src/mandb.c4
-rw-r--r--src/manp.c20
-rw-r--r--src/manp.h2
-rw-r--r--src/straycats.c4
-rw-r--r--src/whatis.c6
-rw-r--r--src/zsoelim.h6
-rw-r--r--src/zsoelim.l51
27 files changed, 172 insertions, 148 deletions
diff --git a/lib/cleanup.c b/lib/cleanup.c
index 65865dd8..42b603b0 100644
--- a/lib/cleanup.c
+++ b/lib/cleanup.c
@@ -23,6 +23,7 @@
# include "config.h"
#endif /* HAVE_CONFIG_H */
+#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h> /* SunOS's loosing assert.h needs it */
#include <assert.h>
@@ -55,7 +56,7 @@ sighandler (int signo)
struct sigaction act;
sigset_t set;
- do_cleanups_sigsafe (1);
+ do_cleanups_sigsafe (true);
/* set default signal action */
memset (&act, 0, sizeof act);
@@ -174,7 +175,7 @@ static unsigned tos = 0; /* top of stack, 0 <= tos <= nslots */
* called.
*/
void
-do_cleanups_sigsafe (int in_sighandler)
+do_cleanups_sigsafe (bool in_sighandler)
{
unsigned i;
@@ -190,7 +191,7 @@ do_cleanups_sigsafe (int in_sighandler)
void
do_cleanups (void)
{
- do_cleanups_sigsafe (0);
+ do_cleanups_sigsafe (false);
tos = 0;
nslots = 0;
free (stack);
@@ -207,14 +208,14 @@ do_cleanups (void)
int
push_cleanup (cleanup_fun fun, void *arg, int sigsafe)
{
- static int handler_installed = 0;
+ static bool handler_installed = false;
assert (tos <= nslots);
if (!handler_installed) {
if (atexit (do_cleanups))
return -1;
- handler_installed = 1;
+ handler_installed = true;
}
if (tos == nslots) {
diff --git a/lib/cleanup.h b/lib/cleanup.h
index 162249ce..5415b7f1 100644
--- a/lib/cleanup.h
+++ b/lib/cleanup.h
@@ -22,9 +22,11 @@
#ifndef _CLEANUP_H
#define _CLEANUP_H
+#include <stdbool.h>
+
typedef void (*cleanup_fun) (void *);
-extern void do_cleanups_sigsafe (int);
+extern void do_cleanups_sigsafe (bool);
extern void do_cleanups (void);
extern int push_cleanup (cleanup_fun, void *, int);
extern void pop_cleanup (cleanup_fun, void *);
diff --git a/lib/compression.c b/lib/compression.c
index 3f3205ab..fe4696c0 100644
--- a/lib/compression.c
+++ b/lib/compression.c
@@ -28,6 +28,7 @@
#endif /* HAVE_CONFIG_H */
#include <assert.h>
+#include <stdbool.h>
#include <stdio.h>
#include <errno.h>
#include <signal.h>
@@ -128,7 +129,7 @@ struct compression comp_list[] = {
comp->ext = "gz";
comp->stem = "/usr/man/man1/foo.1";
*/
-struct compression *comp_info (const char *filename, int want_stem)
+struct compression *comp_info (const char *filename, bool want_stem)
{
const char *ext;
static struct compression hpux_comp =
diff --git a/lib/compression.h b/lib/compression.h
index 15df2dc2..52ede354 100644
--- a/lib/compression.h
+++ b/lib/compression.h
@@ -21,6 +21,8 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <stdbool.h>
+
struct compression {
/* The following are const because they should be pointers to parts
* of strings allocated elsewhere and should not be written through
@@ -36,5 +38,5 @@ struct compression {
extern struct compression comp_list[];
-extern struct compression *comp_info (const char *filename, int want_stem);
+extern struct compression *comp_info (const char *filename, bool want_stem);
extern struct compression *comp_file (const char *filename);
diff --git a/lib/filenames.c b/lib/filenames.c
index 026d942a..5e592c39 100644
--- a/lib/filenames.c
+++ b/lib/filenames.c
@@ -99,7 +99,7 @@ struct mandata *filename_info (const char *file, bool warn_if_bogus)
a missmatch between the section they are under and the
sectional part of their extension. */
- comp = comp_info (basename, 1);
+ comp = comp_info (basename, true);
if (comp) {
info->comp = xstrdup (comp->ext);
*(basename + strlen (comp->stem)) = '\0';
diff --git a/lib/sandbox.c b/lib/sandbox.c
index bfda5e30..f891e533 100644
--- a/lib/sandbox.c
+++ b/lib/sandbox.c
@@ -83,7 +83,7 @@ struct man_sandbox {
};
#ifdef HAVE_LIBSECCOMP
-static int seccomp_filter_unavailable = 0;
+static bool seccomp_filter_unavailable = false;
static void gripe_seccomp_filter_unavailable (void)
{
@@ -231,7 +231,7 @@ static bool can_load_seccomp (void)
* files. Confining these further requires additional tools that can do
* path-based filtering or similar, such as AppArmor.
*/
-static scmp_filter_ctx make_seccomp_filter (int permissive)
+static scmp_filter_ctx make_seccomp_filter (bool permissive)
{
scmp_filter_ctx ctx;
mode_t mode_mask = S_ISUID | S_ISGID | S_IXUSR | S_IXGRP | S_IXOTH;
@@ -244,7 +244,8 @@ static scmp_filter_ctx make_seccomp_filter (int permissive)
if (!can_load_seccomp ())
return NULL;
- debug ("initialising seccomp filter (permissive: %d)\n", permissive);
+ debug ("initialising seccomp filter (permissive: %d)\n",
+ (int) permissive);
ctx = seccomp_init (SCMP_ACT_ERRNO (ENOSYS));
if (!ctx)
fatal (errno, "can't initialise seccomp filter");
@@ -583,8 +584,8 @@ man_sandbox *sandbox_init (void)
man_sandbox *sandbox = XZALLOC (man_sandbox);
#ifdef HAVE_LIBSECCOMP
- sandbox->ctx = make_seccomp_filter (0);
- sandbox->permissive_ctx = make_seccomp_filter (1);
+ sandbox->ctx = make_seccomp_filter (false);
+ sandbox->permissive_ctx = make_seccomp_filter (true);
#else /* !HAVE_LIBSECCOMP */
sandbox->dummy = 0;
#endif /* HAVE_LIBSECCOMP */
@@ -593,7 +594,7 @@ man_sandbox *sandbox_init (void)
}
#ifdef HAVE_LIBSECCOMP
-static void _sandbox_load (man_sandbox *sandbox, int permissive) {
+static void _sandbox_load (man_sandbox *sandbox, bool permissive) {
if (can_load_seccomp ()) {
scmp_filter_ctx ctx;
@@ -604,7 +605,7 @@ static void _sandbox_load (man_sandbox *sandbox, int permissive) {
if (!ctx)
return;
debug ("loading seccomp filter (permissive: %d)\n",
- permissive);
+ (int) permissive);
if (seccomp_load (ctx) < 0) {
if (errno == EINVAL || errno == EFAULT) {
/* The kernel doesn't give us particularly
@@ -619,7 +620,7 @@ static void _sandbox_load (man_sandbox *sandbox, int permissive) {
*/
gripe_seccomp_filter_unavailable ();
/* Don't try this again. */
- seccomp_filter_unavailable = 1;
+ seccomp_filter_unavailable = true;
} else
fatal (errno, "can't load seccomp filter");
}
@@ -627,7 +628,7 @@ static void _sandbox_load (man_sandbox *sandbox, int permissive) {
}
#else /* !HAVE_LIBSECCOMP */
static void _sandbox_load (man_sandbox *sandbox MAYBE_UNUSED,
- int permissive MAYBE_UNUSED)
+ bool permissive MAYBE_UNUSED)
{
}
#endif /* HAVE_LIBSECCOMP */
@@ -637,7 +638,7 @@ void sandbox_load (void *data)
{
man_sandbox *sandbox = data;
- _sandbox_load (sandbox, 0);
+ _sandbox_load (sandbox, false);
}
/* Enter a sandbox for processing untrusted data, allowing limited file
@@ -647,7 +648,7 @@ void sandbox_load_permissive (void *data)
{
man_sandbox *sandbox = data;
- _sandbox_load (sandbox, 1);
+ _sandbox_load (sandbox, true);
}
/* Free a sandbox for processing untrusted data. */
diff --git a/lib/util.c b/lib/util.c
index c9c16d1b..28a4487b 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -36,6 +36,7 @@
#endif /* HAVE_CONFIG_H */
#include <assert.h>
+#include <stdbool.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
@@ -154,7 +155,7 @@ char *escape_shell (const char *unesc)
/* Remove a directory and all files in it. Only recurse beyond that if
* RECURSE is set.
*/
-int remove_directory (const char *directory, int recurse)
+int remove_directory (const char *directory, bool recurse)
{
DIR *handle = opendir (directory);
struct dirent *entry;
diff --git a/lib/util.h b/lib/util.h
index 48c98440..aec8d179 100644
--- a/lib/util.h
+++ b/lib/util.h
@@ -22,10 +22,12 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <stdbool.h>
+
extern int is_changed (const char *fa, const char *fb);
extern int is_directory (const char *path);
extern char *escape_shell (const char *unesc);
-extern int remove_directory (const char *directory, int recurse);
+extern int remove_directory (const char *directory, bool recurse);
extern char *trim_spaces (const char *s);
extern char *lang_dir (const char *filename);
extern void init_locale (void);
diff --git a/libdb/db_gdbm.c b/libdb/db_gdbm.c
index 8179d8d4..99dbcfe9 100644
--- a/libdb/db_gdbm.c
+++ b/libdb/db_gdbm.c
@@ -52,7 +52,7 @@
* threads.
*/
static jmp_buf open_env;
-static int opening;
+static bool opening;
/* Mimic _gdbm_fatal's error output, but handle errors during open more
* gracefully than exiting.
@@ -82,7 +82,7 @@ bool man_gdbm_open_wrapper (man_gdbm_wrapper wrap, int flags)
{
datum key, content;
- opening = 1;
+ opening = true;
if (setjmp (open_env))
return false;
wrap->file = gdbm_open (wrap->name, BLK_SIZE, flags, DBMODE,
@@ -101,7 +101,7 @@ bool man_gdbm_open_wrapper (man_gdbm_wrapper wrap, int flags)
MYDBM_FREE_DPTR (content);
}
- opening = 0;
+ opening = false;
return true;
}
diff --git a/libdb/db_storage.h b/libdb/db_storage.h
index f02beb70..21335d65 100644
--- a/libdb/db_storage.h
+++ b/libdb/db_storage.h
@@ -26,6 +26,8 @@
#ifndef DB_STORAGE_H
#define DB_STORAGE_H
+#include <stdbool.h>
+
#include "gl_list.h"
/* These definitions give an inherent precedence to each particular type
@@ -68,7 +70,7 @@ extern int dbstore (MYDBM_FILE dbf, struct mandata *in, const char *base);
extern int dbdelete (MYDBM_FILE dbf, const char *name, struct mandata *in);
extern void dbprintf (const struct mandata *info);
extern struct mandata *split_content (MYDBM_FILE dbf, char *cont_ptr);
-extern int compare_ids (char a, char b, int promote_links);
+extern int compare_ids (char a, char b, bool promote_links);
/* local to db routines */
extern void gripe_lock (const char *filename);
diff --git a/libdb/db_store.c b/libdb/db_store.c
index 3805f38a..12b3b9f1 100644
--- a/libdb/db_store.c
+++ b/libdb/db_store.c
@@ -26,6 +26,7 @@
#endif /* HAVE_CONFIG_H */
#include <assert.h>
+#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -57,7 +58,7 @@
* If promote_links is true, consider SO_MAN equivalent to ULT_MAN. This is
* appropriate when sorting candidate pages for display.
*/
-int ATTRIBUTE_CONST compare_ids (char a, char b, int promote_links)
+int ATTRIBUTE_CONST compare_ids (char a, char b, bool promote_links)
{
#ifdef FAVOUR_STRAYCATS
if (a == WHATIS_MAN && b == STRAY_CAT)
@@ -109,18 +110,18 @@ static int replace_if_necessary (MYDBM_FILE dbf,
*
* TODO: name fields should be collated with the requested name
*/
- if (compare_ids (newdata->id, olddata->id, 0) < 0) {
+ if (compare_ids (newdata->id, olddata->id, false) < 0) {
debug ("replace_if_necessary: stronger ID; replacing\n");
action = REPLACE_YES;
- } else if (compare_ids (newdata->id, olddata->id, 1) <= 0 &&
+ } else if (compare_ids (newdata->id, olddata->id, true) <= 0 &&
timespec_cmp (newdata->mtime, olddata->mtime) > 0) {
debug ("replace_if_necessary: newer mtime; replacing\n");
action = REPLACE_YES;
- } else if (compare_ids (newdata->id, olddata->id, 1) <= 0 &&
+ } else if (compare_ids (newdata->id, olddata->id, true) <= 0 &&
timespec_cmp (newdata->mtime, olddata->mtime) < 0) {
debug ("replace_if_necessary: older mtime; not replacing\n");
action = REPLACE_NO;
- } else if (compare_ids (newdata->id, olddata->id, 0) > 0) {
+ } else if (compare_ids (newdata->id, olddata->id, false) > 0) {
debug ("replace_if_necessary: weaker ID; not replacing\n");
action = REPLACE_NO;
} else if (newdata->pointer && olddata->pointer &&
diff --git a/src/catman.c b/src/catman.c
index 69a74eac..e421d214 100644
--- a/src/catman.c
+++ b/src/catman.c
@@ -234,7 +234,8 @@ static int parse_for_sec (MYDBM_FILE dbf,
pipecmd *basecmd, *cmd;
datum key;
size_t arg_size, initial_bit;
- int message = 1, first_arg;
+ bool message = true;
+ int first_arg;
basecmd = pipecmd_new (MAN);
pipecmd_clearenv (basecmd);
@@ -298,7 +299,7 @@ static int parse_for_sec (MYDBM_FILE dbf,
if (message) {
printf (_("\nUpdating cat files for section %s of man hierarchy %s\n"),
section, manpath);
- message = 0;
+ message = false;
}
arg_size += add_arg (cmd, key) + 1;
@@ -343,14 +344,14 @@ static int parse_for_sec (MYDBM_FILE dbf,
return 0;
}
-static int check_access (const char *directory)
+static bool check_access (const char *directory)
{
if (!CAN_ACCESS (directory, W_OK)) {
error (0, errno, _("cannot write within %s"), directory);
- return 1;
+ return true;
}
- return 0;
+ return false;
}
int main (int argc, char *argv[])
diff --git a/src/check_mandirs.c b/src/check_mandirs.c
index 33fbaace..8ed87d7f 100644
--- a/src/check_mandirs.c
+++ b/src/check_mandirs.c
@@ -175,7 +175,7 @@ void test_manfile (MYDBM_FILE dbf, const char *file, const char *path)
manpage_base = info->name; /* steal memory */
info->name = NULL;
- comp = comp_info (file, 1);
+ comp = comp_info (file, true);
if (comp) {
len = strlen (comp->stem);
free (comp->stem);
@@ -783,7 +783,7 @@ static int purge_normal (MYDBM_FILE dbf, const char *name,
}
/* Decide whether to purge a reference to a WHATIS_MAN or WHATIS_CAT page. */
-static int purge_whatis (MYDBM_FILE dbf, const char *path, int cat,
+static int purge_whatis (MYDBM_FILE dbf, const char *path, bool cat,
const char *name, struct mandata *info,
gl_list_t found, struct timespec db_mtime)
{
@@ -851,12 +851,12 @@ static int purge_whatis (MYDBM_FILE dbf, const char *path, int cat,
}
/* Check that multi keys are correctly constructed. */
-static int check_multi_key (const char *name, const char *content)
+static bool check_multi_key (const char *name, const char *content)
{
const char *walk, *next;
if (!*content)
- return 0;
+ return false;
for (walk = content; walk && *walk; walk = next) {
/* The name in the multi key should only differ from the
@@ -876,7 +876,7 @@ static int check_multi_key (const char *name, const char *content)
debug ("%s: broken multi key \"%s\", "
"forcing a rescan\n", name, content);
force_rescan = true;
- return 1;
+ return true;
}
/* If the name was valid, skip over the extension and
@@ -886,7 +886,7 @@ static int check_multi_key (const char *name, const char *content)
next = walk ? strchr (walk + 1, '\t') : NULL;
}
- return 0;
+ return false;
}
/* Go through the database and purge references to man pages that no longer
@@ -984,12 +984,12 @@ int purge_missing (MYDBM_FILE dbf, const char *manpath, const char *catpath)
found = look_for_file (manpath, entry->ext,
entry->name ? entry->name
: nicekey,
- 0, LFF_MATCHCASE);
+ false, LFF_MATCHCASE);
else
found = look_for_file (catpath, entry->ext,
entry->name ? entry->name
: nicekey,
- 1, LFF_MATCHCASE);
+ true, LFF_MATCHCASE);
debug_level = save_debug;
/* Now actually decide whether to purge, depending on the
@@ -999,10 +999,10 @@ int purge_missing (MYDBM_FILE dbf, const char *manpath, const char *catpath)
entry->id == STRAY_CAT)
count += purge_normal (dbf, nicekey, entry, found);
else if (entry->id == WHATIS_MAN)
- count += purge_whatis (dbf, manpath, 0, nicekey,
+ count += purge_whatis (dbf, manpath, false, nicekey,
entry, found, db_mtime);
else /* entry->id == WHATIS_CAT */
- count += purge_whatis (dbf, catpath, 1, nicekey,
+ count += purge_whatis (dbf, catpath, true, nicekey,
entry, found, db_mtime);
gl_list_free (found);
diff --git a/src/descriptions.c b/src/descriptions.c
index 57e53055..de2dfb92 100644
--- a/src/descriptions.c
+++ b/src/descriptions.c
@@ -24,6 +24,7 @@
# include "config.h"
#endif /* HAVE_CONFIG_H */
+#include <stdbool.h>
#include <string.h>
#include <stdlib.h>
@@ -56,7 +57,7 @@ gl_list_t parse_descriptions (const char *base, const char *whatis)
{
const char *sep, *nextsep;
gl_list_t descs;
- int seen_base = 0;
+ bool seen_base = false;
descs = gl_list_create_empty (GL_ARRAY_LIST, NULL, NULL,
page_description_free, true);
@@ -131,7 +132,7 @@ gl_list_t parse_descriptions (const char *base, const char *whatis)
gl_list_add_last (descs, desc);
if (base && STREQ (base, desc->name))
- seen_base = 1;
+ seen_base = true;
}
free (names);
diff --git a/src/globbing.c b/src/globbing.c
index 31144f44..9a65b534 100644
--- a/src/globbing.c
+++ b/src/globbing.c
@@ -278,7 +278,7 @@ static void match_in_directory (const char *path, const char *pattern,
}
gl_list_t look_for_file (const char *hier, const char *sec,
- const char *unesc_name, int cat, int opts)
+ const char *unesc_name, bool cat, int opts)
{
gl_list_t matched;
char *pattern, *path = NULL;
diff --git a/src/globbing.h b/src/globbing.h
index ea9ff001..76013950 100644
--- a/src/globbing.h
+++ b/src/globbing.h
@@ -20,6 +20,8 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <stdbool.h>
+
#include "gl_list.h"
enum look_for_file_opts {
@@ -30,7 +32,7 @@ enum look_for_file_opts {
/* globbing.c */
extern gl_list_t look_for_file (const char *hier, const char *sec,
- const char *unesc_name, int cat, int opts);
+ const char *unesc_name, bool cat, int opts);
/* Expand path with wildcards into list of all existing directories. */
extern gl_list_t expand_path (const char *path);
diff --git a/src/globbing_test.c b/src/globbing_test.c
index 75b4e2b8..61fcd548 100644
--- a/src/globbing_test.c
+++ b/src/globbing_test.c
@@ -128,7 +128,7 @@ int main (int argc, char **argv)
const char *file;
files = look_for_file (remaining_args[0], remaining_args[1],
- remaining_args[2], i,
+ remaining_args[2], (bool) i,
(match_case ? LFF_MATCHCASE : 0) |
(regex_opt ? LFF_REGEX : 0) |
(wildcard ? LFF_WILDCARD : 0));
diff --git a/src/lexgrog.l b/src/lexgrog.l
index 46df5d0a..3c297172 100644
--- a/src/lexgrog.l
+++ b/src/lexgrog.l
@@ -48,6 +48,7 @@
#include <sys/stat.h>
#include <errno.h>
+#include <stdbool.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
@@ -243,8 +244,8 @@ static char *p_name;
static const char *fname;
static char filters[MAX_FILTERS];
-static int fill_mode;
-static int waiting_for_quote;
+static bool fill_mode;
+static bool waiting_for_quote;
static decompress *decomp;
@@ -457,7 +458,7 @@ vgrind_request \.vS
/* some include quoting; dealing with this is unpleasant */
{bol}{typeface}{blank}+\" {
newline_found ();
- waiting_for_quote = 1;
+ waiting_for_quote = true;
}
{bol}{typeface}{blank}+ | /* type face commands */
@@ -481,8 +482,8 @@ vgrind_request \.vS
/* Toggle fill mode */
<MAN_NAME,MAN_DESC>{
- {bol}\.nf.* fill_mode = 0;
- {bol}\.fi.* fill_mode = 1;
+ {bol}\.nf.* fill_mode = false;
+ {bol}\.fi.* fill_mode = true;
}
<CAT_NAME>-{eol}{blank_eol}* /* strip continuations */
@@ -748,7 +749,7 @@ static void add_char_to_whatis (unsigned char c)
if (p_name - newname + 1 >= MAX_NAME)
too_big ();
else if (waiting_for_quote && c == '"')
- waiting_for_quote = 0;
+ waiting_for_quote = false;
else
*p_name++ = c;
}
@@ -846,7 +847,7 @@ static void newline_found (void)
BEGIN (MAN_NAME);
}
}
- waiting_for_quote = 0;
+ waiting_for_quote = false;
}
int find_name (const char *file, const char *filename, lexgrog *p_lg,
@@ -936,8 +937,8 @@ int find_name_decompressed (decompress *d, const char *filename, lexgrog *p_lg)
*(p_name = newname) = '\0';
memset (filters, '_', sizeof (filters));
- fill_mode = 1;
- waiting_for_quote = 0;
+ fill_mode = true;
+ waiting_for_quote = false;
if (p_lg->type == CATPAGE)
BEGIN (CAT_FILE);
diff --git a/src/man-recode.c b/src/man-recode.c
index 4d4d1045..e198d175 100644
--- a/src/man-recode.c
+++ b/src/man-recode.c
@@ -185,7 +185,7 @@ static void recode (const char *filename)
dirname = dir_name (filename);
basename = base_name (filename);
- comp = comp_info (basename, 1);
+ comp = comp_info (basename, true);
if (comp)
stem = comp->stem; /* steal memory */
else
diff --git a/src/man.c b/src/man.c
index c90b9d01..e7673e84 100644
--- a/src/man.c
+++ b/src/man.c
@@ -145,7 +145,7 @@ char *lang;
#undef ALT_EXT_FORMAT /* allow external formatters located in cat hierarchy */
static bool global_manpath; /* global or user manual page hierarchy? */
-static int skip; /* page exists but has been skipped */
+static bool skip; /* page exists but has been skipped */
#if defined _AIX || defined __sgi
char **global_argv;
@@ -238,7 +238,7 @@ static int first_arg;
#ifdef MAN_CATS
static char *tmp_cat_file; /* for open_cat_stream(), close_cat_stream() */
-static int created_tmp_cat; /* dto. */
+static bool created_tmp_cat; /* dto. */
#endif
static int tmp_cat_fd;
static struct timespec man_modtime; /* modtime of man page, for
@@ -893,7 +893,7 @@ static const char *escape_less (const char *string)
*
* If filename is non-NULL, uses mandb's -f option to update a single file.
*/
-static int run_mandb (int create, const char *manpath, const char *filename)
+static int run_mandb (bool create, const char *manpath, const char *filename)
{
pipeline *mandb_pl = pipeline_new ();
pipecmd *mandb_cmd = pipecmd_new ("mandb");
@@ -1573,20 +1573,20 @@ static void squeeze_blank_lines (void *data MAYBE_UNUSED)
size_t len = 0;
while (getline (&line, &len, stdin) != -1) {
- int in_blank_line = 1;
- int got_blank_line = 0;
+ bool in_blank_line = true;
+ bool got_blank_line = false;
while (in_blank_line) {
char *p;
for (p = line; *p; ++p) {
if (!CTYPE (isspace, *p)) {
- in_blank_line = 0;
+ in_blank_line = false;
break;
}
}
if (in_blank_line) {
- got_blank_line = 1;
+ got_blank_line = true;
free (line);
line = NULL;
len = 0;
@@ -1833,13 +1833,13 @@ static pipeline *open_cat_stream (const char *cat_file, const char *encoding)
pipecmd *comp_cmd;
# endif
- created_tmp_cat = 0;
+ created_tmp_cat = false;
debug ("creating temporary cat for %s\n", cat_file);
tmp_cat_file = tmp_cat_filename (cat_file);
if (tmp_cat_file)
- created_tmp_cat = 1;
+ created_tmp_cat = true;
else {
if (!debug_level && (errno == EACCES || errno == EROFS)) {
/* No permission to write to the cat file. Oh well,
@@ -2001,7 +2001,7 @@ static void format_display (decompress *d,
char *browser_list, *candidate;
if (format_status) {
- if (remove_directory (htmldir, 0) == -1)
+ if (remove_directory (htmldir, false) == -1)
error (0, errno,
_("can't remove directory %s"),
htmldir);
@@ -2033,7 +2033,7 @@ static void format_display (decompress *d,
sleep (5); /* firefox runs into background too fast */
free (browser_list);
- if (remove_directory (htmldir, 0) == -1)
+ if (remove_directory (htmldir, false) == -1)
error (0, errno, _("can't remove directory %s"),
htmldir);
free (htmlfile);
@@ -2157,7 +2157,7 @@ static int do_prompt (const char *name)
int ch;
FILE *tty = NULL;
- skip = 0;
+ skip = false;
if (!isatty (STDOUT_FILENO) || !isatty (STDIN_FILENO))
return 0; /* noninteractive */
tty = fopen ("/dev/tty", "r+");
@@ -2177,7 +2177,7 @@ static int do_prompt (const char *name)
fclose (tty);
return 0;
case EOF:
- skip = 1;
+ skip = true;
fclose (tty);
return 1;
default:
@@ -2349,7 +2349,7 @@ static int display (const char *dir, const char *man_file,
gripe_system (format_cmd, status);
}
} else {
- int format = 1;
+ bool format = true;
int status;
/* The caller should already have checked for any
@@ -2379,11 +2379,11 @@ static int display (const char *dir, const char *man_file,
if (!man_file) {
/* Stray cat. */
assert (cat_file);
- format = 0;
+ format = false;
} else if (!cat_file) {
assert (man_file);
save_cat = false;
- format = 1;
+ format = true;
} else if (format && save_cat) {
char *cat_dir;
char *tmp;
@@ -2419,14 +2419,14 @@ static int display (const char *dir, const char *man_file,
* expect input via stdin. So we special-case this to avoid
* the bogus access() check.
*/
- if (format == 1 && *man_file == '\0')
+ if (format && *man_file == '\0')
found = 1;
else
found = CAN_ACCESS
(format ? man_file : cat_file, R_OK);
debug ("format: %d, save_cat: %d, found: %d\n",
- format, (int) save_cat, found);
+ (int) format, (int) save_cat, found);
if (!found) {
pipeline_free (format_cmd);
@@ -2435,16 +2435,16 @@ static int display (const char *dir, const char *man_file,
}
if (print_where || print_where_cat) {
- int printed = 0;
+ bool printed = false;
if (print_where && man_file) {
printf ("%s", man_file);
- printed = 1;
+ printed = true;
}
if (print_where_cat && cat_file && !format) {
if (printed)
putchar (' ');
printf ("%s", cat_file);
- printed = 1;
+ printed = true;
}
if (printed)
putchar ('\n');
@@ -2545,14 +2545,14 @@ static _Noreturn void gripe_converting_name (const char *name)
* named with 'man -l'. Otherwise, a symlink to "/home/manuel/foo.1.gz"
* would be converted to "/home/catuel/foo.1.gz", which would be bad.
*/
-static char *convert_name (const char *name, int fsstnd)
+static char *convert_name (const char *name, bool fsstnd)
{
char *to_name, *t1 = NULL;
char *t2 = NULL;
struct compression *comp;
char *namestem;
- comp = comp_info (name, 1);
+ comp = comp_info (name, true);
if (comp)
namestem = comp->stem;
else
@@ -2612,7 +2612,7 @@ static char *find_cat_file (const char *path, const char *original,
* means we'll hardly ever use them at all except for user
* hierarchies; but compatibility, eh?)
*/
- cat_file = convert_name (original, 1);
+ cat_file = convert_name (original, true);
if (cat_file) {
status = is_changed (original, cat_file);
if (status != -2 && (!(status & 1)) == 1) {
@@ -2633,11 +2633,11 @@ static char *find_cat_file (const char *path, const char *original,
(man_file, global_manpath ? SYSTEM_CAT : USER_CAT);
if (cat_path) {
- cat_file = convert_name (cat_path, 0);
+ cat_file = convert_name (cat_path, false);
free (cat_path);
} else if (STRNEQ (man_file, path, path_len) &&
man_file[path_len] == '/')
- cat_file = convert_name (man_file, 1);
+ cat_file = convert_name (man_file, true);
else
cat_file = NULL;
@@ -2662,10 +2662,10 @@ static char *find_cat_file (const char *path, const char *original,
(original, global_manpath ? SYSTEM_CAT : USER_CAT);
if (cat_path) {
- cat_file = convert_name (cat_path, 0);
+ cat_file = convert_name (cat_path, false);
free (cat_path);
} else
- cat_file = convert_name (original, 1);
+ cat_file = convert_name (original, true);
if (cat_file)
debug ("will try cat file %s\n", cat_file);
@@ -2850,7 +2850,7 @@ static int compare_candidates (const struct candidate *left,
}
/* ULT_MAN comes first, etc. Consider SO_MAN equivalent to ULT_MAN. */
- cmp = compare_ids (lsource->id, rsource->id, 1);
+ cmp = compare_ids (lsource->id, rsource->id, true);
if (cmp)
return cmp;
@@ -3040,14 +3040,15 @@ static int add_candidate (struct candidate **head, char from_db, char cat,
* then be quickly checked by brute force.
*/
while (search) {
- int dupcand = duplicate_candidates (candp, search);
+ bool dupcand = duplicate_candidates (candp, search);
debug ("search: %d %d %s %s %s %c %s %s %s "
"(dup: %d)\n",
search->from_db, search->cat, search->req_name,
search->path, search->ult, search->source->id,
search->source->name ? search->source->name : "-",
- search->source->sec, search->source->ext, dupcand);
+ search->source->sec, search->source->ext,
+ (int) dupcand);
/* Check for duplicates. */
if (dupcand) {
@@ -3149,7 +3150,7 @@ static int try_section (const char *path, const char *sec, const char *name,
* Look for man page source files.
*/
- names = look_for_file (path, sec, name, 0, lff_opts);
+ names = look_for_file (path, sec, name, false, lff_opts);
if (!gl_list_size (names))
/*
* No files match.
@@ -3163,7 +3164,8 @@ static int try_section (const char *path, const char *sec, const char *name,
if (!troff && !want_encoding && !recode) {
gl_list_free (names);
- names = look_for_file (path, sec, name, 1, lff_opts);
+ names = look_for_file (path, sec, name, true,
+ lff_opts);
cat = 1;
}
}
@@ -3436,7 +3438,7 @@ static int maybe_update_file (const char *manpath, const char *name,
file,
(long) info->mtime.tv_sec, (long) info->mtime.tv_nsec,
(long) file_mtime.tv_sec, (long) file_mtime.tv_nsec);
- status = run_mandb (0, manpath, file);
+ status = run_mandb (false, manpath, file);
if (status)
error (0, 0, _("mandb command failed with exit status %d"),
status);
@@ -3509,7 +3511,7 @@ static int try_db (const char *manpath, const char *sec, const char *name,
} else if (!global_manpath) {
/* create one */
debug ("Failed to open %s O_RDONLY\n", database);
- if (run_mandb (1, manpath, NULL)) {
+ if (run_mandb (true, manpath, NULL)) {
gl_map_put (db_map, xstrdup (manpath), NULL);
found = TRY_DATABASE_OPEN_FAILED;
goto out;
@@ -3716,7 +3718,7 @@ static int do_global_apropos_section (const char *path, const char *sec,
debug ("searching in %s, section %s\n", path, sec);
- names = look_for_file (path, sec, "*", 0, LFF_WILDCARD);
+ names = look_for_file (path, sec, "*", false, LFF_WILDCARD);
if (regex_opt)
xregcomp (&search, name,
@@ -3842,7 +3844,8 @@ static int local_man_loop (const char *argv)
debug ("recalculating manpath for executable "
"in %s\n", argv_dir);
- new_manp = get_manpath_from_path (argv_dir, 0);
+ new_manp = get_manpath_from_path (argv_dir,
+ false);
if (!new_manp || !*new_manp) {
debug ("no useful manpath for "
"executable\n");
@@ -4289,7 +4292,7 @@ int main (int argc, char *argv[])
#ifdef MAN_DB_UPDATES
/* If `-u', do it now. */
if (update) {
- int status = run_mandb (0, NULL, NULL);
+ int status = run_mandb (false, NULL, NULL);
if (status)
error (0, 0,
_("mandb command failed with exit status %d"),
@@ -4300,7 +4303,7 @@ int main (int argc, char *argv[])
while (first_arg < argc) {
int status = OK;
int found = 0;
- static int maybe_section = 0;
+ static bool maybe_section = false;
const char *nextarg = argv[first_arg++];
/*
@@ -4312,7 +4315,7 @@ int main (int argc, char *argv[])
if (tmp) {
section = tmp;
debug ("\nsection: %s\n", section);
- maybe_section = 1;
+ maybe_section = true;
}
}
@@ -4329,7 +4332,7 @@ int main (int argc, char *argv[])
}
/* this is where we actually start looking for the man page */
- skip = 0;
+ skip = false;
if (global_apropos)
status = do_global_apropos (nextarg, &found);
else {
@@ -4432,7 +4435,7 @@ int main (int argc, char *argv[])
}
}
- maybe_section = 0;
+ maybe_section = false;
}
if (db_map) {
gl_map_free (db_map);
diff --git a/src/mandb.c b/src/mandb.c
index 8acc1723..1817153b 100644
--- a/src/mandb.c
+++ b/src/mandb.c
@@ -744,7 +744,7 @@ static void purge_catdir (gl_map_t tried_catdirs, const char *path)
if (!quiet)
printf (_("Removing obsolete cat directory %s...\n"),
path);
- remove_directory (path, 1);
+ remove_directory (path, true);
}
}
@@ -772,7 +772,7 @@ static void purge_catsubdirs (const char *manpath, const char *catpath)
if (!quiet)
printf (_("Removing obsolete cat directory "
"%s...\n"), catdir);
- remove_directory (catdir, 1);
+ remove_directory (catdir, true);
}
free (catdir);
diff --git a/src/manp.c b/src/manp.c
index 4d706d56..174b2926 100644
--- a/src/manp.c
+++ b/src/manp.c
@@ -177,7 +177,7 @@ const char * ATTRIBUTE_PURE get_def_user (const char *thing, const char *def)
return config_def ? config_def : def;
}
-static void add_sections (char *sections, int user)
+static void add_sections (char *sections, bool user)
{
char *section_list = xstrdup (sections);
char *sect;
@@ -220,7 +220,7 @@ gl_list_t get_sections (void)
return sections;
}
-static void add_def (const char *thing, const char *config_def, int user)
+static void add_def (const char *thing, const char *config_def, bool user)
{
add_config (thing, config_def, user ? DEFINE_USER : DEFINE);
@@ -237,7 +237,7 @@ static void add_manpath_map (const char *path, const char *mandir)
debug (" Path `%s' mapped to mandir `%s'.\n", path, mandir);
}
-static void add_mandb_map (const char *mandir, const char *catdir, int user)
+static void add_mandb_map (const char *mandir, const char *catdir, bool user)
{
char *tmpcatdir;
@@ -682,7 +682,7 @@ static char *guess_manpath (const char *systems)
def_path (MANDATORY));
}
- manpathlist = get_manpath_from_path (path, 1);
+ manpathlist = get_manpath_from_path (path, true);
}
manpath = add_system_manpath (systems, manpathlist);
free (manpathlist);
@@ -753,7 +753,7 @@ char *get_manpath (const char *systems)
}
/* Parse the manpath.config file, extracting appropriate information. */
-static void add_to_dirlist (FILE *config_file, int user)
+static void add_to_dirlist (FILE *config_file, bool user)
{
char *bp;
char *buf = NULL;
@@ -822,7 +822,7 @@ static void free_config_file (void *unused MAYBE_UNUSED)
void read_config_file (bool optional)
{
- static int done = 0;
+ static bool done = false;
char *dotmanpath = NULL;
FILE *config_file;
@@ -844,7 +844,7 @@ void read_config_file (bool optional)
config_file = fopen (dotmanpath, "r");
if (config_file != NULL) {
debug ("From the config file %s:\n", dotmanpath);
- add_to_dirlist (config_file, 1);
+ add_to_dirlist (config_file, true);
fclose (config_file);
}
free (dotmanpath);
@@ -864,12 +864,12 @@ void read_config_file (bool optional)
} else {
debug ("From the config file %s:\n", CONFIG_FILE);
- add_to_dirlist (config_file, 0);
+ add_to_dirlist (config_file, false);
fclose (config_file);
}
}
- done = 1;
+ done = true;
}
@@ -923,7 +923,7 @@ static char *def_path (enum config_flag flag)
* $HOME/man exists -- the directory $HOME/man will be added
* to the manpath.
*/
-char *get_manpath_from_path (const char *path, int mandatory)
+char *get_manpath_from_path (const char *path, bool mandatory)
{
gl_list_t tmplist;
const struct config_item *config_item;
diff --git a/src/manp.h b/src/manp.h
index 676891b2..195315d6 100644
--- a/src/manp.h
+++ b/src/manp.h
@@ -39,7 +39,7 @@ extern void unpack_locale_bits (const char *locale, struct locale_bits *bits);
extern void free_locale_bits (struct locale_bits *bits);
extern char *add_nls_manpaths (const char *manpathlist, const char *locales);
extern char *get_manpath (const char *systems);
-extern char *get_manpath_from_path (const char *path, int mandatory);
+extern char *get_manpath_from_path (const char *path, bool mandatory);
extern gl_list_t create_pathlist (const char *manp);
extern void free_pathlist (gl_list_t list);
extern char *get_mandb_manpath (void);
diff --git a/src/straycats.c b/src/straycats.c
index e4c7c2a7..fd4d6e38 100644
--- a/src/straycats.c
+++ b/src/straycats.c
@@ -132,7 +132,7 @@ static int check_for_stray (MYDBM_FILE dbf)
"ignoring bogus filename"),
catdir);
goto next;
- } else if (comp_info (ext, 0)) {
+ } else if (comp_info (ext, false)) {
*ext = '\0';
info->comp = xstrdup (ext + 1);
}
@@ -191,7 +191,7 @@ static int check_for_stray (MYDBM_FILE dbf)
exists = dblookup_exact (dbf, mandir_base, info->ext,
true);
if (exists &&
- compare_ids (STRAY_CAT, exists->id, 0) >= 0)
+ compare_ids (STRAY_CAT, exists->id, false) >= 0)
goto next_exists;
debug ("%s(%s) is not in the db.\n",
mandir_base, info->ext);
diff --git a/src/whatis.c b/src/whatis.c
index 76d2fae9..7306ad71 100644
--- a/src/whatis.c
+++ b/src/whatis.c
@@ -495,7 +495,7 @@ static bool suitable_manpath (const char *manpath, const char *page_dir)
gl_list_t page_manpathlist;
bool ret;
- page_manp = get_manpath_from_path (page_dir, 0);
+ page_manp = get_manpath_from_path (page_dir, false);
if (!page_manp || !*page_manp) {
free (page_manp);
return false;
@@ -733,12 +733,12 @@ static void do_apropos (MYDBM_FILE dbf,
*/
if (sections) {
char * const *section;
- int matched = 0;
+ bool matched = false;
for (section = sections; *section; ++section) {
if (STREQ (*section, info->sec) ||
STREQ (*section, info->ext)) {
- matched = 1;
+ matched = true;
break;
}
}
diff --git a/src/zsoelim.h b/src/zsoelim.h
index d7481566..901732d3 100644
--- a/src/zsoelim.h
+++ b/src/zsoelim.h
@@ -20,10 +20,12 @@
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <stdbool.h>
+
#include "gl_list.h"
-int zsoelim_open_file (const char *filename, gl_list_t manpathlist,
- const char *parent_path);
+bool zsoelim_open_file (const char *filename, gl_list_t manpathlist,
+ const char *parent_path);
void zsoelim_parse_file (gl_list_t manpathlist, const char *parent_path);
struct zsoelim_stdin_data;
diff --git a/src/zsoelim.l b/src/zsoelim.l
index 2d11660f..b5579bf2 100644
--- a/src/zsoelim.l
+++ b/src/zsoelim.l
@@ -58,6 +58,7 @@
#undef ACCEPT_QUOTES /* accept quoted roff requests */
#include <assert.h>
+#include <stdbool.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
@@ -104,7 +105,7 @@ static char *so_name[MAX_SO_DEPTH];
static int so_line[MAX_SO_DEPTH];
static decompress *so_pipe[MAX_SO_DEPTH];
static int so_stack_ptr;
-static int no_newline;
+static bool no_newline;
static gl_list_t so_manpathlist;
static const char *so_parent_path;
@@ -145,18 +146,18 @@ W [ \t]
%%
^\.de{W}*.+ {
- no_newline = 1;
+ no_newline = true;
ECHO;
BEGIN (de); /* Now we're inside of a macro definition: ends with a comment */
}
^\.so{W}* {
- no_newline = 1;
+ no_newline = true;
BEGIN (so); /* Now we're in the .so environment */
}
^\.lf{W}* {
- no_newline = 1;
+ no_newline = true;
ECHO; /* Now we're in the .lf environment */
BEGIN (lfnumber);
}
@@ -168,12 +169,12 @@ W [ \t]
^\.s |
^\.l |
. {
- no_newline = 1;
+ no_newline = true;
ECHO;
}
\n {
- no_newline = 0;
+ no_newline = false;
putchar ('\n');
LINE++;
}
@@ -190,7 +191,7 @@ W [ \t]
so_stack[so_stack_ptr++] = YY_CURRENT_BUFFER;
LINE = 1;
- no_newline = 0;
+ no_newline = false;
if (zsoelim_open_file (yytext, so_manpathlist,
so_parent_path)) {
@@ -212,12 +213,12 @@ W [ \t]
}
<end_request>{W}*\n {
- no_newline = 0;
+ no_newline = false;
BEGIN (INITIAL);
}
<so>\n {
- no_newline = 0;
+ no_newline = false;
error (OK, 0,
_("%s:%d: warning: newline in .so request, "
"ignoring"),
@@ -228,25 +229,25 @@ W [ \t]
}
<de>^\.\..* {
- no_newline = 1;
+ no_newline = true;
ECHO;
BEGIN (INITIAL);
}
<de>.* {
- no_newline = 1;
+ no_newline = true;
ECHO;
}
<de>\n {
- no_newline = 0;
+ no_newline = false;
putchar ('\n');
LINE++;
}
<lfnumber>\"?[0-9]+\"? {
- no_newline = 1;
+ no_newline = true;
ECHO;
ZAP_QUOTES;
LINE = atoi (yytext);
@@ -254,7 +255,7 @@ W [ \t]
}
<lfname>\"?[^ \t\n\"]+\"? { /* file names including whitespace ?? */
- no_newline = 1;
+ no_newline = true;
ECHO;
putchar ('\n');
ZAP_QUOTES;
@@ -265,19 +266,19 @@ W [ \t]
}
<lfname>{W}+ {
- no_newline = 1;
+ no_newline = true;
ECHO;
}
<lfname>\n {
- no_newline = 0;
+ no_newline = false;
putchar ('\n');
LINE++;
BEGIN (INITIAL);
}
<lfnumber,lfname>. {
- no_newline = 1;
+ no_newline = true;
debug (
"%s:%d: warning: unhandled .lf request; "
"line numbers may be wrong\n",
@@ -287,7 +288,7 @@ W [ \t]
}
<lfnumber>\n {
- no_newline = 0;
+ no_newline = false;
error (OK, 0,
_("%s:%d: warning: newline in .lf request, "
"ignoring"),
@@ -314,7 +315,7 @@ W [ \t]
yy_switch_to_buffer (so_stack[so_stack_ptr]);
printf (".lf %d %s\n", LINE += 1, NAME);
}
- no_newline = 0;
+ no_newline = false;
BEGIN (end_request);
}
%%
@@ -390,8 +391,8 @@ static decompress *try_compressed (char **filename)
/* This routine is used to open the specified file or uncompress a compressed
version and open that instead */
-int zsoelim_open_file (const char *filename, gl_list_t manpathlist,
- const char *parent_path)
+bool zsoelim_open_file (const char *filename, gl_list_t manpathlist,
+ const char *parent_path)
{
decompress *decomp;
@@ -476,7 +477,7 @@ int zsoelim_open_file (const char *filename, gl_list_t manpathlist,
if (parent_path) {
names = look_for_file (parent_path, sec, name,
- 0, LFF_MATCHCASE);
+ false, LFF_MATCHCASE);
GL_LIST_FOREACH (names, found_name) {
decomp = decompress_open
(found_name,
@@ -495,7 +496,7 @@ int zsoelim_open_file (const char *filename, gl_list_t manpathlist,
continue;
names = look_for_file (mp, sec, name,
- 0, LFF_MATCHCASE);
+ false, LFF_MATCHCASE);
GL_LIST_FOREACH (names, found_name) {
decomp = decompress_open
(found_name,
@@ -529,7 +530,7 @@ int zsoelim_open_file (const char *filename, gl_list_t manpathlist,
out:
if (!decomp) {
error (0, errno, _("can't open %s"), filename);
- return 1;
+ return true;
}
}
@@ -540,7 +541,7 @@ out:
/* only used by YY_INPUT, which casts it back to 'decompress *' */
yyin = (FILE *) decomp;
- return 0;
+ return false;
}
void zsoelim_stdin (void *data)