changeset 109744:fdbd24f8d999

Fix warnings produced by compiling with -Wwrite_strings (i.e. use const char *). * b2m.c (concat, fatal): Use const char*. (main): Don't assign labels a string literal. * ebrowse.c (struct member): filename, def_filename is const. (struct sym): filename, sfilename is const. (struct kw): name is const. (add_sym, yyerror, token_string, insert_keyword, main): Use const char*. * emacsclient.c (message, sock_err_message, send_to_emacs) (quote_argument, set_local_socket) (start_daemon_and_retry_set_socket): Use const char*. * etags.c (compressor, language, Ada_suffix, Ada_help, Asm_suffixes) (Asm_help, default_C_suffixes, default_C_help, Cplusplus_suffixes) (Cplusplus_help, Cjava_suffixes, Cobol_suffixes, Cstar_suffixes) (Erlang_suffixes, Erlang_help, Forth_suffixes, Forth_help) (Fortran_suffixes, Fortran_help, HTML_suffixes, HTML_help) (Lisp_suffixes, Lisp_help, Lua_suffixes, Lua_help) (Makefile_filenames, Makefile_help, Objc_suffixes, Objc_help) (Pascal_suffixes, Pascal_help, Perl_suffixes, Perl_interpreters) (Perl_help, PHP_suffixes, PHP_help, plain_C_suffixses, PS_suffixes) (PS_help, Prolog_suffixes, Prolog_help, Python_suffixes, Python_help) (Scheme_suffixes, Scheme_help, TeX_suffixes, TeX_help, Texinfo_suffixes) (Texinfo_help, Yacc_suffixes, Yacc_help, auto_help, none_help) (no_lang_help, print_language_names) (get_language_from_interpreter, get_language_from_filename) (init, make_tag, struct C_stab_entry, write_classname, TEX_defenv) (TEX_decode_env, nocase_tail, savestr, savenstr, fatal, pfatal) (concat): Use const char*. * make-docfile.c (error, fatal, scan_c_file, scan_lisp_file): Use const char *. * movemail.c (fatal, error, concat): Use const char *. * pop.c (pop_multi_first, socket_connection, sendline): Use conat char*. * pop.h (pop_multi_first): Use const char *. (_ARGS): Remove. * sorted-doc.c (error, fatal, states): Use const char *. * update-game-score.c (get_prefix, write_scores, main): Use const char*.
author Jan D <jan.h.d@swipnet.se>
date Wed, 11 Aug 2010 10:20:34 +0200
parents d40bac543314
children b9025d71747a
files lib-src/ChangeLog lib-src/b2m.c lib-src/ebrowse.c lib-src/emacsclient.c lib-src/etags.c lib-src/fakemail.c lib-src/make-docfile.c lib-src/movemail.c lib-src/pop.c lib-src/pop.h lib-src/sorted-doc.c lib-src/update-game-score.c
diffstat 12 files changed, 243 insertions(+), 205 deletions(-) [+]
line wrap: on
line diff
--- a/lib-src/ChangeLog	Tue Aug 10 19:14:53 2010 -0700
+++ b/lib-src/ChangeLog	Wed Aug 11 10:20:34 2010 +0200
@@ -1,3 +1,49 @@
+2010-08-11  Jan Djärv  <jan.h.d@swipnet.se>
+
+	* update-game-score.c (get_prefix, write_scores, main): Use const char*.
+
+	* sorted-doc.c (error, fatal, states): Use const char *.
+
+	* pop.h (pop_multi_first): Use const char *.
+	(_ARGS): Remove.
+
+	* pop.c (pop_multi_first, socket_connection, sendline): Use conat char*.
+
+	* movemail.c (fatal, error, concat): Use const char *.
+
+	* make-docfile.c (error, fatal, scan_c_file, scan_lisp_file): Use
+	const char *.
+
+	* etags.c (compressor, language, Ada_suffix, Ada_help, Asm_suffixes)
+	(Asm_help, default_C_suffixes, default_C_help, Cplusplus_suffixes)
+	(Cplusplus_help, Cjava_suffixes, Cobol_suffixes, Cstar_suffixes)
+	(Erlang_suffixes, Erlang_help, Forth_suffixes, Forth_help)
+	(Fortran_suffixes, Fortran_help, HTML_suffixes,  HTML_help)
+	(Lisp_suffixes, Lisp_help, Lua_suffixes, Lua_help)
+	(Makefile_filenames, Makefile_help, Objc_suffixes, Objc_help)
+	(Pascal_suffixes, Pascal_help, Perl_suffixes, Perl_interpreters)
+	(Perl_help, PHP_suffixes, PHP_help, plain_C_suffixses, PS_suffixes)
+	(PS_help, Prolog_suffixes, Prolog_help, Python_suffixes, Python_help)
+	(Scheme_suffixes, Scheme_help, TeX_suffixes, TeX_help, Texinfo_suffixes)
+	(Texinfo_help, Yacc_suffixes, Yacc_help, auto_help, none_help)
+	(no_lang_help, print_language_names)
+	(get_language_from_interpreter, get_language_from_filename)
+	(init, make_tag, struct C_stab_entry, write_classname, TEX_defenv)
+	(TEX_decode_env, nocase_tail, savestr, savenstr, fatal, pfatal)
+	(concat): Use const char*.
+
+	* emacsclient.c (message, sock_err_message, send_to_emacs)
+	(quote_argument, set_local_socket)
+	(start_daemon_and_retry_set_socket): Use const char*.
+
+	* ebrowse.c (struct member): filename, def_filename is const.
+	(struct sym): filename, sfilename is const.
+	(struct kw): name is const.
+	(add_sym, yyerror, token_string, insert_keyword, main): Use const char*.
+
+	* b2m.c (concat, fatal): Use const char*.
+	(main): Don't assign labels a string literal.
+
 2010-08-07  Juanma Barranquero  <lekktu@gmail.com>
 
 	* ebrowse.c (usage, version, mark_virtual):
--- a/lib-src/b2m.c	Tue Aug 10 19:14:53 2010 -0700
+++ b/lib-src/b2m.c	Wed Aug 11 10:20:34 2010 +0200
@@ -68,9 +68,9 @@
 
 long *xmalloc (unsigned int size);
 long *xrealloc (char *ptr, unsigned int size);
-char *concat (char *s1, char *s2, char *s3);
+char *concat (const char *s1, const char *s2, const char *s3);
 long readline (struct linebuffer *linebuffer, register FILE *stream);
-void fatal (char *message) NO_RETURN;
+void fatal (const char *message) NO_RETURN;
 
 /*
  * xnew -- allocate storage.  SYNOPSIS: Type *xnew (int n, Type);
@@ -170,6 +170,7 @@
 	    continue;
 	  else if (data.buffer[1] == '\f')
 	    {
+              static char babyl[] = "X-Babyl-Labels: ";
 	      if (first)
 		first = FALSE;
 	      else if (! last_was_blank_line)
@@ -177,7 +178,7 @@
 	      /* Save labels. */
 	      readline (&data, stdin);
 	      p = strtok (data.buffer, " ,\r\n\t");
-	      labels = "X-Babyl-Labels: ";
+	      labels = babyl;
 
 	      while ((p = strtok (NULL, " ,\r\n\t")))
 		labels = concat (labels, p, ", ");
@@ -218,7 +219,7 @@
  * concatenate those of s1, s2, s3.
  */
 char *
-concat (char *s1, char *s2, char *s3)
+concat (const char *s1, const char *s2, const char *s3)
 {
   int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
   char *result = xnew (len1 + len2 + len3 + 1, char);
@@ -305,7 +306,7 @@
 }
 
 void
-fatal (char *message)
+fatal (const char *message)
 {
   fprintf (stderr, "%s: %s\n", progname, message);
   exit (EXIT_FAILURE);
--- a/lib-src/ebrowse.c	Tue Aug 10 19:14:53 2010 -0700
+++ b/lib-src/ebrowse.c	Wed Aug 11 10:20:34 2010 +0200
@@ -249,10 +249,10 @@
   int vis;			/* Visibility (public, ...).  */
   int flags;			/* See F_* above.  */
   char *regexp;			/* Matching regular expression.  */
-  char *filename;		/* Don't free this shared string.  */
+  const char *filename;		/* Don't free this shared string.  */
   int pos;			/* Buffer position of occurrence.  */
   char *def_regexp;		/* Regular expression matching definition.  */
-  char *def_filename;		/* File name of definition.  */
+  const char *def_filename;	/* File name of definition.  */
   int def_pos;			/* Buffer position of definition.  */
   char name[1];			/* Member name.  */
 };
@@ -294,8 +294,8 @@
   struct member *types;		/* List of local types.  */
   char *regexp;			/* Matching regular expression.  */
   int pos;			/* Buffer position.  */
-  char *filename;		/* File in which it can be found.  */
-  char *sfilename;		/* File in which members can be found.  */
+  const char *filename;		/* File in which it can be found.  */
+  const char *sfilename; 	/* File in which members can be found.  */
   struct sym *namesp;		/* Namespace in which defined. .  */
   char name[1];                 /* Name of the class.  */
 };
@@ -353,7 +353,7 @@
 
 /* The name of the current input file.  */
 
-char *filename;
+const char *filename;
 
 /* Three character class vectors, and macros to test membership
    of characters.  */
@@ -444,7 +444,7 @@
 
 struct kw
 {
-  char *name;			/* Spelling.  */
+  const char *name;		/* Spelling.  */
   int tk;			/* Token value.  */
   struct kw *next;		/* Next in collision chain.  */
 };
@@ -470,10 +470,10 @@
 int yylex (void);
 void yyparse (void);
 void re_init_parser (void);
-char *token_string (int);
+const char *token_string (int);
 char *matching_regexp (void);
 void init_sym (void);
-struct sym *add_sym (char *, struct sym *);
+struct sym *add_sym (const char *, struct sym *);
 void add_link (struct sym *, struct sym *);
 void add_member_defn (struct sym *, char *, char *,
                       int, unsigned, int, int, int);
@@ -489,7 +489,7 @@
 void leave_namespace (void);
 void enter_namespace (char *);
 void register_namespace_alias (char *, struct link *);
-void insert_keyword (char *, int);
+void insert_keyword (const char *, int);
 void re_init_scanner (void);
 void init_scanner (void);
 void process_file (char *);
@@ -517,7 +517,7 @@
 struct sym *parse_qualified_ident_or_type (char **);
 void parse_qualified_param_ident_or_type (char **);
 int globals (int);
-void yyerror (char *, char *);
+void yyerror (const char *, const char *);
 void usage (int) NO_RETURN;
 void version (void) NO_RETURN;
 
@@ -531,7 +531,7 @@
    name and line number.  */
 
 void
-yyerror (char *format, char *s)
+yyerror (const char *format, const char *s)
 {
   fprintf (stderr, "%s:%d: ", filename, yyline);
   fprintf (stderr, format, s);
@@ -605,11 +605,11 @@
    create a new symbol and set it to default values.  */
 
 struct sym *
-add_sym (char *name, struct sym *nested_in_class)
+add_sym (const char *name, struct sym *nested_in_class)
 {
   struct sym *sym;
   unsigned h;
-  char *s;
+  const char *s;
   struct sym *scope = nested_in_class ? nested_in_class : current_namespace;
 
   for (s = name, h = 0; *s; ++s)
@@ -1975,7 +1975,7 @@
 
 /* Return a printable representation of token T.  */
 
-char *
+const char *
 token_string (int t)
 {
   static char b[3];
@@ -2111,9 +2111,9 @@
    table.  */
 
 void
-insert_keyword (char *name, int tk)
+insert_keyword (const char *name, int tk)
 {
-  char *s;
+  const char *s;
   unsigned h = 0;
   struct kw *k = (struct kw *) xmalloc (sizeof *k);
 
@@ -2839,7 +2839,7 @@
 {
   static int id_size = 0;
   static char *id = NULL;
-  char *s;
+  const char *s;
   int len;
 
   MATCH ();
@@ -3680,7 +3680,7 @@
 {
   int i;
   int any_inputfiles = 0;
-  static char *out_filename = DEFAULT_OUTFILE;
+  static const char *out_filename = DEFAULT_OUTFILE;
   static char **input_filenames = NULL;
   static int input_filenames_size = 0;
   static int n_input_files;
--- a/lib-src/emacsclient.c	Tue Aug 10 19:14:53 2010 -0700
+++ b/lib-src/emacsclient.c	Wed Aug 11 10:20:34 2010 +0200
@@ -134,7 +134,7 @@
 int current_frame = 1;
 
 /* The display on which Emacs should work.  --display.  */
-char *display = NULL;
+const char *display = NULL;
 
 /* The parent window ID, if we are opening a frame via XEmbed.  */
 char *parent_id = NULL;
@@ -150,7 +150,7 @@
 char *socket_name = NULL;
 
 /* If non-NULL, the filename of the authentication file.  */
-char *server_file = NULL;
+const char *server_file = NULL;
 
 /* PID of the Emacs server process.  */
 int emacs_pid = 0;
@@ -479,7 +479,7 @@
 /* Display a normal or error message.
    On Windows, use a message box if compiled as a Windows app.  */
 void
-message (int is_error, char *message, ...)
+message (int is_error, const char *message, ...)
 {
   char msg[2048];
   va_list args;
@@ -724,7 +724,7 @@
 /* On Windows, the socket library was historically separate from the standard
    C library, so errors are handled differently.  */
 void
-sock_err_message (char *function_name)
+sock_err_message (const char *function_name)
 {
 #ifdef WINDOWSNT
   char* msg = NULL;
@@ -748,7 +748,7 @@
    - the buffer is full (but this shouldn't happen)
    Otherwise, we just accumulate it.  */
 void
-send_to_emacs (HSOCKET s, char *data)
+send_to_emacs (HSOCKET s, const char *data)
 {
   while (data)
     {
@@ -787,10 +787,11 @@
 
    Does not change the string.  Outputs the result to S.  */
 void
-quote_argument (HSOCKET s, char *str)
+quote_argument (HSOCKET s, const char *str)
 {
   char *copy = (char *) xmalloc (strlen (str) * 2 + 1);
-  char *p, *q;
+  const char *p;
+  char *q;
 
   p = str;
   q = copy;
@@ -1026,7 +1027,7 @@
 
 /* Returns 1 if PREFIX is a prefix of STRING. */
 static int
-strprefix (char *prefix, char *string)
+strprefix (const char *prefix, const char *string)
 {
   return !strncmp (prefix, string, strlen (prefix));
 }
@@ -1215,8 +1216,8 @@
     int sock_status = 0;
     int default_sock = !socket_name;
     int saved_errno = 0;
-    char *server_name = "server";
-    char *tmpdir;
+    const char *server_name = "server";
+    const char *tmpdir;
 
     if (socket_name && !strchr (socket_name, '/')
 	&& !strchr (socket_name, '\\'))
@@ -1479,11 +1480,13 @@
     }
   else
     {
-      char *d_argv[] = {"emacs", "--daemon", 0 };
+      char emacs[] = "emacs";
+      char daemon[] = "--daemon";
+      char *d_argv[] = {emacs, daemon, 0 };
       if (socket_name != NULL)
 	{
 	  /* Pass  --daemon=socket_name as argument.  */
-	  char *deq = "--daemon=";
+	  const char *deq = "--daemon=";
 	  char *daemon_arg = alloca (strlen (deq)
 				     + strlen (socket_name) + 1);
 	  strcpy (daemon_arg, deq);
--- a/lib-src/etags.c	Tue Aug 10 19:14:53 2010 -0700
+++ b/lib-src/etags.c	Wed Aug 11 10:20:34 2010 +0200
@@ -272,18 +272,18 @@
 
 typedef struct
 {
-  char *suffix;			/* file name suffix for this compressor */
-  char *command;		/* takes one arg and decompresses to stdout */
+  const char *suffix;           /* file name suffix for this compressor */
+  const char *command;		/* takes one arg and decompresses to stdout */
 } compressor;
 
 typedef struct
 {
-  char *name;			/* language name */
-  char *help;                   /* detailed help for the language */
+  const char *name;             /* language name */
+  const char *help; 		/* detailed help for the language */
   Lang_function *function;	/* parse function */
-  char **suffixes;		/* name suffixes of this language's files */
-  char **filenames;		/* names of this language's files */
-  char **interpreters;		/* interpreters for this language */
+  const char **suffixes;        /* name suffixes of this language's files */
+  const char **filenames;       /* names of this language's files */
+  const char **interpreters;    /* interpreters for this language */
   bool metasource;		/* source used to generate other sources */
 } language;
 
@@ -304,7 +304,7 @@
 {				/* sorting structure */
   struct node_st *left, *right;	/* left and right sons */
   fdesc *fdp;			/* description of file to whom tag belongs */
-  char *name;			/* tag name */
+  char *name; 			/* tag name */
   char *regex;			/* search regexp */
   bool valid;			/* write this tag on the tag file */
   bool is_func;			/* function tag: use regexp in CTAGS mode */
@@ -399,7 +399,7 @@
 static language *get_language_from_filename (char *, bool);
 static void readline (linebuffer *, FILE *);
 static long readline_internal (linebuffer *, FILE *);
-static bool nocase_tail (char *);
+static bool nocase_tail (const char *);
 static void get_tag (char *, char **);
 
 static void analyse_regex (char *);
@@ -407,8 +407,8 @@
 static void regex_tag_multiline (void);
 static void error (const char *, const char *);
 static void suggest_asking_for_help (void) NO_RETURN;
-void fatal (char *, char *) NO_RETURN;
-static void pfatal (char *) NO_RETURN;
+void fatal (const char *, const char *) NO_RETURN;
+static void pfatal (const char *) NO_RETURN;
 static void add_node (node *, node **);
 
 static void init (void);
@@ -418,15 +418,15 @@
 static void free_tree (node *);
 static void free_fdesc (fdesc *);
 static void pfnote (char *, bool, char *, int, int, long);
-static void make_tag (char *, int, 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 *);
 
-static char *concat (char *, char *, char *);
+static char *concat (const char *, const char *, const char *);
 static char *skip_spaces (char *);
 static char *skip_non_spaces (char *);
-static char *savenstr (char *, int);
-static char *savestr (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 int etags_strcasecmp (const char *, const char *);
@@ -469,7 +469,7 @@
 
 /* boolean "functions" (see init)	*/
 static bool _wht[CHARS], _nin[CHARS], _itk[CHARS], _btk[CHARS], _etk[CHARS];
-static char
+static const char
   /* white chars */
   *white = " \f\t\n\r\v",
   /* not in a name */
@@ -569,9 +569,9 @@
  */
 
 /* Ada code */
-static char *Ada_suffixes [] =
+static const char *Ada_suffixes [] =
   { "ads", "adb", "ada", NULL };
-static char Ada_help [] =
+static const char Ada_help [] =
 "In Ada code, functions, procedures, packages, tasks and types are\n\
 tags.  Use the `--packages-only' option to create tags for\n\
 packages only.\n\
@@ -589,7 +589,7 @@
 will just search for any tag `bidule'.";
 
 /* Assembly code */
-static char *Asm_suffixes [] =
+static const char *Asm_suffixes [] =
   { "a",	/* Unix assembler */
     "asm", /* Microcontroller assembly */
     "def", /* BSO/Tasking definition includes  */
@@ -600,7 +600,7 @@
     "src", /* BSO/Tasking C compiler output */
     NULL
   };
-static char Asm_help [] =
+static const char Asm_help [] =
 "In assembler code, labels appearing at the beginning of a line,\n\
 followed by a colon, are tags.";
 
@@ -608,10 +608,10 @@
 /* Note that .c and .h can be considered C++, if the --c++ flag was
    given, or if the `class' or `template' keywords are met inside the file.
    That is why default_C_entries is called for these. */
-static char *default_C_suffixes [] =
+static const char *default_C_suffixes [] =
   { "c", "h", NULL };
 #if CTAGS				/* C help for Ctags */
-static char default_C_help [] =
+static const char default_C_help [] =
 "In C code, any C function is a tag.  Use -t to tag typedefs.\n\
 Use -T to tag definitions of `struct', `union' and `enum'.\n\
 Use -d to tag `#define' macro definitions and `enum' constants.\n\
@@ -619,7 +619,7 @@
 You can tag function declarations and external variables by\n\
 using `--declarations', and struct members by using `--members'.";
 #else					/* C help for Etags */
-static char default_C_help [] =
+static const char default_C_help [] =
 "In C code, any C function or typedef is a tag, and so are\n\
 definitions of `struct', `union' and `enum'.  `#define' macro\n\
 definitions and `enum' constants are tags unless you specify\n\
@@ -631,12 +631,12 @@
 using `--declarations'.";
 #endif	/* C help for Ctags and Etags */
 
-static char *Cplusplus_suffixes [] =
+static const char *Cplusplus_suffixes [] =
   { "C", "c++", "cc", "cpp", "cxx", "H", "h++", "hh", "hpp", "hxx",
     "M",			/* Objective C++ */
     "pdb",			/* Postscript with C syntax */
     NULL };
-static char Cplusplus_help [] =
+static const char Cplusplus_help [] =
 "In C++ code, all the tag constructs of C code are tagged.  (Use\n\
 --help --lang=c --lang=c++ for full help.)\n\
 In addition to C tags, member functions are also recognized.  Member\n\
@@ -645,131 +645,131 @@
 and `CLASS::FUNCTION'.  `operator' definitions have tag names like\n\
 `operator+'.";
 
-static char *Cjava_suffixes [] =
+static const char *Cjava_suffixes [] =
   { "java", NULL };
 static char Cjava_help [] =
 "In Java code, all the tags constructs of C and C++ code are\n\
 tagged.  (Use --help --lang=c --lang=c++ --lang=java for full help.)";
 
 
-static char *Cobol_suffixes [] =
+static const char *Cobol_suffixes [] =
   { "COB", "cob", NULL };
 static char Cobol_help [] =
 "In Cobol code, tags are paragraph names; that is, any word\n\
 starting in column 8 and followed by a period.";
 
-static char *Cstar_suffixes [] =
+static const char *Cstar_suffixes [] =
   { "cs", "hs", NULL };
 
-static char *Erlang_suffixes [] =
+static const char *Erlang_suffixes [] =
   { "erl", "hrl", NULL };
-static char Erlang_help [] =
+static const char Erlang_help [] =
 "In Erlang code, the tags are the functions, records and macros\n\
 defined in the file.";
 
-char *Forth_suffixes [] =
+const char *Forth_suffixes [] =
   { "fth", "tok", NULL };
-static char Forth_help [] =
+static const char Forth_help [] =
 "In Forth code, tags are words defined by `:',\n\
 constant, code, create, defer, value, variable, buffer:, field.";
 
-static char *Fortran_suffixes [] =
+static const char *Fortran_suffixes [] =
   { "F", "f", "f90", "for", NULL };
-static char Fortran_help [] =
+static const char Fortran_help [] =
 "In Fortran code, functions, subroutines and block data are tags.";
 
-static char *HTML_suffixes [] =
+static const char *HTML_suffixes [] =
   { "htm", "html", "shtml", NULL };
-static char HTML_help [] =
+static const char HTML_help [] =
 "In HTML input files, the tags are the `title' and the `h1', `h2',\n\
 `h3' headers.  Also, tags are `name=' in anchors and all\n\
 occurrences of `id='.";
 
-static char *Lisp_suffixes [] =
+static const char *Lisp_suffixes [] =
   { "cl", "clisp", "el", "l", "lisp", "LSP", "lsp", "ml", NULL };
-static char Lisp_help [] =
+static const char Lisp_help [] =
 "In Lisp code, any function defined with `defun', any variable\n\
 defined with `defvar' or `defconst', and in general the first\n\
 argument of any expression that starts with `(def' in column zero\n\
 is a tag.";
 
-static char *Lua_suffixes [] =
+static const char *Lua_suffixes [] =
   { "lua", "LUA", NULL };
-static char Lua_help [] =
+static const char Lua_help [] =
 "In Lua scripts, all functions are tags.";
 
-static char *Makefile_filenames [] =
+static const char *Makefile_filenames [] =
   { "Makefile", "makefile", "GNUMakefile", "Makefile.in", "Makefile.am", NULL};
-static char Makefile_help [] =
+static const char Makefile_help [] =
 "In makefiles, targets are tags; additionally, variables are tags\n\
 unless you specify `--no-globals'.";
 
-static char *Objc_suffixes [] =
+static const char *Objc_suffixes [] =
   { "lm",			/* Objective lex file */
     "m",			/* Objective C file */
      NULL };
-static char Objc_help [] =
+static const char Objc_help [] =
 "In Objective C code, tags include Objective C definitions for classes,\n\
 class categories, methods and protocols.  Tags for variables and\n\
 functions in classes are named `CLASS::VARIABLE' and `CLASS::FUNCTION'.\n\
 (Use --help --lang=c --lang=objc --lang=java for full help.)";
 
-static char *Pascal_suffixes [] =
+static const char *Pascal_suffixes [] =
   { "p", "pas", NULL };
-static char Pascal_help [] =
+static const char Pascal_help [] =
 "In Pascal code, the tags are the functions and procedures defined\n\
 in the file.";
 /* " // this is for working around an Emacs highlighting bug... */
 
-static char *Perl_suffixes [] =
+static const char *Perl_suffixes [] =
   { "pl", "pm", NULL };
-static char *Perl_interpreters [] =
+static const char *Perl_interpreters [] =
   { "perl", "@PERL@", NULL };
-static char Perl_help [] =
+static const char Perl_help [] =
 "In Perl code, the tags are the packages, subroutines and variables\n\
 defined by the `package', `sub', `my' and `local' keywords.  Use\n\
 `--globals' if you want to tag global variables.  Tags for\n\
 subroutines are named `PACKAGE::SUB'.  The name for subroutines\n\
 defined in the default package is `main::SUB'.";
 
-static char *PHP_suffixes [] =
+static const char *PHP_suffixes [] =
   { "php", "php3", "php4", NULL };
-static char PHP_help [] =
+static const char PHP_help [] =
 "In PHP code, tags are functions, classes and defines.  Unless you use\n\
 the `--no-members' option, vars are tags too.";
 
-static char *plain_C_suffixes [] =
+static const char *plain_C_suffixes [] =
   { "pc",			/* Pro*C file */
      NULL };
 
-static char *PS_suffixes [] =
+static const char *PS_suffixes [] =
   { "ps", "psw", NULL };	/* .psw is for PSWrap */
-static char PS_help [] =
+static const char PS_help [] =
 "In PostScript code, the tags are the functions.";
 
-static char *Prolog_suffixes [] =
+static const char *Prolog_suffixes [] =
   { "prolog", NULL };
-static char Prolog_help [] =
+static const char Prolog_help [] =
 "In Prolog code, tags are predicates and rules at the beginning of\n\
 line.";
 
-static char *Python_suffixes [] =
+static const char *Python_suffixes [] =
   { "py", NULL };
-static char Python_help [] =
+static const char Python_help [] =
 "In Python code, `def' or `class' at the beginning of a line\n\
 generate a tag.";
 
 /* Can't do the `SCM' or `scm' prefix with a version number. */
-static char *Scheme_suffixes [] =
+static const char *Scheme_suffixes [] =
   { "oak", "sch", "scheme", "SCM", "scm", "SM", "sm", "ss", "t", NULL };
-static char Scheme_help [] =
+static const char Scheme_help [] =
 "In Scheme code, tags include anything defined with `def' or with a\n\
 construct whose name starts with `def'.  They also include\n\
 variables set with `set!' at top level in the file.";
 
-static char *TeX_suffixes [] =
+static const char *TeX_suffixes [] =
   { "bib", "clo", "cls", "ltx", "sty", "TeX", "tex", NULL };
-static char TeX_help [] =
+static const char TeX_help [] =
 "In LaTeX text, the argument of any of the commands `\\chapter',\n\
 `\\section', `\\subsection', `\\subsubsection', `\\eqno', `\\label',\n\
 `\\ref', `\\cite', `\\bibitem', `\\part', `\\appendix', `\\entry',\n\
@@ -781,28 +781,28 @@
      TEXTAGS=\"mycommand:myothercommand\".";
 
 
-static char *Texinfo_suffixes [] =
+static const char *Texinfo_suffixes [] =
   { "texi", "texinfo", "txi", NULL };
-static char Texinfo_help [] =
+static const char Texinfo_help [] =
 "for texinfo files, lines starting with @node are tagged.";
 
-static char *Yacc_suffixes [] =
+static const char *Yacc_suffixes [] =
   { "y", "y++", "ym", "yxx", "yy", NULL }; /* .ym is Objective yacc file */
-static char Yacc_help [] =
+static const char Yacc_help [] =
 "In Bison or Yacc input files, each rule defines as a tag the\n\
 nonterminal it constructs.  The portions of the file that contain\n\
 C code are parsed as C code (use --help --lang=c --lang=yacc\n\
 for full help).";
 
-static char auto_help [] =
+static const char auto_help [] =
 "`auto' is not a real language, it indicates to use\n\
 a default language for files base on file name suffix and file contents.";
 
-static char none_help [] =
+static const char none_help [] =
 "`none' is not a real language, it indicates to only do\n\
 regexp processing on files.";
 
-static char no_lang_help [] =
+static const char no_lang_help [] =
 "No detailed help available for this language.";
 
 
@@ -851,7 +851,7 @@
 print_language_names (void)
 {
   language *lang;
-  char **name, **ext;
+  const char **name, **ext;
 
   puts ("\nThese are the currently supported languages, along with the\n\
 default file names and dot suffixes:");
@@ -1467,7 +1467,7 @@
 get_language_from_interpreter (char *interpreter)
 {
   language *lang;
-  char **iname;
+  const char **iname;
 
   if (interpreter == NULL)
     return NULL;
@@ -1489,7 +1489,7 @@
 get_language_from_filename (char *file, int case_sensitive)
 {
   language *lang;
-  char **name, **ext, *suffix;
+  const char **name, **ext, *suffix;
 
   /* Try whole file name first. */
   for (lang = lang_names; lang->name != NULL; lang++)
@@ -1721,7 +1721,7 @@
 static void
 init (void)
 {
-  register char *sp;
+  register const char *sp;
   register int i;
 
   for (i = 0; i < CHARS; i++)
@@ -1900,23 +1900,23 @@
  * etags.el needs to use the same characters that are in NONAM.
  */
 static void
-make_tag (char *name, int namelen, int is_func, char *linestart, int linelen, int lno, long int cno)
-                		/* tag name, or NULL if unnamed */
-                 		/* tag length */
-                  		/* tag is a function */
-                     		/* start of the line where tag is */
-                 		/* length of the line where tag is */
-             			/* line number */
-              			/* character number */
+make_tag (const char *name, 	/* tag name, or NULL if unnamed */
+	  int namelen,		/* tag length */
+	  int 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 */
+	  long int cno)		/* character number */
 {
   bool named = (name != NULL && namelen > 0);
+  char *nname = NULL;
 
   if (!CTAGS && named)		/* maybe set named to false */
     /* Let's try to make an implicit tag name, that is, create an unnamed tag
        such that etags.el can guess a name from it. */
     {
       int i;
-      register char *cp = name;
+      register const char *cp = name;
 
       for (i = 0; i < namelen; i++)
 	if (notinname (*cp++))
@@ -1935,10 +1935,9 @@
     }
 
   if (named)
-    name = savenstr (name, namelen);
-  else
-    name = NULL;
-  pfnote (name, is_func, linestart, linelen, lno, cno);
+    nname = savenstr (name, namelen);
+
+  pfnote (nname, is_func, linestart, linelen, lno, cno);
 }
 
 /* Record a tag. */
@@ -2361,7 +2360,7 @@
 /* Command-line: gperf -m 5  */
 /* Computed positions: -k'2-3' */
 
-struct C_stab_entry { char *name; int c_ext; enum sym_type type; };
+struct C_stab_entry { const char *name; int c_ext; enum sym_type type; };
 /* maximum key range = 33, duplicates = 0 */
 
 #ifdef __GNUC__
@@ -2550,7 +2549,7 @@
 /*
  * When objdef is different from onone, objtag is the name of the class.
  */
-static char *objtag = "<uninited>";
+static const char *objtag = "<uninited>";
 
 /*
  * Yet another little state machine to deal with preprocessor lines.
@@ -2613,7 +2612,7 @@
  */
 static void pushclass_above (int, char *, int);
 static void popclass_above (int);
-static void write_classname (linebuffer *, char *qualifier);
+static void write_classname (linebuffer *, const char *qualifier);
 
 static struct {
   char **cname;			/* nested class names */
@@ -2661,7 +2660,7 @@
 }
 
 static void
-write_classname (linebuffer *cn, char *qualifier)
+write_classname (linebuffer *cn, const char *qualifier)
 {
   int i, len;
   int qlen = strlen (qualifier);
@@ -3092,7 +3091,7 @@
   int curndx, newndx;		/* indices for current and new lb */
   register int tokoff;		/* offset in line of start of current token */
   register int toklen;		/* length of current token */
-  char *qualifier;		/* string used to qualify names */
+  const char *qualifier;        /* string used to qualify names */
   int qlen;			/* length of qualifier */
   int bracelev;			/* current brace level */
   int bracketlev;		/* current bracket level */
@@ -4127,12 +4126,10 @@
  * Philippe Waroquiers (1998)
  */
 
-static void Ada_getit (FILE *, char *);
-
 /* Once we are positioned after an "interesting" keyword, let's get
    the real tag value necessary. */
 static void
-Ada_getit (FILE *inf, char *name_qualifier)
+Ada_getit (FILE *inf, const char *name_qualifier)
 {
   register char *cp;
   char *name;
@@ -4961,13 +4958,13 @@
 
 /* Default set of control sequences to put into TEX_toktab.
    The value of environment var TEXTAGS is prepended to this.  */
-static char *TEX_defenv = "\
+static const char *TEX_defenv = "\
 :chapter:section:subsection:subsubsection:eqno:label:ref:cite:bibitem\
 :part:appendix:entry:index:def\
 :newcommand:renewcommand:newenvironment:renewenvironment";
 
 static void TEX_mode (FILE *);
-static void TEX_decode_env (char *, char *);
+static void TEX_decode_env (const char *, const char *);
 
 static char TEX_esc = '\\';
 static char TEX_opgrp = '{';
@@ -5075,9 +5072,9 @@
 /* Read environment and prepend it to the default string.
    Build token table. */
 static void
-TEX_decode_env (char *evarname, char *defenv)
+TEX_decode_env (const char *evarname, const char *defenv)
 {
-  register char *env, *p;
+  register const char *env, *p;
   int i, len;
 
   /* Append default string to environment. */
@@ -5085,10 +5082,7 @@
   if (!env)
     env = defenv;
   else
-    {
-      char *oldenv = env;
-      env = concat (oldenv, defenv, "");
-    }
+    env = concat (env, defenv, "");
 
   /* Allocate a token table */
   for (len = 1, p = env; p;)
@@ -5713,6 +5707,7 @@
 {
   static struct re_pattern_buffer zeropattern;
   char sep, *pat, *name, *modifiers;
+  char empty[] = "";
   const char *err;
   struct re_pattern_buffer *patbuf;
   regexp *rp;
@@ -5744,7 +5739,7 @@
   if (modifiers == NULL)	/* no terminating separator --> no name */
     {
       modifiers = name;
-      name = "";
+      name = empty;
     }
   else
     modifiers += 1;		/* skip separator */
@@ -5972,7 +5967,7 @@
 
 
 static bool
-nocase_tail (char *cp)
+nocase_tail (const char *cp)
 {
   register int len = 0;
 
@@ -6289,7 +6284,7 @@
  * with xnew where the string CP has been copied.
  */
 static char *
-savestr (char *cp)
+savestr (const char *cp)
 {
   return savenstr (cp, strlen (cp));
 }
@@ -6299,7 +6294,7 @@
  * the string CP has been copied for at most the first LEN characters.
  */
 static char *
-savenstr (char *cp, int len)
+savenstr (const char *cp, int len)
 {
   register char *dp;
 
@@ -6408,14 +6403,14 @@
 
 /* Print error message and exit.  */
 void
-fatal (char *s1, char *s2)
+fatal (const char *s1, const char *s2)
 {
   error (s1, s2);
   exit (EXIT_FAILURE);
 }
 
 static void
-pfatal (char *s1)
+pfatal (const char *s1)
 {
   perror (s1);
   exit (EXIT_FAILURE);
@@ -6441,7 +6436,7 @@
 /* Return a newly-allocated string whose contents
    concatenate those of s1, s2, s3.  */
 static char *
-concat (char *s1, char *s2, char *s3)
+concat (const char *s1, const char *s2, const char *s3)
 {
   int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
   char *result = xnew (len1 + len2 + len3 + 1, char);
--- a/lib-src/fakemail.c	Tue Aug 10 19:14:53 2010 -0700
+++ b/lib-src/fakemail.c	Wed Aug 11 10:20:34 2010 +0200
@@ -30,7 +30,7 @@
 #if defined (BSD_SYSTEM) && !defined (USE_FAKEMAIL)
 /* This program isnot used in BSD, so just avoid loader complaints.  */
 int
-main ()
+main (void)
 {
   return 0;
 }
--- a/lib-src/make-docfile.c	Tue Aug 10 19:14:53 2010 -0700
+++ b/lib-src/make-docfile.c	Wed Aug 11 10:20:34 2010 +0200
@@ -68,9 +68,9 @@
 #endif
 
 int scan_file (char *filename);
-int scan_lisp_file (char *filename, char *mode);
-int scan_c_file (char *filename, char *mode);
-void fatal (char *s1, char *s2) NO_RETURN;
+int scan_lisp_file (const char *filename, const char *mode);
+int scan_c_file (char *filename, const char *mode);
+void fatal (const char *s1, const char *s2) NO_RETURN;
 
 #ifdef MSDOS
 /* s/msdos.h defines this as sys_chdir, but we're not linking with the
@@ -92,7 +92,7 @@
 
 /* VARARGS1 */
 void
-error (char *s1, char *s2)
+error (const char *s1, const char *s2)
 {
   fprintf (stderr, "%s: ", progname);
   fprintf (stderr, s1, s2);
@@ -103,7 +103,7 @@
 
 /* VARARGS1 */
 void
-fatal (char *s1, char *s2)
+fatal (const char *s1, const char *s2)
 {
   error (s1, s2);
   exit (EXIT_FAILURE);
@@ -233,10 +233,10 @@
 
   /* A keyword we look for at the beginning of lines.  If found, it is
      not copied, and SAW_KEYWORD is set to true.  */
-  char *keyword;
+  const char *keyword;
   /* The current point we've reached in an occurrence of KEYWORD in
      the input stream.  */
-  char *cur_keyword_ptr;
+  const char *cur_keyword_ptr;
   /* Set to true if we saw an occurrence of KEYWORD.  */
   int saw_keyword;
 };
@@ -326,7 +326,7 @@
 	   keyword, but it was a false alarm.  Output the
 	   part we scanned.  */
 	{
-	  char *p;
+	  const char *p;
 
 	  for (p = state->keyword; p < state->cur_keyword_ptr; p++)
 	    put_char (*p, state);
@@ -521,7 +521,7 @@
    Accepts any word starting DEF... so it finds DEFSIMPLE and DEFPRED.  */
 
 int
-scan_c_file (char *filename, char *mode)
+scan_c_file (char *filename, const char *mode)
 {
   FILE *infile;
   register int c;
@@ -834,7 +834,7 @@
 }
 
 int
-scan_lisp_file (char *filename, char *mode)
+scan_lisp_file (const char *filename, const char *mode)
 {
   FILE *infile;
   register int c;
--- a/lib-src/movemail.c	Tue Aug 10 19:14:53 2010 -0700
+++ b/lib-src/movemail.c	Wed Aug 11 10:20:34 2010 +0200
@@ -147,11 +147,11 @@
 char *strerror (int);
 #endif
 
-static void fatal (char *s1, char *s2, char *s3) NO_RETURN;
-static void error (char *s1, char *s2, char *s3);
+static void fatal (const char *s1, const char *s2, const char *s3) NO_RETURN;
+static void error (const char *s1, const char *s2, const char *s3);
 static void pfatal_with_name (char *name) NO_RETURN;
 static void pfatal_and_delete (char *name) NO_RETURN;
-static char *concat (char *s1, char *s2, char *s3);
+static char *concat (const char *s1, const char *s2, const char *s3);
 static long *xmalloc (unsigned int size);
 #ifdef MAIL_USE_POP
 static int popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order);
@@ -589,7 +589,7 @@
 /* Print error message and exit.  */
 
 static void
-fatal (char *s1, char *s2, char *s3)
+fatal (const char *s1, const char *s2, const char *s3)
 {
   if (delete_lockname)
     unlink (delete_lockname);
@@ -601,7 +601,7 @@
    are args for it or null. */
 
 static void
-error (char *s1, char *s2, char *s3)
+error (const char *s1, const char *s2, const char *s3)
 {
   fprintf (stderr, "movemail: ");
   if (s3)
@@ -630,7 +630,7 @@
 /* Return a newly-allocated string whose contents concatenate those of s1, s2, s3.  */
 
 static char *
-concat (char *s1, char *s2, char *s3)
+concat (const char *s1, const char *s2, const char *s3)
 {
   int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
   char *result = (char *) xmalloc (len1 + len2 + len3 + 1);
--- a/lib-src/pop.c	Tue Aug 10 19:14:53 2010 -0700
+++ b/lib-src/pop.c	Wed Aug 11 10:20:34 2010 +0200
@@ -110,7 +110,7 @@
 
 static int socket_connection (char *, int);
 static int pop_getline (popserver, char **);
-static int sendline (popserver, char *);
+static int sendline (popserver, const char *);
 static int fullwrite (int, char *, int);
 static int getok (popserver);
 #if 0
@@ -676,7 +676,7 @@
 }
 
 int
-pop_multi_first (popserver server, char *command, char **response)
+pop_multi_first (popserver server, const char *command, char **response)
 {
   if (server->in_multi)
     {
@@ -988,7 +988,7 @@
   struct servent *servent;
   struct sockaddr_in addr;
   char found_port = 0;
-  char *service;
+  const char *service;
   int sock;
   char *realhost;
 #ifdef KERBEROS
@@ -1414,7 +1414,7 @@
  * Side effects: Closes the connection on error.
  */
 static int
-sendline (popserver server, char *line)
+sendline (popserver server, const char *line)
 {
 #define SENDLINE_ERROR "Error writing to POP server: "
   int ret;
--- a/lib-src/pop.h	Tue Aug 10 19:14:53 2010 -0700
+++ b/lib-src/pop.h	Wed Aug 11 10:20:34 2010 +0200
@@ -49,39 +49,31 @@
 #define POP_NO_HESIOD	(1<<1)
 #define POP_NO_GETPASS 	(1<<2)
 
-#ifdef __STDC__
-#define _ARGS(a) a
-#else
-#define _ARGS(a) ()
-#endif
-
-extern popserver pop_open _ARGS((char *host, char *username, char *password,
-				 int flags));
-extern int pop_stat _ARGS((popserver server, int *count, int *size));
-extern int pop_list _ARGS((popserver server, int message, int **IDs,
-			   int **size));
-extern int pop_retrieve _ARGS((popserver server, int message, int markfrom,
-			       char **));
-extern int pop_retrieve_first _ARGS((popserver server, int message,
-				     char **response));
-extern int pop_retrieve_next _ARGS((popserver server, char **line));
-extern int pop_retrieve_flush _ARGS((popserver server));
-extern int pop_top_first _ARGS((popserver server, int message, int lines,
-				char **response));
-extern int pop_top_next _ARGS((popserver server, char **line));
-extern int pop_top_flush _ARGS((popserver server));
-extern int pop_multi_first _ARGS((popserver server, char *command,
-				  char **response));
-extern int pop_multi_next _ARGS((popserver server, char **line));
-extern int pop_multi_flush _ARGS((popserver server));
-extern int pop_delete _ARGS((popserver server, int message));
-extern int pop_noop _ARGS((popserver server));
-extern int pop_last _ARGS((popserver server));
-extern int pop_reset _ARGS((popserver server));
-extern int pop_quit _ARGS((popserver server));
-extern void pop_close _ARGS((popserver));
-
-#undef _ARGS
+extern popserver pop_open (char *host, char *username, char *password,
+                           int flags);
+extern int pop_stat (popserver server, int *count, int *size);
+extern int pop_list (popserver server, int message, int **IDs,
+                     int **size);
+extern int pop_retrieve (popserver server, int message, int markfrom,
+                         char **);
+extern int pop_retrieve_first (popserver server, int message,
+                               char **response);
+extern int pop_retrieve_next (popserver server, char **line);
+extern int pop_retrieve_flush (popserver server);
+extern int pop_top_first (popserver server, int message, int lines,
+                          char **response);
+extern int pop_top_next (popserver server, char **line);
+extern int pop_top_flush (popserver server);
+extern int pop_multi_first (popserver server, const char *command,
+                            char **response);
+extern int pop_multi_next (popserver server, char **line);
+extern int pop_multi_flush (popserver server);
+extern int pop_delete (popserver server, int message);
+extern int pop_noop (popserver server);
+extern int pop_last (popserver server);
+extern int pop_reset (popserver server);
+extern int pop_quit (popserver server);
+extern void pop_close (popserver);
 
 /* arch-tag: 76cc5f58-8e86-48fa-bc72-a7c6cb1c4f1c
    (do not change this comment) */
--- a/lib-src/sorted-doc.c	Tue Aug 10 19:14:53 2010 -0700
+++ b/lib-src/sorted-doc.c	Wed Aug 11 10:20:34 2010 +0200
@@ -65,7 +65,7 @@
 /* Print error message.  `s1' is printf control string, `s2' is arg for it. */
 
 void
-error (char *s1, char *s2)
+error (const char *s1, const char *s2)
 {
   fprintf (stderr, "sorted-doc: ");
   fprintf (stderr, s1, s2);
@@ -75,7 +75,7 @@
 /* Print error message and exit.  */
 
 void
-fatal (char *s1, char *s2)
+fatal (const char *s1, const char *s2)
 {
   error (s1, s2);
   exit (EXIT_FAILURE);
@@ -117,7 +117,7 @@
   WAITING, BEG_NAME, NAME_GET, BEG_DESC, DESC_GET
 };
 
-char *states[] =
+const char *states[] =
 {
   "WAITING", "BEG_NAME", "NAME_GET", "BEG_DESC", "DESC_GET"
 };
--- a/lib-src/update-game-score.c	Tue Aug 10 19:14:53 2010 -0700
+++ b/lib-src/update-game-score.c	Wed Aug 11 10:20:34 2010 +0200
@@ -157,8 +157,8 @@
   return buf->pw_name;
 }
 
-char *
-get_prefix (int running_suid, char *user_prefix)
+const char *
+get_prefix (int running_suid, const char *user_prefix)
 {
   if (!running_suid && user_prefix == NULL)
     lose ("Not using a shared game directory, and no prefix given.");
@@ -178,7 +178,8 @@
 {
   int c, running_suid;
   void *lockstate;
-  char *user_id, *scorefile, *prefix, *user_prefix = NULL;
+  char *user_id, *scorefile;
+  const char *prefix, *user_prefix = NULL;
   struct stat buf;
   struct score_entry *scores;
   int newscore, scorecount, reverse = 0, max = MAX_SCORES;
@@ -451,7 +452,7 @@
   int fd;
   struct stat buf;
   int attempts = 0;
-  char *lockext = ".lockfile";
+  const char *lockext = ".lockfile";
   char *lockpath = malloc (strlen (filename) + strlen (lockext) + 60);
   if (!lockpath)
     return -1;