]> code.delx.au - gnu-emacs/blobdiff - lib-src/etags.c
Update copyright year to 2015
[gnu-emacs] / lib-src / etags.c
index 27a853a954ac15df64f34e08a5548601130988c5..dc2ced50933ff210dacfc91257101fe44910d4b2 100644 (file)
@@ -28,7 +28,7 @@ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
-Copyright (C) 1984, 1987-1989, 1993-1995, 1998-2013 Free Software
+Copyright (C) 1984, 1987-1989, 1993-1995, 1998-2015 Free Software
 Foundation, Inc.
 
 This file is not considered part of GNU Emacs.
@@ -80,14 +80,11 @@ University of California, as described above. */
 
 char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4";
 
-#define        TRUE    1
-#define        FALSE   0
-
 #ifdef DEBUG
 #  undef DEBUG
-#  define DEBUG TRUE
+#  define DEBUG true
 #else
-#  define DEBUG  FALSE
+#  define DEBUG  false
 #  define NDEBUG               /* disable assert */
 #endif
 
@@ -107,18 +104,14 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4";
 
 #ifdef MSDOS
 # undef MSDOS
-# define MSDOS TRUE
-# include <fcntl.h>
+# define MSDOS true
 # include <sys/param.h>
-# include <io.h>
 #else
-# define MSDOS FALSE
+# define MSDOS false
 #endif /* MSDOS */
 
 #ifdef WINDOWSNT
-# include <fcntl.h>
 # include <direct.h>
-# include <io.h>
 # define MAXPATHLEN _MAX_PATH
 # undef HAVE_NTGUI
 # undef  DOS_NT
@@ -134,6 +127,7 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4";
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <binary-io.h>
 #include <c-strcase.h>
 
 #include <assert.h>
@@ -150,9 +144,9 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4";
  tag tables and tags typedefs, #defines and struct/union/enum by default. */
 #ifdef CTAGS
 # undef  CTAGS
-# define CTAGS TRUE
+# define CTAGS true
 #else
-# define CTAGS FALSE
+# define CTAGS false
 #endif
 
 #define streq(s,t)     (assert ((s)!=NULL || (t)!=NULL), !strcmp (s, t))
@@ -194,8 +188,6 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4";
                                        (char *) (op), (n) * sizeof (Type)))
 #endif
 
-#define bool int
-
 typedef void Lang_function (FILE *);
 
 typedef struct
@@ -316,21 +308,13 @@ static void Texinfo_nodes (FILE *);
 static void Yacc_entries (FILE *);
 static void just_read_file (FILE *);
 
-static void print_language_names (void);
-static void print_version (void);
-static void print_help (argument *);
-int main (int, char **);
-
-static compressor *get_compressor_from_suffix (char *, char **);
 static language *get_language_from_langname (const char *);
-static language *get_language_from_interpreter (char *);
-static language *get_language_from_filename (char *, bool);
 static void readline (linebuffer *, FILE *);
 static long readline_internal (linebuffer *, FILE *);
 static bool nocase_tail (const char *);
 static void get_tag (char *, char **);
 
-static void analyse_regex (char *);
+static void analyze_regex (char *);
 static void free_regexps (void);
 static void regex_tag_multiline (void);
 static void error (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2);
@@ -346,7 +330,6 @@ static void find_entries (FILE *);
 static void free_tree (node *);
 static void free_fdesc (fdesc *);
 static void pfnote (char *, bool, char *, int, int, long);
-static void make_tag (const char *, int, bool, char *, int, int, long);
 static void invalidate_nodes (fdesc *, node **);
 static void put_entries (node *);
 
@@ -356,8 +339,6 @@ static char *skip_non_spaces (char *);
 static char *skip_name (char *);
 static char *savenstr (const char *, int);
 static char *savestr (const char *);
-static char *etags_strchr (const char *, int);
-static char *etags_strrchr (const char *, int);
 static char *etags_getcwd (void);
 static char *relative_filename (char *, char *);
 static char *absolute_filename (char *, char *);
@@ -410,7 +391,7 @@ static const char
   *midtk = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz$0123456789";
 
 static bool append_to_tagfile; /* -a: append to tags */
-/* The next five default to TRUE in C and derived languages.  */
+/* The next five default to true in C and derived languages.  */
 static bool typedefs;          /* -t: create tags for C and Ada typedefs */
 static bool typedefs_or_cplusplus; /* -T: create tags for C typedefs, level */
                                /* 0 struct/enum/union decls, and C++ */
@@ -418,18 +399,18 @@ static bool typedefs_or_cplusplus; /* -T: create tags for C typedefs, level */
 static bool constantypedefs;   /* -d: create tags for C #define, enum */
                                /* constants and variables. */
                                /* -D: opposite of -d.  Default under ctags. */
-static bool globals;           /* create tags for global variables */
-static bool members;           /* create tags for C member variables */
-static bool declarations;      /* --declarations: tag them and extern in C&Co*/
-static bool no_line_directive; /* ignore #line directives (undocumented) */
-static bool no_duplicates;     /* no duplicate tags for ctags (undocumented) */
+static int globals;            /* create tags for global variables */
+static int members;            /* create tags for C member variables */
+static int declarations;       /* --declarations: tag them and extern in C&Co*/
+static int no_line_directive;  /* ignore #line directives (undocumented) */
+static int no_duplicates;      /* no duplicate tags for ctags (undocumented) */
 static bool update;            /* -u: update tags */
 static bool vgrind_style;      /* -v: create vgrind style index output */
 static bool no_warnings;       /* -w: suppress warnings (undocumented) */
 static bool cxref_style;       /* -x: create cxref style output */
 static bool cplusplus;         /* .[hc] means C++, not C (undocumented) */
 static bool ignoreindent;      /* -I: ignore indentation in C */
-static bool packages_only;     /* --packages-only: in Ada, only tag packages*/
+static int packages_only;      /* --packages-only: in Ada, only tag packages*/
 
 /* STDIN is defined in LynxOS system headers */
 #ifdef STDIN
@@ -445,17 +426,17 @@ static bool need_filebuf; /* some regexes are multi-line */
 static struct option longopts[] =
 {
   { "append",             no_argument,       NULL,               'a'   },
-  { "packages-only",      no_argument,       &packages_only,     TRUE  },
+  { "packages-only",      no_argument,       &packages_only,     1     },
   { "c++",                no_argument,       NULL,               'C'   },
-  { "declarations",       no_argument,       &declarations,      TRUE  },
-  { "no-line-directive",  no_argument,       &no_line_directive, TRUE  },
-  { "no-duplicates",      no_argument,       &no_duplicates,     TRUE  },
+  { "declarations",       no_argument,       &declarations,      1     },
+  { "no-line-directive",  no_argument,       &no_line_directive, 1     },
+  { "no-duplicates",      no_argument,       &no_duplicates,     1     },
   { "help",               no_argument,       NULL,               'h'   },
   { "help",               no_argument,       NULL,               'H'   },
   { "ignore-indentation", no_argument,       NULL,               'I'   },
   { "language",           required_argument, NULL,               'l'   },
-  { "members",            no_argument,       &members,           TRUE  },
-  { "no-members",         no_argument,       &members,           FALSE },
+  { "members",            no_argument,       &members,           1     },
+  { "no-members",         no_argument,       &members,           0     },
   { "output",             required_argument, NULL,               'o'   },
   { "regex",              required_argument, NULL,               'r'   },
   { "no-regex",           no_argument,       NULL,               'R'   },
@@ -467,7 +448,7 @@ static struct option longopts[] =
   { "backward-search",    no_argument,       NULL,               'B'   },
   { "cxref",              no_argument,       NULL,               'x'   },
   { "defines",            no_argument,       NULL,               'd'   },
-  { "globals",            no_argument,       &globals,           TRUE  },
+  { "globals",            no_argument,       &globals,           1     },
   { "typedefs",           no_argument,       NULL,               't'   },
   { "typedefs-and-c++",   no_argument,       NULL,               'T'   },
   { "update",             no_argument,       NULL,               'u'   },
@@ -476,7 +457,7 @@ static struct option longopts[] =
 
 #else /* Etags options */
   { "no-defines",         no_argument,       NULL,               'D'   },
-  { "no-globals",         no_argument,       &globals,           FALSE },
+  { "no-globals",         no_argument,       &globals,           0     },
   { "include",            required_argument, NULL,               'i'   },
 #endif
   { NULL }
@@ -770,7 +751,7 @@ static language lang_names [] =
   { "scheme",    Scheme_help,    Scheme_functions,  Scheme_suffixes    },
   { "tex",       TeX_help,       TeX_commands,      TeX_suffixes       },
   { "texinfo",   Texinfo_help,   Texinfo_nodes,     Texinfo_suffixes   },
-  { "yacc",      Yacc_help,Yacc_entries,Yacc_suffixes,NULL,NULL,TRUE},
+  { "yacc",      Yacc_help,Yacc_entries,Yacc_suffixes,NULL,NULL,true},
   { "auto",      auto_help },                      /* default guessing scheme */
   { "none",      none_help,      just_read_file }, /* regexp matching only */
   { NULL }                /* end of list */
@@ -816,7 +797,7 @@ etags --help --lang=ada.");
 #ifndef VERSION
 # define VERSION "17.38.1.4"
 #endif
-static void
+static _Noreturn void
 print_version (void)
 {
   char emacs_copyright[] = COPYRIGHT;
@@ -829,13 +810,13 @@ print_version (void)
 }
 
 #ifndef PRINT_UNDOCUMENTED_OPTIONS_HELP
-# define PRINT_UNDOCUMENTED_OPTIONS_HELP FALSE
+# define PRINT_UNDOCUMENTED_OPTIONS_HELP false
 #endif
 
-static void
+static _Noreturn void
 print_help (argument *argbuffer)
 {
-  bool help_for_lang = FALSE;
+  bool help_for_lang = false;
 
   for (; argbuffer->arg_type != at_end; argbuffer++)
     if (argbuffer->arg_type == at_language)
@@ -843,7 +824,7 @@ print_help (argument *argbuffer)
        if (help_for_lang)
          puts ("");
        puts (argbuffer->lang->help);
-       help_for_lang = TRUE;
+       help_for_lang = true;
       }
 
   if (help_for_lang)
@@ -1014,15 +995,10 @@ main (int argc, char **argv)
   argument *argbuffer;
   int current_arg, file_count;
   linebuffer filename_lb;
-  bool help_asked = FALSE;
+  bool help_asked = false;
   ptrdiff_t len;
- char *optstring;
- int opt;
-
-
-#ifdef DOS_NT
-  _fmode = O_BINARY;   /* all of files are treated as binary files */
-#endif /* DOS_NT */
+  char *optstring;
+  int opt;
 
   progname = argv[0];
   nincluded_files = 0;
@@ -1039,8 +1015,8 @@ main (int argc, char **argv)
    * Also default to find macro constants, enum constants, struct
    * members and global variables.  Do it for both etags and ctags.
    */
-  typedefs = typedefs_or_cplusplus = constantypedefs = TRUE;
-  globals = members = TRUE;
+  typedefs = typedefs_or_cplusplus = constantypedefs = true;
+  globals = members = true;
 
   /* When the optstring begins with a '-' getopt_long does not rearrange the
      non-options arguments to be at the end, but leaves them alone. */
@@ -1078,12 +1054,12 @@ main (int argc, char **argv)
        ++file_count;
        if (parsing_stdin)
          fatal ("cannot parse standard input more than once", (char *)NULL);
-       parsing_stdin = TRUE;
+       parsing_stdin = true;
        break;
 
        /* Common options. */
-      case 'a': append_to_tagfile = TRUE;      break;
-      case 'C': cplusplus = TRUE;              break;
+      case 'a': append_to_tagfile = true;      break;
+      case 'C': cplusplus = true;              break;
       case 'f':                /* for compatibility with old makefiles */
       case 'o':
        if (tagfile)
@@ -1096,7 +1072,7 @@ main (int argc, char **argv)
        break;
       case 'I':
       case 'S':                /* for backward compatibility */
-       ignoreindent = TRUE;
+       ignoreindent = true;
        break;
       case 'l':
        {
@@ -1131,22 +1107,22 @@ main (int argc, char **argv)
        break;
       case 'h':
       case 'H':
-       help_asked = TRUE;
+       help_asked = true;
        break;
 
        /* Etags options */
-      case 'D': constantypedefs = FALSE;                       break;
+      case 'D': constantypedefs = false;                       break;
       case 'i': included_files[nincluded_files++] = optarg;    break;
 
        /* Ctags options. */
       case 'B': searchar = '?';                                        break;
-      case 'd': constantypedefs = TRUE;                                break;
-      case 't': typedefs = TRUE;                               break;
-      case 'T': typedefs = typedefs_or_cplusplus = TRUE;       break;
-      case 'u': update = TRUE;                                 break;
-      case 'v': vgrind_style = TRUE;                     /*FALLTHRU*/
-      case 'x': cxref_style = TRUE;                            break;
-      case 'w': no_warnings = TRUE;                            break;
+      case 'd': constantypedefs = true;                                break;
+      case 't': typedefs = true;                               break;
+      case 'T': typedefs = typedefs_or_cplusplus = true;       break;
+      case 'u': update = true;                                 break;
+      case 'v': vgrind_style = true;                     /*FALLTHRU*/
+      case 'x': cxref_style = true;                            break;
+      case 'w': no_warnings = true;                            break;
       default:
        suggest_asking_for_help ();
        /* NOTREACHED */
@@ -1209,15 +1185,10 @@ main (int argc, char **argv)
       if (streq (tagfile, "-"))
        {
          tagf = stdout;
-#ifdef DOS_NT
-         /* Switch redirected `stdout' to binary mode (setting `_fmode'
-            doesn't take effect until after `stdout' is already open). */
-         if (!isatty (fileno (stdout)))
-           setmode (fileno (stdout), O_BINARY);
-#endif /* DOS_NT */
+         SET_BINARY (fileno (stdout));
        }
       else
-       tagf = fopen (tagfile, append_to_tagfile ? "a" : "w");
+       tagf = fopen (tagfile, append_to_tagfile ? "ab" : "wb");
       if (tagf == NULL)
        pfatal (tagfile);
     }
@@ -1236,7 +1207,7 @@ main (int argc, char **argv)
          lang = argbuffer[i].lang;
          break;
        case at_regexp:
-         analyse_regex (argbuffer[i].what);
+         analyze_regex (argbuffer[i].what);
          break;
        case at_filename:
              this_file = argbuffer[i].what;
@@ -1306,21 +1277,21 @@ main (int argc, char **argv)
            default:
              continue;         /* the for loop */
            }
-         strcpy (cmd, "mv ");
-         strcat (cmd, tagfile);
-         strcat (cmd, " OTAGS;fgrep -v '\t");
-         strcat (cmd, argbuffer[i].what);
-         strcat (cmd, "\t' OTAGS >");
-         strcat (cmd, tagfile);
-         strcat (cmd, ";rm OTAGS");
+         char *z = stpcpy (cmd, "mv ");
+         z = stpcpy (z, tagfile);
+         z = stpcpy (z, " OTAGS;fgrep -v '\t");
+         z = stpcpy (z, argbuffer[i].what);
+         z = stpcpy (z, "\t' OTAGS >");
+         z = stpcpy (z, tagfile);
+         strcpy (z, ";rm OTAGS");
          if (system (cmd) != EXIT_SUCCESS)
            fatal ("failed to execute shell command", (char *)NULL);
        }
       free (cmd);
-      append_to_tagfile = TRUE;
+      append_to_tagfile = true;
     }
 
-  tagf = fopen (tagfile, append_to_tagfile ? "a" : "w");
+  tagf = fopen (tagfile, append_to_tagfile ? "ab" : "wb");
   if (tagf == NULL)
     pfatal (tagfile);
   put_entries (nodehead);      /* write all the tags (CTAGS) */
@@ -1336,10 +1307,10 @@ main (int argc, char **argv)
        /* Maybe these should be used:
           setenv ("LC_COLLATE", "C", 1);
           setenv ("LC_ALL", "C", 1); */
-       strcpy (cmd, "sort -u -o ");
-       strcat (cmd, tagfile);
-       strcat (cmd, " ");
-       strcat (cmd, tagfile);
+       char *z = stpcpy (cmd, "sort -u -o ");
+       z = stpcpy (z, tagfile);
+       *z++ = ' ';
+       strcpy (z, tagfile);
        exit (system (cmd));
       }
   return EXIT_SUCCESS;
@@ -1361,8 +1332,8 @@ get_compressor_from_suffix (char *file, char **extptr)
 
   /* File has been processed by canonicalize_filename,
      so we don't need to consider backslashes on DOS_NT.  */
-  slash = etags_strrchr (file, '/');
-  suffix = etags_strrchr (file, '.');
+  slash = strrchr (file, '/');
+  suffix = strrchr (file, '.');
   if (suffix == NULL || suffix < slash)
     return NULL;
   if (extptr != NULL)
@@ -1449,7 +1420,7 @@ get_language_from_filename (char *file, int case_sensitive)
          return lang;
 
   /* If not found, try suffix after last dot. */
-  suffix = etags_strrchr (file, '.');
+  suffix = strrchr (file, '.');
   if (suffix == NULL)
     return NULL;
   suffix += 1;
@@ -1561,11 +1532,11 @@ process_file_name (char *file, language *lang)
   if (real_name == compressed_name)
     {
       char *cmd = concat (compr->command, " ", real_name);
-      inf = (FILE *) popen (cmd, "r");
+      inf = popen (cmd, "rb");
       free (cmd);
     }
   else
-    inf = fopen (real_name, "r");
+    inf = fopen (real_name, "rb");
   if (inf == NULL)
     {
       perror (real_name);
@@ -1614,9 +1585,9 @@ process_file (FILE *fh, char *fn, language *lang)
         to the directory of the tags file. */
       fdp->taggedfname = relative_filename (fn, tagfiledir);
     }
-  fdp->usecharno = TRUE;       /* use char position when making tags */
+  fdp->usecharno = true;       /* use char position when making tags */
   fdp->prop = NULL;
-  fdp->written = FALSE;                /* not written on tags file yet */
+  fdp->written = false;                /* not written on tags file yet */
 
   fdhead = fdp;
   curfdp = fdhead;             /* the current file description */
@@ -1662,26 +1633,27 @@ process_file (FILE *fh, char *fn, language *lang)
  * This routine sets up the boolean pseudo-functions which work
  * by setting boolean flags dependent upon the corresponding character.
  * Every char which is NOT in that string is not a white char.  Therefore,
- * all of the array "_wht" is set to FALSE, and then the elements
- * subscripted by the chars in "white" are set to TRUE.  Thus "_wht"
- * of a char is TRUE if it is the string "white", else FALSE.
+ * all of the array "_wht" is set to false, and then the elements
+ * subscripted by the chars in "white" are set to true.  Thus "_wht"
+ * of a char is true if it is the string "white", else false.
  */
 static void
 init (void)
 {
-  register const char *sp;
-  register int i;
+  const char *sp;
+  int i;
 
   for (i = 0; i < CHARS; i++)
-    iswhite (i) = notinname (i) = begtoken (i) = intoken (i) = endtoken (i) = FALSE;
-  for (sp = white; *sp != '\0'; sp++) iswhite (*sp) = TRUE;
-  for (sp = nonam; *sp != '\0'; sp++) notinname (*sp) = TRUE;
+    iswhite (i) = notinname (i) = begtoken (i) = intoken (i) = endtoken (i)
+      = false;
+  for (sp = white; *sp != '\0'; sp++) iswhite (*sp) = true;
+  for (sp = nonam; *sp != '\0'; sp++) notinname (*sp) = true;
   notinname ('\0') = notinname ('\n');
-  for (sp = begtk; *sp != '\0'; sp++) begtoken (*sp) = TRUE;
+  for (sp = begtk; *sp != '\0'; sp++) begtoken (*sp) = true;
   begtoken ('\0') = begtoken ('\n');
-  for (sp = midtk; *sp != '\0'; sp++) intoken (*sp) = TRUE;
+  for (sp = midtk; *sp != '\0'; sp++) intoken (*sp) = true;
   intoken ('\0') = intoken ('\n');
-  for (sp = endtk; *sp != '\0'; sp++) endtoken (*sp) = TRUE;
+  for (sp = endtk; *sp != '\0'; sp++) endtoken (*sp) = true;
   endtoken ('\0') = endtoken ('\n');
 }
 
@@ -1705,7 +1677,7 @@ find_entries (FILE *inf)
   /* Else try to guess the language given the file name. */
   if (parser == NULL)
     {
-      lang = get_language_from_filename (curfdp->infname, TRUE);
+      lang = get_language_from_filename (curfdp->infname, true);
       if (lang != NULL && lang->function != NULL)
        {
          curfdp->lang = lang;
@@ -1725,7 +1697,7 @@ find_entries (FILE *inf)
       /* Set lp to point at the first char after the last slash in the
          line or, if no slashes, at the first nonblank.  Then set cp to
         the first successive blank and terminate the string. */
-      lp = etags_strrchr (lb.buffer+2, '/');
+      lp = strrchr (lb.buffer+2, '/');
       if (lp != NULL)
        lp += 1;
       else
@@ -1752,7 +1724,7 @@ find_entries (FILE *inf)
   /* Else try to guess the language given the case insensitive file name. */
   if (parser == NULL)
     {
-      lang = get_language_from_filename (curfdp->infname, FALSE);
+      lang = get_language_from_filename (curfdp->infname, false);
       if (lang != NULL && lang->function != NULL)
        {
          curfdp->lang = lang;
@@ -1850,7 +1822,7 @@ find_entries (FILE *inf)
 static void
 make_tag (const char *name,    /* tag name, or NULL if unnamed */
          int namelen,          /* tag length */
-         int is_func,          /* tag is a function */
+         bool is_func,         /* tag is a function */
          char *linestart,      /* start of the line where tag is */
          int linelen,          /* length of the line where tag is */
          int lno,              /* line number */
@@ -1878,7 +1850,7 @@ make_tag (const char *name,       /* tag name, or NULL if unnamed */
              && (cp == linestart
                  || notinname (cp[-1]))        /* rule #3 */
              && strneq (name, cp, namelen))    /* rule #2 */
-           named = FALSE;      /* use implicit tag name */
+           named = false;      /* use implicit tag name */
        }
     }
 
@@ -1890,7 +1862,8 @@ make_tag (const char *name,       /* tag name, or NULL if unnamed */
 
 /* Record a tag. */
 static void
-pfnote (char *name, int is_func, char *linestart, int linelen, int lno, long int cno)
+pfnote (char *name, bool is_func, char *linestart, int linelen, int lno,
+       long int cno)
                                /* tag name, or NULL if unnamed */
                                /* tag is a function */
                                /* start of the line where tag is */
@@ -1909,16 +1882,16 @@ pfnote (char *name, int is_func, char *linestart, int linelen, int lno, long int
   /* If ctags mode, change name "main" to M<thisfilename>. */
   if (CTAGS && !cxref_style && streq (name, "main"))
     {
-      register char *fp = etags_strrchr (curfdp->taggedfname, '/');
+      char *fp = strrchr (curfdp->taggedfname, '/');
       np->name = concat ("M", fp == NULL ? curfdp->taggedfname : fp + 1, "");
-      fp = etags_strrchr (np->name, '.');
+      fp = strrchr (np->name, '.');
       if (fp != NULL && fp[1] != '\0' && fp[2] == '\0')
        fp[0] = '\0';
     }
   else
     np->name = name;
-  np->valid = TRUE;
-  np->been_warned = FALSE;
+  np->valid = true;
+  np->been_warned = false;
   np->fdp = curfdp;
   np->is_func = is_func;
   np->lno = lno;
@@ -2052,7 +2025,7 @@ add_node (node *np, node **cur_node_p)
                (stderr,
                 "Duplicate entry in files %s and %s: %s (Warning only)\n",
                 np->fdp->infname, cur_node->fdp->infname, np->name);
-             cur_node->been_warned = TRUE;
+             cur_node->been_warned = true;
            }
          return;
        }
@@ -2080,7 +2053,7 @@ invalidate_nodes (fdesc *badfdp, node **npp)
       if (np->left != NULL)
        invalidate_nodes (badfdp, &np->left);
       if (np->fdp == badfdp)
-       np->valid = FALSE;
+       np->valid = false;
       if (np->right != NULL)
        invalidate_nodes (badfdp, &np->right);
     }
@@ -2163,7 +2136,7 @@ put_entries (register node *np)
              fdp = np->fdp;
              fprintf (tagf, "\f\n%s,%d\n",
                       fdp->taggedfname, total_size_of_entries (np));
-             fdp->written = TRUE;
+             fdp->written = true;
            }
          fputs (np->regex, tagf);
          fputc ('\177', tagf);
@@ -2249,10 +2222,6 @@ enum sym_type
   st_C_struct, st_C_extern, st_C_enum, st_C_define, st_C_typedef
 };
 
-static unsigned int hash (const char *, unsigned int);
-static struct C_stab_entry * in_word_set (const char *, unsigned int);
-static enum sym_type C_symtype (char *, int, int);
-
 /* Feed stuff between (but not including) %[ and %] lines to:
      gperf -m 5
 %[
@@ -2311,10 +2280,10 @@ and replace lines between %< and %> with its output, then:
 struct C_stab_entry { const char *name; int c_ext; enum sym_type type; };
 /* maximum key range = 33, duplicates = 0 */
 
-static inline unsigned int
-hash (register const char *str, register unsigned int len)
+static int
+hash (const char *str, int len)
 {
-  static unsigned char asso_values[] =
+  static char const asso_values[] =
     {
       35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
       35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
@@ -2343,15 +2312,15 @@ hash (register const char *str, register unsigned int len)
       35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
       35, 35, 35, 35, 35, 35
     };
-  register int hval = len;
+  int hval = len;
 
   switch (hval)
     {
       default:
-        hval += asso_values[(unsigned char)str[2]];
+        hval += asso_values[(unsigned char) str[2]];
       /*FALLTHROUGH*/
       case 2:
-        hval += asso_values[(unsigned char)str[1]];
+        hval += asso_values[(unsigned char) str[1]];
         break;
     }
   return hval;
@@ -2409,11 +2378,11 @@ in_word_set (register const char *str, register unsigned int len)
 
   if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
     {
-      register int key = hash (str, len);
+      int key = hash (str, len);
 
       if (key <= MAX_HASH_VALUE && key >= 0)
         {
-          register const char *s = wordlist[key].name;
+          const char *s = wordlist[key].name;
 
           if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
             return &wordlist[key];
@@ -2638,7 +2607,7 @@ static void make_C_tag (bool);
  *     function or variable, or corresponds to a typedef, or
  *     is a struct/union/enum tag, or #define, or an enum constant.
  *
- *     *IS_FUNC gets TRUE if the token is a function or #define macro
+ *     *IS_FUNC_OR_VAR gets true if the token is a function or #define macro
  *     with args.  C_EXTP points to which language we are looking at.
  *
  * Globals
@@ -2650,7 +2619,8 @@ static void make_C_tag (bool);
  */
 
 static bool
-consider_token (register char *str, register int len, register int c, int *c_extp, int bracelev, int parlev, int *is_func_or_var)
+consider_token (char *str, int len, int c, int *c_extp,
+               int bracelev, int parlev, bool *is_func_or_var)
                                /* IN: token pointer */
                                /* IN: token length */
                                /* IN: first char after the token */
@@ -2674,8 +2644,8 @@ consider_token (register char *str, register int len, register int c, int *c_ext
    */
   if (toktype == st_C_attribute)
     {
-      inattribute = TRUE;
-      return FALSE;
+      inattribute = true;
+      return false;
      }
 
    /*
@@ -2688,7 +2658,7 @@ consider_token (register char *str, register int len, register int c, int *c_ext
        if (toktype == st_C_gnumacro)
         {
           fvdef = fdefunkey;
-          return FALSE;
+          return false;
         }
        break;
      case dsharpseen:
@@ -2700,20 +2670,20 @@ consider_token (register char *str, register int len, register int c, int *c_ext
         {
           definedef = dignorerest;
         }
-       return FALSE;
+       return false;
      case ddefineseen:
        /*
        * Make a tag for any macro, unless it is a constant
-       * and constantypedefs is FALSE.
+       * and constantypedefs is false.
        */
        definedef = dignorerest;
        *is_func_or_var = (c == '(');
        if (!*is_func_or_var && !constantypedefs)
-        return FALSE;
+        return false;
        else
-        return TRUE;
+        return true;
      case dignorerest:
-       return FALSE;
+       return false;
      default:
        error ("internal error: definedef value.");
      }
@@ -2728,9 +2698,9 @@ consider_token (register char *str, register int len, register int c, int *c_ext
         {
           if (typedefs)
             typdef = tkeyseen;
-          fvextern = FALSE;
+          fvextern = false;
           fvdef = fvnone;
-          return FALSE;
+          return false;
         }
        break;
      case tkeyseen:
@@ -2747,7 +2717,7 @@ consider_token (register char *str, register int len, register int c, int *c_ext
        if (structdef == snone && fvdef == fvnone)
         {
           fvdef = fvnameseen;
-          return TRUE;
+          return true;
         }
        break;
      case tend:
@@ -2756,9 +2726,9 @@ consider_token (register char *str, register int len, register int c, int *c_ext
         case st_C_class:
         case st_C_struct:
         case st_C_enum:
-          return FALSE;
+          return false;
         }
-       return TRUE;
+       return true;
      }
 
    switch (toktype)
@@ -2766,7 +2736,7 @@ consider_token (register char *str, register int len, register int c, int *c_ext
      case st_C_javastruct:
        if (structdef == stagseen)
         structdef = scolonseen;
-       return FALSE;
+       return false;
      case st_C_template:
      case st_C_class:
        if ((*c_extp & C_AUTO)  /* automatic detection of C++ language */
@@ -2790,13 +2760,13 @@ consider_token (register char *str, register int len, register int c, int *c_ext
           if (fvdef == fvnameseen)
             fvdef = fvnone;
         }
-       return FALSE;
+       return false;
      }
 
    if (structdef == skeyseen)
      {
        structdef = stagseen;
-       return TRUE;
+       return true;
      }
 
    if (typdef != tnone)
@@ -2810,27 +2780,27 @@ consider_token (register char *str, register int len, register int c, int *c_ext
         {
         case st_C_objprot:
           objdef = oprotocol;
-          return FALSE;
+          return false;
         case st_C_objimpl:
           objdef = oimplementation;
-          return FALSE;
+          return false;
         }
        break;
      case oimplementation:
        /* Save the class tag for functions or variables defined inside. */
        objtag = savenstr (str, len);
        objdef = oinbody;
-       return FALSE;
+       return false;
      case oprotocol:
        /* Save the class tag for categories. */
        objtag = savenstr (str, len);
        objdef = otagseen;
-       *is_func_or_var = TRUE;
-       return TRUE;
+       *is_func_or_var = true;
+       return true;
      case oparenseen:
        objdef = ocatseen;
-       *is_func_or_var = TRUE;
-       return TRUE;
+       *is_func_or_var = true;
+       return true;
      case oinbody:
        break;
      case omethodsign:
@@ -2841,13 +2811,13 @@ consider_token (register char *str, register int len, register int c, int *c_ext
           linebuffer_setlen (&token_name, len);
           memcpy (token_name.buffer, str, len);
           token_name.buffer[len] = '\0';
-          return TRUE;
+          return true;
         }
-       return FALSE;
+       return false;
      case omethodcolon:
        if (parlev == 0)
         objdef = omethodparm;
-       return FALSE;
+       return false;
      case omethodparm:
        if (parlev == 0)
         {
@@ -2857,9 +2827,9 @@ consider_token (register char *str, register int len, register int c, int *c_ext
           linebuffer_setlen (&token_name, oldlen + len);
           memcpy (token_name.buffer + oldlen, str, len);
           token_name.buffer[oldlen + len] = '\0';
-          return TRUE;
+          return true;
         }
-       return FALSE;
+       return false;
      case oignore:
        if (toktype == st_C_objend)
         {
@@ -2871,14 +2841,14 @@ consider_token (register char *str, register int len, register int c, int *c_ext
           free (objtag); */
           objdef = onone;
         }
-       return FALSE;
+       return false;
      }
 
    /* A function, variable or enum constant? */
    switch (toktype)
      {
      case st_C_extern:
-       fvextern = TRUE;
+       fvextern = true;
        switch  (fvdef)
         {
         case finlist:
@@ -2889,39 +2859,39 @@ consider_token (register char *str, register int len, register int c, int *c_ext
         default:
           fvdef = fvnone;
         }
-       return FALSE;
+       return false;
      case st_C_ignore:
-       fvextern = FALSE;
+       fvextern = false;
        fvdef = vignore;
-       return FALSE;
+       return false;
      case st_C_operator:
        fvdef = foperator;
-       *is_func_or_var = TRUE;
-       return TRUE;
+       *is_func_or_var = true;
+       return true;
      case st_none:
        if (constantypedefs
           && structdef == snone
           && structtype == st_C_enum && bracelev > structbracelev)
-        return TRUE;           /* enum constant */
+        return true;           /* enum constant */
        switch (fvdef)
         {
         case fdefunkey:
           if (bracelev > 0)
             break;
           fvdef = fdefunname;  /* GNU macro */
-          *is_func_or_var = TRUE;
-          return TRUE;
+          *is_func_or_var = true;
+          return true;
         case fvnone:
           switch (typdef)
             {
             case ttypeseen:
-              return FALSE;
+              return false;
             case tnone:
               if ((strneq (str, "asm", 3) && endtoken (str[3]))
                   || (strneq (str, "__asm__", 7) && endtoken (str[7])))
                 {
                   fvdef = vignore;
-                  return FALSE;
+                  return false;
                 }
               break;
             }
@@ -2932,19 +2902,19 @@ consider_token (register char *str, register int len, register int c, int *c_ext
              if (*c_extp & C_AUTO) /* automatic detection of C++ */
                *c_extp = (*c_extp | C_PLPL) & ~C_AUTO;
              fvdef = foperator;
-             *is_func_or_var = TRUE;
-             return TRUE;
+             *is_func_or_var = true;
+             return true;
            }
          if (bracelev > 0 && !instruct)
            break;
          fvdef = fvnameseen;   /* function or variable */
-         *is_func_or_var = TRUE;
-         return TRUE;
+         *is_func_or_var = true;
+         return true;
        }
       break;
     }
 
-  return FALSE;
+  return false;
 }
 
 \f
@@ -2976,7 +2946,7 @@ do {                                                                      \
   curlinepos = charno;                                                 \
   readline (&curlb, inf);                                              \
   lp = curlb.buffer;                                                   \
-  quotednl = FALSE;                                                    \
+  quotednl = false;                                                    \
   newndx = curndx;                                                     \
 } while (0)
 
@@ -2986,16 +2956,16 @@ do {                                                                    \
   if (savetoken.valid)                                                 \
     {                                                                  \
       token = savetoken;                                               \
-      savetoken.valid = FALSE;                                         \
+      savetoken.valid = false;                                         \
     }                                                                  \
   definedef = dnone;                                                   \
 } while (0)
 
 
 static void
-make_C_tag (int isfun)
+make_C_tag (bool isfun)
 {
-  /* This function is never called when token.valid is FALSE, but
+  /* This function is never called when token.valid is false, but
      we must protect against invalid input or internal errors. */
   if (token.valid)
     make_tag (token_name.buffer, token_name.len, isfun, token.line,
@@ -3008,7 +2978,7 @@ make_C_tag (int isfun)
       error ("INVALID TOKEN");
     }
 
-  token.valid = FALSE;
+  token.valid = false;
 }
 
 
@@ -3056,11 +3026,11 @@ C_entries (int c_ext, FILE *inf)
   lp = curlb.buffer;
   *lp = 0;
 
-  fvdef = fvnone; fvextern = FALSE; typdef = tnone;
+  fvdef = fvnone; fvextern = false; typdef = tnone;
   structdef = snone; definedef = dnone; objdef = onone;
-  yacc_rules = FALSE;
-  midtoken = inquote = inchar = incomm = quotednl = FALSE;
-  token.valid = savetoken.valid = FALSE;
+  yacc_rules = false;
+  midtoken = inquote = inchar = incomm = quotednl = false;
+  token.valid = savetoken.valid = false;
   bracelev = bracketlev = parlev = attrparlev = templatelev = 0;
   if (cjava)
     { qualifier = "."; qlen = 1; }
@@ -3078,7 +3048,7 @@ C_entries (int c_ext, FILE *inf)
             to read the next line.  */
          if (*lp == '\0')
            {
-             quotednl = TRUE;
+             quotednl = true;
              continue;
            }
          lp++;
@@ -3092,7 +3062,7 @@ C_entries (int c_ext, FILE *inf)
              if (*lp == '/')
                {
                  c = *lp++;
-                 incomm = FALSE;
+                 incomm = false;
                }
              break;
            case '\0':
@@ -3108,7 +3078,7 @@ C_entries (int c_ext, FILE *inf)
          switch (c)
            {
            case '"':
-             inquote = FALSE;
+             inquote = false;
              break;
            case '\0':
              /* Newlines inside strings do not end macro definitions
@@ -3128,7 +3098,7 @@ C_entries (int c_ext, FILE *inf)
              CNL ();
              /* FALLTHRU */
            case '\'':
-             inchar = FALSE;
+             inchar = false;
              break;
            }
          continue;
@@ -3136,7 +3106,7 @@ C_entries (int c_ext, FILE *inf)
       else switch (c)
        {
        case '"':
-         inquote = TRUE;
+         inquote = true;
          if (bracketlev > 0)
            continue;
          if (inattribute)
@@ -3150,26 +3120,26 @@ C_entries (int c_ext, FILE *inf)
            case vignore:
              break;
            default:
-             fvextern = FALSE;
+             fvextern = false;
              fvdef = fvnone;
            }
          continue;
        case '\'':
-         inchar = TRUE;
+         inchar = true;
          if (bracketlev > 0)
            continue;
          if (inattribute)
            break;
          if (fvdef != finlist && fvdef != fignore && fvdef != vignore)
            {
-             fvextern = FALSE;
+             fvextern = false;
              fvdef = fvnone;
            }
          continue;
        case '/':
          if (*lp == '*')
            {
-             incomm = TRUE;
+             incomm = true;
              lp++;
              c = ' ';
              if (bracketlev > 0)
@@ -3185,9 +3155,9 @@ C_entries (int c_ext, FILE *inf)
            {
              /* Entering or exiting rules section in yacc file. */
              lp++;
-             definedef = dnone; fvdef = fvnone; fvextern = FALSE;
+             definedef = dnone; fvdef = fvnone; fvextern = false;
              typdef = tnone; structdef = snone;
-             midtoken = inquote = inchar = incomm = quotednl = FALSE;
+             midtoken = inquote = inchar = incomm = quotednl = false;
              bracelev = 0;
              yacc_rules = !yacc_rules;
              continue;
@@ -3198,7 +3168,7 @@ C_entries (int c_ext, FILE *inf)
          if (definedef == dnone)
            {
              char *cp;
-             bool cpptoken = TRUE;
+             bool cpptoken = true;
 
              /* Look back on this line.  If all blanks, or nonblanks
                 followed by an end of comment, this is a preprocessor
@@ -3209,10 +3179,10 @@ C_entries (int c_ext, FILE *inf)
                    if (*cp == '*' && cp[1] == '/')
                      {
                        cp++;
-                       cpptoken = TRUE;
+                       cpptoken = true;
                      }
                    else
-                     cpptoken = FALSE;
+                     cpptoken = false;
                  }
              if (cpptoken)
                definedef = dsharpseen;
@@ -3261,7 +3231,7 @@ C_entries (int c_ext, FILE *inf)
                    }
                  else
                    {
-                     bool funorvar = FALSE;
+                     bool funorvar = false;
 
                      if (yacc_rules
                          || consider_token (newlb.buffer + tokoff, toklen, c,
@@ -3280,7 +3250,7 @@ C_entries (int c_ext, FILE *inf)
                              c = *lp++;
                              toklen += lp - oldlp;
                            }
-                         token.named = FALSE;
+                         token.named = false;
                          if (!plainc
                              && nestlev > 0 && definedef == dnone)
                            /* in struct body */
@@ -3291,7 +3261,7 @@ C_entries (int c_ext, FILE *inf)
                              linebuffer_setlen (&token_name, len+qlen+toklen);
                              sprintf (token_name.buffer + len, "%s%.*s",
                                       qualifier, toklen, newlb.buffer + tokoff);
-                             token.named = TRUE;
+                             token.named = true;
                            }
                          else if (objdef == ocatseen)
                            /* Objective C category */
@@ -3300,13 +3270,13 @@ C_entries (int c_ext, FILE *inf)
                              linebuffer_setlen (&token_name, len);
                              sprintf (token_name.buffer, "%s(%.*s)",
                                       objtag, toklen, newlb.buffer + tokoff);
-                             token.named = TRUE;
+                             token.named = true;
                            }
                          else if (objdef == omethodtag
                                   || objdef == omethodparm)
                            /* Objective C method */
                            {
-                             token.named = TRUE;
+                             token.named = true;
                            }
                          else if (fvdef == fdefunname)
                            /* GNU DEFUN and similar macros */
@@ -3354,7 +3324,7 @@ C_entries (int c_ext, FILE *inf)
                          token.length = toklen;
                          token.line = newlb.buffer;
                          token.linepos = newlinepos;
-                         token.valid = TRUE;
+                         token.valid = true;
 
                          if (definedef == dnone
                              && (fvdef == fvnameseen
@@ -3382,7 +3352,7 @@ C_entries (int c_ext, FILE *inf)
                              fvdef = fvnone;
                            }
                        }
-                     midtoken = FALSE;
+                     midtoken = false;
                    }
                } /* if (endtoken (c)) */
              else if (intoken (c))
@@ -3408,7 +3378,7 @@ C_entries (int c_ext, FILE *inf)
                    case flistseen:
                      if (plainc || declarations)
                        {
-                         make_C_tag (TRUE); /* a function */
+                         make_C_tag (true); /* a function */
                          fvdef = fignore;
                        }
                      break;
@@ -3427,7 +3397,7 @@ C_entries (int c_ext, FILE *inf)
                {
                  tokoff = lp - 1 - newlb.buffer;
                  toklen = 1;
-                 midtoken = TRUE;
+                 midtoken = true;
                }
              continue;
            } /* if (begtoken) */
@@ -3443,7 +3413,7 @@ C_entries (int c_ext, FILE *inf)
            break;
          if (yacc_rules && token.offset == 0 && token.valid)
            {
-             make_C_tag (FALSE); /* a yacc function */
+             make_C_tag (false); /* a yacc function */
              break;
            }
          if (definedef != dnone)
@@ -3452,13 +3422,14 @@ C_entries (int c_ext, FILE *inf)
            {
            case  otagseen:
              objdef = oignore;
-             make_C_tag (TRUE); /* an Objective C class */
+             make_C_tag (true); /* an Objective C class */
              break;
            case omethodtag:
            case omethodparm:
              objdef = omethodcolon;
-             linebuffer_setlen (&token_name, token_name.len + 1);
-             strcat (token_name.buffer, ":");
+             int toklen = token_name.len;
+             linebuffer_setlen (&token_name, toklen + 1);
+             strcpy (token_name.buffer + toklen, ":");
              break;
            }
          if (structdef == stagseen)
@@ -3469,7 +3440,7 @@ C_entries (int c_ext, FILE *inf)
          /* Should be useless, but may be work as a safety net. */
          if (cplpl && fvdef == flistseen)
            {
-             make_C_tag (TRUE); /* a function */
+             make_C_tag (true); /* a function */
              fvdef = fignore;
              break;
            }
@@ -3481,7 +3452,7 @@ C_entries (int c_ext, FILE *inf)
            {
            case tend:
            case ttypeseen:
-             make_C_tag (FALSE); /* a typedef */
+             make_C_tag (false); /* a typedef */
              typdef = tnone;
              fvdef = fvnone;
              break;
@@ -3497,10 +3468,10 @@ C_entries (int c_ext, FILE *inf)
                case fvnameseen:
                  if ((globals && bracelev == 0 && (!fvextern || declarations))
                      || (members && instruct))
-                   make_C_tag (FALSE); /* a variable */
-                 fvextern = FALSE;
+                   make_C_tag (false); /* a variable */
+                 fvextern = false;
                  fvdef = fvnone;
-                 token.valid = FALSE;
+                 token.valid = false;
                  break;
                case flistseen:
                  if ((declarations
@@ -3508,16 +3479,16 @@ C_entries (int c_ext, FILE *inf)
                       && (typdef == tnone || (typdef != tignore && instruct)))
                      || (members
                          && plainc && instruct))
-                   make_C_tag (TRUE);  /* a function */
+                   make_C_tag (true);  /* a function */
                  /* FALLTHRU */
                default:
-                 fvextern = FALSE;
+                 fvextern = false;
                  fvdef = fvnone;
                  if (declarations
                       && cplpl && structdef == stagseen)
-                   make_C_tag (FALSE); /* forward declaration */
+                   make_C_tag (false); /* forward declaration */
                  else
-                   token.valid = FALSE;
+                   token.valid = false;
                } /* switch (fvdef) */
              /* FALLTHRU */
            default:
@@ -3534,7 +3505,7 @@ C_entries (int c_ext, FILE *inf)
            {
            case omethodtag:
            case omethodparm:
-             make_C_tag (TRUE); /* an Objective C method */
+             make_C_tag (true); /* an Objective C method */
              objdef = oinbody;
              break;
            }
@@ -3557,18 +3528,18 @@ C_entries (int c_ext, FILE *inf)
                       && templatelev == 0
                       && (!fvextern || declarations))
                      || (members && instruct)))
-                 make_C_tag (FALSE); /* a variable */
+                 make_C_tag (false); /* a variable */
              break;
            case flistseen:
              if ((declarations && typdef == tnone && !instruct)
                  || (members && typdef != tignore && instruct))
                {
-                 make_C_tag (TRUE); /* a function */
+                 make_C_tag (true); /* a function */
                  fvdef = fvnameseen;
                }
              else if (!declarations)
                fvdef = fvnone;
-             token.valid = FALSE;
+             token.valid = false;
              break;
            default:
              fvdef = fvnone;
@@ -3586,7 +3557,7 @@ C_entries (int c_ext, FILE *inf)
            case ttypeseen:
            case tend:
              typdef = tignore;
-             make_C_tag (FALSE);       /* a typedef */
+             make_C_tag (false);       /* a typedef */
              break;
            case tnone:
            case tinbody:
@@ -3601,7 +3572,7 @@ C_entries (int c_ext, FILE *inf)
                  if ((members && bracelev == 1)
                      || (globals && bracelev == 0
                          && (!fvextern || declarations)))
-                   make_C_tag (FALSE); /* a variable */
+                   make_C_tag (false); /* a variable */
                  /* FALLTHRU */
                default:
                  fvdef = fvnone;
@@ -3628,7 +3599,7 @@ C_entries (int c_ext, FILE *inf)
                {
                  /* This handles constructs like:
                     typedef void OperatorFun (int fun); */
-                 make_C_tag (FALSE);
+                 make_C_tag (false);
                  typdef = tignore;
                  fvdef = fignore;
                  break;
@@ -3647,14 +3618,14 @@ C_entries (int c_ext, FILE *inf)
          if (inattribute)
            {
              if (--attrparlev == 0)
-               inattribute = FALSE;
+               inattribute = false;
              break;
            }
          if (definedef != dnone)
            break;
          if (objdef == ocatseen && parlev == 1)
            {
-             make_C_tag (TRUE); /* an Objective C category */
+             make_C_tag (true); /* an Objective C category */
              objdef = oignore;
            }
          if (--parlev == 0)
@@ -3671,7 +3642,7 @@ C_entries (int c_ext, FILE *inf)
                      || typdef == ttypeseen))
                {
                  typdef = tignore;
-                 make_C_tag (FALSE); /* a typedef */
+                 make_C_tag (false); /* a typedef */
                }
            }
          else if (parlev < 0)  /* can happen due to ill-conceived #if's. */
@@ -3690,7 +3661,7 @@ C_entries (int c_ext, FILE *inf)
          switch (fvdef)
            {
            case flistseen:
-             make_C_tag (TRUE);    /* a function */
+             make_C_tag (true);    /* a function */
              /* FALLTHRU */
            case fignore:
              fvdef = fvnone;
@@ -3699,12 +3670,12 @@ C_entries (int c_ext, FILE *inf)
              switch (objdef)
                {
                case otagseen:
-                 make_C_tag (TRUE); /* an Objective C class */
+                 make_C_tag (true); /* an Objective C class */
                  objdef = oignore;
                  break;
                case omethodtag:
                case omethodparm:
-                 make_C_tag (TRUE); /* an Objective C method */
+                 make_C_tag (true); /* an Objective C method */
                  objdef = oinbody;
                  break;
                default:
@@ -3725,7 +3696,7 @@ C_entries (int c_ext, FILE *inf)
            case scolonseen:       /* a class */
              pushclass_above (bracelev,token.line+token.offset, token.length);
              structdef = snone;
-             make_C_tag (FALSE);  /* a struct or enum */
+             make_C_tag (false);  /* a struct or enum */
              break;
            }
          bracelev += 1;
@@ -3736,7 +3707,7 @@ C_entries (int c_ext, FILE *inf)
          if (fvdef == fstartlist)
            {
              fvdef = fvnone;   /* avoid tagging `foo' in `foo (*bar()) ()' */
-             token.valid = FALSE;
+             token.valid = false;
            }
          break;
        case '}':
@@ -3746,13 +3717,13 @@ C_entries (int c_ext, FILE *inf)
          if (!ignoreindent && lp == newlb.buffer + 1)
            {
              if (bracelev != 0)
-               token.valid = FALSE; /* unexpected value, token unreliable */
+               token.valid = false; /* unexpected value, token unreliable */
              bracelev = 0;     /* reset brace level if first column */
              parlev = 0;       /* also reset paren level, just in case... */
            }
          else if (bracelev < 0)
            {
-             token.valid = FALSE; /* something gone amiss, token unreliable */
+             token.valid = false; /* something gone amiss, token unreliable */
              bracelev = 0;
            }
          if (bracelev == 0 && fvdef == vignore)
@@ -3779,7 +3750,7 @@ C_entries (int c_ext, FILE *inf)
            case fvnameseen:
              if ((members && bracelev == 1)
                  || (globals && bracelev == 0 && (!fvextern || declarations)))
-               make_C_tag (FALSE); /* a variable */
+               make_C_tag (false); /* a variable */
              /* FALLTHRU */
            default:
              fvdef = vignore;
@@ -3828,7 +3799,7 @@ C_entries (int c_ext, FILE *inf)
        case '\0':
          if (objdef == otagseen)
            {
-             make_C_tag (TRUE); /* an Objective C class */
+             make_C_tag (true); /* an Objective C class */
              objdef = oignore;
            }
          /* If a macro spans multiple lines don't reset its state. */
@@ -3898,18 +3869,18 @@ Yacc_entries (FILE *inf)
        &&                      /* instructions at start of loop */     \
          (readline (&line_buffer, file_pointer),                       \
            char_pointer = line_buffer.buffer,                          \
-          TRUE);                                                       \
+          true);                                                       \
       )
 
 #define LOOKING_AT(cp, kw)  /* kw is the keyword, a literal string */  \
-  ((assert ("" kw), TRUE)   /* syntax error if not a literal string */ \
+  ((assert ("" kw), true)   /* syntax error if not a literal string */ \
    && strneq ((cp), kw, sizeof (kw)-1)         /* cp points at kw */   \
    && notinname ((cp)[sizeof (kw)-1])          /* end of kw */         \
    && ((cp) = skip_spaces ((cp)+sizeof (kw)-1))) /* skip spaces */
 
 /* Similar to LOOKING_AT but does not use notinname, does not skip */
 #define LOOKING_AT_NOCASE(cp, kw) /* the keyword is a literal string */        \
-  ((assert ("" kw), TRUE) /* syntax error if not a literal string */   \
+  ((assert ("" kw), true) /* syntax error if not a literal string */   \
    && strncaseeq ((cp), kw, sizeof (kw)-1)     /* cp points at kw */   \
    && ((cp) += sizeof (kw)-1))                 /* skip spaces */
 
@@ -3972,7 +3943,7 @@ F_getit (FILE *inf)
     return;
   for (cp = dbp + 1; *cp != '\0' && intoken (*cp); cp++)
     continue;
-  make_tag (dbp, cp-dbp, TRUE,
+  make_tag (dbp, cp-dbp, true,
            lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
 }
 
@@ -4049,7 +4020,7 @@ Fortran_functions (FILE *inf)
            {
              dbp = skip_spaces (dbp);
              if (*dbp == '\0') /* assume un-named */
-               make_tag ("blockdata", 9, TRUE,
+               make_tag ("blockdata", 9, true,
                          lb.buffer, dbp - lb.buffer, lineno, linecharno);
              else
                F_getit (inf);  /* look for name */
@@ -4122,7 +4093,7 @@ Ada_getit (FILE *inf, const char *name_qualifier)
       *cp = '\0';
       name = concat (dbp, name_qualifier, "");
       *cp = c;
-      make_tag (name, strlen (name), TRUE,
+      make_tag (name, strlen (name), true,
                lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
       free (name);
       if (c == '"')
@@ -4134,8 +4105,8 @@ Ada_getit (FILE *inf, const char *name_qualifier)
 static void
 Ada_funcs (FILE *inf)
 {
-  bool inquote = FALSE;
-  bool skip_till_semicolumn = FALSE;
+  bool inquote = false;
+  bool skip_till_semicolumn = false;
 
   LOOP_ON_INPUT_LINES (inf, lb, dbp)
     {
@@ -4144,16 +4115,16 @@ Ada_funcs (FILE *inf)
          /* Skip a string i.e. "abcd". */
          if (inquote || (*dbp == '"'))
            {
-             dbp = etags_strchr (dbp + !inquote, '"');
+             dbp = strchr (dbp + !inquote, '"');
              if (dbp != NULL)
                {
-                 inquote = FALSE;
+                 inquote = false;
                  dbp += 1;
                  continue;     /* advance char */
                }
              else
                {
-                 inquote = TRUE;
+                 inquote = true;
                  break;        /* advance line */
                }
            }
@@ -4175,7 +4146,7 @@ Ada_funcs (FILE *inf)
          if (skip_till_semicolumn)
            {
              if (*dbp == ';')
-               skip_till_semicolumn = FALSE;
+               skip_till_semicolumn = false;
              dbp++;
              continue;         /* advance char */
            }
@@ -4212,7 +4183,7 @@ Ada_funcs (FILE *inf)
                {
                  /* when tagging types, avoid tagging  use type Pack.Typename;
                     for this, we will skip everything till a ; */
-                 skip_till_semicolumn = TRUE;
+                 skip_till_semicolumn = true;
                  continue;     /* advance char */
                }
 
@@ -4261,7 +4232,7 @@ Asm_labels (FILE *inf)
            cp++;
          if (*cp == ':' || iswhite (*cp))
            /* Found end of label, so copy it and add it to the table. */
-           make_tag (lb.buffer, cp - lb.buffer, TRUE,
+           make_tag (lb.buffer, cp - lb.buffer, true,
                      lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
        }
     }
@@ -4302,10 +4273,10 @@ Perl_functions (FILE *inf)
            cp++;
          if (cp == sp)
            continue;           /* nothing found */
-         if ((pos = etags_strchr (sp, ':')) != NULL
+         if ((pos = strchr (sp, ':')) != NULL
              && pos < cp && pos[1] == ':')
            /* The name is already qualified. */
-           make_tag (sp, cp - sp, TRUE,
+           make_tag (sp, cp - sp, true,
                      lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
          else
            /* Qualify it. */
@@ -4316,7 +4287,7 @@ Perl_functions (FILE *inf)
              *cp = '\0';
              name = concat (package, "::", sp);
              *cp = savechar;
-             make_tag (name, strlen (name), TRUE,
+             make_tag (name, strlen (name), true,
                        lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
              free (name);
            }
@@ -4359,7 +4330,7 @@ Perl_functions (FILE *inf)
          else
            continue;
 
-         make_tag (varstart, cp - varstart, FALSE,
+         make_tag (varstart, cp - varstart, false,
                    lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
        }
     }
@@ -4386,7 +4357,7 @@ Python_functions (FILE *inf)
          char *name = cp;
          while (!notinname (*cp) && *cp != ':')
            cp++;
-         make_tag (name, cp - name, TRUE,
+         make_tag (name, cp - name, true,
                    lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
        }
     }
@@ -4406,8 +4377,8 @@ Python_functions (FILE *inf)
 static void
 PHP_functions (FILE *inf)
 {
-  register char *cp, *name;
-  bool search_identifier = FALSE;
+  char *cp, *name;
+  bool search_identifier = false;
 
   LOOP_ON_INPUT_LINES (inf, lb, cp)
     {
@@ -4418,9 +4389,9 @@ PHP_functions (FILE *inf)
        {
          while (!notinname (*cp))
            cp++;
-         make_tag (name, cp - name, TRUE,
+         make_tag (name, cp - name, true,
                    lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
-         search_identifier = FALSE;
+         search_identifier = false;
        }
       else if (LOOKING_AT (cp, "function"))
        {
@@ -4431,11 +4402,11 @@ PHP_functions (FILE *inf)
              name = cp;
              while (!notinname (*cp))
                cp++;
-             make_tag (name, cp - name, TRUE,
+             make_tag (name, cp - name, true,
                        lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
            }
          else
-           search_identifier = TRUE;
+           search_identifier = true;
        }
       else if (LOOKING_AT (cp, "class"))
        {
@@ -4444,11 +4415,11 @@ PHP_functions (FILE *inf)
              name = cp;
              while (*cp != '\0' && !iswhite (*cp))
                cp++;
-             make_tag (name, cp - name, FALSE,
+             make_tag (name, cp - name, false,
                        lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
            }
          else
-           search_identifier = TRUE;
+           search_identifier = true;
        }
       else if (strneq (cp, "define", 6)
               && (cp = skip_spaces (cp+6))
@@ -4459,7 +4430,7 @@ PHP_functions (FILE *inf)
          name = cp;
          while (*cp != quote && *cp != '\0')
            cp++;
-         make_tag (name, cp - name, FALSE,
+         make_tag (name, cp - name, false,
                    lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
        }
       else if (members
@@ -4469,7 +4440,7 @@ PHP_functions (FILE *inf)
          name = cp;
          while (!notinname (*cp))
            cp++;
-         make_tag (name, cp - name, FALSE,
+         make_tag (name, cp - name, false,
                    lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
        }
     }
@@ -4500,7 +4471,7 @@ Cobol_paragraphs (FILE *inf)
       for (ep = bp; ISALNUM (*ep) || *ep == '-'; ep++)
        continue;
       if (*ep++ == '.')
-       make_tag (bp, ep - bp, TRUE,
+       make_tag (bp, ep - bp, true,
                  lb.buffer, ep - lb.buffer + 1, lineno, linecharno);
     }
 }
@@ -4529,7 +4500,7 @@ Makefile_targets (FILE *inf)
          while (--bp > namestart)
            if (!notinname (*bp))
              break;
-         make_tag (namestart, bp - namestart + 1, TRUE,
+         make_tag (namestart, bp - namestart + 1, true,
                    lb.buffer, bp - lb.buffer + 2, lineno, linecharno);
        }
     }
@@ -4553,7 +4524,7 @@ Pascal_functions (FILE *inf)
   int save_lineno, namelen, taglen;
   char c, *name;
 
-  bool                         /* each of these flags is TRUE if: */
+  bool                         /* each of these flags is true if: */
     incomment,                 /* point is inside a comment */
     inquote,                   /* point is inside '..' string */
     get_tagname,               /* point is after PROCEDURE/FUNCTION
@@ -4571,11 +4542,11 @@ Pascal_functions (FILE *inf)
   *dbp = '\0';
   linebuffer_init (&tline);
 
-  incomment = inquote = FALSE;
-  found_tag = FALSE;           /* have a proc name; check if extern */
-  get_tagname = FALSE;         /* found "procedure" keyword         */
-  inparms = FALSE;             /* found '(' after "proc"            */
-  verify_tag = FALSE;          /* check if "extern" is ahead        */
+  incomment = inquote = false;
+  found_tag = false;           /* have a proc name; check if extern */
+  get_tagname = false;         /* found "procedure" keyword         */
+  inparms = false;             /* found '(' after "proc"            */
+  verify_tag = false;          /* check if "extern" is ahead        */
 
 
   while (!feof (inf))          /* long main loop to get next char */
@@ -4596,46 +4567,46 @@ Pascal_functions (FILE *inf)
       if (incomment)
        {
          if (c == '}')         /* within { } comments */
-           incomment = FALSE;
+           incomment = false;
          else if (c == '*' && *dbp == ')') /* within (* *) comments */
            {
              dbp++;
-             incomment = FALSE;
+             incomment = false;
            }
          continue;
        }
       else if (inquote)
        {
          if (c == '\'')
-           inquote = FALSE;
+           inquote = false;
          continue;
        }
       else
        switch (c)
          {
          case '\'':
-           inquote = TRUE;     /* found first quote */
+           inquote = true;     /* found first quote */
            continue;
          case '{':             /* found open { comment */
-           incomment = TRUE;
+           incomment = true;
            continue;
          case '(':
            if (*dbp == '*')    /* found open (* comment */
              {
-               incomment = TRUE;
+               incomment = true;
                dbp++;
              }
            else if (found_tag) /* found '(' after tag, i.e., parm-list */
-             inparms = TRUE;
+             inparms = true;
            continue;
          case ')':             /* end of parms list */
            if (inparms)
-             inparms = FALSE;
+             inparms = false;
            continue;
          case ';':
            if (found_tag && !inparms) /* end of proc or fn stmt */
              {
-               verify_tag = TRUE;
+               verify_tag = true;
                break;
              }
            continue;
@@ -4649,23 +4620,23 @@ Pascal_functions (FILE *inf)
            {
              if (nocase_tail ("extern")) /* superfluous, really! */
                {
-                 found_tag = FALSE;
-                 verify_tag = FALSE;
+                 found_tag = false;
+                 verify_tag = false;
                }
            }
          else if (lowcase (*dbp) == 'f')
            {
              if (nocase_tail ("forward")) /* check for forward reference */
                {
-                 found_tag = FALSE;
-                 verify_tag = FALSE;
+                 found_tag = false;
+                 verify_tag = false;
                }
            }
          if (found_tag && verify_tag) /* not external proc, so make tag */
            {
-             found_tag = FALSE;
-             verify_tag = FALSE;
-             make_tag (name, namelen, TRUE,
+             found_tag = false;
+             verify_tag = false;
+             make_tag (name, namelen, true,
                        tline.buffer, taglen, save_lineno, save_lcno);
              continue;
            }
@@ -4691,8 +4662,8 @@ Pascal_functions (FILE *inf)
          taglen = cp - lb.buffer + 1;
 
          dbp = cp;             /* set dbp to e-o-token */
-         get_tagname = FALSE;
-         found_tag = TRUE;
+         get_tagname = false;
+         found_tag = true;
          continue;
 
          /* And proceed to check for "extern". */
@@ -4704,11 +4675,11 @@ Pascal_functions (FILE *inf)
            {
            case 'p':
              if (nocase_tail ("rocedure")) /* c = 'p', dbp has advanced */
-               get_tagname = TRUE;
+               get_tagname = true;
              continue;
            case 'f':
              if (nocase_tail ("unction"))
-               get_tagname = TRUE;
+               get_tagname = true;
              continue;
            }
        }
@@ -4762,6 +4733,9 @@ Lisp_functions (FILE *inf)
            }
        }
 
+      if (strneq (dbp + 1, "cl-", 3) || strneq (dbp + 1, "CL-", 3))
+       dbp += 3;
+
       if (strneq (dbp+1, "def", 3) || strneq (dbp+1, "DEF", 3))
        {
          dbp = skip_non_spaces (dbp);
@@ -4837,7 +4811,7 @@ PS_functions (FILE *inf)
               *ep != '\0' && *ep != ' ' && *ep != '{';
               ep++)
            continue;
-         make_tag (bp, ep - bp, TRUE,
+         make_tag (bp, ep - bp, true,
                    lb.buffer, ep - lb.buffer + 1, lineno, linecharno);
        }
       else if (LOOKING_AT (bp, "defineps"))
@@ -4967,14 +4941,14 @@ TeX_commands (FILE *inf)
          for (key = TEX_toktab; key->buffer != NULL; key++)
            if (strneq (cp, key->buffer, key->len))
              {
-               register char *p;
+               char *p;
                int namelen, linelen;
-               bool opgrp = FALSE;
+               bool opgrp = false;
 
                cp = skip_spaces (cp + key->len);
                if (*cp == TEX_opgrp)
                  {
-                   opgrp = TRUE;
+                   opgrp = true;
                    cp++;
                  }
                for (p = cp;
@@ -4990,7 +4964,7 @@ TeX_commands (FILE *inf)
                      p++;
                    linelen = p - lb.buffer + 1;
                  }
-               make_tag (cp, namelen, TRUE,
+               make_tag (cp, namelen, true,
                          lb.buffer, linelen, lineno, linecharno);
                goto tex_next_line; /* We only tag a line once */
              }
@@ -5054,7 +5028,7 @@ TEX_decode_env (const char *evarname, const char *defenv)
 
   /* Allocate a token table */
   for (len = 1, p = env; p;)
-    if ((p = etags_strchr (p, ':')) && *++p != '\0')
+    if ((p = strchr (p, ':')) && *++p != '\0')
       len++;
   TEX_toktab = xnew (len, linebuffer);
 
@@ -5062,7 +5036,7 @@ TEX_decode_env (const char *evarname, const char *defenv)
   /* zero-length strings (leading ':', "::" and trailing ':') */
   for (i = 0; *env != '\0';)
     {
-      p = etags_strchr (env, ':');
+      p = strchr (env, ':');
       if (!p)                  /* End of environment string. */
        p = env + strlen (env);
       if (p - env > 0)
@@ -5094,7 +5068,7 @@ Texinfo_nodes (FILE *inf)
        start = cp;
        while (*cp != '\0' && *cp != ',')
          cp++;
-       make_tag (start, cp - start, TRUE,
+       make_tag (start, cp - start, true,
                  lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
       }
 }
@@ -5110,10 +5084,10 @@ Texinfo_nodes (FILE *inf)
 static void
 HTML_labels (FILE *inf)
 {
-  bool getnext = FALSE;                /* next text outside of HTML tags is a tag */
-  bool skiptag = FALSE;                /* skip to the end of the current HTML tag */
-  bool intag = FALSE;          /* inside an html tag, looking for ID= */
-  bool inanchor = FALSE;       /* when INTAG, is an anchor, look for NAME= */
+  bool getnext = false;                /* next text outside of HTML tags is a tag */
+  bool skiptag = false;                /* skip to the end of the current HTML tag */
+  bool intag = false;          /* inside an html tag, looking for ID= */
+  bool inanchor = false;       /* when INTAG, is an anchor, look for NAME= */
   char *end;
 
 
@@ -5129,7 +5103,7 @@ HTML_labels (FILE *inf)
            if (*dbp == '>')
              {
                dbp += 1;
-               skiptag = FALSE;
+               skiptag = false;
                continue;       /* look on the same line */
              }
            break;              /* go to next line */
@@ -5145,7 +5119,7 @@ HTML_labels (FILE *inf)
            if (*dbp == '>')
              {
                dbp += 1;
-               intag = FALSE;
+               intag = false;
                continue;       /* look on the same line */
              }
            if ((inanchor && LOOKING_AT_NOCASE (dbp, "name="))
@@ -5164,9 +5138,9 @@ HTML_labels (FILE *inf)
                token_name.buffer[end - dbp] = '\0';
 
                dbp = end;
-               intag = FALSE;  /* we found what we looked for */
-               skiptag = TRUE; /* skip to the end of the tag */
-               getnext = TRUE; /* then grab the text */
+               intag = false;  /* we found what we looked for */
+               skiptag = true; /* skip to the end of the tag */
+               getnext = true; /* then grab the text */
                continue;       /* look on the same line */
              }
            dbp += 1;
@@ -5179,17 +5153,17 @@ HTML_labels (FILE *inf)
              break;            /* go to next line */
            if (*dbp == '<')
              {
-               intag = TRUE;
+               intag = true;
                inanchor = (lowcase (dbp[1]) == 'a' && !intoken (dbp[2]));
                continue;       /* look on the same line */
              }
 
            for (end = dbp + 1; *end != '\0' && *end != '<'; end++)
              continue;
-           make_tag (token_name.buffer, token_name.len, TRUE,
+           make_tag (token_name.buffer, token_name.len, true,
                      dbp, end - dbp, lineno, linecharno);
            linebuffer_setlen (&token_name, 0); /* no name in buffer */
-           getnext = FALSE;
+           getnext = false;
            break;              /* go to next line */
          }
 
@@ -5199,10 +5173,10 @@ HTML_labels (FILE *inf)
              dbp++;
            if (*dbp == '\0')
              break;            /* go to next line */
-           intag = TRUE;
+           intag = true;
            if (lowcase (dbp[1]) == 'a' && !intoken (dbp[2]))
              {
-               inanchor = TRUE;
+               inanchor = true;
                continue;       /* look on the same line */
              }
            else if (LOOKING_AT_NOCASE (dbp, "<title>")
@@ -5210,8 +5184,8 @@ HTML_labels (FILE *inf)
                     || LOOKING_AT_NOCASE (dbp, "<h2>")
                     || LOOKING_AT_NOCASE (dbp, "<h3>"))
              {
-               intag = FALSE;
-               getnext = TRUE;
+               intag = false;
+               getnext = true;
                continue;       /* look on the same line */
              }
            dbp += 1;
@@ -5316,7 +5290,7 @@ prolog_pr (char *s, char *last)
          || len != strlen (last)
          || !strneq (s, last, len)))
        {
-         make_tag (s, len, TRUE, s, pos, lineno, linecharno);
+         make_tag (s, len, true, s, pos, lineno, linecharno);
          return len;
        }
   else
@@ -5472,7 +5446,7 @@ erlang_func (char *s, char *last)
          || len != (int)strlen (last)
          || !strneq (s, last, len)))
        {
-         make_tag (s, len, TRUE, s, pos, lineno, linecharno);
+         make_tag (s, len, true, s, pos, lineno, linecharno);
          return len;
        }
 
@@ -5499,7 +5473,7 @@ erlang_attribute (char *s)
     {
       int len = erlang_atom (skip_spaces (cp));
       if (len > 0)
-       make_tag (cp, len, TRUE, s, cp + len - s, lineno, linecharno);
+       make_tag (cp, len, true, s, cp + len - s, lineno, linecharno);
     }
   return;
 }
@@ -5552,7 +5526,7 @@ scan_separators (char *name)
 {
   char sep = name[0];
   char *copyto = name;
-  bool quoted = FALSE;
+  bool quoted = false;
 
   for (++name; *name != '\0'; ++name)
     {
@@ -5580,10 +5554,10 @@ scan_separators (char *name)
                }
              break;
            }
-         quoted = FALSE;
+         quoted = false;
        }
       else if (*name == '\\')
-       quoted = TRUE;
+       quoted = true;
       else if (*name == sep)
        break;
       else
@@ -5600,7 +5574,7 @@ scan_separators (char *name)
 /* Look at the argument of --regex or --no-regex and do the right
    thing.  Same for each line of a regexp file. */
 static void
-analyse_regex (char *regex_arg)
+analyze_regex (char *regex_arg)
 {
   if (regex_arg == NULL)
     {
@@ -5626,12 +5600,12 @@ analyse_regex (char *regex_arg)
        char *regexfile = regex_arg + 1;
 
        /* regexfile is a file containing regexps, one per line. */
-       regexfp = fopen (regexfile, "r");
+       regexfp = fopen (regexfile, "rb");
        if (regexfp == NULL)
          pfatal (regexfile);
        linebuffer_init (&regexbuf);
        while (readline_internal (&regexbuf, regexfp) > 0)
-         analyse_regex (regexbuf.buffer);
+         analyze_regex (regexbuf.buffer);
        free (regexbuf.buffer);
        fclose (regexfp);
       }
@@ -5677,10 +5651,10 @@ add_regex (char *regexp_pattern, language *lang)
   struct re_pattern_buffer *patbuf;
   regexp *rp;
   bool
-    force_explicit_name = TRUE, /* do not use implicit tag names */
-    ignore_case = FALSE,       /* case is significant */
-    multi_line = FALSE,                /* matches are done one line at a time */
-    single_line = FALSE;       /* dot does not match newline */
+    force_explicit_name = true, /* do not use implicit tag names */
+    ignore_case = false,       /* case is significant */
+    multi_line = false,                /* matches are done one line at a time */
+    single_line = false;       /* dot does not match newline */
 
 
   if (strlen (regexp_pattern) < 3)
@@ -5716,17 +5690,17 @@ add_regex (char *regexp_pattern, language *lang)
       case 'N':
        if (modifiers == name)
          error ("forcing explicit tag name but no name, ignoring");
-       force_explicit_name = TRUE;
+       force_explicit_name = true;
        break;
       case 'i':
-       ignore_case = TRUE;
+       ignore_case = true;
        break;
       case 's':
-       single_line = TRUE;
+       single_line = true;
        /* FALLTHRU */
       case 'm':
-       multi_line = TRUE;
-       need_filebuf = TRUE;
+       multi_line = true;
+       need_filebuf = true;
        break;
       default:
        error ("invalid regexp modifier `%c', ignoring", modifiers[0]);
@@ -5770,7 +5744,7 @@ add_regex (char *regexp_pattern, language *lang)
   p_head->lang = lang;
   p_head->pat = patbuf;
   p_head->name = savestr (name);
-  p_head->error_signaled = FALSE;
+  p_head->error_signaled = false;
   p_head->force_explicit_name = force_explicit_name;
   p_head->ignore_case = ignore_case;
   p_head->multi_line = multi_line;
@@ -5792,9 +5766,9 @@ substitute (char *in, char *out, struct re_registers *regs)
   /* Pass 1: figure out how much to allocate by finding all \N strings. */
   if (out[size - 1] == '\\')
     fatal ("pattern error in \"%s\"", out);
-  for (t = etags_strchr (out, '\\');
+  for (t = strchr (out, '\\');
        t != NULL;
-       t = etags_strchr (t + 2, '\\'))
+       t = strchr (t + 2, '\\'))
     if (ISDIGIT (t[1]))
       {
        dig = t[1] - '0';
@@ -5884,7 +5858,7 @@ regex_tag_multiline (void)
                {
                  error ("regexp stack overflow while matching \"%s\"",
                         rp->pattern);
-                 rp->error_signaled = TRUE;
+                 rp->error_signaled = true;
                }
              break;
            case -1:
@@ -5897,7 +5871,7 @@ regex_tag_multiline (void)
                    {
                      error ("regexp matches the empty string: \"%s\"",
                             rp->pattern);
-                     rp->error_signaled = TRUE;
+                     rp->error_signaled = true;
                    }
                  match = -3;   /* exit from while loop */
                  break;
@@ -5914,10 +5888,10 @@ regex_tag_multiline (void)
                name = substitute (buffer, rp->name, &rp->regs);
              if (rp->force_explicit_name)
                /* Force explicit tag name, if a name is there. */
-               pfnote (name, TRUE, buffer + linecharno,
+               pfnote (name, true, buffer + linecharno,
                        charno - linecharno + 1, lineno, linecharno);
              else
-               make_tag (name, strlen (name), TRUE, buffer + linecharno,
+               make_tag (name, strlen (name), true, buffer + linecharno,
                          charno - linecharno + 1, lineno, linecharno);
              break;
            }
@@ -5936,9 +5910,9 @@ nocase_tail (const char *cp)
   if (*cp == '\0' && !intoken (dbp[len]))
     {
       dbp += len;
-      return TRUE;
+      return true;
     }
-  return FALSE;
+  return false;
 }
 
 static void
@@ -5951,7 +5925,7 @@ get_tag (register char *bp, char **namepp)
       /* Go till you get to white space or a syntactic break */
       for (cp = bp + 1; !notinname (*cp); cp++)
        continue;
-      make_tag (bp, cp - bp, TRUE,
+      make_tag (bp, cp - bp, true,
                lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
     }
 
@@ -6076,7 +6050,7 @@ readline (linebuffer *lbp, FILE *stream)
            {
              char *endp = lbp->buffer + start;
 
-             while ((endp = etags_strchr (endp, '"')) != NULL
+             while ((endp = strchr (endp, '"')) != NULL
                     && endp[-1] == '\\')
                endp++;
              if (endp != NULL)
@@ -6086,7 +6060,7 @@ readline (linebuffer *lbp, FILE *stream)
                  char *taggedfname;    /* name of original file as given */
                  char *name;           /* temp var */
 
-                 discard_until_line_directive = FALSE; /* found it */
+                 discard_until_line_directive = false; /* found it */
                  name = lbp->buffer + start;
                  *endp = '\0';
                  canonicalize_filename (name);
@@ -6134,7 +6108,7 @@ readline (linebuffer *lbp, FILE *stream)
                        for (fdp = fdhead; fdp != NULL; fdp = fdp->next)
                          if (streq (fdp->infabsname, taggedabsname))
                            {
-                             discard_until_line_directive = TRUE;
+                             discard_until_line_directive = true;
                              free (taggedfname);
                              break;
                            }
@@ -6150,9 +6124,9 @@ readline (linebuffer *lbp, FILE *stream)
                          fdhead->infabsname = savestr (curfdp->infabsname);
                          fdhead->infabsdir = savestr (curfdp->infabsdir);
                          fdhead->taggedfname = taggedfname;
-                         fdhead->usecharno = FALSE;
+                         fdhead->usecharno = false;
                          fdhead->prop = NULL;
-                         fdhead->written = FALSE;
+                         fdhead->written = false;
                          curfdp = fdhead;
                        }
                    }
@@ -6175,7 +6149,7 @@ readline (linebuffer *lbp, FILE *stream)
              return;
            }
          /* End of file. */
-         discard_until_line_directive = FALSE;
+         discard_until_line_directive = false;
          return;
        }
     } /* if #line directives should be considered */
@@ -6205,7 +6179,7 @@ readline (linebuffer *lbp, FILE *stream)
                {
                  error ("regexp stack overflow while matching \"%s\"",
                         rp->pattern);
-                 rp->error_signaled = TRUE;
+                 rp->error_signaled = true;
                }
              break;
            case -1:
@@ -6216,7 +6190,7 @@ readline (linebuffer *lbp, FILE *stream)
              if (!rp->error_signaled)
                {
                  error ("regexp matches the empty string: \"%s\"", rp->pattern);
-                 rp->error_signaled = TRUE;
+                 rp->error_signaled = true;
                }
              break;
            default:
@@ -6228,9 +6202,9 @@ readline (linebuffer *lbp, FILE *stream)
                name = substitute (lbp->buffer, rp->name, &rp->regs);
              if (rp->force_explicit_name)
                /* Force explicit tag name, if a name is there. */
-               pfnote (name, TRUE, lbp->buffer, match, lineno, linecharno);
+               pfnote (name, true, lbp->buffer, match, lineno, linecharno);
              else
-               make_tag (name, strlen (name), TRUE,
+               make_tag (name, strlen (name), true,
                          lbp->buffer, match, lineno, linecharno);
              break;
            }
@@ -6256,49 +6230,9 @@ savestr (const char *cp)
 static char *
 savenstr (const char *cp, int len)
 {
-  register char *dp;
-
-  dp = xnew (len + 1, char);
-  memcpy (dp, cp, len);
+  char *dp = xnew (len + 1, char);
   dp[len] = '\0';
-  return dp;
-}
-
-/*
- * Return the ptr in sp at which the character c last
- * appears; NULL if not found
- *
- * Identical to POSIX strrchr, included for portability.
- */
-static char *
-etags_strrchr (register const char *sp, register int c)
-{
-  register const char *r;
-
-  r = NULL;
-  do
-    {
-      if (*sp == c)
-       r = sp;
-  } while (*sp++);
-  return (char *)r;
-}
-
-/*
- * Return the ptr in sp at which the character c first
- * appears; NULL if not found
- *
- * Identical to POSIX strchr, included for portability.
- */
-static char *
-etags_strchr (register const char *sp, register int c)
-{
-  do
-    {
-      if (*sp == c)
-       return (char *)sp;
-    } while (*sp++);
-  return NULL;
+  return memcpy (dp, cp, len);
 }
 
 /* Skip spaces (end of string is not space), return new pointer. */
@@ -6375,7 +6309,6 @@ concat (const char *s1, const char *s2, const char *s3)
   strcpy (result, s1);
   strcpy (result + len1, s2);
   strcpy (result + len1 + len2, s3);
-  result[len1 + len2 + len3] = '\0';
 
   return result;
 }
@@ -6427,15 +6360,15 @@ relative_filename (char *file, char *dir)
 
   /* Build a sequence of "../" strings for the resulting relative file name. */
   i = 0;
-  while ((dp = etags_strchr (dp + 1, '/')) != NULL)
+  while ((dp = strchr (dp + 1, '/')) != NULL)
     i += 1;
   res = xnew (3*i + strlen (fp + 1) + 1, char);
-  res[0] = '\0';
+  char *z = res;
   while (i-- > 0)
-    strcat (res, "../");
+    z = stpcpy (z, "../");
 
   /* Add the file name relative to the common root of file and dir. */
-  strcat (res, fp + 1);
+  strcpy (z, fp + 1);
   free (afn);
 
   return res;
@@ -6460,7 +6393,7 @@ absolute_filename (char *file, char *dir)
     res = concat (dir, file, "");
 
   /* Delete the "/dirname/.." and "/." substrings. */
-  slashp = etags_strchr (res, '/');
+  slashp = strchr (res, '/');
   while (slashp != NULL && slashp[0] != '\0')
     {
       if (slashp[1] == '.')
@@ -6492,7 +6425,7 @@ absolute_filename (char *file, char *dir)
            }
        }
 
-      slashp = etags_strchr (slashp + 1, '/');
+      slashp = strchr (slashp + 1, '/');
     }
 
   if (res[0] == '\0')          /* just a safety net: should never happen */
@@ -6513,7 +6446,7 @@ absolute_dirname (char *file, char *dir)
   char *slashp, *res;
   char save;
 
-  slashp = etags_strrchr (file, '/');
+  slashp = strrchr (file, '/');
   if (slashp == NULL)
     return savestr (dir);
   save = slashp[1];