diff options
| author | Stefan Monnier | 2010-09-13 16:40:48 +0200 |
|---|---|---|
| committer | Stefan Monnier | 2010-09-13 16:40:48 +0200 |
| commit | cc390e46c7ba95b76ea133d98fd386214cd01709 (patch) | |
| tree | ead4400d22bd07214b782ff7e46e79d473fac419 /lib-src | |
| parent | c566235d981eba73c88bbff00b6a1d88360b6e9f (diff) | |
| parent | c5fe4acb5fb456d6e8e147d8bc7981ce56c5c03d (diff) | |
| download | emacs-cc390e46c7ba95b76ea133d98fd386214cd01709.tar.gz emacs-cc390e46c7ba95b76ea133d98fd386214cd01709.zip | |
Merge from trunk
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/ChangeLog | 51 | ||||
| -rw-r--r-- | lib-src/b2m.c | 11 | ||||
| -rw-r--r-- | lib-src/ebrowse.c | 36 | ||||
| -rw-r--r-- | lib-src/emacsclient.c | 27 | ||||
| -rw-r--r-- | lib-src/etags.c | 213 | ||||
| -rw-r--r-- | lib-src/fakemail.c | 26 | ||||
| -rw-r--r-- | lib-src/make-docfile.c | 20 | ||||
| -rw-r--r-- | lib-src/movemail.c | 12 | ||||
| -rw-r--r-- | lib-src/pop.c | 8 | ||||
| -rw-r--r-- | lib-src/pop.h | 58 | ||||
| -rw-r--r-- | lib-src/sorted-doc.c | 6 | ||||
| -rw-r--r-- | lib-src/update-game-score.c | 9 |
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 @@ | |||
| 1 | 2010-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 | |||
| 1 | 2010-08-07 Juanma Barranquero <lekktu@gmail.com> | 52 | 2010-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 | ||
| 69 | long *xmalloc (unsigned int size); | 69 | long *xmalloc (unsigned int size); |
| 70 | long *xrealloc (char *ptr, unsigned int size); | 70 | long *xrealloc (char *ptr, unsigned int size); |
| 71 | char *concat (char *s1, char *s2, char *s3); | 71 | char *concat (const char *s1, const char *s2, const char *s3); |
| 72 | long readline (struct linebuffer *linebuffer, register FILE *stream); | 72 | long readline (struct linebuffer *linebuffer, register FILE *stream); |
| 73 | void fatal (char *message) NO_RETURN; | 73 | void 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 | */ |
| 220 | char * | 221 | char * |
| 221 | concat (char *s1, char *s2, char *s3) | 222 | concat (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 | ||
| 307 | void | 308 | void |
| 308 | fatal (char *message) | 309 | fatal (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 | ||
| 356 | char *filename; | 356 | const 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 | ||
| 445 | struct kw | 445 | struct 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; | |||
| 470 | int yylex (void); | 470 | int yylex (void); |
| 471 | void yyparse (void); | 471 | void yyparse (void); |
| 472 | void re_init_parser (void); | 472 | void re_init_parser (void); |
| 473 | char *token_string (int); | 473 | const char *token_string (int); |
| 474 | char *matching_regexp (void); | 474 | char *matching_regexp (void); |
| 475 | void init_sym (void); | 475 | void init_sym (void); |
| 476 | struct sym *add_sym (char *, struct sym *); | 476 | struct sym *add_sym (const char *, struct sym *); |
| 477 | void add_link (struct sym *, struct sym *); | 477 | void add_link (struct sym *, struct sym *); |
| 478 | void add_member_defn (struct sym *, char *, char *, | 478 | void 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); | |||
| 489 | void leave_namespace (void); | 489 | void leave_namespace (void); |
| 490 | void enter_namespace (char *); | 490 | void enter_namespace (char *); |
| 491 | void register_namespace_alias (char *, struct link *); | 491 | void register_namespace_alias (char *, struct link *); |
| 492 | void insert_keyword (char *, int); | 492 | void insert_keyword (const char *, int); |
| 493 | void re_init_scanner (void); | 493 | void re_init_scanner (void); |
| 494 | void init_scanner (void); | 494 | void init_scanner (void); |
| 495 | void process_file (char *); | 495 | void process_file (char *); |
| @@ -517,7 +517,7 @@ struct sym *parse_classname (void); | |||
| 517 | struct sym *parse_qualified_ident_or_type (char **); | 517 | struct sym *parse_qualified_ident_or_type (char **); |
| 518 | void parse_qualified_param_ident_or_type (char **); | 518 | void parse_qualified_param_ident_or_type (char **); |
| 519 | int globals (int); | 519 | int globals (int); |
| 520 | void yyerror (char *, char *); | 520 | void yyerror (const char *, const char *); |
| 521 | void usage (int) NO_RETURN; | 521 | void usage (int) NO_RETURN; |
| 522 | void version (void) NO_RETURN; | 522 | void 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 | ||
| 533 | void | 533 | void |
| 534 | yyerror (char *format, char *s) | 534 | yyerror (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 | ||
| 607 | struct sym * | 607 | struct sym * |
| 608 | add_sym (char *name, struct sym *nested_in_class) | 608 | add_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 | ||
| 1978 | char * | 1978 | const char * |
| 1979 | token_string (int t) | 1979 | token_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 | ||
| 2113 | void | 2113 | void |
| 2114 | insert_keyword (char *name, int tk) | 2114 | insert_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; | |||
| 134 | int current_frame = 1; | 134 | int current_frame = 1; |
| 135 | 135 | ||
| 136 | /* The display on which Emacs should work. --display. */ | 136 | /* The display on which Emacs should work. --display. */ |
| 137 | char *display = NULL; | 137 | const 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. */ |
| 140 | char *parent_id = NULL; | 140 | char *parent_id = NULL; |
| @@ -150,7 +150,7 @@ const char *alternate_editor = NULL; | |||
| 150 | char *socket_name = NULL; | 150 | char *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. */ |
| 153 | char *server_file = NULL; | 153 | const char *server_file = NULL; |
| 154 | 154 | ||
| 155 | /* PID of the Emacs server process. */ | 155 | /* PID of the Emacs server process. */ |
| 156 | int emacs_pid = 0; | 156 | int 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. */ |
| 481 | void | 481 | void |
| 482 | message (int is_error, char *message, ...) | 482 | message (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. */ |
| 726 | void | 726 | void |
| 727 | sock_err_message (char *function_name) | 727 | sock_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. */ |
| 750 | void | 750 | void |
| 751 | send_to_emacs (HSOCKET s, char *data) | 751 | send_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. */ |
| 789 | void | 789 | void |
| 790 | quote_argument (HSOCKET s, char *str) | 790 | quote_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. */ |
| 1028 | static int | 1029 | static int |
| 1029 | strprefix (char *prefix, char *string) | 1030 | strprefix (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 | ||
| 273 | typedef struct | 273 | typedef 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 | ||
| 279 | typedef struct | 279 | typedef 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 *); | |||
| 399 | static language *get_language_from_filename (char *, bool); | 399 | static language *get_language_from_filename (char *, bool); |
| 400 | static void readline (linebuffer *, FILE *); | 400 | static void readline (linebuffer *, FILE *); |
| 401 | static long readline_internal (linebuffer *, FILE *); | 401 | static long readline_internal (linebuffer *, FILE *); |
| 402 | static bool nocase_tail (char *); | 402 | static bool nocase_tail (const char *); |
| 403 | static void get_tag (char *, char **); | 403 | static void get_tag (char *, char **); |
| 404 | 404 | ||
| 405 | static void analyse_regex (char *); | 405 | static void analyse_regex (char *); |
| @@ -407,8 +407,8 @@ static void free_regexps (void); | |||
| 407 | static void regex_tag_multiline (void); | 407 | static void regex_tag_multiline (void); |
| 408 | static void error (const char *, const char *); | 408 | static void error (const char *, const char *); |
| 409 | static void suggest_asking_for_help (void) NO_RETURN; | 409 | static void suggest_asking_for_help (void) NO_RETURN; |
| 410 | void fatal (char *, char *) NO_RETURN; | 410 | void fatal (const char *, const char *) NO_RETURN; |
| 411 | static void pfatal (char *) NO_RETURN; | 411 | static void pfatal (const char *) NO_RETURN; |
| 412 | static void add_node (node *, node **); | 412 | static void add_node (node *, node **); |
| 413 | 413 | ||
| 414 | static void init (void); | 414 | static void init (void); |
| @@ -418,15 +418,15 @@ static void find_entries (FILE *); | |||
| 418 | static void free_tree (node *); | 418 | static void free_tree (node *); |
| 419 | static void free_fdesc (fdesc *); | 419 | static void free_fdesc (fdesc *); |
| 420 | static void pfnote (char *, bool, char *, int, int, long); | 420 | static void pfnote (char *, bool, char *, int, int, long); |
| 421 | static void make_tag (char *, int, bool, char *, int, int, long); | 421 | static void make_tag (const char *, int, bool, char *, int, int, long); |
| 422 | static void invalidate_nodes (fdesc *, node **); | 422 | static void invalidate_nodes (fdesc *, node **); |
| 423 | static void put_entries (node *); | 423 | static void put_entries (node *); |
| 424 | 424 | ||
| 425 | static char *concat (char *, char *, char *); | 425 | static char *concat (const char *, const char *, const char *); |
| 426 | static char *skip_spaces (char *); | 426 | static char *skip_spaces (char *); |
| 427 | static char *skip_non_spaces (char *); | 427 | static char *skip_non_spaces (char *); |
| 428 | static char *savenstr (char *, int); | 428 | static char *savenstr (const char *, int); |
| 429 | static char *savestr (char *); | 429 | static char *savestr (const char *); |
| 430 | static char *etags_strchr (const char *, int); | 430 | static char *etags_strchr (const char *, int); |
| 431 | static char *etags_strrchr (const char *, int); | 431 | static char *etags_strrchr (const char *, int); |
| 432 | static int etags_strcasecmp (const char *, const char *); | 432 | static 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) */ |
| 471 | static bool _wht[CHARS], _nin[CHARS], _itk[CHARS], _btk[CHARS], _etk[CHARS]; | 471 | static bool _wht[CHARS], _nin[CHARS], _itk[CHARS], _btk[CHARS], _etk[CHARS]; |
| 472 | static char | 472 | static 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 */ |
| 572 | static char *Ada_suffixes [] = | 572 | static const char *Ada_suffixes [] = |
| 573 | { "ads", "adb", "ada", NULL }; | 573 | { "ads", "adb", "ada", NULL }; |
| 574 | static char Ada_help [] = | 574 | static 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\ |
| 576 | tags. Use the `--packages-only' option to create tags for\n\ | 576 | tags. Use the `--packages-only' option to create tags for\n\ |
| 577 | packages only.\n\ | 577 | packages only.\n\ |
| @@ -589,7 +589,7 @@ body of the package `bidule', while `M-x find-tag <RET> bidule <RET>'\n\ | |||
| 589 | will just search for any tag `bidule'."; | 589 | will just search for any tag `bidule'."; |
| 590 | 590 | ||
| 591 | /* Assembly code */ | 591 | /* Assembly code */ |
| 592 | static char *Asm_suffixes [] = | 592 | static 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 | }; |
| 603 | static char Asm_help [] = | 603 | static 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\ |
| 605 | followed by a colon, are tags."; | 605 | followed 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. */ |
| 611 | static char *default_C_suffixes [] = | 611 | static 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 */ |
| 614 | static char default_C_help [] = | 614 | static 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\ |
| 616 | Use -T to tag definitions of `struct', `union' and `enum'.\n\ | 616 | Use -T to tag definitions of `struct', `union' and `enum'.\n\ |
| 617 | Use -d to tag `#define' macro definitions and `enum' constants.\n\ | 617 | Use -d to tag `#define' macro definitions and `enum' constants.\n\ |
| @@ -619,7 +619,7 @@ Use --globals to tag global variables.\n\ | |||
| 619 | You can tag function declarations and external variables by\n\ | 619 | You can tag function declarations and external variables by\n\ |
| 620 | using `--declarations', and struct members by using `--members'."; | 620 | using `--declarations', and struct members by using `--members'."; |
| 621 | #else /* C help for Etags */ | 621 | #else /* C help for Etags */ |
| 622 | static char default_C_help [] = | 622 | static 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\ |
| 624 | definitions of `struct', `union' and `enum'. `#define' macro\n\ | 624 | definitions of `struct', `union' and `enum'. `#define' macro\n\ |
| 625 | definitions and `enum' constants are tags unless you specify\n\ | 625 | definitions and `enum' constants are tags unless you specify\n\ |
| @@ -631,12 +631,12 @@ You can tag function declarations and external variables by\n\ | |||
| 631 | using `--declarations'."; | 631 | using `--declarations'."; |
| 632 | #endif /* C help for Ctags and Etags */ | 632 | #endif /* C help for Ctags and Etags */ |
| 633 | 633 | ||
| 634 | static char *Cplusplus_suffixes [] = | 634 | static 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 }; |
| 639 | static char Cplusplus_help [] = | 639 | static 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\ |
| 642 | In addition to C tags, member functions are also recognized. Member\n\ | 642 | In 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\ | |||
| 645 | and `CLASS::FUNCTION'. `operator' definitions have tag names like\n\ | 645 | and `CLASS::FUNCTION'. `operator' definitions have tag names like\n\ |
| 646 | `operator+'."; | 646 | `operator+'."; |
| 647 | 647 | ||
| 648 | static char *Cjava_suffixes [] = | 648 | static const char *Cjava_suffixes [] = |
| 649 | { "java", NULL }; | 649 | { "java", NULL }; |
| 650 | static char Cjava_help [] = | 650 | static 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\ |
| 652 | tagged. (Use --help --lang=c --lang=c++ --lang=java for full help.)"; | 652 | tagged. (Use --help --lang=c --lang=c++ --lang=java for full help.)"; |
| 653 | 653 | ||
| 654 | 654 | ||
| 655 | static char *Cobol_suffixes [] = | 655 | static const char *Cobol_suffixes [] = |
| 656 | { "COB", "cob", NULL }; | 656 | { "COB", "cob", NULL }; |
| 657 | static char Cobol_help [] = | 657 | static 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\ |
| 659 | starting in column 8 and followed by a period."; | 659 | starting in column 8 and followed by a period."; |
| 660 | 660 | ||
| 661 | static char *Cstar_suffixes [] = | 661 | static const char *Cstar_suffixes [] = |
| 662 | { "cs", "hs", NULL }; | 662 | { "cs", "hs", NULL }; |
| 663 | 663 | ||
| 664 | static char *Erlang_suffixes [] = | 664 | static const char *Erlang_suffixes [] = |
| 665 | { "erl", "hrl", NULL }; | 665 | { "erl", "hrl", NULL }; |
| 666 | static char Erlang_help [] = | 666 | static 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\ |
| 668 | defined in the file."; | 668 | defined in the file."; |
| 669 | 669 | ||
| 670 | char *Forth_suffixes [] = | 670 | const char *Forth_suffixes [] = |
| 671 | { "fth", "tok", NULL }; | 671 | { "fth", "tok", NULL }; |
| 672 | static char Forth_help [] = | 672 | static const char Forth_help [] = |
| 673 | "In Forth code, tags are words defined by `:',\n\ | 673 | "In Forth code, tags are words defined by `:',\n\ |
| 674 | constant, code, create, defer, value, variable, buffer:, field."; | 674 | constant, code, create, defer, value, variable, buffer:, field."; |
| 675 | 675 | ||
| 676 | static char *Fortran_suffixes [] = | 676 | static const char *Fortran_suffixes [] = |
| 677 | { "F", "f", "f90", "for", NULL }; | 677 | { "F", "f", "f90", "for", NULL }; |
| 678 | static char Fortran_help [] = | 678 | static 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 | ||
| 681 | static char *HTML_suffixes [] = | 681 | static const char *HTML_suffixes [] = |
| 682 | { "htm", "html", "shtml", NULL }; | 682 | { "htm", "html", "shtml", NULL }; |
| 683 | static char HTML_help [] = | 683 | static 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\ |
| 686 | occurrences of `id='."; | 686 | occurrences of `id='."; |
| 687 | 687 | ||
| 688 | static char *Lisp_suffixes [] = | 688 | static const char *Lisp_suffixes [] = |
| 689 | { "cl", "clisp", "el", "l", "lisp", "LSP", "lsp", "ml", NULL }; | 689 | { "cl", "clisp", "el", "l", "lisp", "LSP", "lsp", "ml", NULL }; |
| 690 | static char Lisp_help [] = | 690 | static 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\ |
| 692 | defined with `defvar' or `defconst', and in general the first\n\ | 692 | defined with `defvar' or `defconst', and in general the first\n\ |
| 693 | argument of any expression that starts with `(def' in column zero\n\ | 693 | argument of any expression that starts with `(def' in column zero\n\ |
| 694 | is a tag."; | 694 | is a tag."; |
| 695 | 695 | ||
| 696 | static char *Lua_suffixes [] = | 696 | static const char *Lua_suffixes [] = |
| 697 | { "lua", "LUA", NULL }; | 697 | { "lua", "LUA", NULL }; |
| 698 | static char Lua_help [] = | 698 | static const char Lua_help [] = |
| 699 | "In Lua scripts, all functions are tags."; | 699 | "In Lua scripts, all functions are tags."; |
| 700 | 700 | ||
| 701 | static char *Makefile_filenames [] = | 701 | static const char *Makefile_filenames [] = |
| 702 | { "Makefile", "makefile", "GNUMakefile", "Makefile.in", "Makefile.am", NULL}; | 702 | { "Makefile", "makefile", "GNUMakefile", "Makefile.in", "Makefile.am", NULL}; |
| 703 | static char Makefile_help [] = | 703 | static 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\ |
| 705 | unless you specify `--no-globals'."; | 705 | unless you specify `--no-globals'."; |
| 706 | 706 | ||
| 707 | static char *Objc_suffixes [] = | 707 | static 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 }; |
| 711 | static char Objc_help [] = | 711 | static 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\ |
| 713 | class categories, methods and protocols. Tags for variables and\n\ | 713 | class categories, methods and protocols. Tags for variables and\n\ |
| 714 | functions in classes are named `CLASS::VARIABLE' and `CLASS::FUNCTION'.\n\ | 714 | functions 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 | ||
| 717 | static char *Pascal_suffixes [] = | 717 | static const char *Pascal_suffixes [] = |
| 718 | { "p", "pas", NULL }; | 718 | { "p", "pas", NULL }; |
| 719 | static char Pascal_help [] = | 719 | static 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\ |
| 721 | in the file."; | 721 | in the file."; |
| 722 | /* " // this is for working around an Emacs highlighting bug... */ | 722 | /* " // this is for working around an Emacs highlighting bug... */ |
| 723 | 723 | ||
| 724 | static char *Perl_suffixes [] = | 724 | static const char *Perl_suffixes [] = |
| 725 | { "pl", "pm", NULL }; | 725 | { "pl", "pm", NULL }; |
| 726 | static char *Perl_interpreters [] = | 726 | static const char *Perl_interpreters [] = |
| 727 | { "perl", "@PERL@", NULL }; | 727 | { "perl", "@PERL@", NULL }; |
| 728 | static char Perl_help [] = | 728 | static 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\ |
| 730 | defined by the `package', `sub', `my' and `local' keywords. Use\n\ | 730 | defined 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\ |
| 732 | subroutines are named `PACKAGE::SUB'. The name for subroutines\n\ | 732 | subroutines are named `PACKAGE::SUB'. The name for subroutines\n\ |
| 733 | defined in the default package is `main::SUB'."; | 733 | defined in the default package is `main::SUB'."; |
| 734 | 734 | ||
| 735 | static char *PHP_suffixes [] = | 735 | static const char *PHP_suffixes [] = |
| 736 | { "php", "php3", "php4", NULL }; | 736 | { "php", "php3", "php4", NULL }; |
| 737 | static char PHP_help [] = | 737 | static 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\ |
| 739 | the `--no-members' option, vars are tags too."; | 739 | the `--no-members' option, vars are tags too."; |
| 740 | 740 | ||
| 741 | static char *plain_C_suffixes [] = | 741 | static const char *plain_C_suffixes [] = |
| 742 | { "pc", /* Pro*C file */ | 742 | { "pc", /* Pro*C file */ |
| 743 | NULL }; | 743 | NULL }; |
| 744 | 744 | ||
| 745 | static char *PS_suffixes [] = | 745 | static const char *PS_suffixes [] = |
| 746 | { "ps", "psw", NULL }; /* .psw is for PSWrap */ | 746 | { "ps", "psw", NULL }; /* .psw is for PSWrap */ |
| 747 | static char PS_help [] = | 747 | static const char PS_help [] = |
| 748 | "In PostScript code, the tags are the functions."; | 748 | "In PostScript code, the tags are the functions."; |
| 749 | 749 | ||
| 750 | static char *Prolog_suffixes [] = | 750 | static const char *Prolog_suffixes [] = |
| 751 | { "prolog", NULL }; | 751 | { "prolog", NULL }; |
| 752 | static char Prolog_help [] = | 752 | static 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\ |
| 754 | line."; | 754 | line."; |
| 755 | 755 | ||
| 756 | static char *Python_suffixes [] = | 756 | static const char *Python_suffixes [] = |
| 757 | { "py", NULL }; | 757 | { "py", NULL }; |
| 758 | static char Python_help [] = | 758 | static 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\ |
| 760 | generate a tag."; | 760 | generate 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. */ |
| 763 | static char *Scheme_suffixes [] = | 763 | static 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 }; |
| 765 | static char Scheme_help [] = | 765 | static 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\ |
| 767 | construct whose name starts with `def'. They also include\n\ | 767 | construct whose name starts with `def'. They also include\n\ |
| 768 | variables set with `set!' at top level in the file."; | 768 | variables set with `set!' at top level in the file."; |
| 769 | 769 | ||
| 770 | static char *TeX_suffixes [] = | 770 | static const char *TeX_suffixes [] = |
| 771 | { "bib", "clo", "cls", "ltx", "sty", "TeX", "tex", NULL }; | 771 | { "bib", "clo", "cls", "ltx", "sty", "TeX", "tex", NULL }; |
| 772 | static char TeX_help [] = | 772 | static 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 | ||
| 784 | static char *Texinfo_suffixes [] = | 784 | static const char *Texinfo_suffixes [] = |
| 785 | { "texi", "texinfo", "txi", NULL }; | 785 | { "texi", "texinfo", "txi", NULL }; |
| 786 | static char Texinfo_help [] = | 786 | static 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 | ||
| 789 | static char *Yacc_suffixes [] = | 789 | static 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 */ |
| 791 | static char Yacc_help [] = | 791 | static 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\ |
| 793 | nonterminal it constructs. The portions of the file that contain\n\ | 793 | nonterminal it constructs. The portions of the file that contain\n\ |
| 794 | C code are parsed as C code (use --help --lang=c --lang=yacc\n\ | 794 | C code are parsed as C code (use --help --lang=c --lang=yacc\n\ |
| 795 | for full help)."; | 795 | for full help)."; |
| 796 | 796 | ||
| 797 | static char auto_help [] = | 797 | static 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\ |
| 799 | a default language for files base on file name suffix and file contents."; | 799 | a default language for files base on file name suffix and file contents."; |
| 800 | 800 | ||
| 801 | static char none_help [] = | 801 | static 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\ |
| 803 | regexp processing on files."; | 803 | regexp processing on files."; |
| 804 | 804 | ||
| 805 | static char no_lang_help [] = | 805 | static 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 | |||
| 851 | print_language_names (void) | 851 | print_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\ |
| 857 | default file names and dot suffixes:"); | 857 | default file names and dot suffixes:"); |
| @@ -1467,7 +1467,7 @@ static language * | |||
| 1467 | get_language_from_interpreter (char *interpreter) | 1467 | get_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 * | |||
| 1489 | get_language_from_filename (char *file, int case_sensitive) | 1489 | get_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) | |||
| 1721 | static void | 1721 | static void |
| 1722 | init (void) | 1722 | init (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 | */ |
| 1902 | static void | 1902 | static void |
| 1903 | make_tag (char *name, int namelen, int is_func, char *linestart, int linelen, int lno, long int cno) | 1903 | make_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 | ||
| 2364 | struct C_stab_entry { char *name; int c_ext; enum sym_type type; }; | 2363 | struct 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 | */ |
| 2553 | static char *objtag = "<uninited>"; | 2552 | static 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 | */ |
| 2614 | static void pushclass_above (int, char *, int); | 2613 | static void pushclass_above (int, char *, int); |
| 2615 | static void popclass_above (int); | 2614 | static void popclass_above (int); |
| 2616 | static void write_classname (linebuffer *, char *qualifier); | 2615 | static void write_classname (linebuffer *, const char *qualifier); |
| 2617 | 2616 | ||
| 2618 | static struct { | 2617 | static 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 | ||
| 2663 | static void | 2662 | static void |
| 2664 | write_classname (linebuffer *cn, char *qualifier) | 2663 | write_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 | ||
| 4130 | static 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. */ |
| 4134 | static void | 4131 | static void |
| 4135 | Ada_getit (FILE *inf, char *name_qualifier) | 4132 | Ada_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. */ |
| 4964 | static char *TEX_defenv = "\ | 4961 | static 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 | ||
| 4969 | static void TEX_mode (FILE *); | 4966 | static void TEX_mode (FILE *); |
| 4970 | static void TEX_decode_env (char *, char *); | 4967 | static void TEX_decode_env (const char *, const char *); |
| 4971 | 4968 | ||
| 4972 | static char TEX_esc = '\\'; | 4969 | static char TEX_esc = '\\'; |
| 4973 | static char TEX_opgrp = '{'; | 4970 | static 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. */ |
| 5077 | static void | 5074 | static void |
| 5078 | TEX_decode_env (char *evarname, char *defenv) | 5075 | TEX_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 | ||
| 5974 | static bool | 5969 | static bool |
| 5975 | nocase_tail (char *cp) | 5970 | nocase_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 | */ |
| 6291 | static char * | 6286 | static char * |
| 6292 | savestr (char *cp) | 6287 | savestr (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 | */ |
| 6301 | static char * | 6296 | static char * |
| 6302 | savenstr (char *cp, int len) | 6297 | savenstr (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. */ |
| 6410 | void | 6405 | void |
| 6411 | fatal (char *s1, char *s2) | 6406 | fatal (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 | ||
| 6417 | static void | 6412 | static void |
| 6418 | pfatal (char *s1) | 6413 | pfatal (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. */ |
| 6443 | static char * | 6438 | static char * |
| 6444 | concat (char *s1, char *s2, char *s3) | 6439 | concat (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. */ |
| 32 | int | 32 | int |
| 33 | main () | 33 | main (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 | ||
| 143 | static char *my_name; | 144 | static const char *my_name; |
| 144 | static char *the_date; | 145 | static char *the_date; |
| 145 | static char *the_user; | 146 | static char *the_user; |
| 146 | static line_list file_preface; | 147 | static line_list file_preface; |
| 147 | static stream_list the_streams; | 148 | static stream_list the_streams; |
| 148 | static boolean no_problems = true; | 149 | static boolean no_problems = true; |
| 149 | 150 | ||
| 150 | static void fatal (char *s1) NO_RETURN; | 151 | static void fatal (const char *s1) NO_RETURN; |
| 151 | |||
| 152 | extern FILE *popen (const char *, const char *); | ||
| 153 | extern int fclose (FILE *), pclose (FILE *); | ||
| 154 | 152 | ||
| 155 | #ifdef CURRENT_USER | 153 | #ifdef CURRENT_USER |
| 156 | extern struct passwd *getpwuid (); | ||
| 157 | extern unsigned short geteuid (); | ||
| 158 | static struct passwd *my_entry; | 154 | static 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 | ||
| 168 | static void | 164 | static void |
| 169 | error (char *s1, char *s2) | 165 | error (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 | ||
| 179 | static void | 175 | static void |
| 180 | fatal (char *s1) | 176 | fatal (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 | ||
| 466 | void | 462 | void |
| 467 | put_line (char *string) | 463 | put_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 | ||
| 70 | int scan_file (char *filename); | 70 | int scan_file (char *filename); |
| 71 | int scan_lisp_file (char *filename, char *mode); | 71 | int scan_lisp_file (const char *filename, const char *mode); |
| 72 | int scan_c_file (char *filename, char *mode); | 72 | int scan_c_file (char *filename, const char *mode); |
| 73 | void fatal (char *s1, char *s2) NO_RETURN; | 73 | void 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 */ |
| 94 | void | 94 | void |
| 95 | error (char *s1, char *s2) | 95 | error (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 */ |
| 105 | void | 105 | void |
| 106 | fatal (char *s1, char *s2) | 106 | fatal (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 | ||
| 523 | int | 523 | int |
| 524 | scan_c_file (char *filename, char *mode) | 524 | scan_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 | ||
| 836 | int | 836 | int |
| 837 | scan_lisp_file (char *filename, char *mode) | 837 | scan_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 (); | |||
| 147 | char *strerror (int); | 147 | char *strerror (int); |
| 148 | #endif | 148 | #endif |
| 149 | 149 | ||
| 150 | static void fatal (char *s1, char *s2, char *s3) NO_RETURN; | 150 | static void fatal (const char *s1, const char *s2, const char *s3) NO_RETURN; |
| 151 | static void error (char *s1, char *s2, char *s3); | 151 | static void error (const char *s1, const char *s2, const char *s3); |
| 152 | static void pfatal_with_name (char *name) NO_RETURN; | 152 | static void pfatal_with_name (char *name) NO_RETURN; |
| 153 | static void pfatal_and_delete (char *name) NO_RETURN; | 153 | static void pfatal_and_delete (char *name) NO_RETURN; |
| 154 | static char *concat (char *s1, char *s2, char *s3); | 154 | static char *concat (const char *s1, const char *s2, const char *s3); |
| 155 | static long *xmalloc (unsigned int size); | 155 | static long *xmalloc (unsigned int size); |
| 156 | #ifdef MAIL_USE_POP | 156 | #ifdef MAIL_USE_POP |
| 157 | static int popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order); | 157 | static 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 | ||
| 591 | static void | 591 | static void |
| 592 | fatal (char *s1, char *s2, char *s3) | 592 | fatal (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 | ||
| 603 | static void | 603 | static void |
| 604 | error (char *s1, char *s2, char *s3) | 604 | error (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 | ||
| 632 | static char * | 632 | static char * |
| 633 | concat (char *s1, char *s2, char *s3) | 633 | concat (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 | ||
| 111 | static int socket_connection (char *, int); | 111 | static int socket_connection (char *, int); |
| 112 | static int pop_getline (popserver, char **); | 112 | static int pop_getline (popserver, char **); |
| 113 | static int sendline (popserver, char *); | 113 | static int sendline (popserver, const char *); |
| 114 | static int fullwrite (int, char *, int); | 114 | static int fullwrite (int, char *, int); |
| 115 | static int getok (popserver); | 115 | static int getok (popserver); |
| 116 | #if 0 | 116 | #if 0 |
| @@ -676,7 +676,7 @@ pop_top_flush (popserver server) | |||
| 676 | } | 676 | } |
| 677 | 677 | ||
| 678 | int | 678 | int |
| 679 | pop_multi_first (popserver server, char *command, char **response) | 679 | pop_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 | */ |
| 1416 | static int | 1416 | static int |
| 1417 | sendline (popserver server, char *line) | 1417 | sendline (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__ | 52 | extern popserver pop_open (char *host, char *username, char *password, |
| 53 | #define _ARGS(a) a | 53 | int flags); |
| 54 | #else | 54 | extern int pop_stat (popserver server, int *count, int *size); |
| 55 | #define _ARGS(a) () | 55 | extern int pop_list (popserver server, int message, int **IDs, |
| 56 | #endif | 56 | int **size); |
| 57 | 57 | extern int pop_retrieve (popserver server, int message, int markfrom, | |
| 58 | extern popserver pop_open _ARGS((char *host, char *username, char *password, | 58 | char **); |
| 59 | int flags)); | 59 | extern int pop_retrieve_first (popserver server, int message, |
| 60 | extern int pop_stat _ARGS((popserver server, int *count, int *size)); | 60 | char **response); |
| 61 | extern int pop_list _ARGS((popserver server, int message, int **IDs, | 61 | extern int pop_retrieve_next (popserver server, char **line); |
| 62 | int **size)); | 62 | extern int pop_retrieve_flush (popserver server); |
| 63 | extern int pop_retrieve _ARGS((popserver server, int message, int markfrom, | 63 | extern int pop_top_first (popserver server, int message, int lines, |
| 64 | char **)); | 64 | char **response); |
| 65 | extern int pop_retrieve_first _ARGS((popserver server, int message, | 65 | extern int pop_top_next (popserver server, char **line); |
| 66 | char **response)); | 66 | extern int pop_top_flush (popserver server); |
| 67 | extern int pop_retrieve_next _ARGS((popserver server, char **line)); | 67 | extern int pop_multi_first (popserver server, const char *command, |
| 68 | extern int pop_retrieve_flush _ARGS((popserver server)); | 68 | char **response); |
| 69 | extern int pop_top_first _ARGS((popserver server, int message, int lines, | 69 | extern int pop_multi_next (popserver server, char **line); |
| 70 | char **response)); | 70 | extern int pop_multi_flush (popserver server); |
| 71 | extern int pop_top_next _ARGS((popserver server, char **line)); | 71 | extern int pop_delete (popserver server, int message); |
| 72 | extern int pop_top_flush _ARGS((popserver server)); | 72 | extern int pop_noop (popserver server); |
| 73 | extern int pop_multi_first _ARGS((popserver server, char *command, | 73 | extern int pop_last (popserver server); |
| 74 | char **response)); | 74 | extern int pop_reset (popserver server); |
| 75 | extern int pop_multi_next _ARGS((popserver server, char **line)); | 75 | extern int pop_quit (popserver server); |
| 76 | extern int pop_multi_flush _ARGS((popserver server)); | 76 | extern void pop_close (popserver); |
| 77 | extern int pop_delete _ARGS((popserver server, int message)); | ||
| 78 | extern int pop_noop _ARGS((popserver server)); | ||
| 79 | extern int pop_last _ARGS((popserver server)); | ||
| 80 | extern int pop_reset _ARGS((popserver server)); | ||
| 81 | extern int pop_quit _ARGS((popserver server)); | ||
| 82 | extern 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 | ||
| 67 | void | 67 | void |
| 68 | error (char *s1, char *s2) | 68 | error (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 | ||
| 77 | void | 77 | void |
| 78 | fatal (char *s1, char *s2) | 78 | fatal (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 | ||
| 120 | char *states[] = | 120 | const 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 | ||
| 160 | char * | 160 | const char * |
| 161 | get_prefix (int running_suid, char *user_prefix) | 161 | get_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; |