aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog51
-rw-r--r--lib-src/b2m.c11
-rw-r--r--lib-src/ebrowse.c36
-rw-r--r--lib-src/emacsclient.c27
-rw-r--r--lib-src/etags.c213
-rw-r--r--lib-src/fakemail.c26
-rw-r--r--lib-src/make-docfile.c20
-rw-r--r--lib-src/movemail.c12
-rw-r--r--lib-src/pop.c8
-rw-r--r--lib-src/pop.h58
-rw-r--r--lib-src/sorted-doc.c6
-rw-r--r--lib-src/update-game-score.c9
12 files changed, 257 insertions, 220 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 6ac9bf19a24..4f3f386310a 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,54 @@
12010-08-11 Jan Djärv <jan.h.d@swipnet.se>
2
3 * fakemail.c: Include stdlib.h for getenv. Remove declaration of
4 popen, fclose and pclose.
5 (my_name, fatal, error, put_line): Use const char*
6 (main): Remove extern getenv, mail_program_name is const char*.
7
8 * update-game-score.c (get_prefix, write_scores, main): Use const char*.
9
10 * sorted-doc.c (error, fatal, states): Use const char *.
11
12 * pop.h (pop_multi_first): Use const char *.
13 (_ARGS): Remove.
14
15 * pop.c (pop_multi_first, socket_connection, sendline): Use conat char*.
16
17 * movemail.c (fatal, error, concat): Use const char *.
18
19 * make-docfile.c (error, fatal, scan_c_file, scan_lisp_file): Use
20 const char *.
21
22 * etags.c (compressor, language, Ada_suffix, Ada_help, Asm_suffixes)
23 (Asm_help, default_C_suffixes, default_C_help, Cplusplus_suffixes)
24 (Cplusplus_help, Cjava_suffixes, Cobol_suffixes, Cstar_suffixes)
25 (Erlang_suffixes, Erlang_help, Forth_suffixes, Forth_help)
26 (Fortran_suffixes, Fortran_help, HTML_suffixes, HTML_help)
27 (Lisp_suffixes, Lisp_help, Lua_suffixes, Lua_help)
28 (Makefile_filenames, Makefile_help, Objc_suffixes, Objc_help)
29 (Pascal_suffixes, Pascal_help, Perl_suffixes, Perl_interpreters)
30 (Perl_help, PHP_suffixes, PHP_help, plain_C_suffixses, PS_suffixes)
31 (PS_help, Prolog_suffixes, Prolog_help, Python_suffixes, Python_help)
32 (Scheme_suffixes, Scheme_help, TeX_suffixes, TeX_help, Texinfo_suffixes)
33 (Texinfo_help, Yacc_suffixes, Yacc_help, auto_help, none_help)
34 (no_lang_help, print_language_names)
35 (get_language_from_interpreter, get_language_from_filename)
36 (init, make_tag, struct C_stab_entry, write_classname, TEX_defenv)
37 (TEX_decode_env, nocase_tail, savestr, savenstr, fatal, pfatal)
38 (concat): Use const char*.
39
40 * emacsclient.c (message, sock_err_message, send_to_emacs)
41 (quote_argument, set_local_socket)
42 (start_daemon_and_retry_set_socket): Use const char*.
43
44 * ebrowse.c (struct member): filename, def_filename is const.
45 (struct sym): filename, sfilename is const.
46 (struct kw): name is const.
47 (add_sym, yyerror, token_string, insert_keyword, main): Use const char*.
48
49 * b2m.c (concat, fatal): Use const char*.
50 (main): Don't assign labels a string literal.
51
12010-08-07 Juanma Barranquero <lekktu@gmail.com> 522010-08-07 Juanma Barranquero <lekktu@gmail.com>
2 53
3 * ebrowse.c (usage, version, mark_virtual): 54 * ebrowse.c (usage, version, mark_virtual):
diff --git a/lib-src/b2m.c b/lib-src/b2m.c
index f31b33f9780..803d75e233c 100644
--- a/lib-src/b2m.c
+++ b/lib-src/b2m.c
@@ -68,9 +68,9 @@ extern char *strtok(char *, const char *);
68 68
69long *xmalloc (unsigned int size); 69long *xmalloc (unsigned int size);
70long *xrealloc (char *ptr, unsigned int size); 70long *xrealloc (char *ptr, unsigned int size);
71char *concat (char *s1, char *s2, char *s3); 71char *concat (const char *s1, const char *s2, const char *s3);
72long readline (struct linebuffer *linebuffer, register FILE *stream); 72long readline (struct linebuffer *linebuffer, register FILE *stream);
73void fatal (char *message) NO_RETURN; 73void fatal (const char *message) NO_RETURN;
74 74
75/* 75/*
76 * xnew -- allocate storage. SYNOPSIS: Type *xnew (int n, Type); 76 * xnew -- allocate storage. SYNOPSIS: Type *xnew (int n, Type);
@@ -170,6 +170,7 @@ main (int argc, char **argv)
170 continue; 170 continue;
171 else if (data.buffer[1] == '\f') 171 else if (data.buffer[1] == '\f')
172 { 172 {
173 static char babyl[] = "X-Babyl-Labels: ";
173 if (first) 174 if (first)
174 first = FALSE; 175 first = FALSE;
175 else if (! last_was_blank_line) 176 else if (! last_was_blank_line)
@@ -177,7 +178,7 @@ main (int argc, char **argv)
177 /* Save labels. */ 178 /* Save labels. */
178 readline (&data, stdin); 179 readline (&data, stdin);
179 p = strtok (data.buffer, " ,\r\n\t"); 180 p = strtok (data.buffer, " ,\r\n\t");
180 labels = "X-Babyl-Labels: "; 181 labels = babyl;
181 182
182 while ((p = strtok (NULL, " ,\r\n\t"))) 183 while ((p = strtok (NULL, " ,\r\n\t")))
183 labels = concat (labels, p, ", "); 184 labels = concat (labels, p, ", ");
@@ -218,7 +219,7 @@ main (int argc, char **argv)
218 * concatenate those of s1, s2, s3. 219 * concatenate those of s1, s2, s3.
219 */ 220 */
220char * 221char *
221concat (char *s1, char *s2, char *s3) 222concat (const char *s1, const char *s2, const char *s3)
222{ 223{
223 int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); 224 int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
224 char *result = xnew (len1 + len2 + len3 + 1, char); 225 char *result = xnew (len1 + len2 + len3 + 1, char);
@@ -305,7 +306,7 @@ xrealloc (char *ptr, unsigned int size)
305} 306}
306 307
307void 308void
308fatal (char *message) 309fatal (const char *message)
309{ 310{
310 fprintf (stderr, "%s: %s\n", progname, message); 311 fprintf (stderr, "%s: %s\n", progname, message);
311 exit (EXIT_FAILURE); 312 exit (EXIT_FAILURE);
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c
index 40e72939429..1fcbb8662f5 100644
--- a/lib-src/ebrowse.c
+++ b/lib-src/ebrowse.c
@@ -249,10 +249,10 @@ struct member
249 int vis; /* Visibility (public, ...). */ 249 int vis; /* Visibility (public, ...). */
250 int flags; /* See F_* above. */ 250 int flags; /* See F_* above. */
251 char *regexp; /* Matching regular expression. */ 251 char *regexp; /* Matching regular expression. */
252 char *filename; /* Don't free this shared string. */ 252 const char *filename; /* Don't free this shared string. */
253 int pos; /* Buffer position of occurrence. */ 253 int pos; /* Buffer position of occurrence. */
254 char *def_regexp; /* Regular expression matching definition. */ 254 char *def_regexp; /* Regular expression matching definition. */
255 char *def_filename; /* File name of definition. */ 255 const char *def_filename; /* File name of definition. */
256 int def_pos; /* Buffer position of definition. */ 256 int def_pos; /* Buffer position of definition. */
257 char name[1]; /* Member name. */ 257 char name[1]; /* Member name. */
258}; 258};
@@ -294,8 +294,8 @@ struct sym
294 struct member *types; /* List of local types. */ 294 struct member *types; /* List of local types. */
295 char *regexp; /* Matching regular expression. */ 295 char *regexp; /* Matching regular expression. */
296 int pos; /* Buffer position. */ 296 int pos; /* Buffer position. */
297 char *filename; /* File in which it can be found. */ 297 const char *filename; /* File in which it can be found. */
298 char *sfilename; /* File in which members can be found. */ 298 const char *sfilename; /* File in which members can be found. */
299 struct sym *namesp; /* Namespace in which defined. . */ 299 struct sym *namesp; /* Namespace in which defined. . */
300 char name[1]; /* Name of the class. */ 300 char name[1]; /* Name of the class. */
301}; 301};
@@ -353,7 +353,7 @@ int yyline;
353 353
354/* The name of the current input file. */ 354/* The name of the current input file. */
355 355
356char *filename; 356const char *filename;
357 357
358/* Three character class vectors, and macros to test membership 358/* Three character class vectors, and macros to test membership
359 of characters. */ 359 of characters. */
@@ -444,7 +444,7 @@ int tk = -1;
444 444
445struct kw 445struct kw
446{ 446{
447 char *name; /* Spelling. */ 447 const char *name; /* Spelling. */
448 int tk; /* Token value. */ 448 int tk; /* Token value. */
449 struct kw *next; /* Next in collision chain. */ 449 struct kw *next; /* Next in collision chain. */
450}; 450};
@@ -470,10 +470,10 @@ struct search_path *search_path_tail;
470int yylex (void); 470int yylex (void);
471void yyparse (void); 471void yyparse (void);
472void re_init_parser (void); 472void re_init_parser (void);
473char *token_string (int); 473const char *token_string (int);
474char *matching_regexp (void); 474char *matching_regexp (void);
475void init_sym (void); 475void init_sym (void);
476struct sym *add_sym (char *, struct sym *); 476struct sym *add_sym (const char *, struct sym *);
477void add_link (struct sym *, struct sym *); 477void add_link (struct sym *, struct sym *);
478void add_member_defn (struct sym *, char *, char *, 478void add_member_defn (struct sym *, char *, char *,
479 int, unsigned, int, int, int); 479 int, unsigned, int, int, int);
@@ -489,7 +489,7 @@ void mark_inherited_virtual (void);
489void leave_namespace (void); 489void leave_namespace (void);
490void enter_namespace (char *); 490void enter_namespace (char *);
491void register_namespace_alias (char *, struct link *); 491void register_namespace_alias (char *, struct link *);
492void insert_keyword (char *, int); 492void insert_keyword (const char *, int);
493void re_init_scanner (void); 493void re_init_scanner (void);
494void init_scanner (void); 494void init_scanner (void);
495void process_file (char *); 495void process_file (char *);
@@ -517,7 +517,7 @@ struct sym *parse_classname (void);
517struct sym *parse_qualified_ident_or_type (char **); 517struct sym *parse_qualified_ident_or_type (char **);
518void parse_qualified_param_ident_or_type (char **); 518void parse_qualified_param_ident_or_type (char **);
519int globals (int); 519int globals (int);
520void yyerror (char *, char *); 520void yyerror (const char *, const char *);
521void usage (int) NO_RETURN; 521void usage (int) NO_RETURN;
522void version (void) NO_RETURN; 522void version (void) NO_RETURN;
523 523
@@ -531,7 +531,7 @@ void version (void) NO_RETURN;
531 name and line number. */ 531 name and line number. */
532 532
533void 533void
534yyerror (char *format, char *s) 534yyerror (const char *format, const char *s)
535{ 535{
536 fprintf (stderr, "%s:%d: ", filename, yyline); 536 fprintf (stderr, "%s:%d: ", filename, yyline);
537 fprintf (stderr, format, s); 537 fprintf (stderr, format, s);
@@ -605,11 +605,11 @@ init_sym (void)
605 create a new symbol and set it to default values. */ 605 create a new symbol and set it to default values. */
606 606
607struct sym * 607struct sym *
608add_sym (char *name, struct sym *nested_in_class) 608add_sym (const char *name, struct sym *nested_in_class)
609{ 609{
610 struct sym *sym; 610 struct sym *sym;
611 unsigned h; 611 unsigned h;
612 char *s; 612 const char *s;
613 struct sym *scope = nested_in_class ? nested_in_class : current_namespace; 613 struct sym *scope = nested_in_class ? nested_in_class : current_namespace;
614 614
615 for (s = name, h = 0; *s; ++s) 615 for (s = name, h = 0; *s; ++s)
@@ -1975,7 +1975,7 @@ matching_regexp (void)
1975 1975
1976/* Return a printable representation of token T. */ 1976/* Return a printable representation of token T. */
1977 1977
1978char * 1978const char *
1979token_string (int t) 1979token_string (int t)
1980{ 1980{
1981 static char b[3]; 1981 static char b[3];
@@ -2111,9 +2111,9 @@ re_init_scanner (void)
2111 table. */ 2111 table. */
2112 2112
2113void 2113void
2114insert_keyword (char *name, int tk) 2114insert_keyword (const char *name, int tk)
2115{ 2115{
2116 char *s; 2116 const char *s;
2117 unsigned h = 0; 2117 unsigned h = 0;
2118 struct kw *k = (struct kw *) xmalloc (sizeof *k); 2118 struct kw *k = (struct kw *) xmalloc (sizeof *k);
2119 2119
@@ -2839,7 +2839,7 @@ operator_name (int *sc)
2839{ 2839{
2840 static int id_size = 0; 2840 static int id_size = 0;
2841 static char *id = NULL; 2841 static char *id = NULL;
2842 char *s; 2842 const char *s;
2843 int len; 2843 int len;
2844 2844
2845 MATCH (); 2845 MATCH ();
@@ -3680,7 +3680,7 @@ main (int argc, char **argv)
3680{ 3680{
3681 int i; 3681 int i;
3682 int any_inputfiles = 0; 3682 int any_inputfiles = 0;
3683 static char *out_filename = DEFAULT_OUTFILE; 3683 static const char *out_filename = DEFAULT_OUTFILE;
3684 static char **input_filenames = NULL; 3684 static char **input_filenames = NULL;
3685 static int input_filenames_size = 0; 3685 static int input_filenames_size = 0;
3686 static int n_input_files; 3686 static int n_input_files;
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index cbc1dfe3f6a..e8ffbe7c562 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -134,7 +134,7 @@ int eval = 0;
134int current_frame = 1; 134int current_frame = 1;
135 135
136/* The display on which Emacs should work. --display. */ 136/* The display on which Emacs should work. --display. */
137char *display = NULL; 137const char *display = NULL;
138 138
139/* The parent window ID, if we are opening a frame via XEmbed. */ 139/* The parent window ID, if we are opening a frame via XEmbed. */
140char *parent_id = NULL; 140char *parent_id = NULL;
@@ -150,7 +150,7 @@ const char *alternate_editor = NULL;
150char *socket_name = NULL; 150char *socket_name = NULL;
151 151
152/* If non-NULL, the filename of the authentication file. */ 152/* If non-NULL, the filename of the authentication file. */
153char *server_file = NULL; 153const char *server_file = NULL;
154 154
155/* PID of the Emacs server process. */ 155/* PID of the Emacs server process. */
156int emacs_pid = 0; 156int emacs_pid = 0;
@@ -479,7 +479,7 @@ ttyname (int fd)
479/* Display a normal or error message. 479/* Display a normal or error message.
480 On Windows, use a message box if compiled as a Windows app. */ 480 On Windows, use a message box if compiled as a Windows app. */
481void 481void
482message (int is_error, char *message, ...) 482message (int is_error, const char *message, ...)
483{ 483{
484 char msg[2048]; 484 char msg[2048];
485 va_list args; 485 va_list args;
@@ -724,7 +724,7 @@ HSOCKET emacs_socket = 0;
724/* On Windows, the socket library was historically separate from the standard 724/* On Windows, the socket library was historically separate from the standard
725 C library, so errors are handled differently. */ 725 C library, so errors are handled differently. */
726void 726void
727sock_err_message (char *function_name) 727sock_err_message (const char *function_name)
728{ 728{
729#ifdef WINDOWSNT 729#ifdef WINDOWSNT
730 char* msg = NULL; 730 char* msg = NULL;
@@ -748,7 +748,7 @@ sock_err_message (char *function_name)
748 - the buffer is full (but this shouldn't happen) 748 - the buffer is full (but this shouldn't happen)
749 Otherwise, we just accumulate it. */ 749 Otherwise, we just accumulate it. */
750void 750void
751send_to_emacs (HSOCKET s, char *data) 751send_to_emacs (HSOCKET s, const char *data)
752{ 752{
753 while (data) 753 while (data)
754 { 754 {
@@ -787,10 +787,11 @@ send_to_emacs (HSOCKET s, char *data)
787 787
788 Does not change the string. Outputs the result to S. */ 788 Does not change the string. Outputs the result to S. */
789void 789void
790quote_argument (HSOCKET s, char *str) 790quote_argument (HSOCKET s, const char *str)
791{ 791{
792 char *copy = (char *) xmalloc (strlen (str) * 2 + 1); 792 char *copy = (char *) xmalloc (strlen (str) * 2 + 1);
793 char *p, *q; 793 const char *p;
794 char *q;
794 795
795 p = str; 796 p = str;
796 q = copy; 797 q = copy;
@@ -1026,7 +1027,7 @@ set_tcp_socket (void)
1026 1027
1027/* Returns 1 if PREFIX is a prefix of STRING. */ 1028/* Returns 1 if PREFIX is a prefix of STRING. */
1028static int 1029static int
1029strprefix (char *prefix, char *string) 1030strprefix (const char *prefix, const char *string)
1030{ 1031{
1031 return !strncmp (prefix, string, strlen (prefix)); 1032 return !strncmp (prefix, string, strlen (prefix));
1032} 1033}
@@ -1215,8 +1216,8 @@ set_local_socket (void)
1215 int sock_status = 0; 1216 int sock_status = 0;
1216 int default_sock = !socket_name; 1217 int default_sock = !socket_name;
1217 int saved_errno = 0; 1218 int saved_errno = 0;
1218 char *server_name = "server"; 1219 const char *server_name = "server";
1219 char *tmpdir; 1220 const char *tmpdir;
1220 1221
1221 if (socket_name && !strchr (socket_name, '/') 1222 if (socket_name && !strchr (socket_name, '/')
1222 && !strchr (socket_name, '\\')) 1223 && !strchr (socket_name, '\\'))
@@ -1479,11 +1480,13 @@ start_daemon_and_retry_set_socket (void)
1479 } 1480 }
1480 else 1481 else
1481 { 1482 {
1482 char *d_argv[] = {"emacs", "--daemon", 0 }; 1483 char emacs[] = "emacs";
1484 char daemon[] = "--daemon";
1485 char *d_argv[] = {emacs, daemon, 0 };
1483 if (socket_name != NULL) 1486 if (socket_name != NULL)
1484 { 1487 {
1485 /* Pass --daemon=socket_name as argument. */ 1488 /* Pass --daemon=socket_name as argument. */
1486 char *deq = "--daemon="; 1489 const char *deq = "--daemon=";
1487 char *daemon_arg = alloca (strlen (deq) 1490 char *daemon_arg = alloca (strlen (deq)
1488 + strlen (socket_name) + 1); 1491 + strlen (socket_name) + 1);
1489 strcpy (daemon_arg, deq); 1492 strcpy (daemon_arg, deq);
diff --git a/lib-src/etags.c b/lib-src/etags.c
index b78686dde57..42e4017ab50 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -272,18 +272,18 @@ typedef void Lang_function (FILE *);
272 272
273typedef struct 273typedef struct
274{ 274{
275 char *suffix; /* file name suffix for this compressor */ 275 const char *suffix; /* file name suffix for this compressor */
276 char *command; /* takes one arg and decompresses to stdout */ 276 const char *command; /* takes one arg and decompresses to stdout */
277} compressor; 277} compressor;
278 278
279typedef struct 279typedef struct
280{ 280{
281 char *name; /* language name */ 281 const char *name; /* language name */
282 char *help; /* detailed help for the language */ 282 const char *help; /* detailed help for the language */
283 Lang_function *function; /* parse function */ 283 Lang_function *function; /* parse function */
284 char **suffixes; /* name suffixes of this language's files */ 284 const char **suffixes; /* name suffixes of this language's files */
285 char **filenames; /* names of this language's files */ 285 const char **filenames; /* names of this language's files */
286 char **interpreters; /* interpreters for this language */ 286 const char **interpreters; /* interpreters for this language */
287 bool metasource; /* source used to generate other sources */ 287 bool metasource; /* source used to generate other sources */
288} language; 288} language;
289 289
@@ -304,7 +304,7 @@ typedef struct node_st
304{ /* sorting structure */ 304{ /* sorting structure */
305 struct node_st *left, *right; /* left and right sons */ 305 struct node_st *left, *right; /* left and right sons */
306 fdesc *fdp; /* description of file to whom tag belongs */ 306 fdesc *fdp; /* description of file to whom tag belongs */
307 char *name; /* tag name */ 307 char *name; /* tag name */
308 char *regex; /* search regexp */ 308 char *regex; /* search regexp */
309 bool valid; /* write this tag on the tag file */ 309 bool valid; /* write this tag on the tag file */
310 bool is_func; /* function tag: use regexp in CTAGS mode */ 310 bool is_func; /* function tag: use regexp in CTAGS mode */
@@ -399,7 +399,7 @@ static language *get_language_from_interpreter (char *);
399static language *get_language_from_filename (char *, bool); 399static language *get_language_from_filename (char *, bool);
400static void readline (linebuffer *, FILE *); 400static void readline (linebuffer *, FILE *);
401static long readline_internal (linebuffer *, FILE *); 401static long readline_internal (linebuffer *, FILE *);
402static bool nocase_tail (char *); 402static bool nocase_tail (const char *);
403static void get_tag (char *, char **); 403static void get_tag (char *, char **);
404 404
405static void analyse_regex (char *); 405static void analyse_regex (char *);
@@ -407,8 +407,8 @@ static void free_regexps (void);
407static void regex_tag_multiline (void); 407static void regex_tag_multiline (void);
408static void error (const char *, const char *); 408static void error (const char *, const char *);
409static void suggest_asking_for_help (void) NO_RETURN; 409static void suggest_asking_for_help (void) NO_RETURN;
410void fatal (char *, char *) NO_RETURN; 410void fatal (const char *, const char *) NO_RETURN;
411static void pfatal (char *) NO_RETURN; 411static void pfatal (const char *) NO_RETURN;
412static void add_node (node *, node **); 412static void add_node (node *, node **);
413 413
414static void init (void); 414static void init (void);
@@ -418,15 +418,15 @@ static void find_entries (FILE *);
418static void free_tree (node *); 418static void free_tree (node *);
419static void free_fdesc (fdesc *); 419static void free_fdesc (fdesc *);
420static void pfnote (char *, bool, char *, int, int, long); 420static void pfnote (char *, bool, char *, int, int, long);
421static void make_tag (char *, int, bool, char *, int, int, long); 421static void make_tag (const char *, int, bool, char *, int, int, long);
422static void invalidate_nodes (fdesc *, node **); 422static void invalidate_nodes (fdesc *, node **);
423static void put_entries (node *); 423static void put_entries (node *);
424 424
425static char *concat (char *, char *, char *); 425static char *concat (const char *, const char *, const char *);
426static char *skip_spaces (char *); 426static char *skip_spaces (char *);
427static char *skip_non_spaces (char *); 427static char *skip_non_spaces (char *);
428static char *savenstr (char *, int); 428static char *savenstr (const char *, int);
429static char *savestr (char *); 429static char *savestr (const char *);
430static char *etags_strchr (const char *, int); 430static char *etags_strchr (const char *, int);
431static char *etags_strrchr (const char *, int); 431static char *etags_strrchr (const char *, int);
432static int etags_strcasecmp (const char *, const char *); 432static int etags_strcasecmp (const char *, const char *);
@@ -469,7 +469,7 @@ static linebuffer token_name; /* a buffer containing a tag name */
469 469
470/* boolean "functions" (see init) */ 470/* boolean "functions" (see init) */
471static bool _wht[CHARS], _nin[CHARS], _itk[CHARS], _btk[CHARS], _etk[CHARS]; 471static bool _wht[CHARS], _nin[CHARS], _itk[CHARS], _btk[CHARS], _etk[CHARS];
472static char 472static const char
473 /* white chars */ 473 /* white chars */
474 *white = " \f\t\n\r\v", 474 *white = " \f\t\n\r\v",
475 /* not in a name */ 475 /* not in a name */
@@ -569,9 +569,9 @@ static compressor compressors[] =
569 */ 569 */
570 570
571/* Ada code */ 571/* Ada code */
572static char *Ada_suffixes [] = 572static const char *Ada_suffixes [] =
573 { "ads", "adb", "ada", NULL }; 573 { "ads", "adb", "ada", NULL };
574static char Ada_help [] = 574static const char Ada_help [] =
575"In Ada code, functions, procedures, packages, tasks and types are\n\ 575"In Ada code, functions, procedures, packages, tasks and types are\n\
576tags. Use the `--packages-only' option to create tags for\n\ 576tags. Use the `--packages-only' option to create tags for\n\
577packages only.\n\ 577packages only.\n\
@@ -589,7 +589,7 @@ body of the package `bidule', while `M-x find-tag <RET> bidule <RET>'\n\
589will just search for any tag `bidule'."; 589will just search for any tag `bidule'.";
590 590
591/* Assembly code */ 591/* Assembly code */
592static char *Asm_suffixes [] = 592static const char *Asm_suffixes [] =
593 { "a", /* Unix assembler */ 593 { "a", /* Unix assembler */
594 "asm", /* Microcontroller assembly */ 594 "asm", /* Microcontroller assembly */
595 "def", /* BSO/Tasking definition includes */ 595 "def", /* BSO/Tasking definition includes */
@@ -600,7 +600,7 @@ static char *Asm_suffixes [] =
600 "src", /* BSO/Tasking C compiler output */ 600 "src", /* BSO/Tasking C compiler output */
601 NULL 601 NULL
602 }; 602 };
603static char Asm_help [] = 603static const char Asm_help [] =
604"In assembler code, labels appearing at the beginning of a line,\n\ 604"In assembler code, labels appearing at the beginning of a line,\n\
605followed by a colon, are tags."; 605followed by a colon, are tags.";
606 606
@@ -608,10 +608,10 @@ followed by a colon, are tags.";
608/* Note that .c and .h can be considered C++, if the --c++ flag was 608/* Note that .c and .h can be considered C++, if the --c++ flag was
609 given, or if the `class' or `template' keywords are met inside the file. 609 given, or if the `class' or `template' keywords are met inside the file.
610 That is why default_C_entries is called for these. */ 610 That is why default_C_entries is called for these. */
611static char *default_C_suffixes [] = 611static const char *default_C_suffixes [] =
612 { "c", "h", NULL }; 612 { "c", "h", NULL };
613#if CTAGS /* C help for Ctags */ 613#if CTAGS /* C help for Ctags */
614static char default_C_help [] = 614static const char default_C_help [] =
615"In C code, any C function is a tag. Use -t to tag typedefs.\n\ 615"In C code, any C function is a tag. Use -t to tag typedefs.\n\
616Use -T to tag definitions of `struct', `union' and `enum'.\n\ 616Use -T to tag definitions of `struct', `union' and `enum'.\n\
617Use -d to tag `#define' macro definitions and `enum' constants.\n\ 617Use -d to tag `#define' macro definitions and `enum' constants.\n\
@@ -619,7 +619,7 @@ Use --globals to tag global variables.\n\
619You can tag function declarations and external variables by\n\ 619You can tag function declarations and external variables by\n\
620using `--declarations', and struct members by using `--members'."; 620using `--declarations', and struct members by using `--members'.";
621#else /* C help for Etags */ 621#else /* C help for Etags */
622static char default_C_help [] = 622static const char default_C_help [] =
623"In C code, any C function or typedef is a tag, and so are\n\ 623"In C code, any C function or typedef is a tag, and so are\n\
624definitions of `struct', `union' and `enum'. `#define' macro\n\ 624definitions of `struct', `union' and `enum'. `#define' macro\n\
625definitions and `enum' constants are tags unless you specify\n\ 625definitions and `enum' constants are tags unless you specify\n\
@@ -631,12 +631,12 @@ You can tag function declarations and external variables by\n\
631using `--declarations'."; 631using `--declarations'.";
632#endif /* C help for Ctags and Etags */ 632#endif /* C help for Ctags and Etags */
633 633
634static char *Cplusplus_suffixes [] = 634static const char *Cplusplus_suffixes [] =
635 { "C", "c++", "cc", "cpp", "cxx", "H", "h++", "hh", "hpp", "hxx", 635 { "C", "c++", "cc", "cpp", "cxx", "H", "h++", "hh", "hpp", "hxx",
636 "M", /* Objective C++ */ 636 "M", /* Objective C++ */
637 "pdb", /* Postscript with C syntax */ 637 "pdb", /* Postscript with C syntax */
638 NULL }; 638 NULL };
639static char Cplusplus_help [] = 639static const char Cplusplus_help [] =
640"In C++ code, all the tag constructs of C code are tagged. (Use\n\ 640"In C++ code, all the tag constructs of C code are tagged. (Use\n\
641--help --lang=c --lang=c++ for full help.)\n\ 641--help --lang=c --lang=c++ for full help.)\n\
642In addition to C tags, member functions are also recognized. Member\n\ 642In addition to C tags, member functions are also recognized. Member\n\
@@ -645,131 +645,131 @@ Tags for variables and functions in classes are named `CLASS::VARIABLE'\n\
645and `CLASS::FUNCTION'. `operator' definitions have tag names like\n\ 645and `CLASS::FUNCTION'. `operator' definitions have tag names like\n\
646`operator+'."; 646`operator+'.";
647 647
648static char *Cjava_suffixes [] = 648static const char *Cjava_suffixes [] =
649 { "java", NULL }; 649 { "java", NULL };
650static char Cjava_help [] = 650static char Cjava_help [] =
651"In Java code, all the tags constructs of C and C++ code are\n\ 651"In Java code, all the tags constructs of C and C++ code are\n\
652tagged. (Use --help --lang=c --lang=c++ --lang=java for full help.)"; 652tagged. (Use --help --lang=c --lang=c++ --lang=java for full help.)";
653 653
654 654
655static char *Cobol_suffixes [] = 655static const char *Cobol_suffixes [] =
656 { "COB", "cob", NULL }; 656 { "COB", "cob", NULL };
657static char Cobol_help [] = 657static char Cobol_help [] =
658"In Cobol code, tags are paragraph names; that is, any word\n\ 658"In Cobol code, tags are paragraph names; that is, any word\n\
659starting in column 8 and followed by a period."; 659starting in column 8 and followed by a period.";
660 660
661static char *Cstar_suffixes [] = 661static const char *Cstar_suffixes [] =
662 { "cs", "hs", NULL }; 662 { "cs", "hs", NULL };
663 663
664static char *Erlang_suffixes [] = 664static const char *Erlang_suffixes [] =
665 { "erl", "hrl", NULL }; 665 { "erl", "hrl", NULL };
666static char Erlang_help [] = 666static const char Erlang_help [] =
667"In Erlang code, the tags are the functions, records and macros\n\ 667"In Erlang code, the tags are the functions, records and macros\n\
668defined in the file."; 668defined in the file.";
669 669
670char *Forth_suffixes [] = 670const char *Forth_suffixes [] =
671 { "fth", "tok", NULL }; 671 { "fth", "tok", NULL };
672static char Forth_help [] = 672static const char Forth_help [] =
673"In Forth code, tags are words defined by `:',\n\ 673"In Forth code, tags are words defined by `:',\n\
674constant, code, create, defer, value, variable, buffer:, field."; 674constant, code, create, defer, value, variable, buffer:, field.";
675 675
676static char *Fortran_suffixes [] = 676static const char *Fortran_suffixes [] =
677 { "F", "f", "f90", "for", NULL }; 677 { "F", "f", "f90", "for", NULL };
678static char Fortran_help [] = 678static const char Fortran_help [] =
679"In Fortran code, functions, subroutines and block data are tags."; 679"In Fortran code, functions, subroutines and block data are tags.";
680 680
681static char *HTML_suffixes [] = 681static const char *HTML_suffixes [] =
682 { "htm", "html", "shtml", NULL }; 682 { "htm", "html", "shtml", NULL };
683static char HTML_help [] = 683static const char HTML_help [] =
684"In HTML input files, the tags are the `title' and the `h1', `h2',\n\ 684"In HTML input files, the tags are the `title' and the `h1', `h2',\n\
685`h3' headers. Also, tags are `name=' in anchors and all\n\ 685`h3' headers. Also, tags are `name=' in anchors and all\n\
686occurrences of `id='."; 686occurrences of `id='.";
687 687
688static char *Lisp_suffixes [] = 688static const char *Lisp_suffixes [] =
689 { "cl", "clisp", "el", "l", "lisp", "LSP", "lsp", "ml", NULL }; 689 { "cl", "clisp", "el", "l", "lisp", "LSP", "lsp", "ml", NULL };
690static char Lisp_help [] = 690static const char Lisp_help [] =
691"In Lisp code, any function defined with `defun', any variable\n\ 691"In Lisp code, any function defined with `defun', any variable\n\
692defined with `defvar' or `defconst', and in general the first\n\ 692defined with `defvar' or `defconst', and in general the first\n\
693argument of any expression that starts with `(def' in column zero\n\ 693argument of any expression that starts with `(def' in column zero\n\
694is a tag."; 694is a tag.";
695 695
696static char *Lua_suffixes [] = 696static const char *Lua_suffixes [] =
697 { "lua", "LUA", NULL }; 697 { "lua", "LUA", NULL };
698static char Lua_help [] = 698static const char Lua_help [] =
699"In Lua scripts, all functions are tags."; 699"In Lua scripts, all functions are tags.";
700 700
701static char *Makefile_filenames [] = 701static const char *Makefile_filenames [] =
702 { "Makefile", "makefile", "GNUMakefile", "Makefile.in", "Makefile.am", NULL}; 702 { "Makefile", "makefile", "GNUMakefile", "Makefile.in", "Makefile.am", NULL};
703static char Makefile_help [] = 703static const char Makefile_help [] =
704"In makefiles, targets are tags; additionally, variables are tags\n\ 704"In makefiles, targets are tags; additionally, variables are tags\n\
705unless you specify `--no-globals'."; 705unless you specify `--no-globals'.";
706 706
707static char *Objc_suffixes [] = 707static const char *Objc_suffixes [] =
708 { "lm", /* Objective lex file */ 708 { "lm", /* Objective lex file */
709 "m", /* Objective C file */ 709 "m", /* Objective C file */
710 NULL }; 710 NULL };
711static char Objc_help [] = 711static const char Objc_help [] =
712"In Objective C code, tags include Objective C definitions for classes,\n\ 712"In Objective C code, tags include Objective C definitions for classes,\n\
713class categories, methods and protocols. Tags for variables and\n\ 713class categories, methods and protocols. Tags for variables and\n\
714functions in classes are named `CLASS::VARIABLE' and `CLASS::FUNCTION'.\n\ 714functions in classes are named `CLASS::VARIABLE' and `CLASS::FUNCTION'.\n\
715(Use --help --lang=c --lang=objc --lang=java for full help.)"; 715(Use --help --lang=c --lang=objc --lang=java for full help.)";
716 716
717static char *Pascal_suffixes [] = 717static const char *Pascal_suffixes [] =
718 { "p", "pas", NULL }; 718 { "p", "pas", NULL };
719static char Pascal_help [] = 719static const char Pascal_help [] =
720"In Pascal code, the tags are the functions and procedures defined\n\ 720"In Pascal code, the tags are the functions and procedures defined\n\
721in the file."; 721in the file.";
722/* " // this is for working around an Emacs highlighting bug... */ 722/* " // this is for working around an Emacs highlighting bug... */
723 723
724static char *Perl_suffixes [] = 724static const char *Perl_suffixes [] =
725 { "pl", "pm", NULL }; 725 { "pl", "pm", NULL };
726static char *Perl_interpreters [] = 726static const char *Perl_interpreters [] =
727 { "perl", "@PERL@", NULL }; 727 { "perl", "@PERL@", NULL };
728static char Perl_help [] = 728static const char Perl_help [] =
729"In Perl code, the tags are the packages, subroutines and variables\n\ 729"In Perl code, the tags are the packages, subroutines and variables\n\
730defined by the `package', `sub', `my' and `local' keywords. Use\n\ 730defined by the `package', `sub', `my' and `local' keywords. Use\n\
731`--globals' if you want to tag global variables. Tags for\n\ 731`--globals' if you want to tag global variables. Tags for\n\
732subroutines are named `PACKAGE::SUB'. The name for subroutines\n\ 732subroutines are named `PACKAGE::SUB'. The name for subroutines\n\
733defined in the default package is `main::SUB'."; 733defined in the default package is `main::SUB'.";
734 734
735static char *PHP_suffixes [] = 735static const char *PHP_suffixes [] =
736 { "php", "php3", "php4", NULL }; 736 { "php", "php3", "php4", NULL };
737static char PHP_help [] = 737static const char PHP_help [] =
738"In PHP code, tags are functions, classes and defines. Unless you use\n\ 738"In PHP code, tags are functions, classes and defines. Unless you use\n\
739the `--no-members' option, vars are tags too."; 739the `--no-members' option, vars are tags too.";
740 740
741static char *plain_C_suffixes [] = 741static const char *plain_C_suffixes [] =
742 { "pc", /* Pro*C file */ 742 { "pc", /* Pro*C file */
743 NULL }; 743 NULL };
744 744
745static char *PS_suffixes [] = 745static const char *PS_suffixes [] =
746 { "ps", "psw", NULL }; /* .psw is for PSWrap */ 746 { "ps", "psw", NULL }; /* .psw is for PSWrap */
747static char PS_help [] = 747static const char PS_help [] =
748"In PostScript code, the tags are the functions."; 748"In PostScript code, the tags are the functions.";
749 749
750static char *Prolog_suffixes [] = 750static const char *Prolog_suffixes [] =
751 { "prolog", NULL }; 751 { "prolog", NULL };
752static char Prolog_help [] = 752static const char Prolog_help [] =
753"In Prolog code, tags are predicates and rules at the beginning of\n\ 753"In Prolog code, tags are predicates and rules at the beginning of\n\
754line."; 754line.";
755 755
756static char *Python_suffixes [] = 756static const char *Python_suffixes [] =
757 { "py", NULL }; 757 { "py", NULL };
758static char Python_help [] = 758static const char Python_help [] =
759"In Python code, `def' or `class' at the beginning of a line\n\ 759"In Python code, `def' or `class' at the beginning of a line\n\
760generate a tag."; 760generate a tag.";
761 761
762/* Can't do the `SCM' or `scm' prefix with a version number. */ 762/* Can't do the `SCM' or `scm' prefix with a version number. */
763static char *Scheme_suffixes [] = 763static const char *Scheme_suffixes [] =
764 { "oak", "sch", "scheme", "SCM", "scm", "SM", "sm", "ss", "t", NULL }; 764 { "oak", "sch", "scheme", "SCM", "scm", "SM", "sm", "ss", "t", NULL };
765static char Scheme_help [] = 765static const char Scheme_help [] =
766"In Scheme code, tags include anything defined with `def' or with a\n\ 766"In Scheme code, tags include anything defined with `def' or with a\n\
767construct whose name starts with `def'. They also include\n\ 767construct whose name starts with `def'. They also include\n\
768variables set with `set!' at top level in the file."; 768variables set with `set!' at top level in the file.";
769 769
770static char *TeX_suffixes [] = 770static const char *TeX_suffixes [] =
771 { "bib", "clo", "cls", "ltx", "sty", "TeX", "tex", NULL }; 771 { "bib", "clo", "cls", "ltx", "sty", "TeX", "tex", NULL };
772static char TeX_help [] = 772static const char TeX_help [] =
773"In LaTeX text, the argument of any of the commands `\\chapter',\n\ 773"In LaTeX text, the argument of any of the commands `\\chapter',\n\
774`\\section', `\\subsection', `\\subsubsection', `\\eqno', `\\label',\n\ 774`\\section', `\\subsection', `\\subsubsection', `\\eqno', `\\label',\n\
775`\\ref', `\\cite', `\\bibitem', `\\part', `\\appendix', `\\entry',\n\ 775`\\ref', `\\cite', `\\bibitem', `\\part', `\\appendix', `\\entry',\n\
@@ -781,28 +781,28 @@ Other commands can be specified by setting the environment variable\n\
781 TEXTAGS=\"mycommand:myothercommand\"."; 781 TEXTAGS=\"mycommand:myothercommand\".";
782 782
783 783
784static char *Texinfo_suffixes [] = 784static const char *Texinfo_suffixes [] =
785 { "texi", "texinfo", "txi", NULL }; 785 { "texi", "texinfo", "txi", NULL };
786static char Texinfo_help [] = 786static const char Texinfo_help [] =
787"for texinfo files, lines starting with @node are tagged."; 787"for texinfo files, lines starting with @node are tagged.";
788 788
789static char *Yacc_suffixes [] = 789static const char *Yacc_suffixes [] =
790 { "y", "y++", "ym", "yxx", "yy", NULL }; /* .ym is Objective yacc file */ 790 { "y", "y++", "ym", "yxx", "yy", NULL }; /* .ym is Objective yacc file */
791static char Yacc_help [] = 791static const char Yacc_help [] =
792"In Bison or Yacc input files, each rule defines as a tag the\n\ 792"In Bison or Yacc input files, each rule defines as a tag the\n\
793nonterminal it constructs. The portions of the file that contain\n\ 793nonterminal it constructs. The portions of the file that contain\n\
794C code are parsed as C code (use --help --lang=c --lang=yacc\n\ 794C code are parsed as C code (use --help --lang=c --lang=yacc\n\
795for full help)."; 795for full help).";
796 796
797static char auto_help [] = 797static const char auto_help [] =
798"`auto' is not a real language, it indicates to use\n\ 798"`auto' is not a real language, it indicates to use\n\
799a default language for files base on file name suffix and file contents."; 799a default language for files base on file name suffix and file contents.";
800 800
801static char none_help [] = 801static const char none_help [] =
802"`none' is not a real language, it indicates to only do\n\ 802"`none' is not a real language, it indicates to only do\n\
803regexp processing on files."; 803regexp processing on files.";
804 804
805static char no_lang_help [] = 805static const char no_lang_help [] =
806"No detailed help available for this language."; 806"No detailed help available for this language.";
807 807
808 808
@@ -851,7 +851,7 @@ static void
851print_language_names (void) 851print_language_names (void)
852{ 852{
853 language *lang; 853 language *lang;
854 char **name, **ext; 854 const char **name, **ext;
855 855
856 puts ("\nThese are the currently supported languages, along with the\n\ 856 puts ("\nThese are the currently supported languages, along with the\n\
857default file names and dot suffixes:"); 857default file names and dot suffixes:");
@@ -1467,7 +1467,7 @@ static language *
1467get_language_from_interpreter (char *interpreter) 1467get_language_from_interpreter (char *interpreter)
1468{ 1468{
1469 language *lang; 1469 language *lang;
1470 char **iname; 1470 const char **iname;
1471 1471
1472 if (interpreter == NULL) 1472 if (interpreter == NULL)
1473 return NULL; 1473 return NULL;
@@ -1489,7 +1489,7 @@ static language *
1489get_language_from_filename (char *file, int case_sensitive) 1489get_language_from_filename (char *file, int case_sensitive)
1490{ 1490{
1491 language *lang; 1491 language *lang;
1492 char **name, **ext, *suffix; 1492 const char **name, **ext, *suffix;
1493 1493
1494 /* Try whole file name first. */ 1494 /* Try whole file name first. */
1495 for (lang = lang_names; lang->name != NULL; lang++) 1495 for (lang = lang_names; lang->name != NULL; lang++)
@@ -1721,7 +1721,7 @@ process_file (FILE *fh, char *fn, language *lang)
1721static void 1721static void
1722init (void) 1722init (void)
1723{ 1723{
1724 register char *sp; 1724 register const char *sp;
1725 register int i; 1725 register int i;
1726 1726
1727 for (i = 0; i < CHARS; i++) 1727 for (i = 0; i < CHARS; i++)
@@ -1900,23 +1900,23 @@ find_entries (FILE *inf)
1900 * etags.el needs to use the same characters that are in NONAM. 1900 * etags.el needs to use the same characters that are in NONAM.
1901 */ 1901 */
1902static void 1902static void
1903make_tag (char *name, int namelen, int is_func, char *linestart, int linelen, int lno, long int cno) 1903make_tag (const char *name, /* tag name, or NULL if unnamed */
1904 /* tag name, or NULL if unnamed */ 1904 int namelen, /* tag length */
1905 /* tag length */ 1905 int is_func, /* tag is a function */
1906 /* tag is a function */ 1906 char *linestart, /* start of the line where tag is */
1907 /* start of the line where tag is */ 1907 int linelen, /* length of the line where tag is */
1908 /* length of the line where tag is */ 1908 int lno, /* line number */
1909 /* line number */ 1909 long int cno) /* character number */
1910 /* character number */
1911{ 1910{
1912 bool named = (name != NULL && namelen > 0); 1911 bool named = (name != NULL && namelen > 0);
1912 char *nname = NULL;
1913 1913
1914 if (!CTAGS && named) /* maybe set named to false */ 1914 if (!CTAGS && named) /* maybe set named to false */
1915 /* Let's try to make an implicit tag name, that is, create an unnamed tag 1915 /* Let's try to make an implicit tag name, that is, create an unnamed tag
1916 such that etags.el can guess a name from it. */ 1916 such that etags.el can guess a name from it. */
1917 { 1917 {
1918 int i; 1918 int i;
1919 register char *cp = name; 1919 register const char *cp = name;
1920 1920
1921 for (i = 0; i < namelen; i++) 1921 for (i = 0; i < namelen; i++)
1922 if (notinname (*cp++)) 1922 if (notinname (*cp++))
@@ -1935,10 +1935,9 @@ make_tag (char *name, int namelen, int is_func, char *linestart, int linelen, in
1935 } 1935 }
1936 1936
1937 if (named) 1937 if (named)
1938 name = savenstr (name, namelen); 1938 nname = savenstr (name, namelen);
1939 else 1939
1940 name = NULL; 1940 pfnote (nname, is_func, linestart, linelen, lno, cno);
1941 pfnote (name, is_func, linestart, linelen, lno, cno);
1942} 1941}
1943 1942
1944/* Record a tag. */ 1943/* Record a tag. */
@@ -2361,7 +2360,7 @@ and replace lines between %< and %> with its output, then:
2361/* Command-line: gperf -m 5 */ 2360/* Command-line: gperf -m 5 */
2362/* Computed positions: -k'2-3' */ 2361/* Computed positions: -k'2-3' */
2363 2362
2364struct C_stab_entry { char *name; int c_ext; enum sym_type type; }; 2363struct C_stab_entry { const char *name; int c_ext; enum sym_type type; };
2365/* maximum key range = 33, duplicates = 0 */ 2364/* maximum key range = 33, duplicates = 0 */
2366 2365
2367#ifdef __GNUC__ 2366#ifdef __GNUC__
@@ -2550,7 +2549,7 @@ static enum
2550/* 2549/*
2551 * When objdef is different from onone, objtag is the name of the class. 2550 * When objdef is different from onone, objtag is the name of the class.
2552 */ 2551 */
2553static char *objtag = "<uninited>"; 2552static const char *objtag = "<uninited>";
2554 2553
2555/* 2554/*
2556 * Yet another little state machine to deal with preprocessor lines. 2555 * Yet another little state machine to deal with preprocessor lines.
@@ -2613,7 +2612,7 @@ static struct tok
2613 */ 2612 */
2614static void pushclass_above (int, char *, int); 2613static void pushclass_above (int, char *, int);
2615static void popclass_above (int); 2614static void popclass_above (int);
2616static void write_classname (linebuffer *, char *qualifier); 2615static void write_classname (linebuffer *, const char *qualifier);
2617 2616
2618static struct { 2617static struct {
2619 char **cname; /* nested class names */ 2618 char **cname; /* nested class names */
@@ -2661,7 +2660,7 @@ popclass_above (int bracelev)
2661} 2660}
2662 2661
2663static void 2662static void
2664write_classname (linebuffer *cn, char *qualifier) 2663write_classname (linebuffer *cn, const char *qualifier)
2665{ 2664{
2666 int i, len; 2665 int i, len;
2667 int qlen = strlen (qualifier); 2666 int qlen = strlen (qualifier);
@@ -3092,7 +3091,7 @@ C_entries (int c_ext, FILE *inf)
3092 int curndx, newndx; /* indices for current and new lb */ 3091 int curndx, newndx; /* indices for current and new lb */
3093 register int tokoff; /* offset in line of start of current token */ 3092 register int tokoff; /* offset in line of start of current token */
3094 register int toklen; /* length of current token */ 3093 register int toklen; /* length of current token */
3095 char *qualifier; /* string used to qualify names */ 3094 const char *qualifier; /* string used to qualify names */
3096 int qlen; /* length of qualifier */ 3095 int qlen; /* length of qualifier */
3097 int bracelev; /* current brace level */ 3096 int bracelev; /* current brace level */
3098 int bracketlev; /* current bracket level */ 3097 int bracketlev; /* current bracket level */
@@ -4127,12 +4126,10 @@ Fortran_functions (FILE *inf)
4127 * Philippe Waroquiers (1998) 4126 * Philippe Waroquiers (1998)
4128 */ 4127 */
4129 4128
4130static void Ada_getit (FILE *, char *);
4131
4132/* Once we are positioned after an "interesting" keyword, let's get 4129/* Once we are positioned after an "interesting" keyword, let's get
4133 the real tag value necessary. */ 4130 the real tag value necessary. */
4134static void 4131static void
4135Ada_getit (FILE *inf, char *name_qualifier) 4132Ada_getit (FILE *inf, const char *name_qualifier)
4136{ 4133{
4137 register char *cp; 4134 register char *cp;
4138 char *name; 4135 char *name;
@@ -4961,13 +4958,13 @@ static linebuffer *TEX_toktab = NULL; /* Table with tag tokens */
4961 4958
4962/* Default set of control sequences to put into TEX_toktab. 4959/* Default set of control sequences to put into TEX_toktab.
4963 The value of environment var TEXTAGS is prepended to this. */ 4960 The value of environment var TEXTAGS is prepended to this. */
4964static char *TEX_defenv = "\ 4961static const char *TEX_defenv = "\
4965:chapter:section:subsection:subsubsection:eqno:label:ref:cite:bibitem\ 4962:chapter:section:subsection:subsubsection:eqno:label:ref:cite:bibitem\
4966:part:appendix:entry:index:def\ 4963:part:appendix:entry:index:def\
4967:newcommand:renewcommand:newenvironment:renewenvironment"; 4964:newcommand:renewcommand:newenvironment:renewenvironment";
4968 4965
4969static void TEX_mode (FILE *); 4966static void TEX_mode (FILE *);
4970static void TEX_decode_env (char *, char *); 4967static void TEX_decode_env (const char *, const char *);
4971 4968
4972static char TEX_esc = '\\'; 4969static char TEX_esc = '\\';
4973static char TEX_opgrp = '{'; 4970static char TEX_opgrp = '{';
@@ -5075,9 +5072,9 @@ TEX_mode (FILE *inf)
5075/* Read environment and prepend it to the default string. 5072/* Read environment and prepend it to the default string.
5076 Build token table. */ 5073 Build token table. */
5077static void 5074static void
5078TEX_decode_env (char *evarname, char *defenv) 5075TEX_decode_env (const char *evarname, const char *defenv)
5079{ 5076{
5080 register char *env, *p; 5077 register const char *env, *p;
5081 int i, len; 5078 int i, len;
5082 5079
5083 /* Append default string to environment. */ 5080 /* Append default string to environment. */
@@ -5085,10 +5082,7 @@ TEX_decode_env (char *evarname, char *defenv)
5085 if (!env) 5082 if (!env)
5086 env = defenv; 5083 env = defenv;
5087 else 5084 else
5088 { 5085 env = concat (env, defenv, "");
5089 char *oldenv = env;
5090 env = concat (oldenv, defenv, "");
5091 }
5092 5086
5093 /* Allocate a token table */ 5087 /* Allocate a token table */
5094 for (len = 1, p = env; p;) 5088 for (len = 1, p = env; p;)
@@ -5713,6 +5707,7 @@ add_regex (char *regexp_pattern, language *lang)
5713{ 5707{
5714 static struct re_pattern_buffer zeropattern; 5708 static struct re_pattern_buffer zeropattern;
5715 char sep, *pat, *name, *modifiers; 5709 char sep, *pat, *name, *modifiers;
5710 char empty[] = "";
5716 const char *err; 5711 const char *err;
5717 struct re_pattern_buffer *patbuf; 5712 struct re_pattern_buffer *patbuf;
5718 regexp *rp; 5713 regexp *rp;
@@ -5744,7 +5739,7 @@ add_regex (char *regexp_pattern, language *lang)
5744 if (modifiers == NULL) /* no terminating separator --> no name */ 5739 if (modifiers == NULL) /* no terminating separator --> no name */
5745 { 5740 {
5746 modifiers = name; 5741 modifiers = name;
5747 name = ""; 5742 name = empty;
5748 } 5743 }
5749 else 5744 else
5750 modifiers += 1; /* skip separator */ 5745 modifiers += 1; /* skip separator */
@@ -5972,7 +5967,7 @@ regex_tag_multiline (void)
5972 5967
5973 5968
5974static bool 5969static bool
5975nocase_tail (char *cp) 5970nocase_tail (const char *cp)
5976{ 5971{
5977 register int len = 0; 5972 register int len = 0;
5978 5973
@@ -6289,7 +6284,7 @@ readline (linebuffer *lbp, FILE *stream)
6289 * with xnew where the string CP has been copied. 6284 * with xnew where the string CP has been copied.
6290 */ 6285 */
6291static char * 6286static char *
6292savestr (char *cp) 6287savestr (const char *cp)
6293{ 6288{
6294 return savenstr (cp, strlen (cp)); 6289 return savenstr (cp, strlen (cp));
6295} 6290}
@@ -6299,7 +6294,7 @@ savestr (char *cp)
6299 * the string CP has been copied for at most the first LEN characters. 6294 * the string CP has been copied for at most the first LEN characters.
6300 */ 6295 */
6301static char * 6296static char *
6302savenstr (char *cp, int len) 6297savenstr (const char *cp, int len)
6303{ 6298{
6304 register char *dp; 6299 register char *dp;
6305 6300
@@ -6408,14 +6403,14 @@ skip_non_spaces (char *cp)
6408 6403
6409/* Print error message and exit. */ 6404/* Print error message and exit. */
6410void 6405void
6411fatal (char *s1, char *s2) 6406fatal (const char *s1, const char *s2)
6412{ 6407{
6413 error (s1, s2); 6408 error (s1, s2);
6414 exit (EXIT_FAILURE); 6409 exit (EXIT_FAILURE);
6415} 6410}
6416 6411
6417static void 6412static void
6418pfatal (char *s1) 6413pfatal (const char *s1)
6419{ 6414{
6420 perror (s1); 6415 perror (s1);
6421 exit (EXIT_FAILURE); 6416 exit (EXIT_FAILURE);
@@ -6441,7 +6436,7 @@ error (const char *s1, const char *s2)
6441/* Return a newly-allocated string whose contents 6436/* Return a newly-allocated string whose contents
6442 concatenate those of s1, s2, s3. */ 6437 concatenate those of s1, s2, s3. */
6443static char * 6438static char *
6444concat (char *s1, char *s2, char *s3) 6439concat (const char *s1, const char *s2, const char *s3)
6445{ 6440{
6446 int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); 6441 int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
6447 char *result = xnew (len1 + len2 + len3 + 1, char); 6442 char *result = xnew (len1 + len2 + len3 + 1, char);
diff --git a/lib-src/fakemail.c b/lib-src/fakemail.c
index 72e1b7179c0..16baeb266a8 100644
--- a/lib-src/fakemail.c
+++ b/lib-src/fakemail.c
@@ -30,7 +30,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
30#if defined (BSD_SYSTEM) && !defined (USE_FAKEMAIL) 30#if defined (BSD_SYSTEM) && !defined (USE_FAKEMAIL)
31/* This program isnot used in BSD, so just avoid loader complaints. */ 31/* This program isnot used in BSD, so just avoid loader complaints. */
32int 32int
33main () 33main (void)
34{ 34{
35 return 0; 35 return 0;
36} 36}
@@ -59,6 +59,7 @@ main ()
59#include <ctype.h> 59#include <ctype.h>
60#include <time.h> 60#include <time.h>
61#include <pwd.h> 61#include <pwd.h>
62#include <stdlib.h>
62 63
63/* This is to declare cuserid. */ 64/* This is to declare cuserid. */
64#ifdef HAVE_UNISTD_H 65#ifdef HAVE_UNISTD_H
@@ -140,21 +141,16 @@ struct linebuffer lb;
140#define MAIL_PROGRAM_NAME "/bin/mail" 141#define MAIL_PROGRAM_NAME "/bin/mail"
141#endif 142#endif
142 143
143static char *my_name; 144static const char *my_name;
144static char *the_date; 145static char *the_date;
145static char *the_user; 146static char *the_user;
146static line_list file_preface; 147static line_list file_preface;
147static stream_list the_streams; 148static stream_list the_streams;
148static boolean no_problems = true; 149static boolean no_problems = true;
149 150
150static void fatal (char *s1) NO_RETURN; 151static void fatal (const char *s1) NO_RETURN;
151
152extern FILE *popen (const char *, const char *);
153extern int fclose (FILE *), pclose (FILE *);
154 152
155#ifdef CURRENT_USER 153#ifdef CURRENT_USER
156extern struct passwd *getpwuid ();
157extern unsigned short geteuid ();
158static struct passwd *my_entry; 154static struct passwd *my_entry;
159#define cuserid(s) \ 155#define cuserid(s) \
160(my_entry = getpwuid (((int) geteuid ())), \ 156(my_entry = getpwuid (((int) geteuid ())), \
@@ -166,7 +162,7 @@ static struct passwd *my_entry;
166/* Print error message. `s1' is printf control string, `s2' is arg for it. */ 162/* Print error message. `s1' is printf control string, `s2' is arg for it. */
167 163
168static void 164static void
169error (char *s1, char *s2) 165error (const char *s1, const char *s2)
170{ 166{
171 printf ("%s: ", my_name); 167 printf ("%s: ", my_name);
172 printf (s1, s2); 168 printf (s1, s2);
@@ -177,7 +173,7 @@ error (char *s1, char *s2)
177/* Print error message and exit. */ 173/* Print error message and exit. */
178 174
179static void 175static void
180fatal (char *s1) 176fatal (const char *s1)
181{ 177{
182 error ("%s", s1); 178 error ("%s", s1);
183 exit (EXIT_FAILURE); 179 exit (EXIT_FAILURE);
@@ -464,20 +460,20 @@ put_string (char *s)
464} 460}
465 461
466void 462void
467put_line (char *string) 463put_line (const char *string)
468{ 464{
469 register stream_list rem; 465 register stream_list rem;
470 for (rem = the_streams; 466 for (rem = the_streams;
471 rem != ((stream_list) NULL); 467 rem != ((stream_list) NULL);
472 rem = rem->rest_streams) 468 rem = rem->rest_streams)
473 { 469 {
474 char *s = string; 470 const char *s = string;
475 int column = 0; 471 int column = 0;
476 472
477 /* Divide STRING into lines. */ 473 /* Divide STRING into lines. */
478 while (*s != 0) 474 while (*s != 0)
479 { 475 {
480 char *breakpos; 476 const char *breakpos;
481 477
482 /* Find the last char that fits. */ 478 /* Find the last char that fits. */
483 for (breakpos = s; *breakpos && column < 78; ++breakpos) 479 for (breakpos = s; *breakpos && column < 78; ++breakpos)
@@ -699,13 +695,11 @@ main (int argc, char **argv)
699 char *command_line; 695 char *command_line;
700 header the_header; 696 header the_header;
701 long name_length; 697 long name_length;
702 char *mail_program_name; 698 const char *mail_program_name;
703 char buf[BUFLEN + 1]; 699 char buf[BUFLEN + 1];
704 register int size; 700 register int size;
705 FILE *the_pipe; 701 FILE *the_pipe;
706 702
707 extern char *getenv (const char *);
708
709 mail_program_name = getenv ("FAKEMAILER"); 703 mail_program_name = getenv ("FAKEMAILER");
710 if (!(mail_program_name && *mail_program_name)) 704 if (!(mail_program_name && *mail_program_name))
711 mail_program_name = MAIL_PROGRAM_NAME; 705 mail_program_name = MAIL_PROGRAM_NAME;
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c
index 7fe63bed506..4824731672b 100644
--- a/lib-src/make-docfile.c
+++ b/lib-src/make-docfile.c
@@ -68,9 +68,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
68#endif 68#endif
69 69
70int scan_file (char *filename); 70int scan_file (char *filename);
71int scan_lisp_file (char *filename, char *mode); 71int scan_lisp_file (const char *filename, const char *mode);
72int scan_c_file (char *filename, char *mode); 72int scan_c_file (char *filename, const char *mode);
73void fatal (char *s1, char *s2) NO_RETURN; 73void fatal (const char *s1, const char *s2) NO_RETURN;
74 74
75#ifdef MSDOS 75#ifdef MSDOS
76/* s/msdos.h defines this as sys_chdir, but we're not linking with the 76/* s/msdos.h defines this as sys_chdir, but we're not linking with the
@@ -92,7 +92,7 @@ char *progname;
92 92
93/* VARARGS1 */ 93/* VARARGS1 */
94void 94void
95error (char *s1, char *s2) 95error (const char *s1, const char *s2)
96{ 96{
97 fprintf (stderr, "%s: ", progname); 97 fprintf (stderr, "%s: ", progname);
98 fprintf (stderr, s1, s2); 98 fprintf (stderr, s1, s2);
@@ -103,7 +103,7 @@ error (char *s1, char *s2)
103 103
104/* VARARGS1 */ 104/* VARARGS1 */
105void 105void
106fatal (char *s1, char *s2) 106fatal (const char *s1, const char *s2)
107{ 107{
108 error (s1, s2); 108 error (s1, s2);
109 exit (EXIT_FAILURE); 109 exit (EXIT_FAILURE);
@@ -233,10 +233,10 @@ struct rcsoc_state
233 233
234 /* A keyword we look for at the beginning of lines. If found, it is 234 /* A keyword we look for at the beginning of lines. If found, it is
235 not copied, and SAW_KEYWORD is set to true. */ 235 not copied, and SAW_KEYWORD is set to true. */
236 char *keyword; 236 const char *keyword;
237 /* The current point we've reached in an occurrence of KEYWORD in 237 /* The current point we've reached in an occurrence of KEYWORD in
238 the input stream. */ 238 the input stream. */
239 char *cur_keyword_ptr; 239 const char *cur_keyword_ptr;
240 /* Set to true if we saw an occurrence of KEYWORD. */ 240 /* Set to true if we saw an occurrence of KEYWORD. */
241 int saw_keyword; 241 int saw_keyword;
242}; 242};
@@ -326,7 +326,7 @@ scan_keyword_or_put_char (int ch, struct rcsoc_state *state)
326 keyword, but it was a false alarm. Output the 326 keyword, but it was a false alarm. Output the
327 part we scanned. */ 327 part we scanned. */
328 { 328 {
329 char *p; 329 const char *p;
330 330
331 for (p = state->keyword; p < state->cur_keyword_ptr; p++) 331 for (p = state->keyword; p < state->cur_keyword_ptr; p++)
332 put_char (*p, state); 332 put_char (*p, state);
@@ -521,7 +521,7 @@ write_c_args (FILE *out, char *func, char *buf, int minargs, int maxargs)
521 Accepts any word starting DEF... so it finds DEFSIMPLE and DEFPRED. */ 521 Accepts any word starting DEF... so it finds DEFSIMPLE and DEFPRED. */
522 522
523int 523int
524scan_c_file (char *filename, char *mode) 524scan_c_file (char *filename, const char *mode)
525{ 525{
526 FILE *infile; 526 FILE *infile;
527 register int c; 527 register int c;
@@ -834,7 +834,7 @@ read_lisp_symbol (FILE *infile, char *buffer)
834} 834}
835 835
836int 836int
837scan_lisp_file (char *filename, char *mode) 837scan_lisp_file (const char *filename, const char *mode)
838{ 838{
839 FILE *infile; 839 FILE *infile;
840 register int c; 840 register int c;
diff --git a/lib-src/movemail.c b/lib-src/movemail.c
index bb4a922014c..4ccdc93688c 100644
--- a/lib-src/movemail.c
+++ b/lib-src/movemail.c
@@ -147,11 +147,11 @@ static char *mail_spool_name ();
147char *strerror (int); 147char *strerror (int);
148#endif 148#endif
149 149
150static void fatal (char *s1, char *s2, char *s3) NO_RETURN; 150static void fatal (const char *s1, const char *s2, const char *s3) NO_RETURN;
151static void error (char *s1, char *s2, char *s3); 151static void error (const char *s1, const char *s2, const char *s3);
152static void pfatal_with_name (char *name) NO_RETURN; 152static void pfatal_with_name (char *name) NO_RETURN;
153static void pfatal_and_delete (char *name) NO_RETURN; 153static void pfatal_and_delete (char *name) NO_RETURN;
154static char *concat (char *s1, char *s2, char *s3); 154static char *concat (const char *s1, const char *s2, const char *s3);
155static long *xmalloc (unsigned int size); 155static long *xmalloc (unsigned int size);
156#ifdef MAIL_USE_POP 156#ifdef MAIL_USE_POP
157static int popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order); 157static int popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order);
@@ -589,7 +589,7 @@ mail_spool_name (inname)
589/* Print error message and exit. */ 589/* Print error message and exit. */
590 590
591static void 591static void
592fatal (char *s1, char *s2, char *s3) 592fatal (const char *s1, const char *s2, const char *s3)
593{ 593{
594 if (delete_lockname) 594 if (delete_lockname)
595 unlink (delete_lockname); 595 unlink (delete_lockname);
@@ -601,7 +601,7 @@ fatal (char *s1, char *s2, char *s3)
601 are args for it or null. */ 601 are args for it or null. */
602 602
603static void 603static void
604error (char *s1, char *s2, char *s3) 604error (const char *s1, const char *s2, const char *s3)
605{ 605{
606 fprintf (stderr, "movemail: "); 606 fprintf (stderr, "movemail: ");
607 if (s3) 607 if (s3)
@@ -630,7 +630,7 @@ pfatal_and_delete (char *name)
630/* Return a newly-allocated string whose contents concatenate those of s1, s2, s3. */ 630/* Return a newly-allocated string whose contents concatenate those of s1, s2, s3. */
631 631
632static char * 632static char *
633concat (char *s1, char *s2, char *s3) 633concat (const char *s1, const char *s2, const char *s3)
634{ 634{
635 int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); 635 int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
636 char *result = (char *) xmalloc (len1 + len2 + len3 + 1); 636 char *result = (char *) xmalloc (len1 + len2 + len3 + 1);
diff --git a/lib-src/pop.c b/lib-src/pop.c
index 26a992fa0b0..9eabbd2041e 100644
--- a/lib-src/pop.c
+++ b/lib-src/pop.c
@@ -110,7 +110,7 @@ extern int h_errno;
110 110
111static int socket_connection (char *, int); 111static int socket_connection (char *, int);
112static int pop_getline (popserver, char **); 112static int pop_getline (popserver, char **);
113static int sendline (popserver, char *); 113static int sendline (popserver, const char *);
114static int fullwrite (int, char *, int); 114static int fullwrite (int, char *, int);
115static int getok (popserver); 115static int getok (popserver);
116#if 0 116#if 0
@@ -676,7 +676,7 @@ pop_top_flush (popserver server)
676} 676}
677 677
678int 678int
679pop_multi_first (popserver server, char *command, char **response) 679pop_multi_first (popserver server, const char *command, char **response)
680{ 680{
681 if (server->in_multi) 681 if (server->in_multi)
682 { 682 {
@@ -988,7 +988,7 @@ socket_connection (char *host, int flags)
988 struct servent *servent; 988 struct servent *servent;
989 struct sockaddr_in addr; 989 struct sockaddr_in addr;
990 char found_port = 0; 990 char found_port = 0;
991 char *service; 991 const char *service;
992 int sock; 992 int sock;
993 char *realhost; 993 char *realhost;
994#ifdef KERBEROS 994#ifdef KERBEROS
@@ -1414,7 +1414,7 @@ pop_getline (popserver server, char **line)
1414 * Side effects: Closes the connection on error. 1414 * Side effects: Closes the connection on error.
1415 */ 1415 */
1416static int 1416static int
1417sendline (popserver server, char *line) 1417sendline (popserver server, const char *line)
1418{ 1418{
1419#define SENDLINE_ERROR "Error writing to POP server: " 1419#define SENDLINE_ERROR "Error writing to POP server: "
1420 int ret; 1420 int ret;
diff --git a/lib-src/pop.h b/lib-src/pop.h
index 4b6853e77c8..2ba3fab83a0 100644
--- a/lib-src/pop.h
+++ b/lib-src/pop.h
@@ -49,39 +49,31 @@ typedef struct _popserver *popserver;
49#define POP_NO_HESIOD (1<<1) 49#define POP_NO_HESIOD (1<<1)
50#define POP_NO_GETPASS (1<<2) 50#define POP_NO_GETPASS (1<<2)
51 51
52#ifdef __STDC__ 52extern popserver pop_open (char *host, char *username, char *password,
53#define _ARGS(a) a 53 int flags);
54#else 54extern int pop_stat (popserver server, int *count, int *size);
55#define _ARGS(a) () 55extern int pop_list (popserver server, int message, int **IDs,
56#endif 56 int **size);
57 57extern int pop_retrieve (popserver server, int message, int markfrom,
58extern popserver pop_open _ARGS((char *host, char *username, char *password, 58 char **);
59 int flags)); 59extern int pop_retrieve_first (popserver server, int message,
60extern int pop_stat _ARGS((popserver server, int *count, int *size)); 60 char **response);
61extern int pop_list _ARGS((popserver server, int message, int **IDs, 61extern int pop_retrieve_next (popserver server, char **line);
62 int **size)); 62extern int pop_retrieve_flush (popserver server);
63extern int pop_retrieve _ARGS((popserver server, int message, int markfrom, 63extern int pop_top_first (popserver server, int message, int lines,
64 char **)); 64 char **response);
65extern int pop_retrieve_first _ARGS((popserver server, int message, 65extern int pop_top_next (popserver server, char **line);
66 char **response)); 66extern int pop_top_flush (popserver server);
67extern int pop_retrieve_next _ARGS((popserver server, char **line)); 67extern int pop_multi_first (popserver server, const char *command,
68extern int pop_retrieve_flush _ARGS((popserver server)); 68 char **response);
69extern int pop_top_first _ARGS((popserver server, int message, int lines, 69extern int pop_multi_next (popserver server, char **line);
70 char **response)); 70extern int pop_multi_flush (popserver server);
71extern int pop_top_next _ARGS((popserver server, char **line)); 71extern int pop_delete (popserver server, int message);
72extern int pop_top_flush _ARGS((popserver server)); 72extern int pop_noop (popserver server);
73extern int pop_multi_first _ARGS((popserver server, char *command, 73extern int pop_last (popserver server);
74 char **response)); 74extern int pop_reset (popserver server);
75extern int pop_multi_next _ARGS((popserver server, char **line)); 75extern int pop_quit (popserver server);
76extern int pop_multi_flush _ARGS((popserver server)); 76extern void pop_close (popserver);
77extern int pop_delete _ARGS((popserver server, int message));
78extern int pop_noop _ARGS((popserver server));
79extern int pop_last _ARGS((popserver server));
80extern int pop_reset _ARGS((popserver server));
81extern int pop_quit _ARGS((popserver server));
82extern void pop_close _ARGS((popserver));
83
84#undef _ARGS
85 77
86/* arch-tag: 76cc5f58-8e86-48fa-bc72-a7c6cb1c4f1c 78/* arch-tag: 76cc5f58-8e86-48fa-bc72-a7c6cb1c4f1c
87 (do not change this comment) */ 79 (do not change this comment) */
diff --git a/lib-src/sorted-doc.c b/lib-src/sorted-doc.c
index 595633b76d8..db3f3029532 100644
--- a/lib-src/sorted-doc.c
+++ b/lib-src/sorted-doc.c
@@ -65,7 +65,7 @@ struct docstr /* Allocated thing for an entry. */
65/* Print error message. `s1' is printf control string, `s2' is arg for it. */ 65/* Print error message. `s1' is printf control string, `s2' is arg for it. */
66 66
67void 67void
68error (char *s1, char *s2) 68error (const char *s1, const char *s2)
69{ 69{
70 fprintf (stderr, "sorted-doc: "); 70 fprintf (stderr, "sorted-doc: ");
71 fprintf (stderr, s1, s2); 71 fprintf (stderr, s1, s2);
@@ -75,7 +75,7 @@ error (char *s1, char *s2)
75/* Print error message and exit. */ 75/* Print error message and exit. */
76 76
77void 77void
78fatal (char *s1, char *s2) 78fatal (const char *s1, const char *s2)
79{ 79{
80 error (s1, s2); 80 error (s1, s2);
81 exit (EXIT_FAILURE); 81 exit (EXIT_FAILURE);
@@ -117,7 +117,7 @@ enum state
117 WAITING, BEG_NAME, NAME_GET, BEG_DESC, DESC_GET 117 WAITING, BEG_NAME, NAME_GET, BEG_DESC, DESC_GET
118}; 118};
119 119
120char *states[] = 120const char *states[] =
121{ 121{
122 "WAITING", "BEG_NAME", "NAME_GET", "BEG_DESC", "DESC_GET" 122 "WAITING", "BEG_NAME", "NAME_GET", "BEG_DESC", "DESC_GET"
123}; 123};
diff --git a/lib-src/update-game-score.c b/lib-src/update-game-score.c
index 30208d5c8d2..b8e1147d1c1 100644
--- a/lib-src/update-game-score.c
+++ b/lib-src/update-game-score.c
@@ -157,8 +157,8 @@ get_user_id (void)
157 return buf->pw_name; 157 return buf->pw_name;
158} 158}
159 159
160char * 160const char *
161get_prefix (int running_suid, char *user_prefix) 161get_prefix (int running_suid, const char *user_prefix)
162{ 162{
163 if (!running_suid && user_prefix == NULL) 163 if (!running_suid && user_prefix == NULL)
164 lose ("Not using a shared game directory, and no prefix given."); 164 lose ("Not using a shared game directory, and no prefix given.");
@@ -178,7 +178,8 @@ main (int argc, char **argv)
178{ 178{
179 int c, running_suid; 179 int c, running_suid;
180 void *lockstate; 180 void *lockstate;
181 char *user_id, *scorefile, *prefix, *user_prefix = NULL; 181 char *user_id, *scorefile;
182 const char *prefix, *user_prefix = NULL;
182 struct stat buf; 183 struct stat buf;
183 struct score_entry *scores; 184 struct score_entry *scores;
184 int newscore, scorecount, reverse = 0, max = MAX_SCORES; 185 int newscore, scorecount, reverse = 0, max = MAX_SCORES;
@@ -451,7 +452,7 @@ lock_file (const char *filename, void **state)
451 int fd; 452 int fd;
452 struct stat buf; 453 struct stat buf;
453 int attempts = 0; 454 int attempts = 0;
454 char *lockext = ".lockfile"; 455 const char *lockext = ".lockfile";
455 char *lockpath = malloc (strlen (filename) + strlen (lockext) + 60); 456 char *lockpath = malloc (strlen (filename) + strlen (lockext) + 60);
456 if (!lockpath) 457 if (!lockpath)
457 return -1; 458 return -1;