diff options
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/ChangeLog | 244 | ||||
| -rw-r--r-- | lib-src/Makefile.in | 15 | ||||
| -rw-r--r-- | lib-src/b2m.c | 35 | ||||
| -rw-r--r-- | lib-src/digest-doc.c | 2 | ||||
| -rw-r--r-- | lib-src/ebrowse.c | 374 | ||||
| -rw-r--r-- | lib-src/emacsclient.c | 160 | ||||
| -rw-r--r-- | lib-src/etags.c | 777 | ||||
| -rw-r--r-- | lib-src/fakemail.c | 95 | ||||
| -rw-r--r-- | lib-src/hexl.c | 8 | ||||
| -rw-r--r-- | lib-src/make-docfile.c | 156 | ||||
| -rw-r--r-- | lib-src/makefile.w32-in | 10 | ||||
| -rw-r--r-- | lib-src/movemail.c | 111 | ||||
| -rw-r--r-- | lib-src/ntlib.c | 22 | ||||
| -rw-r--r-- | lib-src/ntlib.h | 12 | ||||
| -rw-r--r-- | lib-src/pop.c | 149 | ||||
| -rw-r--r-- | lib-src/pop.h | 58 | ||||
| -rw-r--r-- | lib-src/profile.c | 6 | ||||
| -rw-r--r-- | lib-src/sorted-doc.c | 23 | ||||
| -rw-r--r-- | lib-src/test-distrib.c | 9 | ||||
| -rw-r--r-- | lib-src/update-game-score.c | 98 |
20 files changed, 1066 insertions, 1298 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 079941811c0..4f3f386310a 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog | |||
| @@ -1,3 +1,236 @@ | |||
| 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 | |||
| 52 | 2010-08-07 Juanma Barranquero <lekktu@gmail.com> | ||
| 53 | |||
| 54 | * ebrowse.c (usage, version, mark_virtual): | ||
| 55 | Remove duplicate declarations. | ||
| 56 | |||
| 57 | 2010-08-06 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 58 | |||
| 59 | * emacsclient.c: Move socket related #includes together with the | ||
| 60 | rest of the #includes. Move a WINDOWSNT includes closer together. | ||
| 61 | (HAVE_CONFIG_H): Remove. | ||
| 62 | (NO_RETURN): Remove, defined in config.h. | ||
| 63 | (main): Convert definition to standard C. | ||
| 64 | |||
| 65 | 2010-07-29 Juanma Barranquero <lekktu@gmail.com> | ||
| 66 | |||
| 67 | * make-docfile.c (write_c_args): Warn for old-style empty arglist (). | ||
| 68 | |||
| 69 | 2010-07-25 Juanma Barranquero <lekktu@gmail.com> | ||
| 70 | |||
| 71 | * emacsclient.c (getcwd): Fix previous change: make getcwd | ||
| 72 | conditional on HAVE_GETCWD and declare with the correct POSIX | ||
| 73 | profile (for some reason MinGW headers define its 2nd arg as int, | ||
| 74 | not size_t; but getcwd is not used on Windows nonetheless). | ||
| 75 | |||
| 76 | 2010-07-25 Juanma Barranquero <lekktu@gmail.com> | ||
| 77 | |||
| 78 | * emacsclient.c (getcwd, w32_getenv): | ||
| 79 | * ntlib.h (getlogin, getuid, getegid, getgid): Fix prototypes. | ||
| 80 | |||
| 81 | 2010-07-24 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 82 | |||
| 83 | * update-game-score.c (usage): Add NO_RETURN specifier. | ||
| 84 | * movemail.c (fatal, pfatal_with_name, pfatal_and_delete): | ||
| 85 | * make-docfile.c (fatal): | ||
| 86 | * hexl.c (usage): | ||
| 87 | * fakemail.c (fatal): | ||
| 88 | * etags.c (fatal, suggest_asking_for_help, pfatal): | ||
| 89 | * emacsclient.c (fatal): | ||
| 90 | * b2m.c (fatal): Likewise. | ||
| 91 | |||
| 92 | 2010-07-23 Juanma Barranquero <lekktu@gmail.com> | ||
| 93 | |||
| 94 | * make-docfile.c (write_c_args): Correctly handle prefixes of "defalt". | ||
| 95 | |||
| 96 | 2010-07-20 Juanma Barranquero <lekktu@gmail.com> | ||
| 97 | |||
| 98 | * emacsclient.c (get_current_dir_name, w32_get_resource) | ||
| 99 | (w32_getenv, w32_set_user_model_id, w32_window_app, w32_execvp) | ||
| 100 | (close_winsock, initialize_sockets, w32_find_emacs_process) | ||
| 101 | (w32_give_focus): | ||
| 102 | * ntlib.c (getlogin, getuid, getgid, getegid): | ||
| 103 | Convert definitions to standard C. | ||
| 104 | |||
| 105 | 2010-07-12 Andreas Schwab <schwab@linux-m68k.org> | ||
| 106 | |||
| 107 | * Makefile.in (C_WARNINGS_SWITCH, PROFILING_CFLAGS) | ||
| 108 | (PROFILING_LDFLAGS): Set from substitution. | ||
| 109 | (BASE_CFLAGS): Add ${C_WARNINGS_SWITCH}. | ||
| 110 | (ALL_CFLAGS, CPP_CFLAGS): Add ${PROFILING_CFLAGS}. | ||
| 111 | (LINK_CFLAGS): Add ${PROFILING_LDFLAGS}. | ||
| 112 | |||
| 113 | 2010-07-12 Eli Zaretskii <eliz@gnu.org> | ||
| 114 | |||
| 115 | * makefile.w32-in (lisp2): Change hebrew.el to hebrew.elc (see | ||
| 116 | 2010-07-12T05:25:46Z!handa@etlken). | ||
| 117 | |||
| 118 | 2010-07-11 Andreas Schwab <schwab@linux-m68k.org> | ||
| 119 | |||
| 120 | * emacsclient.c (set_local_socket): Use strchr, strrchr instead of | ||
| 121 | index, rindex. | ||
| 122 | * movemail.c (mail_spool_name, popmail): Likewise. | ||
| 123 | * pop.c (pop_list): Likewise. | ||
| 124 | |||
| 125 | 2010-07-11 Eli Zaretskii <eliz@gnu.org> | ||
| 126 | |||
| 127 | * makefile.w32-in (obj): Add menu.o, bidi.o, w32uniscribe.o, | ||
| 128 | and unexw32.o. (Bug#6603) | ||
| 129 | |||
| 130 | 2010-07-10 Eli Zaretskii <eliz@gnu.org> | ||
| 131 | |||
| 132 | * Makefile.in ($(DESTDIR)${archlibdir}): Convert spaces to TABs. | ||
| 133 | |||
| 134 | 2010-07-09 Andreas Schwab <schwab@linux-m68k.org> | ||
| 135 | |||
| 136 | * make-docfile.c (write_c_args): Restructure scanning loop. | ||
| 137 | |||
| 138 | 2010-07-09 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 139 | |||
| 140 | * make-docfile.c (write_c_args): Deal with type names in DEFUN | ||
| 141 | arguments. | ||
| 142 | |||
| 143 | 2010-07-08 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 144 | |||
| 145 | * update-game-score.c (P_): Remove macro. | ||
| 146 | * ebrowse.c: Remove include guards. | ||
| 147 | (P_): Remove macro. | ||
| 148 | |||
| 149 | 2010-07-07 Andreas Schwab <schwab@linux-m68k.org> | ||
| 150 | |||
| 151 | * ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by | ||
| 152 | memcpy, memmove, memset. | ||
| 153 | * pop.c (pop_retrieve, socket_connection, pop_getline): Likewise. | ||
| 154 | |||
| 155 | 2010-07-06 Andreas Schwab <schwab@linux-m68k.org> | ||
| 156 | |||
| 157 | * movemail.c: Add MAIL_USE_POP around prototypes. | ||
| 158 | Include <string.h> if HAVE_STRING_H. | ||
| 159 | (strerror): Only declare if !HAVE_STRERROR. | ||
| 160 | (fatal): Make static. | ||
| 161 | (error): Likewise. | ||
| 162 | (pfatal_with_name): Likewise. | ||
| 163 | (pfatal_and_delete). Likewise. | ||
| 164 | (concat): Likewise. | ||
| 165 | (xmalloc): Likewise. | ||
| 166 | (popmail): Likewise. | ||
| 167 | (pop_retr): Likewise. | ||
| 168 | (mbx_write): Likewise. | ||
| 169 | (mbx_delimit_begin): Likewise. | ||
| 170 | (mbx_delimit_end): Likewise. | ||
| 171 | |||
| 172 | 2010-07-04 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 173 | |||
| 174 | * fakemail.c (action): Convert function definitions to standard C. | ||
| 175 | (add_a_stream): | ||
| 176 | * test-distrib.c (cool_read): | ||
| 177 | (main): Likewise. | ||
| 178 | |||
| 179 | 2010-07-03 Andreas Schwab <schwab@linux-m68k.org> | ||
| 180 | |||
| 181 | * sorted-doc.c (cmpdoc): Fix signature. | ||
| 182 | (qsort_compare): Delete. | ||
| 183 | (main): Remove cast. | ||
| 184 | |||
| 185 | 2010-07-03 Juanma Barranquero <lekktu@gmail.com> | ||
| 186 | |||
| 187 | * ebrowse.c (match_qualified_namespace_alias): Check for null pointer. | ||
| 188 | |||
| 189 | 2010-07-03 Juanma Barranquero <lekktu@gmail.com> | ||
| 190 | |||
| 191 | Fix prototype warnings. | ||
| 192 | |||
| 193 | * ebrowse.c (match_qualified_namespace_alias): | ||
| 194 | Pass sym* to find_namespace, not link*. | ||
| 195 | |||
| 196 | * emacsclient.c (send_to_emacs, quote_argument): Arg s is HSOCKET. | ||
| 197 | |||
| 198 | * sorted-doc.c (qsort_compare): New typedef. | ||
| 199 | (main): Use it to cast cmpdoc. | ||
| 200 | |||
| 201 | 2010-07-03 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 202 | |||
| 203 | * update-game-score.c: Convert function definitions to standard C. | ||
| 204 | * sorted-doc.c: | ||
| 205 | * profile.c: | ||
| 206 | * pop.c: | ||
| 207 | * movemail.c: | ||
| 208 | * make-docfile.c: | ||
| 209 | * hexl.c: | ||
| 210 | * fakemail.c: | ||
| 211 | * etags.c: | ||
| 212 | * ebrowse.c: | ||
| 213 | * digest-doc.c: | ||
| 214 | * b2m.c: Likewise. | ||
| 215 | |||
| 216 | 2010-07-02 Dan Nicolaescu <dann@ics.uci.edu> | ||
| 217 | |||
| 218 | * make-docfile.c (xmalloc, xrealloc, concat, readline, fatal): | ||
| 219 | * b2m.c (scan_file, scan_lisp_file, scan_c_file): Convert to | ||
| 220 | standard C prototypes. | ||
| 221 | |||
| 222 | 2010-07-02 Jan Djärv <jan.h.d@swipnet.se> | ||
| 223 | |||
| 224 | * ebrowse.c: Remove P_ and __P. | ||
| 225 | * etags.c: | ||
| 226 | * movemail.c: | ||
| 227 | * pop.c: | ||
| 228 | * update-game-score.c: Likewise. | ||
| 229 | |||
| 230 | 2010-06-24 Juanma Barranquero <lekktu@gmail.com> | ||
| 231 | |||
| 232 | * movemail.c (error): Avoid warning when there are no args. | ||
| 233 | |||
| 1 | 2010-06-11 Juanma Barranquero <lekktu@gmail.com> | 234 | 2010-06-11 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 235 | ||
| 3 | * makefile.w32-in (lisp2): Fix references to vc/vc-hooks.elc | 236 | * makefile.w32-in (lisp2): Fix references to vc/vc-hooks.elc |
| @@ -143,8 +376,7 @@ | |||
| 143 | 376 | ||
| 144 | 2010-01-29 Kester Habermann <kester@linuxtag.org> (tiny change) | 377 | 2010-01-29 Kester Habermann <kester@linuxtag.org> (tiny change) |
| 145 | 378 | ||
| 146 | * etags.c (Fortran_functions): Handle recursive keyword | 379 | * etags.c (Fortran_functions): Handle recursive keyword (Bug#5484). |
| 147 | (Bug#5484). | ||
| 148 | 380 | ||
| 149 | 2010-01-11 Glenn Morris <rgm@gnu.org> | 381 | 2010-01-11 Glenn Morris <rgm@gnu.org> |
| 150 | 382 | ||
| @@ -638,7 +870,7 @@ | |||
| 638 | 870 | ||
| 639 | 2008-02-01 Jason Rumney <jasonr@gnu.org> | 871 | 2008-02-01 Jason Rumney <jasonr@gnu.org> |
| 640 | 872 | ||
| 641 | * makefile.w32-in (obj): Sync with src/Makefile.in | 873 | * makefile.w32-in (obj): Sync with src/Makefile.in. |
| 642 | (TOOLTIP_SUPPORT, WINDOW_SUPPORT): New definitions. | 874 | (TOOLTIP_SUPPORT, WINDOW_SUPPORT): New definitions. |
| 643 | (WINNT_SUPPORT): Add term/w32-win.elc. | 875 | (WINNT_SUPPORT): Add term/w32-win.elc. |
| 644 | (lisp1, lisp2): Sync with lisp in src/Makefile.in. | 876 | (lisp1, lisp2): Sync with lisp in src/Makefile.in. |
| @@ -2334,7 +2566,7 @@ | |||
| 2334 | 2566 | ||
| 2335 | * makefile.w32-in (WINNT_SUPPORT, MOUSE_SUPPORT, lisp): Revert to | 2567 | * makefile.w32-in (WINNT_SUPPORT, MOUSE_SUPPORT, lisp): Revert to |
| 2336 | using .elc files. | 2568 | using .elc files. |
| 2337 | (lisp): Sync with list in src/Makefile.in | 2569 | (lisp): Sync with list in src/Makefile.in. |
| 2338 | (VMS_SUPPORT, MSDOS_SUPPORT): Define, so DOC files can be shared. | 2570 | (VMS_SUPPORT, MSDOS_SUPPORT): Define, so DOC files can be shared. |
| 2339 | 2571 | ||
| 2340 | 2002-02-10 Paul Eggert <eggert@twinsun.com> | 2572 | 2002-02-10 Paul Eggert <eggert@twinsun.com> |
| @@ -6176,7 +6408,7 @@ | |||
| 6176 | (TOKEN): Member linestart removed. | 6408 | (TOKEN): Member linestart removed. |
| 6177 | (linepos, prev_linepos, lb1): Deleted. | 6409 | (linepos, prev_linepos, lb1): Deleted. |
| 6178 | (main): Call initbuffer on lbs array instead of lb1. | 6410 | (main): Call initbuffer on lbs array instead of lb1. |
| 6179 | (init): Removed the initialisation of the logical _gd array; | 6411 | (init): Removed the initialisation of the logical _gd array. |
| 6180 | (find_entries): A .sa suffix means assembler file. | 6412 | (find_entries): A .sa suffix means assembler file. |
| 6181 | (C_create_stab): "auto", "void", "extern", "static" are st_C_typespec. | 6413 | (C_create_stab): "auto", "void", "extern", "static" are st_C_typespec. |
| 6182 | All C state machines rewritten. | 6414 | All C state machines rewritten. |
| @@ -7040,7 +7272,7 @@ | |||
| 7040 | * etags.c: Changes for VMS. | 7272 | * etags.c: Changes for VMS. |
| 7041 | Always define ETAGS on VMS. | 7273 | Always define ETAGS on VMS. |
| 7042 | Define macros GOOD and BAD for success and failure exit codes. | 7274 | Define macros GOOD and BAD for success and failure exit codes. |
| 7043 | (begtk, intk): Allow `$' in identifiers | 7275 | (begtk, intk): Allow `$' in identifiers. |
| 7044 | (main): Don't support -B, -F or -u on VMS. | 7276 | (main): Don't support -B, -F or -u on VMS. |
| 7045 | Alternate loop for scanning filename arguments. | 7277 | Alternate loop for scanning filename arguments. |
| 7046 | (system): Delete definition of this function. | 7278 | (system): Delete definition of this function. |
diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in index 264f14b1d49..9ad3c65afad 100644 --- a/lib-src/Makefile.in +++ b/lib-src/Makefile.in | |||
| @@ -36,6 +36,9 @@ configuration=@configuration@ | |||
| 36 | EXEEXT=@EXEEXT@ | 36 | EXEEXT=@EXEEXT@ |
| 37 | C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@ | 37 | C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@ |
| 38 | C_SWITCH_MACHINE=@C_SWITCH_MACHINE@ | 38 | C_SWITCH_MACHINE=@C_SWITCH_MACHINE@ |
| 39 | C_WARNINGS_SWITCH = @C_WARNINGS_SWITCH@ | ||
| 40 | PROFILING_CFLAGS = @PROFILING_CFLAGS@ | ||
| 41 | PROFILING_LDFLAGS = @PROFILING_LDFLAGS@ | ||
| 39 | 42 | ||
| 40 | # Program name transformation. | 43 | # Program name transformation. |
| 41 | TRANSFORM = @program_transform_name@ | 44 | TRANSFORM = @program_transform_name@ |
| @@ -165,12 +168,12 @@ LIBS_SYSTEM = @LIBS_SYSTEM@ | |||
| 165 | # Those files shared with other GNU utilities need HAVE_CONFIG_H | 168 | # Those files shared with other GNU utilities need HAVE_CONFIG_H |
| 166 | # defined before they know they can take advantage of the information | 169 | # defined before they know they can take advantage of the information |
| 167 | # in ../src/config.h. | 170 | # in ../src/config.h. |
| 168 | BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) -DHAVE_CONFIG_H \ | 171 | BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) ${C_WARNINGS_SWITCH} \ |
| 169 | -I. -I../src -I${srcdir} -I${srcdir}/../src | 172 | -DHAVE_CONFIG_H -I. -I../src -I${srcdir} -I${srcdir}/../src |
| 170 | 173 | ||
| 171 | ALL_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS} | 174 | ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS} |
| 172 | LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS} | 175 | LINK_CFLAGS = ${BASE_CFLAGS} ${PROFILING_LDFLAGS} ${LDFLAGS} ${CFLAGS} |
| 173 | CPP_CFLAGS = ${BASE_CFLAGS} ${CPPFLAGS} ${CFLAGS} | 176 | CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS} |
| 174 | 177 | ||
| 175 | LOADLIBES=$(LIBS_SYSTEM) | 178 | LOADLIBES=$(LIBS_SYSTEM) |
| 176 | 179 | ||
| @@ -245,7 +248,7 @@ $(DESTDIR)${archlibdir}: all | |||
| 245 | chown ${gameuser} $(DESTDIR)${gamedir}; \ | 248 | chown ${gameuser} $(DESTDIR)${gamedir}; \ |
| 246 | chmod u=rwx,g=rwx,o=rx $(DESTDIR)${gamedir}; \ | 249 | chmod u=rwx,g=rwx,o=rx $(DESTDIR)${gamedir}; \ |
| 247 | fi | 250 | fi |
| 248 | if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` \ | 251 | if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` \ |
| 249 | != `(cd ${srcdir} && /bin/pwd)` ]; then \ | 252 | != `(cd ${srcdir} && /bin/pwd)` ]; then \ |
| 250 | for file in ${SCRIPTS}; do \ | 253 | for file in ${SCRIPTS}; do \ |
| 251 | $(INSTALL_SCRIPT) ${srcdir}/$$file $(DESTDIR)${archlibdir}/$$file; \ | 254 | $(INSTALL_SCRIPT) ${srcdir}/$$file $(DESTDIR)${archlibdir}/$$file; \ |
diff --git a/lib-src/b2m.c b/lib-src/b2m.c index 7de48e6a522..803d75e233c 100644 --- a/lib-src/b2m.c +++ b/lib-src/b2m.c | |||
| @@ -64,12 +64,13 @@ struct linebuffer | |||
| 64 | char *buffer; | 64 | char *buffer; |
| 65 | }; | 65 | }; |
| 66 | 66 | ||
| 67 | extern char *strtok(); | 67 | extern char *strtok(char *, const char *); |
| 68 | 68 | ||
| 69 | long *xmalloc (), *xrealloc (); | 69 | long *xmalloc (unsigned int size); |
| 70 | char *concat (); | 70 | long *xrealloc (char *ptr, unsigned int size); |
| 71 | long readline (); | 71 | char *concat (const char *s1, const char *s2, const char *s3); |
| 72 | void fatal (); | 72 | long readline (struct linebuffer *linebuffer, register FILE *stream); |
| 73 | void fatal (const char *message) NO_RETURN; | ||
| 73 | 74 | ||
| 74 | /* | 75 | /* |
| 75 | * xnew -- allocate storage. SYNOPSIS: Type *xnew (int n, Type); | 76 | * xnew -- allocate storage. SYNOPSIS: Type *xnew (int n, Type); |
| @@ -90,9 +91,7 @@ struct option longopts[] = | |||
| 90 | extern int optind; | 91 | extern int optind; |
| 91 | 92 | ||
| 92 | int | 93 | int |
| 93 | main (argc, argv) | 94 | main (int argc, char **argv) |
| 94 | int argc; | ||
| 95 | char **argv; | ||
| 96 | { | 95 | { |
| 97 | logical labels_saved, printing, header, first, last_was_blank_line; | 96 | logical labels_saved, printing, header, first, last_was_blank_line; |
| 98 | time_t ltoday; | 97 | time_t ltoday; |
| @@ -171,6 +170,7 @@ main (argc, argv) | |||
| 171 | continue; | 170 | continue; |
| 172 | else if (data.buffer[1] == '\f') | 171 | else if (data.buffer[1] == '\f') |
| 173 | { | 172 | { |
| 173 | static char babyl[] = "X-Babyl-Labels: "; | ||
| 174 | if (first) | 174 | if (first) |
| 175 | first = FALSE; | 175 | first = FALSE; |
| 176 | else if (! last_was_blank_line) | 176 | else if (! last_was_blank_line) |
| @@ -178,7 +178,7 @@ main (argc, argv) | |||
| 178 | /* Save labels. */ | 178 | /* Save labels. */ |
| 179 | readline (&data, stdin); | 179 | readline (&data, stdin); |
| 180 | p = strtok (data.buffer, " ,\r\n\t"); | 180 | p = strtok (data.buffer, " ,\r\n\t"); |
| 181 | labels = "X-Babyl-Labels: "; | 181 | labels = babyl; |
| 182 | 182 | ||
| 183 | while ((p = strtok (NULL, " ,\r\n\t"))) | 183 | while ((p = strtok (NULL, " ,\r\n\t"))) |
| 184 | labels = concat (labels, p, ", "); | 184 | labels = concat (labels, p, ", "); |
| @@ -219,8 +219,7 @@ main (argc, argv) | |||
| 219 | * concatenate those of s1, s2, s3. | 219 | * concatenate those of s1, s2, s3. |
| 220 | */ | 220 | */ |
| 221 | char * | 221 | char * |
| 222 | concat (s1, s2, s3) | 222 | concat (const char *s1, const char *s2, const char *s3) |
| 223 | char *s1, *s2, *s3; | ||
| 224 | { | 223 | { |
| 225 | int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); | 224 | int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); |
| 226 | char *result = xnew (len1 + len2 + len3 + 1, char); | 225 | char *result = xnew (len1 + len2 + len3 + 1, char); |
| @@ -239,9 +238,7 @@ concat (s1, s2, s3) | |||
| 239 | * which is the length of the line including the newline, if any. | 238 | * which is the length of the line including the newline, if any. |
| 240 | */ | 239 | */ |
| 241 | long | 240 | long |
| 242 | readline (linebuffer, stream) | 241 | readline (struct linebuffer *linebuffer, register FILE *stream) |
| 243 | struct linebuffer *linebuffer; | ||
| 244 | register FILE *stream; | ||
| 245 | { | 242 | { |
| 246 | char *buffer = linebuffer->buffer; | 243 | char *buffer = linebuffer->buffer; |
| 247 | register char *p = linebuffer->buffer; | 244 | register char *p = linebuffer->buffer; |
| @@ -291,8 +288,7 @@ readline (linebuffer, stream) | |||
| 291 | * Like malloc but get fatal error if memory is exhausted. | 288 | * Like malloc but get fatal error if memory is exhausted. |
| 292 | */ | 289 | */ |
| 293 | long * | 290 | long * |
| 294 | xmalloc (size) | 291 | xmalloc (unsigned int size) |
| 295 | unsigned int size; | ||
| 296 | { | 292 | { |
| 297 | long *result = (long *) malloc (size); | 293 | long *result = (long *) malloc (size); |
| 298 | if (result == NULL) | 294 | if (result == NULL) |
| @@ -301,9 +297,7 @@ xmalloc (size) | |||
| 301 | } | 297 | } |
| 302 | 298 | ||
| 303 | long * | 299 | long * |
| 304 | xrealloc (ptr, size) | 300 | xrealloc (char *ptr, unsigned int size) |
| 305 | char *ptr; | ||
| 306 | unsigned int size; | ||
| 307 | { | 301 | { |
| 308 | long *result = (long *) realloc (ptr, size); | 302 | long *result = (long *) realloc (ptr, size); |
| 309 | if (result == NULL) | 303 | if (result == NULL) |
| @@ -312,8 +306,7 @@ xrealloc (ptr, size) | |||
| 312 | } | 306 | } |
| 313 | 307 | ||
| 314 | void | 308 | void |
| 315 | fatal (message) | 309 | fatal (const char *message) |
| 316 | char *message; | ||
| 317 | { | 310 | { |
| 318 | fprintf (stderr, "%s: %s\n", progname, message); | 311 | fprintf (stderr, "%s: %s\n", progname, message); |
| 319 | exit (EXIT_FAILURE); | 312 | exit (EXIT_FAILURE); |
diff --git a/lib-src/digest-doc.c b/lib-src/digest-doc.c index d8c6e620a19..b3cb58e6d99 100644 --- a/lib-src/digest-doc.c +++ b/lib-src/digest-doc.c | |||
| @@ -31,7 +31,7 @@ but in texinfo format and sorted by function/variable name. */ | |||
| 31 | #endif | 31 | #endif |
| 32 | 32 | ||
| 33 | int | 33 | int |
| 34 | main () | 34 | main (void) |
| 35 | { | 35 | { |
| 36 | register int ch; | 36 | register int ch; |
| 37 | register int notfirst = 0; | 37 | register int notfirst = 0; |
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c index b51b4aa6965..1fcbb8662f5 100644 --- a/lib-src/ebrowse.c +++ b/lib-src/ebrowse.c | |||
| @@ -20,20 +20,14 @@ You should have received a copy of the GNU General Public License | |||
| 20 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | 20 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | #ifdef HAVE_CONFIG_H | ||
| 24 | #include <config.h> | 23 | #include <config.h> |
| 25 | #endif | ||
| 26 | |||
| 27 | #include <stdio.h> | 24 | #include <stdio.h> |
| 28 | 25 | ||
| 29 | #ifdef HAVE_STDLIB_H | 26 | #ifdef HAVE_STDLIB_H |
| 30 | #include <stdlib.h> | 27 | #include <stdlib.h> |
| 31 | #endif | 28 | #endif |
| 32 | 29 | ||
| 33 | #ifdef HAVE_STRING_H | ||
| 34 | #include <string.h> | 30 | #include <string.h> |
| 35 | #endif | ||
| 36 | |||
| 37 | #include <ctype.h> | 31 | #include <ctype.h> |
| 38 | #include <assert.h> | 32 | #include <assert.h> |
| 39 | #include "getopt.h" | 33 | #include "getopt.h" |
| @@ -45,12 +39,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 45 | 39 | ||
| 46 | /* Conditionalize function prototypes. */ | 40 | /* Conditionalize function prototypes. */ |
| 47 | 41 | ||
| 48 | #ifdef PROTOTYPES /* From config.h. */ | ||
| 49 | #define P_(x) x | ||
| 50 | #else | ||
| 51 | #define P_(x) () | ||
| 52 | #endif | ||
| 53 | |||
| 54 | /* Value is non-zero if strings X and Y compare equal. */ | 42 | /* Value is non-zero if strings X and Y compare equal. */ |
| 55 | 43 | ||
| 56 | #define streq(X, Y) (*(X) == *(Y) && strcmp ((X) + 1, (Y) + 1) == 0) | 44 | #define streq(X, Y) (*(X) == *(Y) && strcmp ((X) + 1, (Y) + 1) == 0) |
| @@ -261,10 +249,10 @@ struct member | |||
| 261 | int vis; /* Visibility (public, ...). */ | 249 | int vis; /* Visibility (public, ...). */ |
| 262 | int flags; /* See F_* above. */ | 250 | int flags; /* See F_* above. */ |
| 263 | char *regexp; /* Matching regular expression. */ | 251 | char *regexp; /* Matching regular expression. */ |
| 264 | char *filename; /* Don't free this shared string. */ | 252 | const char *filename; /* Don't free this shared string. */ |
| 265 | int pos; /* Buffer position of occurrence. */ | 253 | int pos; /* Buffer position of occurrence. */ |
| 266 | char *def_regexp; /* Regular expression matching definition. */ | 254 | char *def_regexp; /* Regular expression matching definition. */ |
| 267 | char *def_filename; /* File name of definition. */ | 255 | const char *def_filename; /* File name of definition. */ |
| 268 | int def_pos; /* Buffer position of definition. */ | 256 | int def_pos; /* Buffer position of definition. */ |
| 269 | char name[1]; /* Member name. */ | 257 | char name[1]; /* Member name. */ |
| 270 | }; | 258 | }; |
| @@ -306,8 +294,8 @@ struct sym | |||
| 306 | struct member *types; /* List of local types. */ | 294 | struct member *types; /* List of local types. */ |
| 307 | char *regexp; /* Matching regular expression. */ | 295 | char *regexp; /* Matching regular expression. */ |
| 308 | int pos; /* Buffer position. */ | 296 | int pos; /* Buffer position. */ |
| 309 | char *filename; /* File in which it can be found. */ | 297 | const char *filename; /* File in which it can be found. */ |
| 310 | char *sfilename; /* File in which members can be found. */ | 298 | const char *sfilename; /* File in which members can be found. */ |
| 311 | struct sym *namesp; /* Namespace in which defined. . */ | 299 | struct sym *namesp; /* Namespace in which defined. . */ |
| 312 | char name[1]; /* Name of the class. */ | 300 | char name[1]; /* Name of the class. */ |
| 313 | }; | 301 | }; |
| @@ -365,7 +353,7 @@ int yyline; | |||
| 365 | 353 | ||
| 366 | /* The name of the current input file. */ | 354 | /* The name of the current input file. */ |
| 367 | 355 | ||
| 368 | char *filename; | 356 | const char *filename; |
| 369 | 357 | ||
| 370 | /* Three character class vectors, and macros to test membership | 358 | /* Three character class vectors, and macros to test membership |
| 371 | of characters. */ | 359 | of characters. */ |
| @@ -456,7 +444,7 @@ int tk = -1; | |||
| 456 | 444 | ||
| 457 | struct kw | 445 | struct kw |
| 458 | { | 446 | { |
| 459 | char *name; /* Spelling. */ | 447 | const char *name; /* Spelling. */ |
| 460 | int tk; /* Token value. */ | 448 | int tk; /* Token value. */ |
| 461 | struct kw *next; /* Next in collision chain. */ | 449 | struct kw *next; /* Next in collision chain. */ |
| 462 | }; | 450 | }; |
| @@ -479,62 +467,59 @@ struct search_path *search_path_tail; | |||
| 479 | 467 | ||
| 480 | /* Function prototypes. */ | 468 | /* Function prototypes. */ |
| 481 | 469 | ||
| 482 | int yylex P_ ((void)); | 470 | int yylex (void); |
| 483 | void yyparse P_ ((void)); | 471 | void yyparse (void); |
| 484 | void re_init_parser P_ ((void)); | 472 | void re_init_parser (void); |
| 485 | char *token_string P_ ((int)); | 473 | const char *token_string (int); |
| 486 | char *matching_regexp P_ ((void)); | 474 | char *matching_regexp (void); |
| 487 | void init_sym P_ ((void)); | 475 | void init_sym (void); |
| 488 | struct sym *add_sym P_ ((char *, struct sym *)); | 476 | struct sym *add_sym (const char *, struct sym *); |
| 489 | void add_link P_ ((struct sym *, struct sym *)); | 477 | void add_link (struct sym *, struct sym *); |
| 490 | void add_member_defn P_ ((struct sym *, char *, char *, | 478 | void add_member_defn (struct sym *, char *, char *, |
| 491 | int, unsigned, int, int, int)); | 479 | int, unsigned, int, int, int); |
| 492 | void add_member_decl P_ ((struct sym *, char *, char *, int, | 480 | void add_member_decl (struct sym *, char *, char *, int, |
| 493 | unsigned, int, int, int, int)); | 481 | unsigned, int, int, int, int); |
| 494 | void dump_roots P_ ((FILE *)); | 482 | void dump_roots (FILE *); |
| 495 | void *xmalloc P_ ((int)); | 483 | void *xmalloc (int); |
| 496 | void xfree P_ ((void *)); | 484 | void xfree (void *); |
| 497 | void add_global_defn P_ ((char *, char *, int, unsigned, int, int, int)); | 485 | void add_global_defn (char *, char *, int, unsigned, int, int, int); |
| 498 | void add_global_decl P_ ((char *, char *, int, unsigned, int, int, int)); | 486 | void add_global_decl (char *, char *, int, unsigned, int, int, int); |
| 499 | void add_define P_ ((char *, char *, int)); | 487 | void add_define (char *, char *, int); |
| 500 | void mark_inherited_virtual P_ ((void)); | 488 | void mark_inherited_virtual (void); |
| 501 | void leave_namespace P_ ((void)); | 489 | void leave_namespace (void); |
| 502 | void enter_namespace P_ ((char *)); | 490 | void enter_namespace (char *); |
| 503 | void register_namespace_alias P_ ((char *, struct link *)); | 491 | void register_namespace_alias (char *, struct link *); |
| 504 | void insert_keyword P_ ((char *, int)); | 492 | void insert_keyword (const char *, int); |
| 505 | void re_init_scanner P_ ((void)); | 493 | void re_init_scanner (void); |
| 506 | void init_scanner P_ ((void)); | 494 | void init_scanner (void); |
| 507 | void usage P_ ((int)); | 495 | void process_file (char *); |
| 508 | void version P_ ((void)); | 496 | void add_search_path (char *); |
| 509 | void process_file P_ ((char *)); | 497 | FILE *open_file (char *); |
| 510 | void add_search_path P_ ((char *)); | 498 | int process_pp_line (void); |
| 511 | FILE *open_file P_ ((char *)); | 499 | int dump_members (FILE *, struct member *); |
| 512 | int process_pp_line P_ ((void)); | 500 | void dump_sym (FILE *, struct sym *); |
| 513 | int dump_members P_ ((FILE *, struct member *)); | 501 | int dump_tree (FILE *, struct sym *); |
| 514 | void dump_sym P_ ((FILE *, struct sym *)); | 502 | struct member *find_member (struct sym *, char *, int, int, unsigned); |
| 515 | int dump_tree P_ ((FILE *, struct sym *)); | 503 | struct member *add_member (struct sym *, char *, int, int, unsigned); |
| 516 | struct member *find_member P_ ((struct sym *, char *, int, int, unsigned)); | 504 | void mark_virtual (struct sym *); |
| 517 | struct member *add_member P_ ((struct sym *, char *, int, int, unsigned)); | 505 | struct sym *make_namespace (char *, struct sym *); |
| 518 | void mark_virtual P_ ((struct sym *)); | 506 | char *sym_scope (struct sym *); |
| 519 | void mark_virtual P_ ((struct sym *)); | 507 | char *sym_scope_1 (struct sym *); |
| 520 | struct sym *make_namespace P_ ((char *, struct sym *)); | 508 | int skip_to (int); |
| 521 | char *sym_scope P_ ((struct sym *)); | 509 | void skip_matching (void); |
| 522 | char *sym_scope_1 P_ ((struct sym *)); | 510 | void member (struct sym *, int); |
| 523 | int skip_to P_ ((int)); | 511 | void class_body (struct sym *, int); |
| 524 | void skip_matching P_ ((void)); | 512 | void class_definition (struct sym *, int, int, int); |
| 525 | void member P_ ((struct sym *, int)); | 513 | void declaration (int); |
| 526 | void class_body P_ ((struct sym *, int)); | 514 | unsigned parm_list (int *); |
| 527 | void class_definition P_ ((struct sym *, int, int, int)); | 515 | char *operator_name (int *); |
| 528 | void declaration P_ ((int)); | 516 | struct sym *parse_classname (void); |
| 529 | unsigned parm_list P_ ((int *)); | 517 | struct sym *parse_qualified_ident_or_type (char **); |
| 530 | char *operator_name P_ ((int *)); | 518 | void parse_qualified_param_ident_or_type (char **); |
| 531 | struct sym *parse_classname P_ ((void)); | 519 | int globals (int); |
| 532 | struct sym *parse_qualified_ident_or_type P_ ((char **)); | 520 | void yyerror (const char *, const char *); |
| 533 | void parse_qualified_param_ident_or_type P_ ((char **)); | 521 | void usage (int) NO_RETURN; |
| 534 | int globals P_ ((int)); | 522 | void version (void) NO_RETURN; |
| 535 | void yyerror P_ ((char *, char *)); | ||
| 536 | void usage P_ ((int)) NO_RETURN; | ||
| 537 | void version P_ (()) NO_RETURN; | ||
| 538 | 523 | ||
| 539 | 524 | ||
| 540 | 525 | ||
| @@ -546,8 +531,7 @@ void version P_ (()) NO_RETURN; | |||
| 546 | name and line number. */ | 531 | name and line number. */ |
| 547 | 532 | ||
| 548 | void | 533 | void |
| 549 | yyerror (format, s) | 534 | yyerror (const char *format, const char *s) |
| 550 | char *format, *s; | ||
| 551 | { | 535 | { |
| 552 | fprintf (stderr, "%s:%d: ", filename, yyline); | 536 | fprintf (stderr, "%s:%d: ", filename, yyline); |
| 553 | fprintf (stderr, format, s); | 537 | fprintf (stderr, format, s); |
| @@ -559,8 +543,7 @@ yyerror (format, s) | |||
| 559 | available. */ | 543 | available. */ |
| 560 | 544 | ||
| 561 | void * | 545 | void * |
| 562 | xmalloc (nbytes) | 546 | xmalloc (int nbytes) |
| 563 | int nbytes; | ||
| 564 | { | 547 | { |
| 565 | void *p = malloc (nbytes); | 548 | void *p = malloc (nbytes); |
| 566 | if (p == NULL) | 549 | if (p == NULL) |
| @@ -575,9 +558,7 @@ xmalloc (nbytes) | |||
| 575 | /* Like realloc but print an error and exit if out of memory. */ | 558 | /* Like realloc but print an error and exit if out of memory. */ |
| 576 | 559 | ||
| 577 | void * | 560 | void * |
| 578 | xrealloc (p, sz) | 561 | xrealloc (void *p, int sz) |
| 579 | void *p; | ||
| 580 | int sz; | ||
| 581 | { | 562 | { |
| 582 | p = realloc (p, sz); | 563 | p = realloc (p, sz); |
| 583 | if (p == NULL) | 564 | if (p == NULL) |
| @@ -593,8 +574,7 @@ xrealloc (p, sz) | |||
| 593 | available.. If S is null, return null. */ | 574 | available.. If S is null, return null. */ |
| 594 | 575 | ||
| 595 | char * | 576 | char * |
| 596 | xstrdup (s) | 577 | xstrdup (char *s) |
| 597 | char *s; | ||
| 598 | { | 578 | { |
| 599 | if (s) | 579 | if (s) |
| 600 | s = strcpy (xmalloc (strlen (s) + 1), s); | 580 | s = strcpy (xmalloc (strlen (s) + 1), s); |
| @@ -611,7 +591,7 @@ xstrdup (s) | |||
| 611 | special symbol for globals (`*Globals*'). */ | 591 | special symbol for globals (`*Globals*'). */ |
| 612 | 592 | ||
| 613 | void | 593 | void |
| 614 | init_sym () | 594 | init_sym (void) |
| 615 | { | 595 | { |
| 616 | global_symbols = add_sym (GLOBALS_NAME, NULL); | 596 | global_symbols = add_sym (GLOBALS_NAME, NULL); |
| 617 | } | 597 | } |
| @@ -625,13 +605,11 @@ init_sym () | |||
| 625 | create a new symbol and set it to default values. */ | 605 | create a new symbol and set it to default values. */ |
| 626 | 606 | ||
| 627 | struct sym * | 607 | struct sym * |
| 628 | add_sym (name, nested_in_class) | 608 | add_sym (const char *name, struct sym *nested_in_class) |
| 629 | char *name; | ||
| 630 | struct sym *nested_in_class; | ||
| 631 | { | 609 | { |
| 632 | struct sym *sym; | 610 | struct sym *sym; |
| 633 | unsigned h; | 611 | unsigned h; |
| 634 | char *s; | 612 | const char *s; |
| 635 | struct sym *scope = nested_in_class ? nested_in_class : current_namespace; | 613 | struct sym *scope = nested_in_class ? nested_in_class : current_namespace; |
| 636 | 614 | ||
| 637 | for (s = name, h = 0; *s; ++s) | 615 | for (s = name, h = 0; *s; ++s) |
| @@ -654,7 +632,7 @@ add_sym (name, nested_in_class) | |||
| 654 | } | 632 | } |
| 655 | 633 | ||
| 656 | sym = (struct sym *) xmalloc (sizeof *sym + strlen (name)); | 634 | sym = (struct sym *) xmalloc (sizeof *sym + strlen (name)); |
| 657 | bzero (sym, sizeof *sym); | 635 | memset (sym, 0, sizeof *sym); |
| 658 | strcpy (sym->name, name); | 636 | strcpy (sym->name, name); |
| 659 | sym->namesp = scope; | 637 | sym->namesp = scope; |
| 660 | sym->next = class_table[h]; | 638 | sym->next = class_table[h]; |
| @@ -668,8 +646,7 @@ add_sym (name, nested_in_class) | |||
| 668 | /* Add links between superclass SUPER and subclass SUB. */ | 646 | /* Add links between superclass SUPER and subclass SUB. */ |
| 669 | 647 | ||
| 670 | void | 648 | void |
| 671 | add_link (super, sub) | 649 | add_link (struct sym *super, struct sym *sub) |
| 672 | struct sym *super, *sub; | ||
| 673 | { | 650 | { |
| 674 | struct link *lnk, *lnk2, *p, *prev; | 651 | struct link *lnk, *lnk2, *p, *prev; |
| 675 | 652 | ||
| @@ -709,11 +686,7 @@ add_link (super, sub) | |||
| 709 | found or null if not found. */ | 686 | found or null if not found. */ |
| 710 | 687 | ||
| 711 | struct member * | 688 | struct member * |
| 712 | find_member (cls, name, var, sc, hash) | 689 | find_member (struct sym *cls, char *name, int var, int sc, unsigned int hash) |
| 713 | struct sym *cls; | ||
| 714 | char *name; | ||
| 715 | int var, sc; | ||
| 716 | unsigned hash; | ||
| 717 | { | 690 | { |
| 718 | struct member **list; | 691 | struct member **list; |
| 719 | struct member *p; | 692 | struct member *p; |
| @@ -763,16 +736,7 @@ find_member (cls, name, var, sc, hash) | |||
| 763 | F_* defines). */ | 736 | F_* defines). */ |
| 764 | 737 | ||
| 765 | void | 738 | void |
| 766 | add_member_decl (cls, name, regexp, pos, hash, var, sc, vis, flags) | 739 | add_member_decl (struct sym *cls, char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int vis, int flags) |
| 767 | struct sym *cls; | ||
| 768 | char *name; | ||
| 769 | char *regexp; | ||
| 770 | int pos; | ||
| 771 | unsigned hash; | ||
| 772 | int var; | ||
| 773 | int sc; | ||
| 774 | int vis; | ||
| 775 | int flags; | ||
| 776 | { | 740 | { |
| 777 | struct member *m; | 741 | struct member *m; |
| 778 | 742 | ||
| @@ -820,15 +784,7 @@ add_member_decl (cls, name, regexp, pos, hash, var, sc, vis, flags) | |||
| 820 | F_* defines). */ | 784 | F_* defines). */ |
| 821 | 785 | ||
| 822 | void | 786 | void |
| 823 | add_member_defn (cls, name, regexp, pos, hash, var, sc, flags) | 787 | add_member_defn (struct sym *cls, char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags) |
| 824 | struct sym *cls; | ||
| 825 | char *name; | ||
| 826 | char *regexp; | ||
| 827 | int pos; | ||
| 828 | unsigned hash; | ||
| 829 | int var; | ||
| 830 | int sc; | ||
| 831 | int flags; | ||
| 832 | { | 788 | { |
| 833 | struct member *m; | 789 | struct member *m; |
| 834 | 790 | ||
| @@ -870,9 +826,7 @@ add_member_defn (cls, name, regexp, pos, hash, var, sc, flags) | |||
| 870 | if it is non-null. POS is the position in the file. */ | 826 | if it is non-null. POS is the position in the file. */ |
| 871 | 827 | ||
| 872 | void | 828 | void |
| 873 | add_define (name, regexp, pos) | 829 | add_define (char *name, char *regexp, int pos) |
| 874 | char *name, *regexp; | ||
| 875 | int pos; | ||
| 876 | { | 830 | { |
| 877 | add_global_defn (name, regexp, pos, 0, 1, SC_FRIEND, F_DEFINE); | 831 | add_global_defn (name, regexp, pos, 0, 1, SC_FRIEND, F_DEFINE); |
| 878 | add_global_decl (name, regexp, pos, 0, 1, SC_FRIEND, F_DEFINE); | 832 | add_global_decl (name, regexp, pos, 0, 1, SC_FRIEND, F_DEFINE); |
| @@ -890,13 +844,7 @@ add_define (name, regexp, pos) | |||
| 890 | F_* defines). */ | 844 | F_* defines). */ |
| 891 | 845 | ||
| 892 | void | 846 | void |
| 893 | add_global_defn (name, regexp, pos, hash, var, sc, flags) | 847 | add_global_defn (char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags) |
| 894 | char *name, *regexp; | ||
| 895 | int pos; | ||
| 896 | unsigned hash; | ||
| 897 | int var; | ||
| 898 | int sc; | ||
| 899 | int flags; | ||
| 900 | { | 848 | { |
| 901 | int i; | 849 | int i; |
| 902 | struct sym *sym; | 850 | struct sym *sym; |
| @@ -927,13 +875,7 @@ add_global_defn (name, regexp, pos, hash, var, sc, flags) | |||
| 927 | F_* defines). */ | 875 | F_* defines). */ |
| 928 | 876 | ||
| 929 | void | 877 | void |
| 930 | add_global_decl (name, regexp, pos, hash, var, sc, flags) | 878 | add_global_decl (char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags) |
| 931 | char *name, *regexp; | ||
| 932 | int pos; | ||
| 933 | unsigned hash; | ||
| 934 | int var; | ||
| 935 | int sc; | ||
| 936 | int flags; | ||
| 937 | { | 879 | { |
| 938 | /* Add declaration only if not already declared. Header files must | 880 | /* Add declaration only if not already declared. Header files must |
| 939 | be processed before source files for this to have the right effect. | 881 | be processed before source files for this to have the right effect. |
| @@ -972,12 +914,7 @@ add_global_decl (name, regexp, pos, hash, var, sc, flags) | |||
| 972 | Value is a pointer to the member's structure. */ | 914 | Value is a pointer to the member's structure. */ |
| 973 | 915 | ||
| 974 | struct member * | 916 | struct member * |
| 975 | add_member (cls, name, var, sc, hash) | 917 | add_member (struct sym *cls, char *name, int var, int sc, unsigned int hash) |
| 976 | struct sym *cls; | ||
| 977 | char *name; | ||
| 978 | int var; | ||
| 979 | int sc; | ||
| 980 | unsigned hash; | ||
| 981 | { | 918 | { |
| 982 | struct member *m = (struct member *) xmalloc (sizeof *m + strlen (name)); | 919 | struct member *m = (struct member *) xmalloc (sizeof *m + strlen (name)); |
| 983 | struct member **list; | 920 | struct member **list; |
| @@ -1048,8 +985,7 @@ add_member (cls, name, var, sc, hash) | |||
| 1048 | in base classes. */ | 985 | in base classes. */ |
| 1049 | 986 | ||
| 1050 | void | 987 | void |
| 1051 | mark_virtual (r) | 988 | mark_virtual (struct sym *r) |
| 1052 | struct sym *r; | ||
| 1053 | { | 989 | { |
| 1054 | struct link *p; | 990 | struct link *p; |
| 1055 | struct member *m, *m2; | 991 | struct member *m, *m2; |
| @@ -1073,7 +1009,7 @@ mark_virtual (r) | |||
| 1073 | are virtual because of a virtual declaration in a base class. */ | 1009 | are virtual because of a virtual declaration in a base class. */ |
| 1074 | 1010 | ||
| 1075 | void | 1011 | void |
| 1076 | mark_inherited_virtual () | 1012 | mark_inherited_virtual (void) |
| 1077 | { | 1013 | { |
| 1078 | struct sym *r; | 1014 | struct sym *r; |
| 1079 | int i; | 1015 | int i; |
| @@ -1088,12 +1024,10 @@ mark_inherited_virtual () | |||
| 1088 | /* Create and return a symbol for a namespace with name NAME. */ | 1024 | /* Create and return a symbol for a namespace with name NAME. */ |
| 1089 | 1025 | ||
| 1090 | struct sym * | 1026 | struct sym * |
| 1091 | make_namespace (name, context) | 1027 | make_namespace (char *name, struct sym *context) |
| 1092 | char *name; | ||
| 1093 | struct sym *context; | ||
| 1094 | { | 1028 | { |
| 1095 | struct sym *s = (struct sym *) xmalloc (sizeof *s + strlen (name)); | 1029 | struct sym *s = (struct sym *) xmalloc (sizeof *s + strlen (name)); |
| 1096 | bzero (s, sizeof *s); | 1030 | memset (s, 0, sizeof *s); |
| 1097 | strcpy (s->name, name); | 1031 | strcpy (s->name, name); |
| 1098 | s->next = all_namespaces; | 1032 | s->next = all_namespaces; |
| 1099 | s->namesp = context; | 1033 | s->namesp = context; |
| @@ -1105,9 +1039,7 @@ make_namespace (name, context) | |||
| 1105 | /* Find the symbol for namespace NAME. If not found, retrun NULL */ | 1039 | /* Find the symbol for namespace NAME. If not found, retrun NULL */ |
| 1106 | 1040 | ||
| 1107 | struct sym * | 1041 | struct sym * |
| 1108 | check_namespace (name, context) | 1042 | check_namespace (char *name, struct sym *context) |
| 1109 | char *name; | ||
| 1110 | struct sym *context; | ||
| 1111 | { | 1043 | { |
| 1112 | struct sym *p = NULL; | 1044 | struct sym *p = NULL; |
| 1113 | 1045 | ||
| @@ -1115,18 +1047,16 @@ check_namespace (name, context) | |||
| 1115 | { | 1047 | { |
| 1116 | if (streq (p->name, name) && (p->namesp == context)) | 1048 | if (streq (p->name, name) && (p->namesp == context)) |
| 1117 | break; | 1049 | break; |
| 1118 | } | 1050 | } |
| 1119 | 1051 | ||
| 1120 | return p; | 1052 | return p; |
| 1121 | } | 1053 | } |
| 1122 | 1054 | ||
| 1123 | /* Find the symbol for namespace NAME. If not found, add a new symbol | 1055 | /* Find the symbol for namespace NAME. If not found, add a new symbol |
| 1124 | for NAME to all_namespaces. */ | 1056 | for NAME to all_namespaces. */ |
| 1125 | 1057 | ||
| 1126 | struct sym * | 1058 | struct sym * |
| 1127 | find_namespace (name, context) | 1059 | find_namespace (char *name, struct sym *context) |
| 1128 | char *name; | ||
| 1129 | struct sym *context; | ||
| 1130 | { | 1060 | { |
| 1131 | struct sym *p = check_namespace (name, context); | 1061 | struct sym *p = check_namespace (name, context); |
| 1132 | 1062 | ||
| @@ -1140,8 +1070,7 @@ find_namespace (name, context) | |||
| 1140 | /* Find namespace alias with name NAME. If not found return NULL. */ | 1070 | /* Find namespace alias with name NAME. If not found return NULL. */ |
| 1141 | 1071 | ||
| 1142 | struct link * | 1072 | struct link * |
| 1143 | check_namespace_alias (name) | 1073 | check_namespace_alias (char *name) |
| 1144 | char *name; | ||
| 1145 | { | 1074 | { |
| 1146 | struct link *p = NULL; | 1075 | struct link *p = NULL; |
| 1147 | struct alias *al; | 1076 | struct alias *al; |
| @@ -1165,9 +1094,7 @@ check_namespace_alias (name) | |||
| 1165 | /* Register the name NEW_NAME as an alias for namespace list OLD_NAME. */ | 1094 | /* Register the name NEW_NAME as an alias for namespace list OLD_NAME. */ |
| 1166 | 1095 | ||
| 1167 | void | 1096 | void |
| 1168 | register_namespace_alias (new_name, old_name) | 1097 | register_namespace_alias (char *new_name, struct link *old_name) |
| 1169 | char *new_name; | ||
| 1170 | struct link *old_name; | ||
| 1171 | { | 1098 | { |
| 1172 | unsigned h; | 1099 | unsigned h; |
| 1173 | char *s; | 1100 | char *s; |
| @@ -1195,8 +1122,7 @@ register_namespace_alias (new_name, old_name) | |||
| 1195 | /* Enter namespace with name NAME. */ | 1122 | /* Enter namespace with name NAME. */ |
| 1196 | 1123 | ||
| 1197 | void | 1124 | void |
| 1198 | enter_namespace (name) | 1125 | enter_namespace (char *name) |
| 1199 | char *name; | ||
| 1200 | { | 1126 | { |
| 1201 | struct sym *p = find_namespace (name, current_namespace); | 1127 | struct sym *p = find_namespace (name, current_namespace); |
| 1202 | 1128 | ||
| @@ -1217,7 +1143,7 @@ enter_namespace (name) | |||
| 1217 | /* Leave the current namespace. */ | 1143 | /* Leave the current namespace. */ |
| 1218 | 1144 | ||
| 1219 | void | 1145 | void |
| 1220 | leave_namespace () | 1146 | leave_namespace (void) |
| 1221 | { | 1147 | { |
| 1222 | assert (namespace_sp > 0); | 1148 | assert (namespace_sp > 0); |
| 1223 | current_namespace = namespace_stack[--namespace_sp]; | 1149 | current_namespace = namespace_stack[--namespace_sp]; |
| @@ -1259,8 +1185,7 @@ int scope_buffer_len; | |||
| 1259 | /* Make sure scope_buffer has enough room to add LEN chars to it. */ | 1185 | /* Make sure scope_buffer has enough room to add LEN chars to it. */ |
| 1260 | 1186 | ||
| 1261 | void | 1187 | void |
| 1262 | ensure_scope_buffer_room (len) | 1188 | ensure_scope_buffer_room (int len) |
| 1263 | int len; | ||
| 1264 | { | 1189 | { |
| 1265 | if (scope_buffer_len + len >= scope_buffer_size) | 1190 | if (scope_buffer_len + len >= scope_buffer_size) |
| 1266 | { | 1191 | { |
| @@ -1276,8 +1201,7 @@ ensure_scope_buffer_room (len) | |||
| 1276 | scope name constructed. */ | 1201 | scope name constructed. */ |
| 1277 | 1202 | ||
| 1278 | char * | 1203 | char * |
| 1279 | sym_scope_1 (p) | 1204 | sym_scope_1 (struct sym *p) |
| 1280 | struct sym *p; | ||
| 1281 | { | 1205 | { |
| 1282 | int len; | 1206 | int len; |
| 1283 | 1207 | ||
| @@ -1311,8 +1235,7 @@ sym_scope_1 (p) | |||
| 1311 | as it would appear in a C*+ source file. */ | 1235 | as it would appear in a C*+ source file. */ |
| 1312 | 1236 | ||
| 1313 | char * | 1237 | char * |
| 1314 | sym_scope (p) | 1238 | sym_scope (struct sym *p) |
| 1315 | struct sym *p; | ||
| 1316 | { | 1239 | { |
| 1317 | if (!scope_buffer) | 1240 | if (!scope_buffer) |
| 1318 | { | 1241 | { |
| @@ -1334,9 +1257,7 @@ sym_scope (p) | |||
| 1334 | list. */ | 1257 | list. */ |
| 1335 | 1258 | ||
| 1336 | int | 1259 | int |
| 1337 | dump_members (fp, m) | 1260 | dump_members (FILE *fp, struct member *m) |
| 1338 | FILE *fp; | ||
| 1339 | struct member *m; | ||
| 1340 | { | 1261 | { |
| 1341 | int n; | 1262 | int n; |
| 1342 | 1263 | ||
| @@ -1369,9 +1290,7 @@ dump_members (fp, m) | |||
| 1369 | /* Dump class ROOT to stream FP. */ | 1290 | /* Dump class ROOT to stream FP. */ |
| 1370 | 1291 | ||
| 1371 | void | 1292 | void |
| 1372 | dump_sym (fp, root) | 1293 | dump_sym (FILE *fp, struct sym *root) |
| 1373 | FILE *fp; | ||
| 1374 | struct sym *root; | ||
| 1375 | { | 1294 | { |
| 1376 | fputs (CLASS_STRUCT, fp); | 1295 | fputs (CLASS_STRUCT, fp); |
| 1377 | PUTSTR (root->name, fp); | 1296 | PUTSTR (root->name, fp); |
| @@ -1397,9 +1316,7 @@ dump_sym (fp, root) | |||
| 1397 | number of classes written. */ | 1316 | number of classes written. */ |
| 1398 | 1317 | ||
| 1399 | int | 1318 | int |
| 1400 | dump_tree (fp, root) | 1319 | dump_tree (FILE *fp, struct sym *root) |
| 1401 | FILE *fp; | ||
| 1402 | struct sym *root; | ||
| 1403 | { | 1320 | { |
| 1404 | struct link *lk; | 1321 | struct link *lk; |
| 1405 | unsigned n = 0; | 1322 | unsigned n = 0; |
| @@ -1446,8 +1363,7 @@ dump_tree (fp, root) | |||
| 1446 | /* Dump the entire class tree to file FP. */ | 1363 | /* Dump the entire class tree to file FP. */ |
| 1447 | 1364 | ||
| 1448 | void | 1365 | void |
| 1449 | dump_roots (fp) | 1366 | dump_roots (FILE *fp) |
| 1450 | FILE *fp; | ||
| 1451 | { | 1367 | { |
| 1452 | int i, n = 0; | 1368 | int i, n = 0; |
| 1453 | struct sym *r; | 1369 | struct sym *r; |
| @@ -1521,7 +1437,7 @@ do { \ | |||
| 1521 | input buffer not consumed. */ | 1437 | input buffer not consumed. */ |
| 1522 | 1438 | ||
| 1523 | int | 1439 | int |
| 1524 | process_pp_line () | 1440 | process_pp_line (void) |
| 1525 | { | 1441 | { |
| 1526 | int in_comment = 0, in_string = 0; | 1442 | int in_comment = 0, in_string = 0; |
| 1527 | int c; | 1443 | int c; |
| @@ -1592,7 +1508,7 @@ process_pp_line () | |||
| 1592 | /* Value is the next token from the input buffer. */ | 1508 | /* Value is the next token from the input buffer. */ |
| 1593 | 1509 | ||
| 1594 | int | 1510 | int |
| 1595 | yylex () | 1511 | yylex (void) |
| 1596 | { | 1512 | { |
| 1597 | int c; | 1513 | int c; |
| 1598 | char end_char; | 1514 | char end_char; |
| @@ -2009,7 +1925,7 @@ static char *matching_regexp_buffer, *matching_regexp_end_buf; | |||
| 2009 | shorter than min_regexp. */ | 1925 | shorter than min_regexp. */ |
| 2010 | 1926 | ||
| 2011 | char * | 1927 | char * |
| 2012 | matching_regexp () | 1928 | matching_regexp (void) |
| 2013 | { | 1929 | { |
| 2014 | char *p; | 1930 | char *p; |
| 2015 | char *s; | 1931 | char *s; |
| @@ -2059,9 +1975,8 @@ matching_regexp () | |||
| 2059 | 1975 | ||
| 2060 | /* Return a printable representation of token T. */ | 1976 | /* Return a printable representation of token T. */ |
| 2061 | 1977 | ||
| 2062 | char * | 1978 | const char * |
| 2063 | token_string (t) | 1979 | token_string (int t) |
| 2064 | int t; | ||
| 2065 | { | 1980 | { |
| 2066 | static char b[3]; | 1981 | static char b[3]; |
| 2067 | 1982 | ||
| @@ -2178,7 +2093,7 @@ token_string (t) | |||
| 2178 | /* Reinitialize the scanner for a new input file. */ | 2093 | /* Reinitialize the scanner for a new input file. */ |
| 2179 | 2094 | ||
| 2180 | void | 2095 | void |
| 2181 | re_init_scanner () | 2096 | re_init_scanner (void) |
| 2182 | { | 2097 | { |
| 2183 | in = inbuffer; | 2098 | in = inbuffer; |
| 2184 | yyline = 1; | 2099 | yyline = 1; |
| @@ -2196,11 +2111,9 @@ re_init_scanner () | |||
| 2196 | table. */ | 2111 | table. */ |
| 2197 | 2112 | ||
| 2198 | void | 2113 | void |
| 2199 | insert_keyword (name, tk) | 2114 | insert_keyword (const char *name, int tk) |
| 2200 | char *name; | ||
| 2201 | int tk; | ||
| 2202 | { | 2115 | { |
| 2203 | char *s; | 2116 | const char *s; |
| 2204 | unsigned h = 0; | 2117 | unsigned h = 0; |
| 2205 | struct kw *k = (struct kw *) xmalloc (sizeof *k); | 2118 | struct kw *k = (struct kw *) xmalloc (sizeof *k); |
| 2206 | 2119 | ||
| @@ -2219,7 +2132,7 @@ insert_keyword (name, tk) | |||
| 2219 | character class vectors and fills the keyword hash table. */ | 2132 | character class vectors and fills the keyword hash table. */ |
| 2220 | 2133 | ||
| 2221 | void | 2134 | void |
| 2222 | init_scanner () | 2135 | init_scanner (void) |
| 2223 | { | 2136 | { |
| 2224 | int i; | 2137 | int i; |
| 2225 | 2138 | ||
| @@ -2363,8 +2276,7 @@ init_scanner () | |||
| 2363 | the current lookahead token after skipping. */ | 2276 | the current lookahead token after skipping. */ |
| 2364 | 2277 | ||
| 2365 | int | 2278 | int |
| 2366 | skip_to (token) | 2279 | skip_to (int token) |
| 2367 | int token; | ||
| 2368 | { | 2280 | { |
| 2369 | while (!LOOKING_AT2 (YYEOF, token)) | 2281 | while (!LOOKING_AT2 (YYEOF, token)) |
| 2370 | MATCH (); | 2282 | MATCH (); |
| @@ -2375,7 +2287,7 @@ skip_to (token) | |||
| 2375 | angle brackets, curly brackets) matching the current lookahead. */ | 2287 | angle brackets, curly brackets) matching the current lookahead. */ |
| 2376 | 2288 | ||
| 2377 | void | 2289 | void |
| 2378 | skip_matching () | 2290 | skip_matching (void) |
| 2379 | { | 2291 | { |
| 2380 | int open, close, n; | 2292 | int open, close, n; |
| 2381 | 2293 | ||
| @@ -2418,7 +2330,7 @@ skip_matching () | |||
| 2418 | } | 2330 | } |
| 2419 | 2331 | ||
| 2420 | void | 2332 | void |
| 2421 | skip_initializer () | 2333 | skip_initializer (void) |
| 2422 | { | 2334 | { |
| 2423 | for (;;) | 2335 | for (;;) |
| 2424 | { | 2336 | { |
| @@ -2445,7 +2357,7 @@ skip_initializer () | |||
| 2445 | /* Build qualified namespace alias (A::B::c) and return it. */ | 2357 | /* Build qualified namespace alias (A::B::c) and return it. */ |
| 2446 | 2358 | ||
| 2447 | struct link * | 2359 | struct link * |
| 2448 | match_qualified_namespace_alias () | 2360 | match_qualified_namespace_alias (void) |
| 2449 | { | 2361 | { |
| 2450 | struct link *head = NULL; | 2362 | struct link *head = NULL; |
| 2451 | struct link *cur = NULL; | 2363 | struct link *cur = NULL; |
| @@ -2458,7 +2370,7 @@ match_qualified_namespace_alias () | |||
| 2458 | { | 2370 | { |
| 2459 | case IDENT: | 2371 | case IDENT: |
| 2460 | tmp = (struct link *) xmalloc (sizeof *cur); | 2372 | tmp = (struct link *) xmalloc (sizeof *cur); |
| 2461 | tmp->sym = find_namespace (yytext, cur); | 2373 | tmp->sym = find_namespace (yytext, cur ? cur->sym : NULL); |
| 2462 | tmp->next = NULL; | 2374 | tmp->next = NULL; |
| 2463 | if (head) | 2375 | if (head) |
| 2464 | { | 2376 | { |
| @@ -2482,7 +2394,7 @@ match_qualified_namespace_alias () | |||
| 2482 | /* Re-initialize the parser by resetting the lookahead token. */ | 2394 | /* Re-initialize the parser by resetting the lookahead token. */ |
| 2483 | 2395 | ||
| 2484 | void | 2396 | void |
| 2485 | re_init_parser () | 2397 | re_init_parser (void) |
| 2486 | { | 2398 | { |
| 2487 | tk = -1; | 2399 | tk = -1; |
| 2488 | } | 2400 | } |
| @@ -2495,8 +2407,7 @@ re_init_parser () | |||
| 2495 | distinguish between overloaded functions. */ | 2407 | distinguish between overloaded functions. */ |
| 2496 | 2408 | ||
| 2497 | unsigned | 2409 | unsigned |
| 2498 | parm_list (flags) | 2410 | parm_list (int *flags) |
| 2499 | int *flags; | ||
| 2500 | { | 2411 | { |
| 2501 | unsigned hash = 0; | 2412 | unsigned hash = 0; |
| 2502 | int type_seen = 0; | 2413 | int type_seen = 0; |
| @@ -2609,7 +2520,7 @@ parm_list (flags) | |||
| 2609 | /* Print position info to stdout. */ | 2520 | /* Print position info to stdout. */ |
| 2610 | 2521 | ||
| 2611 | void | 2522 | void |
| 2612 | print_info () | 2523 | print_info (void) |
| 2613 | { | 2524 | { |
| 2614 | if (info_position >= 0 && BUFFER_POS () <= info_position) | 2525 | if (info_position >= 0 && BUFFER_POS () <= info_position) |
| 2615 | if (info_cls) | 2526 | if (info_cls) |
| @@ -2624,9 +2535,7 @@ print_info () | |||
| 2624 | public). */ | 2535 | public). */ |
| 2625 | 2536 | ||
| 2626 | void | 2537 | void |
| 2627 | member (cls, vis) | 2538 | member (struct sym *cls, int vis) |
| 2628 | struct sym *cls; | ||
| 2629 | int vis; | ||
| 2630 | { | 2539 | { |
| 2631 | char *id = NULL; | 2540 | char *id = NULL; |
| 2632 | int sc = SC_MEMBER; | 2541 | int sc = SC_MEMBER; |
| @@ -2835,9 +2744,7 @@ member (cls, vis) | |||
| 2835 | union, class). */ | 2744 | union, class). */ |
| 2836 | 2745 | ||
| 2837 | void | 2746 | void |
| 2838 | class_body (cls, tag) | 2747 | class_body (struct sym *cls, int tag) |
| 2839 | struct sym *cls; | ||
| 2840 | int tag; | ||
| 2841 | { | 2748 | { |
| 2842 | int vis = tag == CLASS ? PRIVATE : PUBLIC; | 2749 | int vis = tag == CLASS ? PRIVATE : PUBLIC; |
| 2843 | int temp; | 2750 | int temp; |
| @@ -2898,7 +2805,7 @@ class_body (cls, tag) | |||
| 2898 | symbol for that class. */ | 2805 | symbol for that class. */ |
| 2899 | 2806 | ||
| 2900 | struct sym * | 2807 | struct sym * |
| 2901 | parse_classname () | 2808 | parse_classname (void) |
| 2902 | { | 2809 | { |
| 2903 | struct sym *last_class = NULL; | 2810 | struct sym *last_class = NULL; |
| 2904 | 2811 | ||
| @@ -2928,12 +2835,11 @@ parse_classname () | |||
| 2928 | a static buffer holding the constructed operator name string. */ | 2835 | a static buffer holding the constructed operator name string. */ |
| 2929 | 2836 | ||
| 2930 | char * | 2837 | char * |
| 2931 | operator_name (sc) | 2838 | operator_name (int *sc) |
| 2932 | int *sc; | ||
| 2933 | { | 2839 | { |
| 2934 | static int id_size = 0; | 2840 | static int id_size = 0; |
| 2935 | static char *id = NULL; | 2841 | static char *id = NULL; |
| 2936 | char *s; | 2842 | const char *s; |
| 2937 | int len; | 2843 | int len; |
| 2938 | 2844 | ||
| 2939 | MATCH (); | 2845 | MATCH (); |
| @@ -3019,8 +2925,7 @@ operator_name (sc) | |||
| 3019 | symbol structure for the ident. */ | 2925 | symbol structure for the ident. */ |
| 3020 | 2926 | ||
| 3021 | struct sym * | 2927 | struct sym * |
| 3022 | parse_qualified_ident_or_type (last_id) | 2928 | parse_qualified_ident_or_type (char **last_id) |
| 3023 | char **last_id; | ||
| 3024 | { | 2929 | { |
| 3025 | struct sym *cls = NULL; | 2930 | struct sym *cls = NULL; |
| 3026 | char *id = NULL; | 2931 | char *id = NULL; |
| @@ -3085,8 +2990,7 @@ parse_qualified_ident_or_type (last_id) | |||
| 3085 | symbol structure for the ident. */ | 2990 | symbol structure for the ident. */ |
| 3086 | 2991 | ||
| 3087 | void | 2992 | void |
| 3088 | parse_qualified_param_ident_or_type (last_id) | 2993 | parse_qualified_param_ident_or_type (char **last_id) |
| 3089 | char **last_id; | ||
| 3090 | { | 2994 | { |
| 3091 | struct sym *cls = NULL; | 2995 | struct sym *cls = NULL; |
| 3092 | static char *id = NULL; | 2996 | static char *id = NULL; |
| @@ -3128,11 +3032,7 @@ parse_qualified_param_ident_or_type (last_id) | |||
| 3128 | Current lookahead is the class name. */ | 3032 | Current lookahead is the class name. */ |
| 3129 | 3033 | ||
| 3130 | void | 3034 | void |
| 3131 | class_definition (containing, tag, flags, nested) | 3035 | class_definition (struct sym *containing, int tag, int flags, int nested) |
| 3132 | struct sym *containing; | ||
| 3133 | int tag; | ||
| 3134 | int flags; | ||
| 3135 | int nested; | ||
| 3136 | { | 3036 | { |
| 3137 | struct sym *current; | 3037 | struct sym *current; |
| 3138 | struct sym *base_class; | 3038 | struct sym *base_class; |
| @@ -3229,10 +3129,7 @@ class_definition (containing, tag, flags, nested) | |||
| 3229 | information about the member (see the F_* defines). */ | 3129 | information about the member (see the F_* defines). */ |
| 3230 | 3130 | ||
| 3231 | void | 3131 | void |
| 3232 | add_declarator (cls, id, flags, sc) | 3132 | add_declarator (struct sym **cls, char **id, int flags, int sc) |
| 3233 | struct sym **cls; | ||
| 3234 | char **id; | ||
| 3235 | int flags, sc; | ||
| 3236 | { | 3133 | { |
| 3237 | if (LOOKING_AT2 (';', ',')) | 3134 | if (LOOKING_AT2 (';', ',')) |
| 3238 | { | 3135 | { |
| @@ -3275,8 +3172,7 @@ add_declarator (cls, id, flags, sc) | |||
| 3275 | /* Parse a declaration. */ | 3172 | /* Parse a declaration. */ |
| 3276 | 3173 | ||
| 3277 | void | 3174 | void |
| 3278 | declaration (flags) | 3175 | declaration (int flags) |
| 3279 | int flags; | ||
| 3280 | { | 3176 | { |
| 3281 | char *id = NULL; | 3177 | char *id = NULL; |
| 3282 | struct sym *cls = NULL; | 3178 | struct sym *cls = NULL; |
| @@ -3430,8 +3326,7 @@ declaration (flags) | |||
| 3430 | otherwise. */ | 3326 | otherwise. */ |
| 3431 | 3327 | ||
| 3432 | int | 3328 | int |
| 3433 | globals (start_flags) | 3329 | globals (int start_flags) |
| 3434 | int start_flags; | ||
| 3435 | { | 3330 | { |
| 3436 | int anonymous; | 3331 | int anonymous; |
| 3437 | int class_tk; | 3332 | int class_tk; |
| @@ -3549,7 +3444,7 @@ globals (start_flags) | |||
| 3549 | /* Parse the current input file. */ | 3444 | /* Parse the current input file. */ |
| 3550 | 3445 | ||
| 3551 | void | 3446 | void |
| 3552 | yyparse () | 3447 | yyparse (void) |
| 3553 | { | 3448 | { |
| 3554 | while (globals (0) == 0) | 3449 | while (globals (0) == 0) |
| 3555 | MATCH_IF ('}'); | 3450 | MATCH_IF ('}'); |
| @@ -3565,8 +3460,7 @@ yyparse () | |||
| 3565 | input files. */ | 3460 | input files. */ |
| 3566 | 3461 | ||
| 3567 | void | 3462 | void |
| 3568 | add_search_path (path_list) | 3463 | add_search_path (char *path_list) |
| 3569 | char *path_list; | ||
| 3570 | { | 3464 | { |
| 3571 | while (*path_list) | 3465 | while (*path_list) |
| 3572 | { | 3466 | { |
| @@ -3601,8 +3495,7 @@ add_search_path (path_list) | |||
| 3601 | unchanged file name. */ | 3495 | unchanged file name. */ |
| 3602 | 3496 | ||
| 3603 | FILE * | 3497 | FILE * |
| 3604 | open_file (file) | 3498 | open_file (char *file) |
| 3605 | char *file; | ||
| 3606 | { | 3499 | { |
| 3607 | FILE *fp = NULL; | 3500 | FILE *fp = NULL; |
| 3608 | static char *buffer; | 3501 | static char *buffer; |
| @@ -3661,8 +3554,7 @@ Usage: ebrowse [options] {files}\n\ | |||
| 3661 | " | 3554 | " |
| 3662 | 3555 | ||
| 3663 | void | 3556 | void |
| 3664 | usage (error) | 3557 | usage (int error) |
| 3665 | int error; | ||
| 3666 | { | 3558 | { |
| 3667 | puts (USAGE); | 3559 | puts (USAGE); |
| 3668 | exit (error ? EXIT_FAILURE : EXIT_SUCCESS); | 3560 | exit (error ? EXIT_FAILURE : EXIT_SUCCESS); |
| @@ -3677,7 +3569,7 @@ usage (error) | |||
| 3677 | #endif | 3569 | #endif |
| 3678 | 3570 | ||
| 3679 | void | 3571 | void |
| 3680 | version () | 3572 | version (void) |
| 3681 | { | 3573 | { |
| 3682 | /* Makes it easier to update automatically. */ | 3574 | /* Makes it easier to update automatically. */ |
| 3683 | char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc."; | 3575 | char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc."; |
| @@ -3693,8 +3585,7 @@ version () | |||
| 3693 | table. */ | 3585 | table. */ |
| 3694 | 3586 | ||
| 3695 | void | 3587 | void |
| 3696 | process_file (file) | 3588 | process_file (char *file) |
| 3697 | char *file; | ||
| 3698 | { | 3589 | { |
| 3699 | FILE *fp; | 3590 | FILE *fp; |
| 3700 | 3591 | ||
| @@ -3749,8 +3640,7 @@ process_file (file) | |||
| 3749 | is null when EOF is reached. */ | 3640 | is null when EOF is reached. */ |
| 3750 | 3641 | ||
| 3751 | char * | 3642 | char * |
| 3752 | read_line (fp) | 3643 | read_line (FILE *fp) |
| 3753 | FILE *fp; | ||
| 3754 | { | 3644 | { |
| 3755 | static char *buffer; | 3645 | static char *buffer; |
| 3756 | static int buffer_size; | 3646 | static int buffer_size; |
| @@ -3786,13 +3676,11 @@ read_line (fp) | |||
| 3786 | /* Main entry point. */ | 3676 | /* Main entry point. */ |
| 3787 | 3677 | ||
| 3788 | int | 3678 | int |
| 3789 | main (argc, argv) | 3679 | main (int argc, char **argv) |
| 3790 | int argc; | ||
| 3791 | char **argv; | ||
| 3792 | { | 3680 | { |
| 3793 | int i; | 3681 | int i; |
| 3794 | int any_inputfiles = 0; | 3682 | int any_inputfiles = 0; |
| 3795 | static char *out_filename = DEFAULT_OUTFILE; | 3683 | static const char *out_filename = DEFAULT_OUTFILE; |
| 3796 | static char **input_filenames = NULL; | 3684 | static char **input_filenames = NULL; |
| 3797 | static int input_filenames_size = 0; | 3685 | static int input_filenames_size = 0; |
| 3798 | static int n_input_files; | 3686 | static int n_input_files; |
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 3172ebb8cd1..e8ffbe7c562 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c | |||
| @@ -18,9 +18,7 @@ You should have received a copy of the GNU General Public License | |||
| 18 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | 18 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 19 | 19 | ||
| 20 | 20 | ||
| 21 | #ifdef HAVE_CONFIG_H | ||
| 22 | #include <config.h> | 21 | #include <config.h> |
| 23 | #endif | ||
| 24 | 22 | ||
| 25 | #ifdef WINDOWSNT | 23 | #ifdef WINDOWSNT |
| 26 | 24 | ||
| @@ -32,6 +30,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 32 | # include <stdlib.h> | 30 | # include <stdlib.h> |
| 33 | # include <windows.h> | 31 | # include <windows.h> |
| 34 | # include <commctrl.h> | 32 | # include <commctrl.h> |
| 33 | # include <io.h> | ||
| 34 | # include <winsock2.h> | ||
| 35 | 35 | ||
| 36 | # define NO_SOCKETS_IN_FILE_SYSTEM | 36 | # define NO_SOCKETS_IN_FILE_SYSTEM |
| 37 | 37 | ||
| @@ -45,8 +45,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 45 | 45 | ||
| 46 | # ifdef HAVE_INET_SOCKETS | 46 | # ifdef HAVE_INET_SOCKETS |
| 47 | # include <netinet/in.h> | 47 | # include <netinet/in.h> |
| 48 | # ifdef HAVE_SOCKETS | ||
| 49 | # include <sys/types.h> | ||
| 50 | # include <sys/socket.h> | ||
| 51 | # include <sys/un.h> | ||
| 52 | # endif /* HAVE_SOCKETS */ | ||
| 48 | # endif | 53 | # endif |
| 49 | |||
| 50 | # include <arpa/inet.h> | 54 | # include <arpa/inet.h> |
| 51 | 55 | ||
| 52 | # define INVALID_SOCKET -1 | 56 | # define INVALID_SOCKET -1 |
| @@ -67,25 +71,23 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 67 | #include <stdio.h> | 71 | #include <stdio.h> |
| 68 | #include "getopt.h" | 72 | #include "getopt.h" |
| 69 | #ifdef HAVE_UNISTD_H | 73 | #ifdef HAVE_UNISTD_H |
| 70 | #include <unistd.h> | 74 | # include <unistd.h> |
| 71 | #endif | 75 | #endif |
| 72 | 76 | ||
| 73 | #ifdef WINDOWSNT | 77 | #include <pwd.h> |
| 74 | # include <io.h> | ||
| 75 | #else /* not WINDOWSNT */ | ||
| 76 | # include <pwd.h> | ||
| 77 | #endif /* not WINDOWSNT */ | ||
| 78 | #include <sys/stat.h> | 78 | #include <sys/stat.h> |
| 79 | |||
| 80 | #include <signal.h> | 79 | #include <signal.h> |
| 81 | #include <errno.h> | 80 | #include <errno.h> |
| 82 | 81 | ||
| 82 | |||
| 83 | 83 | ||
| 84 | char *getenv (), *getwd (); | 84 | char *getenv (const char *), *getwd (char *); |
| 85 | char *(getcwd) (); | 85 | #ifdef HAVE_GETCWD |
| 86 | char *(getcwd) (char *, size_t); | ||
| 87 | #endif | ||
| 86 | 88 | ||
| 87 | #ifdef WINDOWSNT | 89 | #ifdef WINDOWSNT |
| 88 | char *w32_getenv (); | 90 | char *w32_getenv (char *); |
| 89 | #define egetenv(VAR) w32_getenv(VAR) | 91 | #define egetenv(VAR) w32_getenv(VAR) |
| 90 | #else | 92 | #else |
| 91 | #define egetenv(VAR) getenv(VAR) | 93 | #define egetenv(VAR) getenv(VAR) |
| @@ -112,10 +114,6 @@ char *w32_getenv (); | |||
| 112 | #define TRUE 1 | 114 | #define TRUE 1 |
| 113 | #endif | 115 | #endif |
| 114 | 116 | ||
| 115 | #ifndef NO_RETURN | ||
| 116 | #define NO_RETURN | ||
| 117 | #endif | ||
| 118 | |||
| 119 | /* Additional space when allocating buffers for filenames, etc. */ | 117 | /* Additional space when allocating buffers for filenames, etc. */ |
| 120 | #define EXTRA_SPACE 100 | 118 | #define EXTRA_SPACE 100 |
| 121 | 119 | ||
| @@ -136,7 +134,7 @@ int eval = 0; | |||
| 136 | int current_frame = 1; | 134 | int current_frame = 1; |
| 137 | 135 | ||
| 138 | /* The display on which Emacs should work. --display. */ | 136 | /* The display on which Emacs should work. --display. */ |
| 139 | char *display = NULL; | 137 | const char *display = NULL; |
| 140 | 138 | ||
| 141 | /* 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. */ |
| 142 | char *parent_id = NULL; | 140 | char *parent_id = NULL; |
| @@ -152,12 +150,14 @@ const char *alternate_editor = NULL; | |||
| 152 | char *socket_name = NULL; | 150 | char *socket_name = NULL; |
| 153 | 151 | ||
| 154 | /* If non-NULL, the filename of the authentication file. */ | 152 | /* If non-NULL, the filename of the authentication file. */ |
| 155 | char *server_file = NULL; | 153 | const char *server_file = NULL; |
| 156 | 154 | ||
| 157 | /* PID of the Emacs server process. */ | 155 | /* PID of the Emacs server process. */ |
| 158 | int emacs_pid = 0; | 156 | int emacs_pid = 0; |
| 159 | 157 | ||
| 160 | void print_help_and_exit () NO_RETURN; | 158 | void print_help_and_exit (void) NO_RETURN; |
| 159 | void fail (void) NO_RETURN; | ||
| 160 | |||
| 161 | 161 | ||
| 162 | struct option longopts[] = | 162 | struct option longopts[] = |
| 163 | { | 163 | { |
| @@ -184,8 +184,7 @@ struct option longopts[] = | |||
| 184 | /* Like malloc but get fatal error if memory is exhausted. */ | 184 | /* Like malloc but get fatal error if memory is exhausted. */ |
| 185 | 185 | ||
| 186 | long * | 186 | long * |
| 187 | xmalloc (size) | 187 | xmalloc (unsigned int size) |
| 188 | unsigned int size; | ||
| 189 | { | 188 | { |
| 190 | long *result = (long *) malloc (size); | 189 | long *result = (long *) malloc (size); |
| 191 | if (result == NULL) | 190 | if (result == NULL) |
| @@ -236,7 +235,7 @@ xstrdup (const char *s) | |||
| 236 | Any other returned value must be freed with free. This is used | 235 | Any other returned value must be freed with free. This is used |
| 237 | only when get_current_dir_name is not defined on the system. */ | 236 | only when get_current_dir_name is not defined on the system. */ |
| 238 | char* | 237 | char* |
| 239 | get_current_dir_name () | 238 | get_current_dir_name (void) |
| 240 | { | 239 | { |
| 241 | char *buf; | 240 | char *buf; |
| 242 | char *pwd; | 241 | char *pwd; |
| @@ -312,10 +311,7 @@ get_current_dir_name () | |||
| 312 | Return NULL if the variable was not found, or it was empty. | 311 | Return NULL if the variable was not found, or it was empty. |
| 313 | This code is based on w32_get_resource (w32.c). */ | 312 | This code is based on w32_get_resource (w32.c). */ |
| 314 | char * | 313 | char * |
| 315 | w32_get_resource (predefined, key, type) | 314 | w32_get_resource (HKEY predefined, char *key, LPDWORD type) |
| 316 | HKEY predefined; | ||
| 317 | char *key; | ||
| 318 | LPDWORD type; | ||
| 319 | { | 315 | { |
| 320 | HKEY hrootkey = NULL; | 316 | HKEY hrootkey = NULL; |
| 321 | char *result = NULL; | 317 | char *result = NULL; |
| @@ -348,8 +344,7 @@ w32_get_resource (predefined, key, type) | |||
| 348 | variables in the registry if they don't appear in the environment. | 344 | variables in the registry if they don't appear in the environment. |
| 349 | */ | 345 | */ |
| 350 | char * | 346 | char * |
| 351 | w32_getenv (envvar) | 347 | w32_getenv (char *envvar) |
| 352 | char *envvar; | ||
| 353 | { | 348 | { |
| 354 | char *value; | 349 | char *value; |
| 355 | DWORD dwType; | 350 | DWORD dwType; |
| @@ -397,7 +392,7 @@ w32_getenv (envvar) | |||
| 397 | } | 392 | } |
| 398 | 393 | ||
| 399 | void | 394 | void |
| 400 | w32_set_user_model_id () | 395 | w32_set_user_model_id (void) |
| 401 | { | 396 | { |
| 402 | HMODULE shell; | 397 | HMODULE shell; |
| 403 | HRESULT (WINAPI * set_user_model) (wchar_t * id); | 398 | HRESULT (WINAPI * set_user_model) (wchar_t * id); |
| @@ -405,7 +400,7 @@ w32_set_user_model_id () | |||
| 405 | /* On Windows 7 and later, we need to set the user model ID | 400 | /* On Windows 7 and later, we need to set the user model ID |
| 406 | to associate emacsclient launched files with Emacs frames | 401 | to associate emacsclient launched files with Emacs frames |
| 407 | in the UI. */ | 402 | in the UI. */ |
| 408 | shell = LoadLibrary("shell32.dll"); | 403 | shell = LoadLibrary ("shell32.dll"); |
| 409 | if (shell) | 404 | if (shell) |
| 410 | { | 405 | { |
| 411 | set_user_model | 406 | set_user_model |
| @@ -424,7 +419,7 @@ w32_set_user_model_id () | |||
| 424 | } | 419 | } |
| 425 | 420 | ||
| 426 | int | 421 | int |
| 427 | w32_window_app () | 422 | w32_window_app (void) |
| 428 | { | 423 | { |
| 429 | static int window_app = -1; | 424 | static int window_app = -1; |
| 430 | char szTitle[MAX_PATH]; | 425 | char szTitle[MAX_PATH]; |
| @@ -435,7 +430,7 @@ w32_window_app () | |||
| 435 | nonconsole apps. Testing for the console title seems to work. */ | 430 | nonconsole apps. Testing for the console title seems to work. */ |
| 436 | window_app = (GetConsoleTitleA (szTitle, MAX_PATH) == 0); | 431 | window_app = (GetConsoleTitleA (szTitle, MAX_PATH) == 0); |
| 437 | if (window_app) | 432 | if (window_app) |
| 438 | InitCommonControls(); | 433 | InitCommonControls (); |
| 439 | } | 434 | } |
| 440 | 435 | ||
| 441 | return window_app; | 436 | return window_app; |
| @@ -447,13 +442,11 @@ w32_window_app () | |||
| 447 | This is necessary due to the broken implementation of exec* routines in | 442 | This is necessary due to the broken implementation of exec* routines in |
| 448 | the Microsoft libraries: they concatenate the arguments together without | 443 | the Microsoft libraries: they concatenate the arguments together without |
| 449 | quoting special characters, and pass the result to CreateProcess, with | 444 | quoting special characters, and pass the result to CreateProcess, with |
| 450 | predictably bad results. By contrast, Posix execvp passes the arguments | 445 | predictably bad results. By contrast, POSIX execvp passes the arguments |
| 451 | directly into the argv array of the child process. | 446 | directly into the argv array of the child process. |
| 452 | */ | 447 | */ |
| 453 | int | 448 | int |
| 454 | w32_execvp (path, argv) | 449 | w32_execvp (const char *path, char **argv) |
| 455 | char *path; | ||
| 456 | char **argv; | ||
| 457 | { | 450 | { |
| 458 | int i; | 451 | int i; |
| 459 | 452 | ||
| @@ -486,9 +479,9 @@ ttyname (int fd) | |||
| 486 | /* Display a normal or error message. | 479 | /* Display a normal or error message. |
| 487 | 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. */ |
| 488 | void | 481 | void |
| 489 | message (int is_error, char *message, ...) | 482 | message (int is_error, const char *message, ...) |
| 490 | { | 483 | { |
| 491 | char msg [2048]; | 484 | char msg[2048]; |
| 492 | va_list args; | 485 | va_list args; |
| 493 | 486 | ||
| 494 | va_start (args, message); | 487 | va_start (args, message); |
| @@ -517,9 +510,7 @@ message (int is_error, char *message, ...) | |||
| 517 | The global variable `optind' will say how many arguments we used up. */ | 510 | The global variable `optind' will say how many arguments we used up. */ |
| 518 | 511 | ||
| 519 | void | 512 | void |
| 520 | decode_options (argc, argv) | 513 | decode_options (int argc, char **argv) |
| 521 | int argc; | ||
| 522 | char **argv; | ||
| 523 | { | 514 | { |
| 524 | alternate_editor = egetenv ("ALTERNATE_EDITOR"); | 515 | alternate_editor = egetenv ("ALTERNATE_EDITOR"); |
| 525 | 516 | ||
| @@ -645,7 +636,7 @@ an empty string"); | |||
| 645 | 636 | ||
| 646 | 637 | ||
| 647 | void | 638 | void |
| 648 | print_help_and_exit () | 639 | print_help_and_exit (void) |
| 649 | { | 640 | { |
| 650 | /* Spaces and tabs are significant in this message; they're chosen so the | 641 | /* Spaces and tabs are significant in this message; they're chosen so the |
| 651 | message aligns properly both in a tty and in a Windows message box. | 642 | message aligns properly both in a tty and in a Windows message box. |
| @@ -707,9 +698,7 @@ fail (void) | |||
| 707 | #if !defined (HAVE_SOCKETS) || !defined (HAVE_INET_SOCKETS) | 698 | #if !defined (HAVE_SOCKETS) || !defined (HAVE_INET_SOCKETS) |
| 708 | 699 | ||
| 709 | int | 700 | int |
| 710 | main (argc, argv) | 701 | main (int argc, char **argv) |
| 711 | int argc; | ||
| 712 | char **argv; | ||
| 713 | { | 702 | { |
| 714 | main_argv = argv; | 703 | main_argv = argv; |
| 715 | progname = argv[0]; | 704 | progname = argv[0]; |
| @@ -721,18 +710,10 @@ main (argc, argv) | |||
| 721 | 710 | ||
| 722 | #else /* HAVE_SOCKETS && HAVE_INET_SOCKETS */ | 711 | #else /* HAVE_SOCKETS && HAVE_INET_SOCKETS */ |
| 723 | 712 | ||
| 724 | #ifdef WINDOWSNT | ||
| 725 | # include <winsock2.h> | ||
| 726 | #else | ||
| 727 | # include <sys/types.h> | ||
| 728 | # include <sys/socket.h> | ||
| 729 | # include <sys/un.h> | ||
| 730 | #endif | ||
| 731 | |||
| 732 | #define AUTH_KEY_LENGTH 64 | 713 | #define AUTH_KEY_LENGTH 64 |
| 733 | #define SEND_BUFFER_SIZE 4096 | 714 | #define SEND_BUFFER_SIZE 4096 |
| 734 | 715 | ||
| 735 | extern char *strerror (); | 716 | extern char *strerror (int); |
| 736 | 717 | ||
| 737 | /* Buffer to accumulate data to send in TCP connections. */ | 718 | /* Buffer to accumulate data to send in TCP connections. */ |
| 738 | char send_buffer[SEND_BUFFER_SIZE + 1]; | 719 | char send_buffer[SEND_BUFFER_SIZE + 1]; |
| @@ -743,8 +724,7 @@ HSOCKET emacs_socket = 0; | |||
| 743 | /* On Windows, the socket library was historically separate from the standard | 724 | /* On Windows, the socket library was historically separate from the standard |
| 744 | C library, so errors are handled differently. */ | 725 | C library, so errors are handled differently. */ |
| 745 | void | 726 | void |
| 746 | sock_err_message (function_name) | 727 | sock_err_message (const char *function_name) |
| 747 | char *function_name; | ||
| 748 | { | 728 | { |
| 749 | #ifdef WINDOWSNT | 729 | #ifdef WINDOWSNT |
| 750 | char* msg = NULL; | 730 | char* msg = NULL; |
| @@ -768,9 +748,7 @@ sock_err_message (function_name) | |||
| 768 | - the buffer is full (but this shouldn't happen) | 748 | - the buffer is full (but this shouldn't happen) |
| 769 | Otherwise, we just accumulate it. */ | 749 | Otherwise, we just accumulate it. */ |
| 770 | void | 750 | void |
| 771 | send_to_emacs (s, data) | 751 | send_to_emacs (HSOCKET s, const char *data) |
| 772 | HSOCKET s; | ||
| 773 | char *data; | ||
| 774 | { | 752 | { |
| 775 | while (data) | 753 | while (data) |
| 776 | { | 754 | { |
| @@ -807,14 +785,13 @@ send_to_emacs (s, data) | |||
| 807 | any initial -. Change spaces to underscores, too, so that the | 785 | any initial -. Change spaces to underscores, too, so that the |
| 808 | return value never contains a space. | 786 | return value never contains a space. |
| 809 | 787 | ||
| 810 | Does not change the string. Outputs the result to STREAM. */ | 788 | Does not change the string. Outputs the result to S. */ |
| 811 | void | 789 | void |
| 812 | quote_argument (s, str) | 790 | quote_argument (HSOCKET s, const char *str) |
| 813 | HSOCKET s; | ||
| 814 | char *str; | ||
| 815 | { | 791 | { |
| 816 | char *copy = (char *) xmalloc (strlen (str) * 2 + 1); | 792 | char *copy = (char *) xmalloc (strlen (str) * 2 + 1); |
| 817 | char *p, *q; | 793 | const char *p; |
| 794 | char *q; | ||
| 818 | 795 | ||
| 819 | p = str; | 796 | p = str; |
| 820 | q = copy; | 797 | q = copy; |
| @@ -851,8 +828,7 @@ quote_argument (s, str) | |||
| 851 | modifying the string in place. Returns STR. */ | 828 | modifying the string in place. Returns STR. */ |
| 852 | 829 | ||
| 853 | char * | 830 | char * |
| 854 | unquote_argument (str) | 831 | unquote_argument (char *str) |
| 855 | char *str; | ||
| 856 | { | 832 | { |
| 857 | char *p, *q; | 833 | char *p, *q; |
| 858 | 834 | ||
| @@ -883,8 +859,7 @@ unquote_argument (str) | |||
| 883 | 859 | ||
| 884 | 860 | ||
| 885 | int | 861 | int |
| 886 | file_name_absolute_p (filename) | 862 | file_name_absolute_p (const unsigned char *filename) |
| 887 | const unsigned char *filename; | ||
| 888 | { | 863 | { |
| 889 | /* Sanity check, it shouldn't happen. */ | 864 | /* Sanity check, it shouldn't happen. */ |
| 890 | if (! filename) return FALSE; | 865 | if (! filename) return FALSE; |
| @@ -910,15 +885,15 @@ file_name_absolute_p (filename) | |||
| 910 | 885 | ||
| 911 | #ifdef WINDOWSNT | 886 | #ifdef WINDOWSNT |
| 912 | /* Wrapper to make WSACleanup a cdecl, as required by atexit. */ | 887 | /* Wrapper to make WSACleanup a cdecl, as required by atexit. */ |
| 913 | void | 888 | void __cdecl |
| 914 | __cdecl close_winsock () | 889 | close_winsock (void) |
| 915 | { | 890 | { |
| 916 | WSACleanup (); | 891 | WSACleanup (); |
| 917 | } | 892 | } |
| 918 | 893 | ||
| 919 | /* Initialize the WinSock2 library. */ | 894 | /* Initialize the WinSock2 library. */ |
| 920 | void | 895 | void |
| 921 | initialize_sockets () | 896 | initialize_sockets (void) |
| 922 | { | 897 | { |
| 923 | WSADATA wsaData; | 898 | WSADATA wsaData; |
| 924 | 899 | ||
| @@ -938,9 +913,7 @@ initialize_sockets () | |||
| 938 | * the Emacs server: host, port, pid and authentication string. | 913 | * the Emacs server: host, port, pid and authentication string. |
| 939 | */ | 914 | */ |
| 940 | int | 915 | int |
| 941 | get_server_config (server, authentication) | 916 | get_server_config (struct sockaddr_in *server, char *authentication) |
| 942 | struct sockaddr_in *server; | ||
| 943 | char *authentication; | ||
| 944 | { | 917 | { |
| 945 | char dotted[32]; | 918 | char dotted[32]; |
| 946 | char *port; | 919 | char *port; |
| @@ -1005,7 +978,7 @@ get_server_config (server, authentication) | |||
| 1005 | } | 978 | } |
| 1006 | 979 | ||
| 1007 | HSOCKET | 980 | HSOCKET |
| 1008 | set_tcp_socket () | 981 | set_tcp_socket (void) |
| 1009 | { | 982 | { |
| 1010 | HSOCKET s; | 983 | HSOCKET s; |
| 1011 | struct sockaddr_in server; | 984 | struct sockaddr_in server; |
| @@ -1054,7 +1027,7 @@ set_tcp_socket () | |||
| 1054 | 1027 | ||
| 1055 | /* Returns 1 if PREFIX is a prefix of STRING. */ | 1028 | /* Returns 1 if PREFIX is a prefix of STRING. */ |
| 1056 | static int | 1029 | static int |
| 1057 | strprefix (char *prefix, char *string) | 1030 | strprefix (const char *prefix, const char *string) |
| 1058 | { | 1031 | { |
| 1059 | return !strncmp (prefix, string, strlen (prefix)); | 1032 | return !strncmp (prefix, string, strlen (prefix)); |
| 1060 | } | 1033 | } |
| @@ -1119,8 +1092,7 @@ find_tty (char **tty_type, char **tty_name, int noabort) | |||
| 1119 | 0 - success: none of the above */ | 1092 | 0 - success: none of the above */ |
| 1120 | 1093 | ||
| 1121 | static int | 1094 | static int |
| 1122 | socket_status (socket_name) | 1095 | socket_status (char *socket_name) |
| 1123 | char *socket_name; | ||
| 1124 | { | 1096 | { |
| 1125 | struct stat statbfr; | 1097 | struct stat statbfr; |
| 1126 | 1098 | ||
| @@ -1223,7 +1195,7 @@ init_signals (void) | |||
| 1223 | 1195 | ||
| 1224 | 1196 | ||
| 1225 | HSOCKET | 1197 | HSOCKET |
| 1226 | set_local_socket () | 1198 | set_local_socket (void) |
| 1227 | { | 1199 | { |
| 1228 | HSOCKET s; | 1200 | HSOCKET s; |
| 1229 | struct sockaddr_un server; | 1201 | struct sockaddr_un server; |
| @@ -1244,11 +1216,13 @@ set_local_socket () | |||
| 1244 | int sock_status = 0; | 1216 | int sock_status = 0; |
| 1245 | int default_sock = !socket_name; | 1217 | int default_sock = !socket_name; |
| 1246 | int saved_errno = 0; | 1218 | int saved_errno = 0; |
| 1247 | char *server_name = "server"; | 1219 | const char *server_name = "server"; |
| 1248 | char *tmpdir; | 1220 | const char *tmpdir; |
| 1249 | 1221 | ||
| 1250 | if (socket_name && !index (socket_name, '/') && !index (socket_name, '\\')) | 1222 | if (socket_name && !strchr (socket_name, '/') |
| 1251 | { /* socket_name is a file name component. */ | 1223 | && !strchr (socket_name, '\\')) |
| 1224 | { | ||
| 1225 | /* socket_name is a file name component. */ | ||
| 1252 | server_name = socket_name; | 1226 | server_name = socket_name; |
| 1253 | socket_name = NULL; | 1227 | socket_name = NULL; |
| 1254 | default_sock = 1; /* Try both UIDs. */ | 1228 | default_sock = 1; /* Try both UIDs. */ |
| @@ -1419,9 +1393,7 @@ FARPROC set_fg; /* Pointer to AllowSetForegroundWindow. */ | |||
| 1419 | FARPROC get_wc; /* Pointer to RealGetWindowClassA. */ | 1393 | FARPROC get_wc; /* Pointer to RealGetWindowClassA. */ |
| 1420 | 1394 | ||
| 1421 | BOOL CALLBACK | 1395 | BOOL CALLBACK |
| 1422 | w32_find_emacs_process (hWnd, lParam) | 1396 | w32_find_emacs_process (HWND hWnd, LPARAM lParam) |
| 1423 | HWND hWnd; | ||
| 1424 | LPARAM lParam; | ||
| 1425 | { | 1397 | { |
| 1426 | DWORD pid; | 1398 | DWORD pid; |
| 1427 | char class[6]; | 1399 | char class[6]; |
| @@ -1449,7 +1421,7 @@ w32_find_emacs_process (hWnd, lParam) | |||
| 1449 | * process id = emacs_pid. If found, allow it to grab the focus. | 1421 | * process id = emacs_pid. If found, allow it to grab the focus. |
| 1450 | */ | 1422 | */ |
| 1451 | void | 1423 | void |
| 1452 | w32_give_focus () | 1424 | w32_give_focus (void) |
| 1453 | { | 1425 | { |
| 1454 | HANDLE user32; | 1426 | HANDLE user32; |
| 1455 | 1427 | ||
| @@ -1487,7 +1459,7 @@ start_daemon_and_retry_set_socket (void) | |||
| 1487 | pid_t w; | 1459 | pid_t w; |
| 1488 | w = waitpid (dpid, &status, WUNTRACED | WCONTINUED); | 1460 | w = waitpid (dpid, &status, WUNTRACED | WCONTINUED); |
| 1489 | 1461 | ||
| 1490 | if ((w == -1) || !WIFEXITED (status) || WEXITSTATUS(status)) | 1462 | if ((w == -1) || !WIFEXITED (status) || WEXITSTATUS (status)) |
| 1491 | { | 1463 | { |
| 1492 | message (TRUE, "Error: Could not start the Emacs daemon\n"); | 1464 | message (TRUE, "Error: Could not start the Emacs daemon\n"); |
| 1493 | exit (EXIT_FAILURE); | 1465 | exit (EXIT_FAILURE); |
| @@ -1508,11 +1480,13 @@ start_daemon_and_retry_set_socket (void) | |||
| 1508 | } | 1480 | } |
| 1509 | else | 1481 | else |
| 1510 | { | 1482 | { |
| 1511 | char *d_argv[] = {"emacs", "--daemon", 0 }; | 1483 | char emacs[] = "emacs"; |
| 1484 | char daemon[] = "--daemon"; | ||
| 1485 | char *d_argv[] = {emacs, daemon, 0 }; | ||
| 1512 | if (socket_name != NULL) | 1486 | if (socket_name != NULL) |
| 1513 | { | 1487 | { |
| 1514 | /* Pass --daemon=socket_name as argument. */ | 1488 | /* Pass --daemon=socket_name as argument. */ |
| 1515 | char *deq = "--daemon="; | 1489 | const char *deq = "--daemon="; |
| 1516 | char *daemon_arg = alloca (strlen (deq) | 1490 | char *daemon_arg = alloca (strlen (deq) |
| 1517 | + strlen (socket_name) + 1); | 1491 | + strlen (socket_name) + 1); |
| 1518 | strcpy (daemon_arg, deq); | 1492 | strcpy (daemon_arg, deq); |
| @@ -1526,9 +1500,7 @@ start_daemon_and_retry_set_socket (void) | |||
| 1526 | } | 1500 | } |
| 1527 | 1501 | ||
| 1528 | int | 1502 | int |
| 1529 | main (argc, argv) | 1503 | main (int argc, char **argv) |
| 1530 | int argc; | ||
| 1531 | char **argv; | ||
| 1532 | { | 1504 | { |
| 1533 | int i, rl, needlf = 0; | 1505 | int i, rl, needlf = 0; |
| 1534 | char *cwd, *str; | 1506 | char *cwd, *str; |
diff --git a/lib-src/etags.c b/lib-src/etags.c index 89edc6c1b27..42e4017ab50 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c | |||
| @@ -100,15 +100,10 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; | |||
| 100 | # ifndef PTR /* for XEmacs */ | 100 | # ifndef PTR /* for XEmacs */ |
| 101 | # define PTR void * | 101 | # define PTR void * |
| 102 | # endif | 102 | # endif |
| 103 | # ifndef __P /* for XEmacs */ | ||
| 104 | # define __P(args) args | ||
| 105 | # endif | ||
| 106 | #else /* no config.h */ | 103 | #else /* no config.h */ |
| 107 | # if defined(__STDC__) && (__STDC__ || defined(__SUNPRO_C)) | 104 | # if defined(__STDC__) && (__STDC__ || defined(__SUNPRO_C)) |
| 108 | # define __P(args) args /* use prototypes */ | ||
| 109 | # define PTR void * /* for generic pointers */ | 105 | # define PTR void * /* for generic pointers */ |
| 110 | # else /* not standard C */ | 106 | # else /* not standard C */ |
| 111 | # define __P(args) () /* no prototypes */ | ||
| 112 | # define const /* remove const for old compilers' sake */ | 107 | # define const /* remove const for old compilers' sake */ |
| 113 | # define PTR long * /* don't use void* */ | 108 | # define PTR long * /* don't use void* */ |
| 114 | # endif | 109 | # endif |
| @@ -158,20 +153,20 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; | |||
| 158 | # include <stdlib.h> | 153 | # include <stdlib.h> |
| 159 | # include <string.h> | 154 | # include <string.h> |
| 160 | # else /* no standard C headers */ | 155 | # else /* no standard C headers */ |
| 161 | extern char *getenv __P((const char *)); | 156 | extern char *getenv (const char *); |
| 162 | extern char *strcpy __P((char *, const char *)); | 157 | extern char *strcpy (char *, const char *); |
| 163 | extern char *strncpy __P((char *, const char *, unsigned long)); | 158 | extern char *strncpy (char *, const char *, unsigned long); |
| 164 | extern char *strcat __P((char *, const char *)); | 159 | extern char *strcat (char *, const char *); |
| 165 | extern char *strncat __P((char *, const char *, unsigned long)); | 160 | extern char *strncat (char *, const char *, unsigned long); |
| 166 | extern int strcmp __P((const char *, const char *)); | 161 | extern int strcmp (const char *, const char *); |
| 167 | extern int strncmp __P((const char *, const char *, unsigned long)); | 162 | extern int strncmp (const char *, const char *, unsigned long); |
| 168 | extern int system __P((const char *)); | 163 | extern int system (const char *); |
| 169 | extern unsigned long strlen __P((const char *)); | 164 | extern unsigned long strlen (const char *); |
| 170 | extern void *malloc __P((unsigned long)); | 165 | extern void *malloc (unsigned long); |
| 171 | extern void *realloc __P((void *, unsigned long)); | 166 | extern void *realloc (void *, unsigned long); |
| 172 | extern void exit __P((int)); | 167 | extern void exit (int); |
| 173 | extern void free __P((void *)); | 168 | extern void free (void *); |
| 174 | extern void *memmove __P((void *, const void *, unsigned long)); | 169 | extern void *memmove (void *, const void *, unsigned long); |
| 175 | # define EXIT_SUCCESS 0 | 170 | # define EXIT_SUCCESS 0 |
| 176 | # define EXIT_FAILURE 1 | 171 | # define EXIT_FAILURE 1 |
| 177 | # endif | 172 | # endif |
| @@ -273,22 +268,22 @@ If you want regular expression support, you should delete this notice and | |||
| 273 | 268 | ||
| 274 | #define bool int | 269 | #define bool int |
| 275 | 270 | ||
| 276 | typedef void Lang_function __P((FILE *)); | 271 | typedef void Lang_function (FILE *); |
| 277 | 272 | ||
| 278 | typedef struct | 273 | typedef struct |
| 279 | { | 274 | { |
| 280 | char *suffix; /* file name suffix for this compressor */ | 275 | const char *suffix; /* file name suffix for this compressor */ |
| 281 | char *command; /* takes one arg and decompresses to stdout */ | 276 | const char *command; /* takes one arg and decompresses to stdout */ |
| 282 | } compressor; | 277 | } compressor; |
| 283 | 278 | ||
| 284 | typedef struct | 279 | typedef struct |
| 285 | { | 280 | { |
| 286 | char *name; /* language name */ | 281 | const char *name; /* language name */ |
| 287 | char *help; /* detailed help for the language */ | 282 | const char *help; /* detailed help for the language */ |
| 288 | Lang_function *function; /* parse function */ | 283 | Lang_function *function; /* parse function */ |
| 289 | char **suffixes; /* name suffixes of this language's files */ | 284 | const char **suffixes; /* name suffixes of this language's files */ |
| 290 | char **filenames; /* names of this language's files */ | 285 | const char **filenames; /* names of this language's files */ |
| 291 | char **interpreters; /* interpreters for this language */ | 286 | const char **interpreters; /* interpreters for this language */ |
| 292 | bool metasource; /* source used to generate other sources */ | 287 | bool metasource; /* source used to generate other sources */ |
| 293 | } language; | 288 | } language; |
| 294 | 289 | ||
| @@ -309,7 +304,7 @@ typedef struct node_st | |||
| 309 | { /* sorting structure */ | 304 | { /* sorting structure */ |
| 310 | struct node_st *left, *right; /* left and right sons */ | 305 | struct node_st *left, *right; /* left and right sons */ |
| 311 | fdesc *fdp; /* description of file to whom tag belongs */ | 306 | fdesc *fdp; /* description of file to whom tag belongs */ |
| 312 | char *name; /* tag name */ | 307 | char *name; /* tag name */ |
| 313 | char *regex; /* search regexp */ | 308 | char *regex; /* search regexp */ |
| 314 | bool valid; /* write this tag on the tag file */ | 309 | bool valid; /* write this tag on the tag file */ |
| 315 | bool is_func; /* function tag: use regexp in CTAGS mode */ | 310 | bool is_func; /* function tag: use regexp in CTAGS mode */ |
| @@ -365,87 +360,87 @@ typedef struct regexp | |||
| 365 | /* Many compilers barf on this: | 360 | /* Many compilers barf on this: |
| 366 | Lang_function Ada_funcs; | 361 | Lang_function Ada_funcs; |
| 367 | so let's write it this way */ | 362 | so let's write it this way */ |
| 368 | static void Ada_funcs __P((FILE *)); | 363 | static void Ada_funcs (FILE *); |
| 369 | static void Asm_labels __P((FILE *)); | 364 | static void Asm_labels (FILE *); |
| 370 | static void C_entries __P((int c_ext, FILE *)); | 365 | static void C_entries (int c_ext, FILE *); |
| 371 | static void default_C_entries __P((FILE *)); | 366 | static void default_C_entries (FILE *); |
| 372 | static void plain_C_entries __P((FILE *)); | 367 | static void plain_C_entries (FILE *); |
| 373 | static void Cjava_entries __P((FILE *)); | 368 | static void Cjava_entries (FILE *); |
| 374 | static void Cobol_paragraphs __P((FILE *)); | 369 | static void Cobol_paragraphs (FILE *); |
| 375 | static void Cplusplus_entries __P((FILE *)); | 370 | static void Cplusplus_entries (FILE *); |
| 376 | static void Cstar_entries __P((FILE *)); | 371 | static void Cstar_entries (FILE *); |
| 377 | static void Erlang_functions __P((FILE *)); | 372 | static void Erlang_functions (FILE *); |
| 378 | static void Forth_words __P((FILE *)); | 373 | static void Forth_words (FILE *); |
| 379 | static void Fortran_functions __P((FILE *)); | 374 | static void Fortran_functions (FILE *); |
| 380 | static void HTML_labels __P((FILE *)); | 375 | static void HTML_labels (FILE *); |
| 381 | static void Lisp_functions __P((FILE *)); | 376 | static void Lisp_functions (FILE *); |
| 382 | static void Lua_functions __P((FILE *)); | 377 | static void Lua_functions (FILE *); |
| 383 | static void Makefile_targets __P((FILE *)); | 378 | static void Makefile_targets (FILE *); |
| 384 | static void Pascal_functions __P((FILE *)); | 379 | static void Pascal_functions (FILE *); |
| 385 | static void Perl_functions __P((FILE *)); | 380 | static void Perl_functions (FILE *); |
| 386 | static void PHP_functions __P((FILE *)); | 381 | static void PHP_functions (FILE *); |
| 387 | static void PS_functions __P((FILE *)); | 382 | static void PS_functions (FILE *); |
| 388 | static void Prolog_functions __P((FILE *)); | 383 | static void Prolog_functions (FILE *); |
| 389 | static void Python_functions __P((FILE *)); | 384 | static void Python_functions (FILE *); |
| 390 | static void Scheme_functions __P((FILE *)); | 385 | static void Scheme_functions (FILE *); |
| 391 | static void TeX_commands __P((FILE *)); | 386 | static void TeX_commands (FILE *); |
| 392 | static void Texinfo_nodes __P((FILE *)); | 387 | static void Texinfo_nodes (FILE *); |
| 393 | static void Yacc_entries __P((FILE *)); | 388 | static void Yacc_entries (FILE *); |
| 394 | static void just_read_file __P((FILE *)); | 389 | static void just_read_file (FILE *); |
| 395 | 390 | ||
| 396 | static void print_language_names __P((void)); | 391 | static void print_language_names (void); |
| 397 | static void print_version __P((void)); | 392 | static void print_version (void); |
| 398 | static void print_help __P((argument *)); | 393 | static void print_help (argument *); |
| 399 | int main __P((int, char **)); | 394 | int main (int, char **); |
| 400 | 395 | ||
| 401 | static compressor *get_compressor_from_suffix __P((char *, char **)); | 396 | static compressor *get_compressor_from_suffix (char *, char **); |
| 402 | static language *get_language_from_langname __P((const char *)); | 397 | static language *get_language_from_langname (const char *); |
| 403 | static language *get_language_from_interpreter __P((char *)); | 398 | static language *get_language_from_interpreter (char *); |
| 404 | static language *get_language_from_filename __P((char *, bool)); | 399 | static language *get_language_from_filename (char *, bool); |
| 405 | static void readline __P((linebuffer *, FILE *)); | 400 | static void readline (linebuffer *, FILE *); |
| 406 | static long readline_internal __P((linebuffer *, FILE *)); | 401 | static long readline_internal (linebuffer *, FILE *); |
| 407 | static bool nocase_tail __P((char *)); | 402 | static bool nocase_tail (const char *); |
| 408 | static void get_tag __P((char *, char **)); | 403 | static void get_tag (char *, char **); |
| 409 | 404 | ||
| 410 | static void analyse_regex __P((char *)); | 405 | static void analyse_regex (char *); |
| 411 | static void free_regexps __P((void)); | 406 | static void free_regexps (void); |
| 412 | static void regex_tag_multiline __P((void)); | 407 | static void regex_tag_multiline (void); |
| 413 | static void error __P((const char *, const char *)); | 408 | static void error (const char *, const char *); |
| 414 | static void suggest_asking_for_help __P((void)); | 409 | static void suggest_asking_for_help (void) NO_RETURN; |
| 415 | void fatal __P((char *, char *)); | 410 | void fatal (const char *, const char *) NO_RETURN; |
| 416 | static void pfatal __P((char *)); | 411 | static void pfatal (const char *) NO_RETURN; |
| 417 | static void add_node __P((node *, node **)); | 412 | static void add_node (node *, node **); |
| 418 | 413 | ||
| 419 | static void init __P((void)); | 414 | static void init (void); |
| 420 | static void process_file_name __P((char *, language *)); | 415 | static void process_file_name (char *, language *); |
| 421 | static void process_file __P((FILE *, char *, language *)); | 416 | static void process_file (FILE *, char *, language *); |
| 422 | static void find_entries __P((FILE *)); | 417 | static void find_entries (FILE *); |
| 423 | static void free_tree __P((node *)); | 418 | static void free_tree (node *); |
| 424 | static void free_fdesc __P((fdesc *)); | 419 | static void free_fdesc (fdesc *); |
| 425 | static void pfnote __P((char *, bool, char *, int, int, long)); | 420 | static void pfnote (char *, bool, char *, int, int, long); |
| 426 | static void make_tag __P((char *, int, bool, char *, int, int, long)); | 421 | static void make_tag (const char *, int, bool, char *, int, int, long); |
| 427 | static void invalidate_nodes __P((fdesc *, node **)); | 422 | static void invalidate_nodes (fdesc *, node **); |
| 428 | static void put_entries __P((node *)); | 423 | static void put_entries (node *); |
| 429 | 424 | ||
| 430 | static char *concat __P((char *, char *, char *)); | 425 | static char *concat (const char *, const char *, const char *); |
| 431 | static char *skip_spaces __P((char *)); | 426 | static char *skip_spaces (char *); |
| 432 | static char *skip_non_spaces __P((char *)); | 427 | static char *skip_non_spaces (char *); |
| 433 | static char *savenstr __P((char *, int)); | 428 | static char *savenstr (const char *, int); |
| 434 | static char *savestr __P((char *)); | 429 | static char *savestr (const char *); |
| 435 | static char *etags_strchr __P((const char *, int)); | 430 | static char *etags_strchr (const char *, int); |
| 436 | static char *etags_strrchr __P((const char *, int)); | 431 | static char *etags_strrchr (const char *, int); |
| 437 | static int etags_strcasecmp __P((const char *, const char *)); | 432 | static int etags_strcasecmp (const char *, const char *); |
| 438 | static int etags_strncasecmp __P((const char *, const char *, int)); | 433 | static int etags_strncasecmp (const char *, const char *, int); |
| 439 | static char *etags_getcwd __P((void)); | 434 | static char *etags_getcwd (void); |
| 440 | static char *relative_filename __P((char *, char *)); | 435 | static char *relative_filename (char *, char *); |
| 441 | static char *absolute_filename __P((char *, char *)); | 436 | static char *absolute_filename (char *, char *); |
| 442 | static char *absolute_dirname __P((char *, char *)); | 437 | static char *absolute_dirname (char *, char *); |
| 443 | static bool filename_is_absolute __P((char *f)); | 438 | static bool filename_is_absolute (char *f); |
| 444 | static void canonicalize_filename __P((char *)); | 439 | static void canonicalize_filename (char *); |
| 445 | static void linebuffer_init __P((linebuffer *)); | 440 | static void linebuffer_init (linebuffer *); |
| 446 | static void linebuffer_setlen __P((linebuffer *, int)); | 441 | static void linebuffer_setlen (linebuffer *, int); |
| 447 | static PTR xmalloc __P((unsigned int)); | 442 | static PTR xmalloc (unsigned int); |
| 448 | static PTR xrealloc __P((char *, unsigned int)); | 443 | static PTR xrealloc (char *, unsigned int); |
| 449 | 444 | ||
| 450 | 445 | ||
| 451 | static char searchar = '/'; /* use /.../ searches */ | 446 | static char searchar = '/'; /* use /.../ searches */ |
| @@ -474,7 +469,7 @@ static linebuffer token_name; /* a buffer containing a tag name */ | |||
| 474 | 469 | ||
| 475 | /* boolean "functions" (see init) */ | 470 | /* boolean "functions" (see init) */ |
| 476 | 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]; |
| 477 | static char | 472 | static const char |
| 478 | /* white chars */ | 473 | /* white chars */ |
| 479 | *white = " \f\t\n\r\v", | 474 | *white = " \f\t\n\r\v", |
| 480 | /* not in a name */ | 475 | /* not in a name */ |
| @@ -574,9 +569,9 @@ static compressor compressors[] = | |||
| 574 | */ | 569 | */ |
| 575 | 570 | ||
| 576 | /* Ada code */ | 571 | /* Ada code */ |
| 577 | static char *Ada_suffixes [] = | 572 | static const char *Ada_suffixes [] = |
| 578 | { "ads", "adb", "ada", NULL }; | 573 | { "ads", "adb", "ada", NULL }; |
| 579 | static char Ada_help [] = | 574 | static const char Ada_help [] = |
| 580 | "In Ada code, functions, procedures, packages, tasks and types are\n\ | 575 | "In Ada code, functions, procedures, packages, tasks and types are\n\ |
| 581 | tags. Use the `--packages-only' option to create tags for\n\ | 576 | tags. Use the `--packages-only' option to create tags for\n\ |
| 582 | packages only.\n\ | 577 | packages only.\n\ |
| @@ -594,7 +589,7 @@ body of the package `bidule', while `M-x find-tag <RET> bidule <RET>'\n\ | |||
| 594 | will just search for any tag `bidule'."; | 589 | will just search for any tag `bidule'."; |
| 595 | 590 | ||
| 596 | /* Assembly code */ | 591 | /* Assembly code */ |
| 597 | static char *Asm_suffixes [] = | 592 | static const char *Asm_suffixes [] = |
| 598 | { "a", /* Unix assembler */ | 593 | { "a", /* Unix assembler */ |
| 599 | "asm", /* Microcontroller assembly */ | 594 | "asm", /* Microcontroller assembly */ |
| 600 | "def", /* BSO/Tasking definition includes */ | 595 | "def", /* BSO/Tasking definition includes */ |
| @@ -605,7 +600,7 @@ static char *Asm_suffixes [] = | |||
| 605 | "src", /* BSO/Tasking C compiler output */ | 600 | "src", /* BSO/Tasking C compiler output */ |
| 606 | NULL | 601 | NULL |
| 607 | }; | 602 | }; |
| 608 | static char Asm_help [] = | 603 | static const char Asm_help [] = |
| 609 | "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\ |
| 610 | followed by a colon, are tags."; | 605 | followed by a colon, are tags."; |
| 611 | 606 | ||
| @@ -613,10 +608,10 @@ followed by a colon, are tags."; | |||
| 613 | /* 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 |
| 614 | 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. |
| 615 | That is why default_C_entries is called for these. */ | 610 | That is why default_C_entries is called for these. */ |
| 616 | static char *default_C_suffixes [] = | 611 | static const char *default_C_suffixes [] = |
| 617 | { "c", "h", NULL }; | 612 | { "c", "h", NULL }; |
| 618 | #if CTAGS /* C help for Ctags */ | 613 | #if CTAGS /* C help for Ctags */ |
| 619 | static char default_C_help [] = | 614 | static const char default_C_help [] = |
| 620 | "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\ |
| 621 | Use -T to tag definitions of `struct', `union' and `enum'.\n\ | 616 | Use -T to tag definitions of `struct', `union' and `enum'.\n\ |
| 622 | Use -d to tag `#define' macro definitions and `enum' constants.\n\ | 617 | Use -d to tag `#define' macro definitions and `enum' constants.\n\ |
| @@ -624,7 +619,7 @@ Use --globals to tag global variables.\n\ | |||
| 624 | You can tag function declarations and external variables by\n\ | 619 | You can tag function declarations and external variables by\n\ |
| 625 | using `--declarations', and struct members by using `--members'."; | 620 | using `--declarations', and struct members by using `--members'."; |
| 626 | #else /* C help for Etags */ | 621 | #else /* C help for Etags */ |
| 627 | static char default_C_help [] = | 622 | static const char default_C_help [] = |
| 628 | "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\ |
| 629 | definitions of `struct', `union' and `enum'. `#define' macro\n\ | 624 | definitions of `struct', `union' and `enum'. `#define' macro\n\ |
| 630 | definitions and `enum' constants are tags unless you specify\n\ | 625 | definitions and `enum' constants are tags unless you specify\n\ |
| @@ -636,12 +631,12 @@ You can tag function declarations and external variables by\n\ | |||
| 636 | using `--declarations'."; | 631 | using `--declarations'."; |
| 637 | #endif /* C help for Ctags and Etags */ | 632 | #endif /* C help for Ctags and Etags */ |
| 638 | 633 | ||
| 639 | static char *Cplusplus_suffixes [] = | 634 | static const char *Cplusplus_suffixes [] = |
| 640 | { "C", "c++", "cc", "cpp", "cxx", "H", "h++", "hh", "hpp", "hxx", | 635 | { "C", "c++", "cc", "cpp", "cxx", "H", "h++", "hh", "hpp", "hxx", |
| 641 | "M", /* Objective C++ */ | 636 | "M", /* Objective C++ */ |
| 642 | "pdb", /* Postscript with C syntax */ | 637 | "pdb", /* Postscript with C syntax */ |
| 643 | NULL }; | 638 | NULL }; |
| 644 | static char Cplusplus_help [] = | 639 | static const char Cplusplus_help [] = |
| 645 | "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\ |
| 646 | --help --lang=c --lang=c++ for full help.)\n\ | 641 | --help --lang=c --lang=c++ for full help.)\n\ |
| 647 | 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\ |
| @@ -650,131 +645,131 @@ Tags for variables and functions in classes are named `CLASS::VARIABLE'\n\ | |||
| 650 | and `CLASS::FUNCTION'. `operator' definitions have tag names like\n\ | 645 | and `CLASS::FUNCTION'. `operator' definitions have tag names like\n\ |
| 651 | `operator+'."; | 646 | `operator+'."; |
| 652 | 647 | ||
| 653 | static char *Cjava_suffixes [] = | 648 | static const char *Cjava_suffixes [] = |
| 654 | { "java", NULL }; | 649 | { "java", NULL }; |
| 655 | static char Cjava_help [] = | 650 | static char Cjava_help [] = |
| 656 | "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\ |
| 657 | 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.)"; |
| 658 | 653 | ||
| 659 | 654 | ||
| 660 | static char *Cobol_suffixes [] = | 655 | static const char *Cobol_suffixes [] = |
| 661 | { "COB", "cob", NULL }; | 656 | { "COB", "cob", NULL }; |
| 662 | static char Cobol_help [] = | 657 | static char Cobol_help [] = |
| 663 | "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\ |
| 664 | starting in column 8 and followed by a period."; | 659 | starting in column 8 and followed by a period."; |
| 665 | 660 | ||
| 666 | static char *Cstar_suffixes [] = | 661 | static const char *Cstar_suffixes [] = |
| 667 | { "cs", "hs", NULL }; | 662 | { "cs", "hs", NULL }; |
| 668 | 663 | ||
| 669 | static char *Erlang_suffixes [] = | 664 | static const char *Erlang_suffixes [] = |
| 670 | { "erl", "hrl", NULL }; | 665 | { "erl", "hrl", NULL }; |
| 671 | static char Erlang_help [] = | 666 | static const char Erlang_help [] = |
| 672 | "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\ |
| 673 | defined in the file."; | 668 | defined in the file."; |
| 674 | 669 | ||
| 675 | char *Forth_suffixes [] = | 670 | const char *Forth_suffixes [] = |
| 676 | { "fth", "tok", NULL }; | 671 | { "fth", "tok", NULL }; |
| 677 | static char Forth_help [] = | 672 | static const char Forth_help [] = |
| 678 | "In Forth code, tags are words defined by `:',\n\ | 673 | "In Forth code, tags are words defined by `:',\n\ |
| 679 | constant, code, create, defer, value, variable, buffer:, field."; | 674 | constant, code, create, defer, value, variable, buffer:, field."; |
| 680 | 675 | ||
| 681 | static char *Fortran_suffixes [] = | 676 | static const char *Fortran_suffixes [] = |
| 682 | { "F", "f", "f90", "for", NULL }; | 677 | { "F", "f", "f90", "for", NULL }; |
| 683 | static char Fortran_help [] = | 678 | static const char Fortran_help [] = |
| 684 | "In Fortran code, functions, subroutines and block data are tags."; | 679 | "In Fortran code, functions, subroutines and block data are tags."; |
| 685 | 680 | ||
| 686 | static char *HTML_suffixes [] = | 681 | static const char *HTML_suffixes [] = |
| 687 | { "htm", "html", "shtml", NULL }; | 682 | { "htm", "html", "shtml", NULL }; |
| 688 | static char HTML_help [] = | 683 | static const char HTML_help [] = |
| 689 | "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\ |
| 690 | `h3' headers. Also, tags are `name=' in anchors and all\n\ | 685 | `h3' headers. Also, tags are `name=' in anchors and all\n\ |
| 691 | occurrences of `id='."; | 686 | occurrences of `id='."; |
| 692 | 687 | ||
| 693 | static char *Lisp_suffixes [] = | 688 | static const char *Lisp_suffixes [] = |
| 694 | { "cl", "clisp", "el", "l", "lisp", "LSP", "lsp", "ml", NULL }; | 689 | { "cl", "clisp", "el", "l", "lisp", "LSP", "lsp", "ml", NULL }; |
| 695 | static char Lisp_help [] = | 690 | static const char Lisp_help [] = |
| 696 | "In Lisp code, any function defined with `defun', any variable\n\ | 691 | "In Lisp code, any function defined with `defun', any variable\n\ |
| 697 | defined with `defvar' or `defconst', and in general the first\n\ | 692 | defined with `defvar' or `defconst', and in general the first\n\ |
| 698 | 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\ |
| 699 | is a tag."; | 694 | is a tag."; |
| 700 | 695 | ||
| 701 | static char *Lua_suffixes [] = | 696 | static const char *Lua_suffixes [] = |
| 702 | { "lua", "LUA", NULL }; | 697 | { "lua", "LUA", NULL }; |
| 703 | static char Lua_help [] = | 698 | static const char Lua_help [] = |
| 704 | "In Lua scripts, all functions are tags."; | 699 | "In Lua scripts, all functions are tags."; |
| 705 | 700 | ||
| 706 | static char *Makefile_filenames [] = | 701 | static const char *Makefile_filenames [] = |
| 707 | { "Makefile", "makefile", "GNUMakefile", "Makefile.in", "Makefile.am", NULL}; | 702 | { "Makefile", "makefile", "GNUMakefile", "Makefile.in", "Makefile.am", NULL}; |
| 708 | static char Makefile_help [] = | 703 | static const char Makefile_help [] = |
| 709 | "In makefiles, targets are tags; additionally, variables are tags\n\ | 704 | "In makefiles, targets are tags; additionally, variables are tags\n\ |
| 710 | unless you specify `--no-globals'."; | 705 | unless you specify `--no-globals'."; |
| 711 | 706 | ||
| 712 | static char *Objc_suffixes [] = | 707 | static const char *Objc_suffixes [] = |
| 713 | { "lm", /* Objective lex file */ | 708 | { "lm", /* Objective lex file */ |
| 714 | "m", /* Objective C file */ | 709 | "m", /* Objective C file */ |
| 715 | NULL }; | 710 | NULL }; |
| 716 | static char Objc_help [] = | 711 | static const char Objc_help [] = |
| 717 | "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\ |
| 718 | class categories, methods and protocols. Tags for variables and\n\ | 713 | class categories, methods and protocols. Tags for variables and\n\ |
| 719 | functions in classes are named `CLASS::VARIABLE' and `CLASS::FUNCTION'.\n\ | 714 | functions in classes are named `CLASS::VARIABLE' and `CLASS::FUNCTION'.\n\ |
| 720 | (Use --help --lang=c --lang=objc --lang=java for full help.)"; | 715 | (Use --help --lang=c --lang=objc --lang=java for full help.)"; |
| 721 | 716 | ||
| 722 | static char *Pascal_suffixes [] = | 717 | static const char *Pascal_suffixes [] = |
| 723 | { "p", "pas", NULL }; | 718 | { "p", "pas", NULL }; |
| 724 | static char Pascal_help [] = | 719 | static const char Pascal_help [] = |
| 725 | "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\ |
| 726 | in the file."; | 721 | in the file."; |
| 727 | /* " // this is for working around an Emacs highlighting bug... */ | 722 | /* " // this is for working around an Emacs highlighting bug... */ |
| 728 | 723 | ||
| 729 | static char *Perl_suffixes [] = | 724 | static const char *Perl_suffixes [] = |
| 730 | { "pl", "pm", NULL }; | 725 | { "pl", "pm", NULL }; |
| 731 | static char *Perl_interpreters [] = | 726 | static const char *Perl_interpreters [] = |
| 732 | { "perl", "@PERL@", NULL }; | 727 | { "perl", "@PERL@", NULL }; |
| 733 | static char Perl_help [] = | 728 | static const char Perl_help [] = |
| 734 | "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\ |
| 735 | defined by the `package', `sub', `my' and `local' keywords. Use\n\ | 730 | defined by the `package', `sub', `my' and `local' keywords. Use\n\ |
| 736 | `--globals' if you want to tag global variables. Tags for\n\ | 731 | `--globals' if you want to tag global variables. Tags for\n\ |
| 737 | subroutines are named `PACKAGE::SUB'. The name for subroutines\n\ | 732 | subroutines are named `PACKAGE::SUB'. The name for subroutines\n\ |
| 738 | defined in the default package is `main::SUB'."; | 733 | defined in the default package is `main::SUB'."; |
| 739 | 734 | ||
| 740 | static char *PHP_suffixes [] = | 735 | static const char *PHP_suffixes [] = |
| 741 | { "php", "php3", "php4", NULL }; | 736 | { "php", "php3", "php4", NULL }; |
| 742 | static char PHP_help [] = | 737 | static const char PHP_help [] = |
| 743 | "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\ |
| 744 | the `--no-members' option, vars are tags too."; | 739 | the `--no-members' option, vars are tags too."; |
| 745 | 740 | ||
| 746 | static char *plain_C_suffixes [] = | 741 | static const char *plain_C_suffixes [] = |
| 747 | { "pc", /* Pro*C file */ | 742 | { "pc", /* Pro*C file */ |
| 748 | NULL }; | 743 | NULL }; |
| 749 | 744 | ||
| 750 | static char *PS_suffixes [] = | 745 | static const char *PS_suffixes [] = |
| 751 | { "ps", "psw", NULL }; /* .psw is for PSWrap */ | 746 | { "ps", "psw", NULL }; /* .psw is for PSWrap */ |
| 752 | static char PS_help [] = | 747 | static const char PS_help [] = |
| 753 | "In PostScript code, the tags are the functions."; | 748 | "In PostScript code, the tags are the functions."; |
| 754 | 749 | ||
| 755 | static char *Prolog_suffixes [] = | 750 | static const char *Prolog_suffixes [] = |
| 756 | { "prolog", NULL }; | 751 | { "prolog", NULL }; |
| 757 | static char Prolog_help [] = | 752 | static const char Prolog_help [] = |
| 758 | "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\ |
| 759 | line."; | 754 | line."; |
| 760 | 755 | ||
| 761 | static char *Python_suffixes [] = | 756 | static const char *Python_suffixes [] = |
| 762 | { "py", NULL }; | 757 | { "py", NULL }; |
| 763 | static char Python_help [] = | 758 | static const char Python_help [] = |
| 764 | "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\ |
| 765 | generate a tag."; | 760 | generate a tag."; |
| 766 | 761 | ||
| 767 | /* 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. */ |
| 768 | static char *Scheme_suffixes [] = | 763 | static const char *Scheme_suffixes [] = |
| 769 | { "oak", "sch", "scheme", "SCM", "scm", "SM", "sm", "ss", "t", NULL }; | 764 | { "oak", "sch", "scheme", "SCM", "scm", "SM", "sm", "ss", "t", NULL }; |
| 770 | static char Scheme_help [] = | 765 | static const char Scheme_help [] = |
| 771 | "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\ |
| 772 | construct whose name starts with `def'. They also include\n\ | 767 | construct whose name starts with `def'. They also include\n\ |
| 773 | variables set with `set!' at top level in the file."; | 768 | variables set with `set!' at top level in the file."; |
| 774 | 769 | ||
| 775 | static char *TeX_suffixes [] = | 770 | static const char *TeX_suffixes [] = |
| 776 | { "bib", "clo", "cls", "ltx", "sty", "TeX", "tex", NULL }; | 771 | { "bib", "clo", "cls", "ltx", "sty", "TeX", "tex", NULL }; |
| 777 | static char TeX_help [] = | 772 | static const char TeX_help [] = |
| 778 | "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\ |
| 779 | `\\section', `\\subsection', `\\subsubsection', `\\eqno', `\\label',\n\ | 774 | `\\section', `\\subsection', `\\subsubsection', `\\eqno', `\\label',\n\ |
| 780 | `\\ref', `\\cite', `\\bibitem', `\\part', `\\appendix', `\\entry',\n\ | 775 | `\\ref', `\\cite', `\\bibitem', `\\part', `\\appendix', `\\entry',\n\ |
| @@ -786,28 +781,28 @@ Other commands can be specified by setting the environment variable\n\ | |||
| 786 | TEXTAGS=\"mycommand:myothercommand\"."; | 781 | TEXTAGS=\"mycommand:myothercommand\"."; |
| 787 | 782 | ||
| 788 | 783 | ||
| 789 | static char *Texinfo_suffixes [] = | 784 | static const char *Texinfo_suffixes [] = |
| 790 | { "texi", "texinfo", "txi", NULL }; | 785 | { "texi", "texinfo", "txi", NULL }; |
| 791 | static char Texinfo_help [] = | 786 | static const char Texinfo_help [] = |
| 792 | "for texinfo files, lines starting with @node are tagged."; | 787 | "for texinfo files, lines starting with @node are tagged."; |
| 793 | 788 | ||
| 794 | static char *Yacc_suffixes [] = | 789 | static const char *Yacc_suffixes [] = |
| 795 | { "y", "y++", "ym", "yxx", "yy", NULL }; /* .ym is Objective yacc file */ | 790 | { "y", "y++", "ym", "yxx", "yy", NULL }; /* .ym is Objective yacc file */ |
| 796 | static char Yacc_help [] = | 791 | static const char Yacc_help [] = |
| 797 | "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\ |
| 798 | nonterminal it constructs. The portions of the file that contain\n\ | 793 | nonterminal it constructs. The portions of the file that contain\n\ |
| 799 | 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\ |
| 800 | for full help)."; | 795 | for full help)."; |
| 801 | 796 | ||
| 802 | static char auto_help [] = | 797 | static const char auto_help [] = |
| 803 | "`auto' is not a real language, it indicates to use\n\ | 798 | "`auto' is not a real language, it indicates to use\n\ |
| 804 | 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."; |
| 805 | 800 | ||
| 806 | static char none_help [] = | 801 | static const char none_help [] = |
| 807 | "`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\ |
| 808 | regexp processing on files."; | 803 | regexp processing on files."; |
| 809 | 804 | ||
| 810 | static char no_lang_help [] = | 805 | static const char no_lang_help [] = |
| 811 | "No detailed help available for this language."; | 806 | "No detailed help available for this language."; |
| 812 | 807 | ||
| 813 | 808 | ||
| @@ -853,10 +848,10 @@ static language lang_names [] = | |||
| 853 | 848 | ||
| 854 | 849 | ||
| 855 | static void | 850 | static void |
| 856 | print_language_names () | 851 | print_language_names (void) |
| 857 | { | 852 | { |
| 858 | language *lang; | 853 | language *lang; |
| 859 | char **name, **ext; | 854 | const char **name, **ext; |
| 860 | 855 | ||
| 861 | puts ("\nThese are the currently supported languages, along with the\n\ | 856 | puts ("\nThese are the currently supported languages, along with the\n\ |
| 862 | default file names and dot suffixes:"); | 857 | default file names and dot suffixes:"); |
| @@ -892,7 +887,7 @@ etags --help --lang=ada."); | |||
| 892 | # define VERSION "17.38.1.4" | 887 | # define VERSION "17.38.1.4" |
| 893 | #endif | 888 | #endif |
| 894 | static void | 889 | static void |
| 895 | print_version () | 890 | print_version (void) |
| 896 | { | 891 | { |
| 897 | /* Makes it easier to update automatically. */ | 892 | /* Makes it easier to update automatically. */ |
| 898 | char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc."; | 893 | char emacs_copyright[] = "Copyright (C) 2010 Free Software Foundation, Inc."; |
| @@ -909,8 +904,7 @@ print_version () | |||
| 909 | #endif | 904 | #endif |
| 910 | 905 | ||
| 911 | static void | 906 | static void |
| 912 | print_help (argbuffer) | 907 | print_help (argument *argbuffer) |
| 913 | argument *argbuffer; | ||
| 914 | { | 908 | { |
| 915 | bool help_for_lang = FALSE; | 909 | bool help_for_lang = FALSE; |
| 916 | 910 | ||
| @@ -1087,9 +1081,7 @@ Relative ones are stored relative to the output file's directory.\n"); | |||
| 1087 | 1081 | ||
| 1088 | 1082 | ||
| 1089 | int | 1083 | int |
| 1090 | main (argc, argv) | 1084 | main (int argc, char **argv) |
| 1091 | int argc; | ||
| 1092 | char *argv[]; | ||
| 1093 | { | 1085 | { |
| 1094 | int i; | 1086 | int i; |
| 1095 | unsigned int nincluded_files; | 1087 | unsigned int nincluded_files; |
| @@ -1414,9 +1406,7 @@ main (argc, argv) | |||
| 1414 | * Idea by Vladimir Alexiev <vladimir@cs.ualberta.ca> (1998) | 1406 | * Idea by Vladimir Alexiev <vladimir@cs.ualberta.ca> (1998) |
| 1415 | */ | 1407 | */ |
| 1416 | static compressor * | 1408 | static compressor * |
| 1417 | get_compressor_from_suffix (file, extptr) | 1409 | get_compressor_from_suffix (char *file, char **extptr) |
| 1418 | char *file; | ||
| 1419 | char **extptr; | ||
| 1420 | { | 1410 | { |
| 1421 | compressor *compr; | 1411 | compressor *compr; |
| 1422 | char *slash, *suffix; | 1412 | char *slash, *suffix; |
| @@ -1452,8 +1442,7 @@ get_compressor_from_suffix (file, extptr) | |||
| 1452 | * Return a language given the name. | 1442 | * Return a language given the name. |
| 1453 | */ | 1443 | */ |
| 1454 | static language * | 1444 | static language * |
| 1455 | get_language_from_langname (name) | 1445 | get_language_from_langname (const char *name) |
| 1456 | const char *name; | ||
| 1457 | { | 1446 | { |
| 1458 | language *lang; | 1447 | language *lang; |
| 1459 | 1448 | ||
| @@ -1475,11 +1464,10 @@ get_language_from_langname (name) | |||
| 1475 | * Return a language given the interpreter name. | 1464 | * Return a language given the interpreter name. |
| 1476 | */ | 1465 | */ |
| 1477 | static language * | 1466 | static language * |
| 1478 | get_language_from_interpreter (interpreter) | 1467 | get_language_from_interpreter (char *interpreter) |
| 1479 | char *interpreter; | ||
| 1480 | { | 1468 | { |
| 1481 | language *lang; | 1469 | language *lang; |
| 1482 | char **iname; | 1470 | const char **iname; |
| 1483 | 1471 | ||
| 1484 | if (interpreter == NULL) | 1472 | if (interpreter == NULL) |
| 1485 | return NULL; | 1473 | return NULL; |
| @@ -1498,12 +1486,10 @@ get_language_from_interpreter (interpreter) | |||
| 1498 | * Return a language given the file name. | 1486 | * Return a language given the file name. |
| 1499 | */ | 1487 | */ |
| 1500 | static language * | 1488 | static language * |
| 1501 | get_language_from_filename (file, case_sensitive) | 1489 | get_language_from_filename (char *file, int case_sensitive) |
| 1502 | char *file; | ||
| 1503 | bool case_sensitive; | ||
| 1504 | { | 1490 | { |
| 1505 | language *lang; | 1491 | language *lang; |
| 1506 | char **name, **ext, *suffix; | 1492 | const char **name, **ext, *suffix; |
| 1507 | 1493 | ||
| 1508 | /* Try whole file name first. */ | 1494 | /* Try whole file name first. */ |
| 1509 | for (lang = lang_names; lang->name != NULL; lang++) | 1495 | for (lang = lang_names; lang->name != NULL; lang++) |
| @@ -1534,9 +1520,7 @@ get_language_from_filename (file, case_sensitive) | |||
| 1534 | * This routine is called on each file argument. | 1520 | * This routine is called on each file argument. |
| 1535 | */ | 1521 | */ |
| 1536 | static void | 1522 | static void |
| 1537 | process_file_name (file, lang) | 1523 | process_file_name (char *file, language *lang) |
| 1538 | char *file; | ||
| 1539 | language *lang; | ||
| 1540 | { | 1524 | { |
| 1541 | struct stat stat_buf; | 1525 | struct stat stat_buf; |
| 1542 | FILE *inf; | 1526 | FILE *inf; |
| @@ -1658,10 +1642,7 @@ process_file_name (file, lang) | |||
| 1658 | } | 1642 | } |
| 1659 | 1643 | ||
| 1660 | static void | 1644 | static void |
| 1661 | process_file (fh, fn, lang) | 1645 | process_file (FILE *fh, char *fn, language *lang) |
| 1662 | FILE *fh; | ||
| 1663 | char *fn; | ||
| 1664 | language *lang; | ||
| 1665 | { | 1646 | { |
| 1666 | static const fdesc emptyfdesc; | 1647 | static const fdesc emptyfdesc; |
| 1667 | fdesc *fdp; | 1648 | fdesc *fdp; |
| @@ -1738,9 +1719,9 @@ process_file (fh, fn, lang) | |||
| 1738 | * of a char is TRUE if it is the string "white", else FALSE. | 1719 | * of a char is TRUE if it is the string "white", else FALSE. |
| 1739 | */ | 1720 | */ |
| 1740 | static void | 1721 | static void |
| 1741 | init () | 1722 | init (void) |
| 1742 | { | 1723 | { |
| 1743 | register char *sp; | 1724 | register const char *sp; |
| 1744 | register int i; | 1725 | register int i; |
| 1745 | 1726 | ||
| 1746 | for (i = 0; i < CHARS; i++) | 1727 | for (i = 0; i < CHARS; i++) |
| @@ -1761,8 +1742,7 @@ init () | |||
| 1761 | * which finds the function and type definitions. | 1742 | * which finds the function and type definitions. |
| 1762 | */ | 1743 | */ |
| 1763 | static void | 1744 | static void |
| 1764 | find_entries (inf) | 1745 | find_entries (FILE *inf) |
| 1765 | FILE *inf; | ||
| 1766 | { | 1746 | { |
| 1767 | char *cp; | 1747 | char *cp; |
| 1768 | language *lang = curfdp->lang; | 1748 | language *lang = curfdp->lang; |
| @@ -1920,23 +1900,23 @@ find_entries (inf) | |||
| 1920 | * 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. |
| 1921 | */ | 1901 | */ |
| 1922 | static void | 1902 | static void |
| 1923 | make_tag (name, namelen, is_func, linestart, linelen, lno, cno) | 1903 | make_tag (const char *name, /* tag name, or NULL if unnamed */ |
| 1924 | char *name; /* tag name, or NULL if unnamed */ | 1904 | int namelen, /* tag length */ |
| 1925 | int namelen; /* tag length */ | 1905 | int is_func, /* tag is a function */ |
| 1926 | bool is_func; /* tag is a function */ | 1906 | char *linestart, /* start of the line where tag is */ |
| 1927 | char *linestart; /* start of the line where tag is */ | 1907 | int linelen, /* length of the line where tag is */ |
| 1928 | int linelen; /* length of the line where tag is */ | 1908 | int lno, /* line number */ |
| 1929 | int lno; /* line number */ | 1909 | long int cno) /* character number */ |
| 1930 | long cno; /* character number */ | ||
| 1931 | { | 1910 | { |
| 1932 | bool named = (name != NULL && namelen > 0); | 1911 | bool named = (name != NULL && namelen > 0); |
| 1912 | char *nname = NULL; | ||
| 1933 | 1913 | ||
| 1934 | if (!CTAGS && named) /* maybe set named to false */ | 1914 | if (!CTAGS && named) /* maybe set named to false */ |
| 1935 | /* 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 |
| 1936 | such that etags.el can guess a name from it. */ | 1916 | such that etags.el can guess a name from it. */ |
| 1937 | { | 1917 | { |
| 1938 | int i; | 1918 | int i; |
| 1939 | register char *cp = name; | 1919 | register const char *cp = name; |
| 1940 | 1920 | ||
| 1941 | for (i = 0; i < namelen; i++) | 1921 | for (i = 0; i < namelen; i++) |
| 1942 | if (notinname (*cp++)) | 1922 | if (notinname (*cp++)) |
| @@ -1955,21 +1935,20 @@ make_tag (name, namelen, is_func, linestart, linelen, lno, cno) | |||
| 1955 | } | 1935 | } |
| 1956 | 1936 | ||
| 1957 | if (named) | 1937 | if (named) |
| 1958 | name = savenstr (name, namelen); | 1938 | nname = savenstr (name, namelen); |
| 1959 | else | 1939 | |
| 1960 | name = NULL; | 1940 | pfnote (nname, is_func, linestart, linelen, lno, cno); |
| 1961 | pfnote (name, is_func, linestart, linelen, lno, cno); | ||
| 1962 | } | 1941 | } |
| 1963 | 1942 | ||
| 1964 | /* Record a tag. */ | 1943 | /* Record a tag. */ |
| 1965 | static void | 1944 | static void |
| 1966 | pfnote (name, is_func, linestart, linelen, lno, cno) | 1945 | pfnote (char *name, int is_func, char *linestart, int linelen, int lno, long int cno) |
| 1967 | char *name; /* tag name, or NULL if unnamed */ | 1946 | /* tag name, or NULL if unnamed */ |
| 1968 | bool is_func; /* tag is a function */ | 1947 | /* tag is a function */ |
| 1969 | char *linestart; /* start of the line where tag is */ | 1948 | /* start of the line where tag is */ |
| 1970 | int linelen; /* length of the line where tag is */ | 1949 | /* length of the line where tag is */ |
| 1971 | int lno; /* line number */ | 1950 | /* line number */ |
| 1972 | long cno; /* character number */ | 1951 | /* character number */ |
| 1973 | { | 1952 | { |
| 1974 | register node *np; | 1953 | register node *np; |
| 1975 | 1954 | ||
| @@ -2023,8 +2002,7 @@ pfnote (name, is_func, linestart, linelen, lno, cno) | |||
| 2023 | * recurse on left children, iterate on right children. | 2002 | * recurse on left children, iterate on right children. |
| 2024 | */ | 2003 | */ |
| 2025 | static void | 2004 | static void |
| 2026 | free_tree (np) | 2005 | free_tree (register node *np) |
| 2027 | register node *np; | ||
| 2028 | { | 2006 | { |
| 2029 | while (np) | 2007 | while (np) |
| 2030 | { | 2008 | { |
| @@ -2042,8 +2020,7 @@ free_tree (np) | |||
| 2042 | * delete a file description | 2020 | * delete a file description |
| 2043 | */ | 2021 | */ |
| 2044 | static void | 2022 | static void |
| 2045 | free_fdesc (fdp) | 2023 | free_fdesc (register fdesc *fdp) |
| 2046 | register fdesc *fdp; | ||
| 2047 | { | 2024 | { |
| 2048 | free (fdp->infname); | 2025 | free (fdp->infname); |
| 2049 | free (fdp->infabsname); | 2026 | free (fdp->infabsname); |
| @@ -2063,8 +2040,7 @@ free_fdesc (fdp) | |||
| 2063 | * maintain state. | 2040 | * maintain state. |
| 2064 | */ | 2041 | */ |
| 2065 | static void | 2042 | static void |
| 2066 | add_node (np, cur_node_p) | 2043 | add_node (node *np, node **cur_node_p) |
| 2067 | node *np, **cur_node_p; | ||
| 2068 | { | 2044 | { |
| 2069 | register int dif; | 2045 | register int dif; |
| 2070 | register node *cur_node = *cur_node_p; | 2046 | register node *cur_node = *cur_node_p; |
| @@ -2144,9 +2120,7 @@ add_node (np, cur_node_p) | |||
| 2144 | * given file description (CTAGS case) or free them (ETAGS case). | 2120 | * given file description (CTAGS case) or free them (ETAGS case). |
| 2145 | */ | 2121 | */ |
| 2146 | static void | 2122 | static void |
| 2147 | invalidate_nodes (badfdp, npp) | 2123 | invalidate_nodes (fdesc *badfdp, node **npp) |
| 2148 | fdesc *badfdp; | ||
| 2149 | node **npp; | ||
| 2150 | { | 2124 | { |
| 2151 | node *np = *npp; | 2125 | node *np = *npp; |
| 2152 | 2126 | ||
| @@ -2178,13 +2152,12 @@ invalidate_nodes (badfdp, npp) | |||
| 2178 | } | 2152 | } |
| 2179 | 2153 | ||
| 2180 | 2154 | ||
| 2181 | static int total_size_of_entries __P((node *)); | 2155 | static int total_size_of_entries (node *); |
| 2182 | static int number_len __P((long)); | 2156 | static int number_len (long); |
| 2183 | 2157 | ||
| 2184 | /* Length of a non-negative number's decimal representation. */ | 2158 | /* Length of a non-negative number's decimal representation. */ |
| 2185 | static int | 2159 | static int |
| 2186 | number_len (num) | 2160 | number_len (long int num) |
| 2187 | long num; | ||
| 2188 | { | 2161 | { |
| 2189 | int len = 1; | 2162 | int len = 1; |
| 2190 | while ((num /= 10) > 0) | 2163 | while ((num /= 10) > 0) |
| @@ -2199,8 +2172,7 @@ number_len (num) | |||
| 2199 | * but is still supplied for backward compatibility. | 2172 | * but is still supplied for backward compatibility. |
| 2200 | */ | 2173 | */ |
| 2201 | static int | 2174 | static int |
| 2202 | total_size_of_entries (np) | 2175 | total_size_of_entries (register node *np) |
| 2203 | register node *np; | ||
| 2204 | { | 2176 | { |
| 2205 | register int total = 0; | 2177 | register int total = 0; |
| 2206 | 2178 | ||
| @@ -2220,8 +2192,7 @@ total_size_of_entries (np) | |||
| 2220 | } | 2192 | } |
| 2221 | 2193 | ||
| 2222 | static void | 2194 | static void |
| 2223 | put_entries (np) | 2195 | put_entries (register node *np) |
| 2224 | register node *np; | ||
| 2225 | { | 2196 | { |
| 2226 | register char *sp; | 2197 | register char *sp; |
| 2227 | static fdesc *fdp = NULL; | 2198 | static fdesc *fdp = NULL; |
| @@ -2330,9 +2301,9 @@ enum sym_type | |||
| 2330 | st_C_struct, st_C_extern, st_C_enum, st_C_define, st_C_typedef | 2301 | st_C_struct, st_C_extern, st_C_enum, st_C_define, st_C_typedef |
| 2331 | }; | 2302 | }; |
| 2332 | 2303 | ||
| 2333 | static unsigned int hash __P((const char *, unsigned int)); | 2304 | static unsigned int hash (const char *, unsigned int); |
| 2334 | static struct C_stab_entry * in_word_set __P((const char *, unsigned int)); | 2305 | static struct C_stab_entry * in_word_set (const char *, unsigned int); |
| 2335 | static enum sym_type C_symtype __P((char *, int, int)); | 2306 | static enum sym_type C_symtype (char *, int, int); |
| 2336 | 2307 | ||
| 2337 | /* Feed stuff between (but not including) %[ and %] lines to: | 2308 | /* Feed stuff between (but not including) %[ and %] lines to: |
| 2338 | gperf -m 5 | 2309 | gperf -m 5 |
| @@ -2389,7 +2360,7 @@ and replace lines between %< and %> with its output, then: | |||
| 2389 | /* Command-line: gperf -m 5 */ | 2360 | /* Command-line: gperf -m 5 */ |
| 2390 | /* Computed positions: -k'2-3' */ | 2361 | /* Computed positions: -k'2-3' */ |
| 2391 | 2362 | ||
| 2392 | 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; }; |
| 2393 | /* maximum key range = 33, duplicates = 0 */ | 2364 | /* maximum key range = 33, duplicates = 0 */ |
| 2394 | 2365 | ||
| 2395 | #ifdef __GNUC__ | 2366 | #ifdef __GNUC__ |
| @@ -2400,9 +2371,7 @@ inline | |||
| 2400 | #endif | 2371 | #endif |
| 2401 | #endif | 2372 | #endif |
| 2402 | static unsigned int | 2373 | static unsigned int |
| 2403 | hash (str, len) | 2374 | hash (register const char *str, register unsigned int len) |
| 2404 | register const char *str; | ||
| 2405 | register unsigned int len; | ||
| 2406 | { | 2375 | { |
| 2407 | static unsigned char asso_values[] = | 2376 | static unsigned char asso_values[] = |
| 2408 | { | 2377 | { |
| @@ -2448,9 +2417,7 @@ hash (str, len) | |||
| 2448 | } | 2417 | } |
| 2449 | 2418 | ||
| 2450 | static struct C_stab_entry * | 2419 | static struct C_stab_entry * |
| 2451 | in_word_set (str, len) | 2420 | in_word_set (register const char *str, register unsigned int len) |
| 2452 | register const char *str; | ||
| 2453 | register unsigned int len; | ||
| 2454 | { | 2421 | { |
| 2455 | enum | 2422 | enum |
| 2456 | { | 2423 | { |
| @@ -2516,10 +2483,7 @@ in_word_set (str, len) | |||
| 2516 | /*%>*/ | 2483 | /*%>*/ |
| 2517 | 2484 | ||
| 2518 | static enum sym_type | 2485 | static enum sym_type |
| 2519 | C_symtype (str, len, c_ext) | 2486 | C_symtype (char *str, int len, int c_ext) |
| 2520 | char *str; | ||
| 2521 | int len; | ||
| 2522 | int c_ext; | ||
| 2523 | { | 2487 | { |
| 2524 | register struct C_stab_entry *se = in_word_set (str, len); | 2488 | register struct C_stab_entry *se = in_word_set (str, len); |
| 2525 | 2489 | ||
| @@ -2585,7 +2549,7 @@ static enum | |||
| 2585 | /* | 2549 | /* |
| 2586 | * 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. |
| 2587 | */ | 2551 | */ |
| 2588 | static char *objtag = "<uninited>"; | 2552 | static const char *objtag = "<uninited>"; |
| 2589 | 2553 | ||
| 2590 | /* | 2554 | /* |
| 2591 | * Yet another little state machine to deal with preprocessor lines. | 2555 | * Yet another little state machine to deal with preprocessor lines. |
| @@ -2646,9 +2610,9 @@ static struct tok | |||
| 2646 | * Variables and functions for dealing with nested structures. | 2610 | * Variables and functions for dealing with nested structures. |
| 2647 | * Idea by Mykola Dzyuba <mdzyuba@yahoo.com> (2001) | 2611 | * Idea by Mykola Dzyuba <mdzyuba@yahoo.com> (2001) |
| 2648 | */ | 2612 | */ |
| 2649 | static void pushclass_above __P((int, char *, int)); | 2613 | static void pushclass_above (int, char *, int); |
| 2650 | static void popclass_above __P((int)); | 2614 | static void popclass_above (int); |
| 2651 | static void write_classname __P((linebuffer *, char *qualifier)); | 2615 | static void write_classname (linebuffer *, const char *qualifier); |
| 2652 | 2616 | ||
| 2653 | static struct { | 2617 | static struct { |
| 2654 | char **cname; /* nested class names */ | 2618 | char **cname; /* nested class names */ |
| @@ -2663,10 +2627,7 @@ static struct { | |||
| 2663 | && bracelev == cstack.bracelev[nestlev-1] + 1) | 2627 | && bracelev == cstack.bracelev[nestlev-1] + 1) |
| 2664 | 2628 | ||
| 2665 | static void | 2629 | static void |
| 2666 | pushclass_above (bracelev, str, len) | 2630 | pushclass_above (int bracelev, char *str, int len) |
| 2667 | int bracelev; | ||
| 2668 | char *str; | ||
| 2669 | int len; | ||
| 2670 | { | 2631 | { |
| 2671 | int nl; | 2632 | int nl; |
| 2672 | 2633 | ||
| @@ -2685,8 +2646,7 @@ pushclass_above (bracelev, str, len) | |||
| 2685 | } | 2646 | } |
| 2686 | 2647 | ||
| 2687 | static void | 2648 | static void |
| 2688 | popclass_above (bracelev) | 2649 | popclass_above (int bracelev) |
| 2689 | int bracelev; | ||
| 2690 | { | 2650 | { |
| 2691 | int nl; | 2651 | int nl; |
| 2692 | 2652 | ||
| @@ -2700,9 +2660,7 @@ popclass_above (bracelev) | |||
| 2700 | } | 2660 | } |
| 2701 | 2661 | ||
| 2702 | static void | 2662 | static void |
| 2703 | write_classname (cn, qualifier) | 2663 | write_classname (linebuffer *cn, const char *qualifier) |
| 2704 | linebuffer *cn; | ||
| 2705 | char *qualifier; | ||
| 2706 | { | 2664 | { |
| 2707 | int i, len; | 2665 | int i, len; |
| 2708 | int qlen = strlen (qualifier); | 2666 | int qlen = strlen (qualifier); |
| @@ -2736,8 +2694,8 @@ write_classname (cn, qualifier) | |||
| 2736 | } | 2694 | } |
| 2737 | 2695 | ||
| 2738 | 2696 | ||
| 2739 | static bool consider_token __P((char *, int, int, int *, int, int, bool *)); | 2697 | static bool consider_token (char *, int, int, int *, int, int, bool *); |
| 2740 | static void make_C_tag __P((bool)); | 2698 | static void make_C_tag (bool); |
| 2741 | 2699 | ||
| 2742 | /* | 2700 | /* |
| 2743 | * consider_token () | 2701 | * consider_token () |
| @@ -2757,14 +2715,14 @@ static void make_C_tag __P((bool)); | |||
| 2757 | */ | 2715 | */ |
| 2758 | 2716 | ||
| 2759 | static bool | 2717 | static bool |
| 2760 | consider_token (str, len, c, c_extp, bracelev, parlev, is_func_or_var) | 2718 | consider_token (register char *str, register int len, register int c, int *c_extp, int bracelev, int parlev, int *is_func_or_var) |
| 2761 | register char *str; /* IN: token pointer */ | 2719 | /* IN: token pointer */ |
| 2762 | register int len; /* IN: token length */ | 2720 | /* IN: token length */ |
| 2763 | register int c; /* IN: first char after the token */ | 2721 | /* IN: first char after the token */ |
| 2764 | int *c_extp; /* IN, OUT: C extensions mask */ | 2722 | /* IN, OUT: C extensions mask */ |
| 2765 | int bracelev; /* IN: brace level */ | 2723 | /* IN: brace level */ |
| 2766 | int parlev; /* IN: parenthesis level */ | 2724 | /* IN: parenthesis level */ |
| 2767 | bool *is_func_or_var; /* OUT: function or variable found */ | 2725 | /* OUT: function or variable found */ |
| 2768 | { | 2726 | { |
| 2769 | /* When structdef is stagseen, scolonseen, or snone with bracelev > 0, | 2727 | /* When structdef is stagseen, scolonseen, or snone with bracelev > 0, |
| 2770 | structtype is the type of the preceding struct-like keyword, and | 2728 | structtype is the type of the preceding struct-like keyword, and |
| @@ -3098,8 +3056,7 @@ do { \ | |||
| 3098 | 3056 | ||
| 3099 | 3057 | ||
| 3100 | static void | 3058 | static void |
| 3101 | make_C_tag (isfun) | 3059 | make_C_tag (int isfun) |
| 3102 | bool isfun; | ||
| 3103 | { | 3060 | { |
| 3104 | /* This function is never called when token.valid is FALSE, but | 3061 | /* This function is never called when token.valid is FALSE, but |
| 3105 | we must protect against invalid input or internal errors. */ | 3062 | we must protect against invalid input or internal errors. */ |
| @@ -3125,16 +3082,16 @@ make_C_tag (isfun) | |||
| 3125 | * C syntax and adds them to the list. | 3082 | * C syntax and adds them to the list. |
| 3126 | */ | 3083 | */ |
| 3127 | static void | 3084 | static void |
| 3128 | C_entries (c_ext, inf) | 3085 | C_entries (int c_ext, FILE *inf) |
| 3129 | int c_ext; /* extension of C */ | 3086 | /* extension of C */ |
| 3130 | FILE *inf; /* input file */ | 3087 | /* input file */ |
| 3131 | { | 3088 | { |
| 3132 | register char c; /* latest char read; '\0' for end of line */ | 3089 | register char c; /* latest char read; '\0' for end of line */ |
| 3133 | register char *lp; /* pointer one beyond the character `c' */ | 3090 | register char *lp; /* pointer one beyond the character `c' */ |
| 3134 | int curndx, newndx; /* indices for current and new lb */ | 3091 | int curndx, newndx; /* indices for current and new lb */ |
| 3135 | register int tokoff; /* offset in line of start of current token */ | 3092 | register int tokoff; /* offset in line of start of current token */ |
| 3136 | register int toklen; /* length of current token */ | 3093 | register int toklen; /* length of current token */ |
| 3137 | char *qualifier; /* string used to qualify names */ | 3094 | const char *qualifier; /* string used to qualify names */ |
| 3138 | int qlen; /* length of qualifier */ | 3095 | int qlen; /* length of qualifier */ |
| 3139 | int bracelev; /* current brace level */ | 3096 | int bracelev; /* current brace level */ |
| 3140 | int bracketlev; /* current bracket level */ | 3097 | int bracketlev; /* current bracket level */ |
| @@ -3957,48 +3914,42 @@ C_entries (c_ext, inf) | |||
| 3957 | * of a global flag. | 3914 | * of a global flag. |
| 3958 | */ | 3915 | */ |
| 3959 | static void | 3916 | static void |
| 3960 | default_C_entries (inf) | 3917 | default_C_entries (FILE *inf) |
| 3961 | FILE *inf; | ||
| 3962 | { | 3918 | { |
| 3963 | C_entries (cplusplus ? C_PLPL : C_AUTO, inf); | 3919 | C_entries (cplusplus ? C_PLPL : C_AUTO, inf); |
| 3964 | } | 3920 | } |
| 3965 | 3921 | ||
| 3966 | /* Always do plain C. */ | 3922 | /* Always do plain C. */ |
| 3967 | static void | 3923 | static void |
| 3968 | plain_C_entries (inf) | 3924 | plain_C_entries (FILE *inf) |
| 3969 | FILE *inf; | ||
| 3970 | { | 3925 | { |
| 3971 | C_entries (0, inf); | 3926 | C_entries (0, inf); |
| 3972 | } | 3927 | } |
| 3973 | 3928 | ||
| 3974 | /* Always do C++. */ | 3929 | /* Always do C++. */ |
| 3975 | static void | 3930 | static void |
| 3976 | Cplusplus_entries (inf) | 3931 | Cplusplus_entries (FILE *inf) |
| 3977 | FILE *inf; | ||
| 3978 | { | 3932 | { |
| 3979 | C_entries (C_PLPL, inf); | 3933 | C_entries (C_PLPL, inf); |
| 3980 | } | 3934 | } |
| 3981 | 3935 | ||
| 3982 | /* Always do Java. */ | 3936 | /* Always do Java. */ |
| 3983 | static void | 3937 | static void |
| 3984 | Cjava_entries (inf) | 3938 | Cjava_entries (FILE *inf) |
| 3985 | FILE *inf; | ||
| 3986 | { | 3939 | { |
| 3987 | C_entries (C_JAVA, inf); | 3940 | C_entries (C_JAVA, inf); |
| 3988 | } | 3941 | } |
| 3989 | 3942 | ||
| 3990 | /* Always do C*. */ | 3943 | /* Always do C*. */ |
| 3991 | static void | 3944 | static void |
| 3992 | Cstar_entries (inf) | 3945 | Cstar_entries (FILE *inf) |
| 3993 | FILE *inf; | ||
| 3994 | { | 3946 | { |
| 3995 | C_entries (C_STAR, inf); | 3947 | C_entries (C_STAR, inf); |
| 3996 | } | 3948 | } |
| 3997 | 3949 | ||
| 3998 | /* Always do Yacc. */ | 3950 | /* Always do Yacc. */ |
| 3999 | static void | 3951 | static void |
| 4000 | Yacc_entries (inf) | 3952 | Yacc_entries (FILE *inf) |
| 4001 | FILE *inf; | ||
| 4002 | { | 3953 | { |
| 4003 | C_entries (YACC, inf); | 3954 | C_entries (YACC, inf); |
| 4004 | } | 3955 | } |
| @@ -4031,8 +3982,7 @@ Yacc_entries (inf) | |||
| 4031 | * matching on files that have no language defined. | 3982 | * matching on files that have no language defined. |
| 4032 | */ | 3983 | */ |
| 4033 | static void | 3984 | static void |
| 4034 | just_read_file (inf) | 3985 | just_read_file (FILE *inf) |
| 4035 | FILE *inf; | ||
| 4036 | { | 3986 | { |
| 4037 | register char *dummy; | 3987 | register char *dummy; |
| 4038 | 3988 | ||
| @@ -4043,11 +3993,11 @@ just_read_file (inf) | |||
| 4043 | 3993 | ||
| 4044 | /* Fortran parsing */ | 3994 | /* Fortran parsing */ |
| 4045 | 3995 | ||
| 4046 | static void F_takeprec __P((void)); | 3996 | static void F_takeprec (void); |
| 4047 | static void F_getit __P((FILE *)); | 3997 | static void F_getit (FILE *); |
| 4048 | 3998 | ||
| 4049 | static void | 3999 | static void |
| 4050 | F_takeprec () | 4000 | F_takeprec (void) |
| 4051 | { | 4001 | { |
| 4052 | dbp = skip_spaces (dbp); | 4002 | dbp = skip_spaces (dbp); |
| 4053 | if (*dbp != '*') | 4003 | if (*dbp != '*') |
| @@ -4070,8 +4020,7 @@ F_takeprec () | |||
| 4070 | } | 4020 | } |
| 4071 | 4021 | ||
| 4072 | static void | 4022 | static void |
| 4073 | F_getit (inf) | 4023 | F_getit (FILE *inf) |
| 4074 | FILE *inf; | ||
| 4075 | { | 4024 | { |
| 4076 | register char *cp; | 4025 | register char *cp; |
| 4077 | 4026 | ||
| @@ -4095,8 +4044,7 @@ F_getit (inf) | |||
| 4095 | 4044 | ||
| 4096 | 4045 | ||
| 4097 | static void | 4046 | static void |
| 4098 | Fortran_functions (inf) | 4047 | Fortran_functions (FILE *inf) |
| 4099 | FILE *inf; | ||
| 4100 | { | 4048 | { |
| 4101 | LOOP_ON_INPUT_LINES (inf, lb, dbp) | 4049 | LOOP_ON_INPUT_LINES (inf, lb, dbp) |
| 4102 | { | 4050 | { |
| @@ -4178,14 +4126,10 @@ Fortran_functions (inf) | |||
| 4178 | * Philippe Waroquiers (1998) | 4126 | * Philippe Waroquiers (1998) |
| 4179 | */ | 4127 | */ |
| 4180 | 4128 | ||
| 4181 | static void Ada_getit __P((FILE *, char *)); | ||
| 4182 | |||
| 4183 | /* Once we are positioned after an "interesting" keyword, let's get | 4129 | /* Once we are positioned after an "interesting" keyword, let's get |
| 4184 | the real tag value necessary. */ | 4130 | the real tag value necessary. */ |
| 4185 | static void | 4131 | static void |
| 4186 | Ada_getit (inf, name_qualifier) | 4132 | Ada_getit (FILE *inf, const char *name_qualifier) |
| 4187 | FILE *inf; | ||
| 4188 | char *name_qualifier; | ||
| 4189 | { | 4133 | { |
| 4190 | register char *cp; | 4134 | register char *cp; |
| 4191 | char *name; | 4135 | char *name; |
| @@ -4248,8 +4192,7 @@ Ada_getit (inf, name_qualifier) | |||
| 4248 | } | 4192 | } |
| 4249 | 4193 | ||
| 4250 | static void | 4194 | static void |
| 4251 | Ada_funcs (inf) | 4195 | Ada_funcs (FILE *inf) |
| 4252 | FILE *inf; | ||
| 4253 | { | 4196 | { |
| 4254 | bool inquote = FALSE; | 4197 | bool inquote = FALSE; |
| 4255 | bool skip_till_semicolumn = FALSE; | 4198 | bool skip_till_semicolumn = FALSE; |
| @@ -4362,8 +4305,7 @@ Ada_funcs (inf) | |||
| 4362 | * Idea by Bob Weiner, Motorola Inc. (1994) | 4305 | * Idea by Bob Weiner, Motorola Inc. (1994) |
| 4363 | */ | 4306 | */ |
| 4364 | static void | 4307 | static void |
| 4365 | Asm_labels (inf) | 4308 | Asm_labels (FILE *inf) |
| 4366 | FILE *inf; | ||
| 4367 | { | 4309 | { |
| 4368 | register char *cp; | 4310 | register char *cp; |
| 4369 | 4311 | ||
| @@ -4395,8 +4337,7 @@ Asm_labels (inf) | |||
| 4395 | * Ideas by Kai Großjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> (2001) | 4337 | * Ideas by Kai Großjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> (2001) |
| 4396 | */ | 4338 | */ |
| 4397 | static void | 4339 | static void |
| 4398 | Perl_functions (inf) | 4340 | Perl_functions (FILE *inf) |
| 4399 | FILE *inf; | ||
| 4400 | { | 4341 | { |
| 4401 | char *package = savestr ("main"); /* current package name */ | 4342 | char *package = savestr ("main"); /* current package name */ |
| 4402 | register char *cp; | 4343 | register char *cp; |
| @@ -4478,8 +4419,7 @@ Perl_functions (inf) | |||
| 4478 | * More ideas by seb bacon <seb@jamkit.com> (2002) | 4419 | * More ideas by seb bacon <seb@jamkit.com> (2002) |
| 4479 | */ | 4420 | */ |
| 4480 | static void | 4421 | static void |
| 4481 | Python_functions (inf) | 4422 | Python_functions (FILE *inf) |
| 4482 | FILE *inf; | ||
| 4483 | { | 4423 | { |
| 4484 | register char *cp; | 4424 | register char *cp; |
| 4485 | 4425 | ||
| @@ -4509,8 +4449,7 @@ Python_functions (inf) | |||
| 4509 | * Idea by Diez B. Roggisch (2001) | 4449 | * Idea by Diez B. Roggisch (2001) |
| 4510 | */ | 4450 | */ |
| 4511 | static void | 4451 | static void |
| 4512 | PHP_functions (inf) | 4452 | PHP_functions (FILE *inf) |
| 4513 | FILE *inf; | ||
| 4514 | { | 4453 | { |
| 4515 | register char *cp, *name; | 4454 | register char *cp, *name; |
| 4516 | bool search_identifier = FALSE; | 4455 | bool search_identifier = FALSE; |
| @@ -4589,8 +4528,7 @@ PHP_functions (inf) | |||
| 4589 | * Idea by Corny de Souza (1993) | 4528 | * Idea by Corny de Souza (1993) |
| 4590 | */ | 4529 | */ |
| 4591 | static void | 4530 | static void |
| 4592 | Cobol_paragraphs (inf) | 4531 | Cobol_paragraphs (FILE *inf) |
| 4593 | FILE *inf; | ||
| 4594 | { | 4532 | { |
| 4595 | register char *bp, *ep; | 4533 | register char *bp, *ep; |
| 4596 | 4534 | ||
| @@ -4618,8 +4556,7 @@ Cobol_paragraphs (inf) | |||
| 4618 | * Ideas by Assar Westerlund <assar@sics.se> (2001) | 4556 | * Ideas by Assar Westerlund <assar@sics.se> (2001) |
| 4619 | */ | 4557 | */ |
| 4620 | static void | 4558 | static void |
| 4621 | Makefile_targets (inf) | 4559 | Makefile_targets (FILE *inf) |
| 4622 | FILE *inf; | ||
| 4623 | { | 4560 | { |
| 4624 | register char *bp; | 4561 | register char *bp; |
| 4625 | 4562 | ||
| @@ -4654,8 +4591,7 @@ Makefile_targets (inf) | |||
| 4654 | * the tag is skipped. | 4591 | * the tag is skipped. |
| 4655 | */ | 4592 | */ |
| 4656 | static void | 4593 | static void |
| 4657 | Pascal_functions (inf) | 4594 | Pascal_functions (FILE *inf) |
| 4658 | FILE *inf; | ||
| 4659 | { | 4595 | { |
| 4660 | linebuffer tline; /* mostly copied from C_entries */ | 4596 | linebuffer tline; /* mostly copied from C_entries */ |
| 4661 | long save_lcno; | 4597 | long save_lcno; |
| @@ -4832,10 +4768,10 @@ Pascal_functions (inf) | |||
| 4832 | * look for (def or (DEF, quote or QUOTE | 4768 | * look for (def or (DEF, quote or QUOTE |
| 4833 | */ | 4769 | */ |
| 4834 | 4770 | ||
| 4835 | static void L_getit __P((void)); | 4771 | static void L_getit (void); |
| 4836 | 4772 | ||
| 4837 | static void | 4773 | static void |
| 4838 | L_getit () | 4774 | L_getit (void) |
| 4839 | { | 4775 | { |
| 4840 | if (*dbp == '\'') /* Skip prefix quote */ | 4776 | if (*dbp == '\'') /* Skip prefix quote */ |
| 4841 | dbp++; | 4777 | dbp++; |
| @@ -4851,8 +4787,7 @@ L_getit () | |||
| 4851 | } | 4787 | } |
| 4852 | 4788 | ||
| 4853 | static void | 4789 | static void |
| 4854 | Lisp_functions (inf) | 4790 | Lisp_functions (FILE *inf) |
| 4855 | FILE *inf; | ||
| 4856 | { | 4791 | { |
| 4857 | LOOP_ON_INPUT_LINES (inf, lb, dbp) | 4792 | LOOP_ON_INPUT_LINES (inf, lb, dbp) |
| 4858 | { | 4793 | { |
| @@ -4896,8 +4831,7 @@ Lisp_functions (inf) | |||
| 4896 | * "function" and "local function" are tags if they start at column 1. | 4831 | * "function" and "local function" are tags if they start at column 1. |
| 4897 | */ | 4832 | */ |
| 4898 | static void | 4833 | static void |
| 4899 | Lua_functions (inf) | 4834 | Lua_functions (FILE *inf) |
| 4900 | FILE *inf; | ||
| 4901 | { | 4835 | { |
| 4902 | register char *bp; | 4836 | register char *bp; |
| 4903 | 4837 | ||
| @@ -4923,8 +4857,7 @@ Lua_functions (inf) | |||
| 4923 | * Masatake Yamato <masata-y@is.aist-nara.ac.jp> (1999) | 4857 | * Masatake Yamato <masata-y@is.aist-nara.ac.jp> (1999) |
| 4924 | */ | 4858 | */ |
| 4925 | static void | 4859 | static void |
| 4926 | PS_functions (inf) | 4860 | PS_functions (FILE *inf) |
| 4927 | FILE *inf; | ||
| 4928 | { | 4861 | { |
| 4929 | register char *bp, *ep; | 4862 | register char *bp, *ep; |
| 4930 | 4863 | ||
| @@ -4954,8 +4887,7 @@ PS_functions (inf) | |||
| 4954 | * Ideas by Eduardo Horvath <eeh@netbsd.org> (2004) | 4887 | * Ideas by Eduardo Horvath <eeh@netbsd.org> (2004) |
| 4955 | */ | 4888 | */ |
| 4956 | static void | 4889 | static void |
| 4957 | Forth_words (inf) | 4890 | Forth_words (FILE *inf) |
| 4958 | FILE *inf; | ||
| 4959 | { | 4891 | { |
| 4960 | register char *bp; | 4892 | register char *bp; |
| 4961 | 4893 | ||
| @@ -4991,8 +4923,7 @@ Forth_words (inf) | |||
| 4991 | * Original code by Ken Haase (1985?) | 4923 | * Original code by Ken Haase (1985?) |
| 4992 | */ | 4924 | */ |
| 4993 | static void | 4925 | static void |
| 4994 | Scheme_functions (inf) | 4926 | Scheme_functions (FILE *inf) |
| 4995 | FILE *inf; | ||
| 4996 | { | 4927 | { |
| 4997 | register char *bp; | 4928 | register char *bp; |
| 4998 | 4929 | ||
| @@ -5027,13 +4958,13 @@ static linebuffer *TEX_toktab = NULL; /* Table with tag tokens */ | |||
| 5027 | 4958 | ||
| 5028 | /* Default set of control sequences to put into TEX_toktab. | 4959 | /* Default set of control sequences to put into TEX_toktab. |
| 5029 | The value of environment var TEXTAGS is prepended to this. */ | 4960 | The value of environment var TEXTAGS is prepended to this. */ |
| 5030 | static char *TEX_defenv = "\ | 4961 | static const char *TEX_defenv = "\ |
| 5031 | :chapter:section:subsection:subsubsection:eqno:label:ref:cite:bibitem\ | 4962 | :chapter:section:subsection:subsubsection:eqno:label:ref:cite:bibitem\ |
| 5032 | :part:appendix:entry:index:def\ | 4963 | :part:appendix:entry:index:def\ |
| 5033 | :newcommand:renewcommand:newenvironment:renewenvironment"; | 4964 | :newcommand:renewcommand:newenvironment:renewenvironment"; |
| 5034 | 4965 | ||
| 5035 | static void TEX_mode __P((FILE *)); | 4966 | static void TEX_mode (FILE *); |
| 5036 | static void TEX_decode_env __P((char *, char *)); | 4967 | static void TEX_decode_env (const char *, const char *); |
| 5037 | 4968 | ||
| 5038 | static char TEX_esc = '\\'; | 4969 | static char TEX_esc = '\\'; |
| 5039 | static char TEX_opgrp = '{'; | 4970 | static char TEX_opgrp = '{'; |
| @@ -5043,8 +4974,7 @@ static char TEX_clgrp = '}'; | |||
| 5043 | * TeX/LaTeX scanning loop. | 4974 | * TeX/LaTeX scanning loop. |
| 5044 | */ | 4975 | */ |
| 5045 | static void | 4976 | static void |
| 5046 | TeX_commands (inf) | 4977 | TeX_commands (FILE *inf) |
| 5047 | FILE *inf; | ||
| 5048 | { | 4978 | { |
| 5049 | char *cp; | 4979 | char *cp; |
| 5050 | linebuffer *key; | 4980 | linebuffer *key; |
| @@ -5108,8 +5038,7 @@ TeX_commands (inf) | |||
| 5108 | /* Figure out whether TeX's escapechar is '\\' or '!' and set grouping | 5038 | /* Figure out whether TeX's escapechar is '\\' or '!' and set grouping |
| 5109 | chars accordingly. */ | 5039 | chars accordingly. */ |
| 5110 | static void | 5040 | static void |
| 5111 | TEX_mode (inf) | 5041 | TEX_mode (FILE *inf) |
| 5112 | FILE *inf; | ||
| 5113 | { | 5042 | { |
| 5114 | int c; | 5043 | int c; |
| 5115 | 5044 | ||
| @@ -5143,11 +5072,9 @@ TEX_mode (inf) | |||
| 5143 | /* Read environment and prepend it to the default string. | 5072 | /* Read environment and prepend it to the default string. |
| 5144 | Build token table. */ | 5073 | Build token table. */ |
| 5145 | static void | 5074 | static void |
| 5146 | TEX_decode_env (evarname, defenv) | 5075 | TEX_decode_env (const char *evarname, const char *defenv) |
| 5147 | char *evarname; | ||
| 5148 | char *defenv; | ||
| 5149 | { | 5076 | { |
| 5150 | register char *env, *p; | 5077 | register const char *env, *p; |
| 5151 | int i, len; | 5078 | int i, len; |
| 5152 | 5079 | ||
| 5153 | /* Append default string to environment. */ | 5080 | /* Append default string to environment. */ |
| @@ -5155,10 +5082,7 @@ TEX_decode_env (evarname, defenv) | |||
| 5155 | if (!env) | 5082 | if (!env) |
| 5156 | env = defenv; | 5083 | env = defenv; |
| 5157 | else | 5084 | else |
| 5158 | { | 5085 | env = concat (env, defenv, ""); |
| 5159 | char *oldenv = env; | ||
| 5160 | env = concat (oldenv, defenv, ""); | ||
| 5161 | } | ||
| 5162 | 5086 | ||
| 5163 | /* Allocate a token table */ | 5087 | /* Allocate a token table */ |
| 5164 | for (len = 1, p = env; p;) | 5088 | for (len = 1, p = env; p;) |
| @@ -5193,8 +5117,7 @@ TEX_decode_env (evarname, defenv) | |||
| 5193 | 5117 | ||
| 5194 | /* Texinfo support. Dave Love, Mar. 2000. */ | 5118 | /* Texinfo support. Dave Love, Mar. 2000. */ |
| 5195 | static void | 5119 | static void |
| 5196 | Texinfo_nodes (inf) | 5120 | Texinfo_nodes (FILE *inf) |
| 5197 | FILE * inf; | ||
| 5198 | { | 5121 | { |
| 5199 | char *cp, *start; | 5122 | char *cp, *start; |
| 5200 | LOOP_ON_INPUT_LINES (inf, lb, cp) | 5123 | LOOP_ON_INPUT_LINES (inf, lb, cp) |
| @@ -5217,8 +5140,7 @@ Texinfo_nodes (inf) | |||
| 5217 | * Francesco Potortì, 2002. | 5140 | * Francesco Potortì, 2002. |
| 5218 | */ | 5141 | */ |
| 5219 | static void | 5142 | static void |
| 5220 | HTML_labels (inf) | 5143 | HTML_labels (FILE *inf) |
| 5221 | FILE * inf; | ||
| 5222 | { | 5144 | { |
| 5223 | bool getnext = FALSE; /* next text outside of HTML tags is a tag */ | 5145 | bool getnext = FALSE; /* next text outside of HTML tags is a tag */ |
| 5224 | bool skiptag = FALSE; /* skip to the end of the current HTML tag */ | 5146 | bool skiptag = FALSE; /* skip to the end of the current HTML tag */ |
| @@ -5338,13 +5260,12 @@ HTML_labels (inf) | |||
| 5338 | * Original code by Sunichirou Sugou (1989) | 5260 | * Original code by Sunichirou Sugou (1989) |
| 5339 | * Rewritten by Anders Lindgren (1996) | 5261 | * Rewritten by Anders Lindgren (1996) |
| 5340 | */ | 5262 | */ |
| 5341 | static int prolog_pr __P((char *, char *)); | 5263 | static int prolog_pr (char *, char *); |
| 5342 | static void prolog_skip_comment __P((linebuffer *, FILE *)); | 5264 | static void prolog_skip_comment (linebuffer *, FILE *); |
| 5343 | static int prolog_atom __P((char *, int)); | 5265 | static int prolog_atom (char *, int); |
| 5344 | 5266 | ||
| 5345 | static void | 5267 | static void |
| 5346 | Prolog_functions (inf) | 5268 | Prolog_functions (FILE *inf) |
| 5347 | FILE *inf; | ||
| 5348 | { | 5269 | { |
| 5349 | char *cp, *last; | 5270 | char *cp, *last; |
| 5350 | int len; | 5271 | int len; |
| @@ -5380,9 +5301,7 @@ Prolog_functions (inf) | |||
| 5380 | 5301 | ||
| 5381 | 5302 | ||
| 5382 | static void | 5303 | static void |
| 5383 | prolog_skip_comment (plb, inf) | 5304 | prolog_skip_comment (linebuffer *plb, FILE *inf) |
| 5384 | linebuffer *plb; | ||
| 5385 | FILE *inf; | ||
| 5386 | { | 5305 | { |
| 5387 | char *cp; | 5306 | char *cp; |
| 5388 | 5307 | ||
| @@ -5408,9 +5327,9 @@ prolog_skip_comment (plb, inf) | |||
| 5408 | * header was found. | 5327 | * header was found. |
| 5409 | */ | 5328 | */ |
| 5410 | static int | 5329 | static int |
| 5411 | prolog_pr (s, last) | 5330 | prolog_pr (char *s, char *last) |
| 5412 | char *s; | 5331 | |
| 5413 | char *last; /* Name of last clause. */ | 5332 | /* Name of last clause. */ |
| 5414 | { | 5333 | { |
| 5415 | int pos; | 5334 | int pos; |
| 5416 | int len; | 5335 | int len; |
| @@ -5446,9 +5365,7 @@ prolog_pr (s, last) | |||
| 5446 | * Backslash quotes everything. | 5365 | * Backslash quotes everything. |
| 5447 | */ | 5366 | */ |
| 5448 | static int | 5367 | static int |
| 5449 | prolog_atom (s, pos) | 5368 | prolog_atom (char *s, int pos) |
| 5450 | char *s; | ||
| 5451 | int pos; | ||
| 5452 | { | 5369 | { |
| 5453 | int origpos; | 5370 | int origpos; |
| 5454 | 5371 | ||
| @@ -5503,13 +5420,12 @@ prolog_atom (s, pos) | |||
| 5503 | * Assumes that Erlang functions start at column 0. | 5420 | * Assumes that Erlang functions start at column 0. |
| 5504 | * Original code by Anders Lindgren (1996) | 5421 | * Original code by Anders Lindgren (1996) |
| 5505 | */ | 5422 | */ |
| 5506 | static int erlang_func __P((char *, char *)); | 5423 | static int erlang_func (char *, char *); |
| 5507 | static void erlang_attribute __P((char *)); | 5424 | static void erlang_attribute (char *); |
| 5508 | static int erlang_atom __P((char *)); | 5425 | static int erlang_atom (char *); |
| 5509 | 5426 | ||
| 5510 | static void | 5427 | static void |
| 5511 | Erlang_functions (inf) | 5428 | Erlang_functions (FILE *inf) |
| 5512 | FILE *inf; | ||
| 5513 | { | 5429 | { |
| 5514 | char *cp, *last; | 5430 | char *cp, *last; |
| 5515 | int len; | 5431 | int len; |
| @@ -5568,9 +5484,9 @@ Erlang_functions (inf) | |||
| 5568 | * was found. | 5484 | * was found. |
| 5569 | */ | 5485 | */ |
| 5570 | static int | 5486 | static int |
| 5571 | erlang_func (s, last) | 5487 | erlang_func (char *s, char *last) |
| 5572 | char *s; | 5488 | |
| 5573 | char *last; /* Name of last clause. */ | 5489 | /* Name of last clause. */ |
| 5574 | { | 5490 | { |
| 5575 | int pos; | 5491 | int pos; |
| 5576 | int len; | 5492 | int len; |
| @@ -5606,8 +5522,7 @@ erlang_func (s, last) | |||
| 5606 | * -record(graph, {vtab = notable, cyclic = true}). | 5522 | * -record(graph, {vtab = notable, cyclic = true}). |
| 5607 | */ | 5523 | */ |
| 5608 | static void | 5524 | static void |
| 5609 | erlang_attribute (s) | 5525 | erlang_attribute (char *s) |
| 5610 | char *s; | ||
| 5611 | { | 5526 | { |
| 5612 | char *cp = s; | 5527 | char *cp = s; |
| 5613 | 5528 | ||
| @@ -5627,8 +5542,7 @@ erlang_attribute (s) | |||
| 5627 | * Return the number of bytes consumed, or -1 if there was an error. | 5542 | * Return the number of bytes consumed, or -1 if there was an error. |
| 5628 | */ | 5543 | */ |
| 5629 | static int | 5544 | static int |
| 5630 | erlang_atom (s) | 5545 | erlang_atom (char *s) |
| 5631 | char *s; | ||
| 5632 | { | 5546 | { |
| 5633 | int pos = 0; | 5547 | int pos = 0; |
| 5634 | 5548 | ||
| @@ -5652,9 +5566,9 @@ erlang_atom (s) | |||
| 5652 | } | 5566 | } |
| 5653 | 5567 | ||
| 5654 | 5568 | ||
| 5655 | static char *scan_separators __P((char *)); | 5569 | static char *scan_separators (char *); |
| 5656 | static void add_regex __P((char *, language *)); | 5570 | static void add_regex (char *, language *); |
| 5657 | static char *substitute __P((char *, char *, struct re_registers *)); | 5571 | static char *substitute (char *, char *, struct re_registers *); |
| 5658 | 5572 | ||
| 5659 | /* | 5573 | /* |
| 5660 | * Take a string like "/blah/" and turn it into "blah", verifying | 5574 | * Take a string like "/blah/" and turn it into "blah", verifying |
| @@ -5666,8 +5580,7 @@ static char *substitute __P((char *, char *, struct re_registers *)); | |||
| 5666 | * unterminated regexps. | 5580 | * unterminated regexps. |
| 5667 | */ | 5581 | */ |
| 5668 | static char * | 5582 | static char * |
| 5669 | scan_separators (name) | 5583 | scan_separators (char *name) |
| 5670 | char *name; | ||
| 5671 | { | 5584 | { |
| 5672 | char sep = name[0]; | 5585 | char sep = name[0]; |
| 5673 | char *copyto = name; | 5586 | char *copyto = name; |
| @@ -5719,8 +5632,7 @@ scan_separators (name) | |||
| 5719 | /* Look at the argument of --regex or --no-regex and do the right | 5632 | /* Look at the argument of --regex or --no-regex and do the right |
| 5720 | thing. Same for each line of a regexp file. */ | 5633 | thing. Same for each line of a regexp file. */ |
| 5721 | static void | 5634 | static void |
| 5722 | analyse_regex (regex_arg) | 5635 | analyse_regex (char *regex_arg) |
| 5723 | char *regex_arg; | ||
| 5724 | { | 5636 | { |
| 5725 | if (regex_arg == NULL) | 5637 | if (regex_arg == NULL) |
| 5726 | { | 5638 | { |
| @@ -5791,12 +5703,11 @@ analyse_regex (regex_arg) | |||
| 5791 | /* Separate the regexp pattern, compile it, | 5703 | /* Separate the regexp pattern, compile it, |
| 5792 | and care for optional name and modifiers. */ | 5704 | and care for optional name and modifiers. */ |
| 5793 | static void | 5705 | static void |
| 5794 | add_regex (regexp_pattern, lang) | 5706 | add_regex (char *regexp_pattern, language *lang) |
| 5795 | char *regexp_pattern; | ||
| 5796 | language *lang; | ||
| 5797 | { | 5707 | { |
| 5798 | static struct re_pattern_buffer zeropattern; | 5708 | static struct re_pattern_buffer zeropattern; |
| 5799 | char sep, *pat, *name, *modifiers; | 5709 | char sep, *pat, *name, *modifiers; |
| 5710 | char empty[] = ""; | ||
| 5800 | const char *err; | 5711 | const char *err; |
| 5801 | struct re_pattern_buffer *patbuf; | 5712 | struct re_pattern_buffer *patbuf; |
| 5802 | regexp *rp; | 5713 | regexp *rp; |
| @@ -5828,7 +5739,7 @@ add_regex (regexp_pattern, lang) | |||
| 5828 | if (modifiers == NULL) /* no terminating separator --> no name */ | 5739 | if (modifiers == NULL) /* no terminating separator --> no name */ |
| 5829 | { | 5740 | { |
| 5830 | modifiers = name; | 5741 | modifiers = name; |
| 5831 | name = ""; | 5742 | name = empty; |
| 5832 | } | 5743 | } |
| 5833 | else | 5744 | else |
| 5834 | modifiers += 1; /* skip separator */ | 5745 | modifiers += 1; /* skip separator */ |
| @@ -5910,9 +5821,7 @@ add_regex (regexp_pattern, lang) | |||
| 5910 | * arguments. | 5821 | * arguments. |
| 5911 | */ | 5822 | */ |
| 5912 | static char * | 5823 | static char * |
| 5913 | substitute (in, out, regs) | 5824 | substitute (char *in, char *out, struct re_registers *regs) |
| 5914 | char *in, *out; | ||
| 5915 | struct re_registers *regs; | ||
| 5916 | { | 5825 | { |
| 5917 | char *result, *t; | 5826 | char *result, *t; |
| 5918 | int size, dig, diglen; | 5827 | int size, dig, diglen; |
| @@ -5959,7 +5868,7 @@ substitute (in, out, regs) | |||
| 5959 | 5868 | ||
| 5960 | /* Deallocate all regexps. */ | 5869 | /* Deallocate all regexps. */ |
| 5961 | static void | 5870 | static void |
| 5962 | free_regexps () | 5871 | free_regexps (void) |
| 5963 | { | 5872 | { |
| 5964 | regexp *rp; | 5873 | regexp *rp; |
| 5965 | while (p_head != NULL) | 5874 | while (p_head != NULL) |
| @@ -5981,7 +5890,7 @@ free_regexps () | |||
| 5981 | * Idea by Ben Wing <ben@666.com> (2002). | 5890 | * Idea by Ben Wing <ben@666.com> (2002). |
| 5982 | */ | 5891 | */ |
| 5983 | static void | 5892 | static void |
| 5984 | regex_tag_multiline () | 5893 | regex_tag_multiline (void) |
| 5985 | { | 5894 | { |
| 5986 | char *buffer = filebuf.buffer; | 5895 | char *buffer = filebuf.buffer; |
| 5987 | regexp *rp; | 5896 | regexp *rp; |
| @@ -6058,8 +5967,7 @@ regex_tag_multiline () | |||
| 6058 | 5967 | ||
| 6059 | 5968 | ||
| 6060 | static bool | 5969 | static bool |
| 6061 | nocase_tail (cp) | 5970 | nocase_tail (const char *cp) |
| 6062 | char *cp; | ||
| 6063 | { | 5971 | { |
| 6064 | register int len = 0; | 5972 | register int len = 0; |
| 6065 | 5973 | ||
| @@ -6074,9 +5982,7 @@ nocase_tail (cp) | |||
| 6074 | } | 5982 | } |
| 6075 | 5983 | ||
| 6076 | static void | 5984 | static void |
| 6077 | get_tag (bp, namepp) | 5985 | get_tag (register char *bp, char **namepp) |
| 6078 | register char *bp; | ||
| 6079 | char **namepp; | ||
| 6080 | { | 5986 | { |
| 6081 | register char *cp = bp; | 5987 | register char *cp = bp; |
| 6082 | 5988 | ||
| @@ -6107,9 +6013,7 @@ get_tag (bp, namepp) | |||
| 6107 | * appended to `filebuf'. | 6013 | * appended to `filebuf'. |
| 6108 | */ | 6014 | */ |
| 6109 | static long | 6015 | static long |
| 6110 | readline_internal (lbp, stream) | 6016 | readline_internal (linebuffer *lbp, register FILE *stream) |
| 6111 | linebuffer *lbp; | ||
| 6112 | register FILE *stream; | ||
| 6113 | { | 6017 | { |
| 6114 | char *buffer = lbp->buffer; | 6018 | char *buffer = lbp->buffer; |
| 6115 | register char *p = lbp->buffer; | 6019 | register char *p = lbp->buffer; |
| @@ -6187,9 +6091,7 @@ readline_internal (lbp, stream) | |||
| 6187 | * directives. | 6091 | * directives. |
| 6188 | */ | 6092 | */ |
| 6189 | static void | 6093 | static void |
| 6190 | readline (lbp, stream) | 6094 | readline (linebuffer *lbp, FILE *stream) |
| 6191 | linebuffer *lbp; | ||
| 6192 | FILE *stream; | ||
| 6193 | { | 6095 | { |
| 6194 | long result; | 6096 | long result; |
| 6195 | 6097 | ||
| @@ -6382,8 +6284,7 @@ readline (lbp, stream) | |||
| 6382 | * with xnew where the string CP has been copied. | 6284 | * with xnew where the string CP has been copied. |
| 6383 | */ | 6285 | */ |
| 6384 | static char * | 6286 | static char * |
| 6385 | savestr (cp) | 6287 | savestr (const char *cp) |
| 6386 | char *cp; | ||
| 6387 | { | 6288 | { |
| 6388 | return savenstr (cp, strlen (cp)); | 6289 | return savenstr (cp, strlen (cp)); |
| 6389 | } | 6290 | } |
| @@ -6393,9 +6294,7 @@ savestr (cp) | |||
| 6393 | * 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. |
| 6394 | */ | 6295 | */ |
| 6395 | static char * | 6296 | static char * |
| 6396 | savenstr (cp, len) | 6297 | savenstr (const char *cp, int len) |
| 6397 | char *cp; | ||
| 6398 | int len; | ||
| 6399 | { | 6298 | { |
| 6400 | register char *dp; | 6299 | register char *dp; |
| 6401 | 6300 | ||
| @@ -6412,9 +6311,7 @@ savenstr (cp, len) | |||
| 6412 | * Identical to POSIX strrchr, included for portability. | 6311 | * Identical to POSIX strrchr, included for portability. |
| 6413 | */ | 6312 | */ |
| 6414 | static char * | 6313 | static char * |
| 6415 | etags_strrchr (sp, c) | 6314 | etags_strrchr (register const char *sp, register int c) |
| 6416 | register const char *sp; | ||
| 6417 | register int c; | ||
| 6418 | { | 6315 | { |
| 6419 | register const char *r; | 6316 | register const char *r; |
| 6420 | 6317 | ||
| @@ -6434,9 +6331,7 @@ etags_strrchr (sp, c) | |||
| 6434 | * Identical to POSIX strchr, included for portability. | 6331 | * Identical to POSIX strchr, included for portability. |
| 6435 | */ | 6332 | */ |
| 6436 | static char * | 6333 | static char * |
| 6437 | etags_strchr (sp, c) | 6334 | etags_strchr (register const char *sp, register int c) |
| 6438 | register const char *sp; | ||
| 6439 | register int c; | ||
| 6440 | { | 6335 | { |
| 6441 | do | 6336 | do |
| 6442 | { | 6337 | { |
| @@ -6452,9 +6347,7 @@ etags_strchr (sp, c) | |||
| 6452 | * Same as BSD's strcasecmp, included for portability. | 6347 | * Same as BSD's strcasecmp, included for portability. |
| 6453 | */ | 6348 | */ |
| 6454 | static int | 6349 | static int |
| 6455 | etags_strcasecmp (s1, s2) | 6350 | etags_strcasecmp (register const char *s1, register const char *s2) |
| 6456 | register const char *s1; | ||
| 6457 | register const char *s2; | ||
| 6458 | { | 6351 | { |
| 6459 | while (*s1 != '\0' | 6352 | while (*s1 != '\0' |
| 6460 | && (ISALPHA (*s1) && ISALPHA (*s2) | 6353 | && (ISALPHA (*s1) && ISALPHA (*s2) |
| @@ -6474,10 +6367,7 @@ etags_strcasecmp (s1, s2) | |||
| 6474 | * Same as BSD's strncasecmp, included for portability. | 6367 | * Same as BSD's strncasecmp, included for portability. |
| 6475 | */ | 6368 | */ |
| 6476 | static int | 6369 | static int |
| 6477 | etags_strncasecmp (s1, s2, n) | 6370 | etags_strncasecmp (register const char *s1, register const char *s2, register int n) |
| 6478 | register const char *s1; | ||
| 6479 | register const char *s2; | ||
| 6480 | register int n; | ||
| 6481 | { | 6371 | { |
| 6482 | while (*s1 != '\0' && n-- > 0 | 6372 | while (*s1 != '\0' && n-- > 0 |
| 6483 | && (ISALPHA (*s1) && ISALPHA (*s2) | 6373 | && (ISALPHA (*s1) && ISALPHA (*s2) |
| @@ -6495,8 +6385,7 @@ etags_strncasecmp (s1, s2, n) | |||
| 6495 | 6385 | ||
| 6496 | /* Skip spaces (end of string is not space), return new pointer. */ | 6386 | /* Skip spaces (end of string is not space), return new pointer. */ |
| 6497 | static char * | 6387 | static char * |
| 6498 | skip_spaces (cp) | 6388 | skip_spaces (char *cp) |
| 6499 | char *cp; | ||
| 6500 | { | 6389 | { |
| 6501 | while (iswhite (*cp)) | 6390 | while (iswhite (*cp)) |
| 6502 | cp++; | 6391 | cp++; |
| @@ -6505,8 +6394,7 @@ skip_spaces (cp) | |||
| 6505 | 6394 | ||
| 6506 | /* Skip non spaces, except end of string, return new pointer. */ | 6395 | /* Skip non spaces, except end of string, return new pointer. */ |
| 6507 | static char * | 6396 | static char * |
| 6508 | skip_non_spaces (cp) | 6397 | skip_non_spaces (char *cp) |
| 6509 | char *cp; | ||
| 6510 | { | 6398 | { |
| 6511 | while (*cp != '\0' && !iswhite (*cp)) | 6399 | while (*cp != '\0' && !iswhite (*cp)) |
| 6512 | cp++; | 6400 | cp++; |
| @@ -6515,23 +6403,21 @@ skip_non_spaces (cp) | |||
| 6515 | 6403 | ||
| 6516 | /* Print error message and exit. */ | 6404 | /* Print error message and exit. */ |
| 6517 | void | 6405 | void |
| 6518 | fatal (s1, s2) | 6406 | fatal (const char *s1, const char *s2) |
| 6519 | char *s1, *s2; | ||
| 6520 | { | 6407 | { |
| 6521 | error (s1, s2); | 6408 | error (s1, s2); |
| 6522 | exit (EXIT_FAILURE); | 6409 | exit (EXIT_FAILURE); |
| 6523 | } | 6410 | } |
| 6524 | 6411 | ||
| 6525 | static void | 6412 | static void |
| 6526 | pfatal (s1) | 6413 | pfatal (const char *s1) |
| 6527 | char *s1; | ||
| 6528 | { | 6414 | { |
| 6529 | perror (s1); | 6415 | perror (s1); |
| 6530 | exit (EXIT_FAILURE); | 6416 | exit (EXIT_FAILURE); |
| 6531 | } | 6417 | } |
| 6532 | 6418 | ||
| 6533 | static void | 6419 | static void |
| 6534 | suggest_asking_for_help () | 6420 | suggest_asking_for_help (void) |
| 6535 | { | 6421 | { |
| 6536 | fprintf (stderr, "\tTry `%s %s' for a complete list of options.\n", | 6422 | fprintf (stderr, "\tTry `%s %s' for a complete list of options.\n", |
| 6537 | progname, NO_LONG_OPTIONS ? "-h" : "--help"); | 6423 | progname, NO_LONG_OPTIONS ? "-h" : "--help"); |
| @@ -6540,8 +6426,7 @@ suggest_asking_for_help () | |||
| 6540 | 6426 | ||
| 6541 | /* Print error message. `s1' is printf control string, `s2' is arg for it. */ | 6427 | /* Print error message. `s1' is printf control string, `s2' is arg for it. */ |
| 6542 | static void | 6428 | static void |
| 6543 | error (s1, s2) | 6429 | error (const char *s1, const char *s2) |
| 6544 | const char *s1, *s2; | ||
| 6545 | { | 6430 | { |
| 6546 | fprintf (stderr, "%s: ", progname); | 6431 | fprintf (stderr, "%s: ", progname); |
| 6547 | fprintf (stderr, s1, s2); | 6432 | fprintf (stderr, s1, s2); |
| @@ -6551,8 +6436,7 @@ error (s1, s2) | |||
| 6551 | /* Return a newly-allocated string whose contents | 6436 | /* Return a newly-allocated string whose contents |
| 6552 | concatenate those of s1, s2, s3. */ | 6437 | concatenate those of s1, s2, s3. */ |
| 6553 | static char * | 6438 | static char * |
| 6554 | concat (s1, s2, s3) | 6439 | concat (const char *s1, const char *s2, const char *s3) |
| 6555 | char *s1, *s2, *s3; | ||
| 6556 | { | 6440 | { |
| 6557 | int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); | 6441 | int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); |
| 6558 | char *result = xnew (len1 + len2 + len3 + 1, char); | 6442 | char *result = xnew (len1 + len2 + len3 + 1, char); |
| @@ -6569,7 +6453,7 @@ concat (s1, s2, s3) | |||
| 6569 | /* Does the same work as the system V getcwd, but does not need to | 6453 | /* Does the same work as the system V getcwd, but does not need to |
| 6570 | guess the buffer size in advance. */ | 6454 | guess the buffer size in advance. */ |
| 6571 | static char * | 6455 | static char * |
| 6572 | etags_getcwd () | 6456 | etags_getcwd (void) |
| 6573 | { | 6457 | { |
| 6574 | #ifdef HAVE_GETCWD | 6458 | #ifdef HAVE_GETCWD |
| 6575 | int bufsize = 200; | 6459 | int bufsize = 200; |
| @@ -6619,8 +6503,7 @@ etags_getcwd () | |||
| 6619 | /* Return a newly allocated string containing the file name of FILE | 6503 | /* Return a newly allocated string containing the file name of FILE |
| 6620 | relative to the absolute directory DIR (which should end with a slash). */ | 6504 | relative to the absolute directory DIR (which should end with a slash). */ |
| 6621 | static char * | 6505 | static char * |
| 6622 | relative_filename (file, dir) | 6506 | relative_filename (char *file, char *dir) |
| 6623 | char *file, *dir; | ||
| 6624 | { | 6507 | { |
| 6625 | char *fp, *dp, *afn, *res; | 6508 | char *fp, *dp, *afn, *res; |
| 6626 | int i; | 6509 | int i; |
| @@ -6659,8 +6542,7 @@ relative_filename (file, dir) | |||
| 6659 | /* Return a newly allocated string containing the absolute file name | 6542 | /* Return a newly allocated string containing the absolute file name |
| 6660 | of FILE given DIR (which should end with a slash). */ | 6543 | of FILE given DIR (which should end with a slash). */ |
| 6661 | static char * | 6544 | static char * |
| 6662 | absolute_filename (file, dir) | 6545 | absolute_filename (char *file, char *dir) |
| 6663 | char *file, *dir; | ||
| 6664 | { | 6546 | { |
| 6665 | char *slashp, *cp, *res; | 6547 | char *slashp, *cp, *res; |
| 6666 | 6548 | ||
| @@ -6733,8 +6615,7 @@ absolute_filename (file, dir) | |||
| 6733 | file name of dir where FILE resides given DIR (which should | 6615 | file name of dir where FILE resides given DIR (which should |
| 6734 | end with a slash). */ | 6616 | end with a slash). */ |
| 6735 | static char * | 6617 | static char * |
| 6736 | absolute_dirname (file, dir) | 6618 | absolute_dirname (char *file, char *dir) |
| 6737 | char *file, *dir; | ||
| 6738 | { | 6619 | { |
| 6739 | char *slashp, *res; | 6620 | char *slashp, *res; |
| 6740 | char save; | 6621 | char save; |
| @@ -6753,8 +6634,7 @@ absolute_dirname (file, dir) | |||
| 6753 | /* Whether the argument string is an absolute file name. The argument | 6634 | /* Whether the argument string is an absolute file name. The argument |
| 6754 | string must have been canonicalized with canonicalize_filename. */ | 6635 | string must have been canonicalized with canonicalize_filename. */ |
| 6755 | static bool | 6636 | static bool |
| 6756 | filename_is_absolute (fn) | 6637 | filename_is_absolute (char *fn) |
| 6757 | char *fn; | ||
| 6758 | { | 6638 | { |
| 6759 | return (fn[0] == '/' | 6639 | return (fn[0] == '/' |
| 6760 | #ifdef DOS_NT | 6640 | #ifdef DOS_NT |
| @@ -6766,8 +6646,7 @@ filename_is_absolute (fn) | |||
| 6766 | /* Upcase DOS drive letter and collapse separators into single slashes. | 6646 | /* Upcase DOS drive letter and collapse separators into single slashes. |
| 6767 | Works in place. */ | 6647 | Works in place. */ |
| 6768 | static void | 6648 | static void |
| 6769 | canonicalize_filename (fn) | 6649 | canonicalize_filename (register char *fn) |
| 6770 | register char *fn; | ||
| 6771 | { | 6650 | { |
| 6772 | register char* cp; | 6651 | register char* cp; |
| 6773 | char sep = '/'; | 6652 | char sep = '/'; |
| @@ -6796,8 +6675,7 @@ canonicalize_filename (fn) | |||
| 6796 | 6675 | ||
| 6797 | /* Initialize a linebuffer for use. */ | 6676 | /* Initialize a linebuffer for use. */ |
| 6798 | static void | 6677 | static void |
| 6799 | linebuffer_init (lbp) | 6678 | linebuffer_init (linebuffer *lbp) |
| 6800 | linebuffer *lbp; | ||
| 6801 | { | 6679 | { |
| 6802 | lbp->size = (DEBUG) ? 3 : 200; | 6680 | lbp->size = (DEBUG) ? 3 : 200; |
| 6803 | lbp->buffer = xnew (lbp->size, char); | 6681 | lbp->buffer = xnew (lbp->size, char); |
| @@ -6807,9 +6685,7 @@ linebuffer_init (lbp) | |||
| 6807 | 6685 | ||
| 6808 | /* Set the minimum size of a string contained in a linebuffer. */ | 6686 | /* Set the minimum size of a string contained in a linebuffer. */ |
| 6809 | static void | 6687 | static void |
| 6810 | linebuffer_setlen (lbp, toksize) | 6688 | linebuffer_setlen (linebuffer *lbp, int toksize) |
| 6811 | linebuffer *lbp; | ||
| 6812 | int toksize; | ||
| 6813 | { | 6689 | { |
| 6814 | while (lbp->size <= toksize) | 6690 | while (lbp->size <= toksize) |
| 6815 | { | 6691 | { |
| @@ -6821,8 +6697,7 @@ linebuffer_setlen (lbp, toksize) | |||
| 6821 | 6697 | ||
| 6822 | /* Like malloc but get fatal error if memory is exhausted. */ | 6698 | /* Like malloc but get fatal error if memory is exhausted. */ |
| 6823 | static PTR | 6699 | static PTR |
| 6824 | xmalloc (size) | 6700 | xmalloc (unsigned int size) |
| 6825 | unsigned int size; | ||
| 6826 | { | 6701 | { |
| 6827 | PTR result = (PTR) malloc (size); | 6702 | PTR result = (PTR) malloc (size); |
| 6828 | if (result == NULL) | 6703 | if (result == NULL) |
| @@ -6831,9 +6706,7 @@ xmalloc (size) | |||
| 6831 | } | 6706 | } |
| 6832 | 6707 | ||
| 6833 | static PTR | 6708 | static PTR |
| 6834 | xrealloc (ptr, size) | 6709 | xrealloc (char *ptr, unsigned int size) |
| 6835 | char *ptr; | ||
| 6836 | unsigned int size; | ||
| 6837 | { | 6710 | { |
| 6838 | PTR result = (PTR) realloc (ptr, size); | 6711 | PTR result = (PTR) realloc (ptr, size); |
| 6839 | if (result == NULL) | 6712 | if (result == NULL) |
diff --git a/lib-src/fakemail.c b/lib-src/fakemail.c index f98fb749476..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 |
| @@ -100,7 +101,7 @@ typedef struct header_record *header; | |||
| 100 | struct stream_record | 101 | struct stream_record |
| 101 | { | 102 | { |
| 102 | FILE *handle; | 103 | FILE *handle; |
| 103 | int (*action)(); | 104 | int (*action)(FILE *); |
| 104 | struct stream_record *rest_streams; | 105 | struct stream_record *rest_streams; |
| 105 | }; | 106 | }; |
| 106 | typedef struct stream_record *stream_list; | 107 | typedef struct stream_record *stream_list; |
| @@ -140,19 +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 | extern FILE *popen (); | 151 | static void fatal (const char *s1) NO_RETURN; |
| 151 | extern int fclose (), pclose (); | ||
| 152 | 152 | ||
| 153 | #ifdef CURRENT_USER | 153 | #ifdef CURRENT_USER |
| 154 | extern struct passwd *getpwuid (); | ||
| 155 | extern unsigned short geteuid (); | ||
| 156 | static struct passwd *my_entry; | 154 | static struct passwd *my_entry; |
| 157 | #define cuserid(s) \ | 155 | #define cuserid(s) \ |
| 158 | (my_entry = getpwuid (((int) geteuid ())), \ | 156 | (my_entry = getpwuid (((int) geteuid ())), \ |
| @@ -164,8 +162,7 @@ static struct passwd *my_entry; | |||
| 164 | /* 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. */ |
| 165 | 163 | ||
| 166 | static void | 164 | static void |
| 167 | error (s1, s2) | 165 | error (const char *s1, const char *s2) |
| 168 | char *s1, *s2; | ||
| 169 | { | 166 | { |
| 170 | printf ("%s: ", my_name); | 167 | printf ("%s: ", my_name); |
| 171 | printf (s1, s2); | 168 | printf (s1, s2); |
| @@ -176,8 +173,7 @@ error (s1, s2) | |||
| 176 | /* Print error message and exit. */ | 173 | /* Print error message and exit. */ |
| 177 | 174 | ||
| 178 | static void | 175 | static void |
| 179 | fatal (s1) | 176 | fatal (const char *s1) |
| 180 | char *s1; | ||
| 181 | { | 177 | { |
| 182 | error ("%s", s1); | 178 | error ("%s", s1); |
| 183 | exit (EXIT_FAILURE); | 179 | exit (EXIT_FAILURE); |
| @@ -186,8 +182,7 @@ fatal (s1) | |||
| 186 | /* Like malloc but get fatal error if memory is exhausted. */ | 182 | /* Like malloc but get fatal error if memory is exhausted. */ |
| 187 | 183 | ||
| 188 | static long * | 184 | static long * |
| 189 | xmalloc (size) | 185 | xmalloc (int size) |
| 190 | int size; | ||
| 191 | { | 186 | { |
| 192 | long *result = (long *) malloc (((unsigned) size)); | 187 | long *result = (long *) malloc (((unsigned) size)); |
| 193 | if (result == ((long *) NULL)) | 188 | if (result == ((long *) NULL)) |
| @@ -196,9 +191,7 @@ xmalloc (size) | |||
| 196 | } | 191 | } |
| 197 | 192 | ||
| 198 | static long * | 193 | static long * |
| 199 | xrealloc (ptr, size) | 194 | xrealloc (long int *ptr, int size) |
| 200 | long *ptr; | ||
| 201 | int size; | ||
| 202 | { | 195 | { |
| 203 | long *result = (long *) realloc (ptr, ((unsigned) size)); | 196 | long *result = (long *) realloc (ptr, ((unsigned) size)); |
| 204 | if (result == ((long *) NULL)) | 197 | if (result == ((long *) NULL)) |
| @@ -209,8 +202,7 @@ xrealloc (ptr, size) | |||
| 209 | /* Initialize a linebuffer for use */ | 202 | /* Initialize a linebuffer for use */ |
| 210 | 203 | ||
| 211 | void | 204 | void |
| 212 | init_linebuffer (linebuffer) | 205 | init_linebuffer (struct linebuffer *linebuffer) |
| 213 | struct linebuffer *linebuffer; | ||
| 214 | { | 206 | { |
| 215 | linebuffer->size = INITIAL_LINE_SIZE; | 207 | linebuffer->size = INITIAL_LINE_SIZE; |
| 216 | linebuffer->buffer = ((char *) xmalloc (INITIAL_LINE_SIZE)); | 208 | linebuffer->buffer = ((char *) xmalloc (INITIAL_LINE_SIZE)); |
| @@ -220,9 +212,7 @@ init_linebuffer (linebuffer) | |||
| 220 | Return the length of the line. */ | 212 | Return the length of the line. */ |
| 221 | 213 | ||
| 222 | long | 214 | long |
| 223 | readline (linebuffer, stream) | 215 | readline (struct linebuffer *linebuffer, FILE *stream) |
| 224 | struct linebuffer *linebuffer; | ||
| 225 | FILE *stream; | ||
| 226 | { | 216 | { |
| 227 | char *buffer = linebuffer->buffer; | 217 | char *buffer = linebuffer->buffer; |
| 228 | char *p = linebuffer->buffer; | 218 | char *p = linebuffer->buffer; |
| @@ -257,9 +247,7 @@ readline (linebuffer, stream) | |||
| 257 | If there is no keyword, return NULL and don't alter *REST. */ | 247 | If there is no keyword, return NULL and don't alter *REST. */ |
| 258 | 248 | ||
| 259 | char * | 249 | char * |
| 260 | get_keyword (field, rest) | 250 | get_keyword (register char *field, char **rest) |
| 261 | register char *field; | ||
| 262 | char **rest; | ||
| 263 | { | 251 | { |
| 264 | static char keyword[KEYWORD_SIZE]; | 252 | static char keyword[KEYWORD_SIZE]; |
| 265 | register char *ptr; | 253 | register char *ptr; |
| @@ -284,8 +272,7 @@ get_keyword (field, rest) | |||
| 284 | /* Nonzero if the string FIELD starts with a colon-terminated keyword. */ | 272 | /* Nonzero if the string FIELD starts with a colon-terminated keyword. */ |
| 285 | 273 | ||
| 286 | boolean | 274 | boolean |
| 287 | has_keyword (field) | 275 | has_keyword (char *field) |
| 288 | char *field; | ||
| 289 | { | 276 | { |
| 290 | char *ignored; | 277 | char *ignored; |
| 291 | return (get_keyword (field, &ignored) != ((char *) NULL)); | 278 | return (get_keyword (field, &ignored) != ((char *) NULL)); |
| @@ -302,9 +289,7 @@ has_keyword (field) | |||
| 302 | the caller has to make it big enough. */ | 289 | the caller has to make it big enough. */ |
| 303 | 290 | ||
| 304 | char * | 291 | char * |
| 305 | add_field (the_list, field, where) | 292 | add_field (line_list the_list, register char *field, register char *where) |
| 306 | line_list the_list; | ||
| 307 | register char *field, *where; | ||
| 308 | { | 293 | { |
| 309 | register char c; | 294 | register char c; |
| 310 | while (true) | 295 | while (true) |
| @@ -360,7 +345,7 @@ add_field (the_list, field, where) | |||
| 360 | } | 345 | } |
| 361 | 346 | ||
| 362 | line_list | 347 | line_list |
| 363 | make_file_preface () | 348 | make_file_preface (void) |
| 364 | { | 349 | { |
| 365 | char *the_string, *temp; | 350 | char *the_string, *temp; |
| 366 | long idiotic_interface; | 351 | long idiotic_interface; |
| @@ -404,9 +389,7 @@ make_file_preface () | |||
| 404 | } | 389 | } |
| 405 | 390 | ||
| 406 | void | 391 | void |
| 407 | write_line_list (the_list, the_stream) | 392 | write_line_list (register line_list the_list, FILE *the_stream) |
| 408 | register line_list the_list; | ||
| 409 | FILE *the_stream; | ||
| 410 | { | 393 | { |
| 411 | for ( ; | 394 | for ( ; |
| 412 | the_list != ((line_list) NULL) ; | 395 | the_list != ((line_list) NULL) ; |
| @@ -419,7 +402,7 @@ write_line_list (the_list, the_stream) | |||
| 419 | } | 402 | } |
| 420 | 403 | ||
| 421 | int | 404 | int |
| 422 | close_the_streams () | 405 | close_the_streams (void) |
| 423 | { | 406 | { |
| 424 | register stream_list rem; | 407 | register stream_list rem; |
| 425 | for (rem = the_streams; | 408 | for (rem = the_streams; |
| @@ -432,9 +415,7 @@ close_the_streams () | |||
| 432 | } | 415 | } |
| 433 | 416 | ||
| 434 | void | 417 | void |
| 435 | add_a_stream (the_stream, closing_action) | 418 | add_a_stream (FILE *the_stream, int (*closing_action) (FILE *)) |
| 436 | FILE *the_stream; | ||
| 437 | int (*closing_action)(); | ||
| 438 | { | 419 | { |
| 439 | stream_list old = the_streams; | 420 | stream_list old = the_streams; |
| 440 | the_streams = new_stream (); | 421 | the_streams = new_stream (); |
| @@ -445,8 +426,7 @@ add_a_stream (the_stream, closing_action) | |||
| 445 | } | 426 | } |
| 446 | 427 | ||
| 447 | int | 428 | int |
| 448 | my_fclose (the_file) | 429 | my_fclose (FILE *the_file) |
| 449 | FILE *the_file; | ||
| 450 | { | 430 | { |
| 451 | putc ('\n', the_file); | 431 | putc ('\n', the_file); |
| 452 | fflush (the_file); | 432 | fflush (the_file); |
| @@ -454,8 +434,7 @@ my_fclose (the_file) | |||
| 454 | } | 434 | } |
| 455 | 435 | ||
| 456 | boolean | 436 | boolean |
| 457 | open_a_file (name) | 437 | open_a_file (char *name) |
| 458 | char *name; | ||
| 459 | { | 438 | { |
| 460 | FILE *the_stream = fopen (name, "a"); | 439 | FILE *the_stream = fopen (name, "a"); |
| 461 | if (the_stream != ((FILE *) NULL)) | 440 | if (the_stream != ((FILE *) NULL)) |
| @@ -470,8 +449,7 @@ open_a_file (name) | |||
| 470 | } | 449 | } |
| 471 | 450 | ||
| 472 | void | 451 | void |
| 473 | put_string (s) | 452 | put_string (char *s) |
| 474 | char *s; | ||
| 475 | { | 453 | { |
| 476 | register stream_list rem; | 454 | register stream_list rem; |
| 477 | for (rem = the_streams; | 455 | for (rem = the_streams; |
| @@ -482,21 +460,20 @@ put_string (s) | |||
| 482 | } | 460 | } |
| 483 | 461 | ||
| 484 | void | 462 | void |
| 485 | put_line (string) | 463 | put_line (const char *string) |
| 486 | char *string; | ||
| 487 | { | 464 | { |
| 488 | register stream_list rem; | 465 | register stream_list rem; |
| 489 | for (rem = the_streams; | 466 | for (rem = the_streams; |
| 490 | rem != ((stream_list) NULL); | 467 | rem != ((stream_list) NULL); |
| 491 | rem = rem->rest_streams) | 468 | rem = rem->rest_streams) |
| 492 | { | 469 | { |
| 493 | char *s = string; | 470 | const char *s = string; |
| 494 | int column = 0; | 471 | int column = 0; |
| 495 | 472 | ||
| 496 | /* Divide STRING into lines. */ | 473 | /* Divide STRING into lines. */ |
| 497 | while (*s != 0) | 474 | while (*s != 0) |
| 498 | { | 475 | { |
| 499 | char *breakpos; | 476 | const char *breakpos; |
| 500 | 477 | ||
| 501 | /* Find the last char that fits. */ | 478 | /* Find the last char that fits. */ |
| 502 | for (breakpos = s; *breakpos && column < 78; ++breakpos) | 479 | for (breakpos = s; *breakpos && column < 78; ++breakpos) |
| @@ -543,9 +520,7 @@ put_line (string) | |||
| 543 | Call open_a_file for each file. */ | 520 | Call open_a_file for each file. */ |
| 544 | 521 | ||
| 545 | void | 522 | void |
| 546 | setup_files (the_list, field) | 523 | setup_files (register line_list the_list, register char *field) |
| 547 | register line_list the_list; | ||
| 548 | register char *field; | ||
| 549 | { | 524 | { |
| 550 | register char *start; | 525 | register char *start; |
| 551 | register char c; | 526 | register char c; |
| @@ -581,8 +556,7 @@ setup_files (the_list, field) | |||
| 581 | The result says how big to make the buffer to pass to parse_header. */ | 556 | The result says how big to make the buffer to pass to parse_header. */ |
| 582 | 557 | ||
| 583 | int | 558 | int |
| 584 | args_size (the_header) | 559 | args_size (header the_header) |
| 585 | header the_header; | ||
| 586 | { | 560 | { |
| 587 | register header old = the_header; | 561 | register header old = the_header; |
| 588 | register line_list rem; | 562 | register line_list rem; |
| @@ -613,9 +587,7 @@ args_size (the_header) | |||
| 613 | Also, if the header has any FCC fields, call setup_files for each one. */ | 587 | Also, if the header has any FCC fields, call setup_files for each one. */ |
| 614 | 588 | ||
| 615 | void | 589 | void |
| 616 | parse_header (the_header, where) | 590 | parse_header (header the_header, register char *where) |
| 617 | header the_header; | ||
| 618 | register char *where; | ||
| 619 | { | 591 | { |
| 620 | register header old = the_header; | 592 | register header old = the_header; |
| 621 | do | 593 | do |
| @@ -647,7 +619,7 @@ parse_header (the_header, where) | |||
| 647 | Continuation lines are grouped in the headers they continue. */ | 619 | Continuation lines are grouped in the headers they continue. */ |
| 648 | 620 | ||
| 649 | header | 621 | header |
| 650 | read_header () | 622 | read_header (void) |
| 651 | { | 623 | { |
| 652 | register header the_header = ((header) NULL); | 624 | register header the_header = ((header) NULL); |
| 653 | register line_list *next_line = ((line_list *) NULL); | 625 | register line_list *next_line = ((line_list *) NULL); |
| @@ -701,8 +673,7 @@ read_header () | |||
| 701 | } | 673 | } |
| 702 | 674 | ||
| 703 | void | 675 | void |
| 704 | write_header (the_header) | 676 | write_header (header the_header) |
| 705 | header the_header; | ||
| 706 | { | 677 | { |
| 707 | register header old = the_header; | 678 | register header old = the_header; |
| 708 | do | 679 | do |
| @@ -719,20 +690,16 @@ write_header (the_header) | |||
| 719 | } | 690 | } |
| 720 | 691 | ||
| 721 | int | 692 | int |
| 722 | main (argc, argv) | 693 | main (int argc, char **argv) |
| 723 | int argc; | ||
| 724 | char **argv; | ||
| 725 | { | 694 | { |
| 726 | char *command_line; | 695 | char *command_line; |
| 727 | header the_header; | 696 | header the_header; |
| 728 | long name_length; | 697 | long name_length; |
| 729 | char *mail_program_name; | 698 | const char *mail_program_name; |
| 730 | char buf[BUFLEN + 1]; | 699 | char buf[BUFLEN + 1]; |
| 731 | register int size; | 700 | register int size; |
| 732 | FILE *the_pipe; | 701 | FILE *the_pipe; |
| 733 | 702 | ||
| 734 | extern char *getenv (); | ||
| 735 | |||
| 736 | mail_program_name = getenv ("FAKEMAILER"); | 703 | mail_program_name = getenv ("FAKEMAILER"); |
| 737 | if (!(mail_program_name && *mail_program_name)) | 704 | if (!(mail_program_name && *mail_program_name)) |
| 738 | mail_program_name = MAIL_PROGRAM_NAME; | 705 | mail_program_name = MAIL_PROGRAM_NAME; |
diff --git a/lib-src/hexl.c b/lib-src/hexl.c index 91fadd81f5a..b31ab812534 100644 --- a/lib-src/hexl.c +++ b/lib-src/hexl.c | |||
| @@ -49,12 +49,10 @@ int base = DEFAULT_BASE, un_flag = FALSE, iso_flag = FALSE, endian = 1; | |||
| 49 | int group_by = DEFAULT_GROUPING; | 49 | int group_by = DEFAULT_GROUPING; |
| 50 | char *progname; | 50 | char *progname; |
| 51 | 51 | ||
| 52 | void usage(); | 52 | void usage(void) NO_RETURN; |
| 53 | 53 | ||
| 54 | int | 54 | int |
| 55 | main (argc, argv) | 55 | main (int argc, char **argv) |
| 56 | int argc; | ||
| 57 | char *argv[]; | ||
| 58 | { | 56 | { |
| 59 | register long address; | 57 | register long address; |
| 60 | char string[18]; | 58 | char string[18]; |
| @@ -278,7 +276,7 @@ main (argc, argv) | |||
| 278 | } | 276 | } |
| 279 | 277 | ||
| 280 | void | 278 | void |
| 281 | usage () | 279 | usage (void) |
| 282 | { | 280 | { |
| 283 | fprintf (stderr, "usage: %s [-de] [-iso]\n", progname); | 281 | fprintf (stderr, "usage: %s [-de] [-iso]\n", progname); |
| 284 | exit (EXIT_FAILURE); | 282 | exit (EXIT_FAILURE); |
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index eb15342ca5b..4824731672b 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c | |||
| @@ -67,9 +67,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 67 | #define IS_DIRECTORY_SEP(_c_) ((_c_) == DIRECTORY_SEP) | 67 | #define IS_DIRECTORY_SEP(_c_) ((_c_) == DIRECTORY_SEP) |
| 68 | #endif | 68 | #endif |
| 69 | 69 | ||
| 70 | int scan_file (); | 70 | int scan_file (char *filename); |
| 71 | int scan_lisp_file (); | 71 | int scan_lisp_file (const char *filename, const char *mode); |
| 72 | int scan_c_file (); | 72 | int scan_c_file (char *filename, const char *mode); |
| 73 | void fatal (const char *s1, const char *s2) NO_RETURN; | ||
| 73 | 74 | ||
| 74 | #ifdef MSDOS | 75 | #ifdef MSDOS |
| 75 | /* 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 |
| @@ -91,8 +92,7 @@ char *progname; | |||
| 91 | 92 | ||
| 92 | /* VARARGS1 */ | 93 | /* VARARGS1 */ |
| 93 | void | 94 | void |
| 94 | error (s1, s2) | 95 | error (const char *s1, const char *s2) |
| 95 | char *s1, *s2; | ||
| 96 | { | 96 | { |
| 97 | fprintf (stderr, "%s: ", progname); | 97 | fprintf (stderr, "%s: ", progname); |
| 98 | fprintf (stderr, s1, s2); | 98 | fprintf (stderr, s1, s2); |
| @@ -103,8 +103,7 @@ error (s1, s2) | |||
| 103 | 103 | ||
| 104 | /* VARARGS1 */ | 104 | /* VARARGS1 */ |
| 105 | void | 105 | void |
| 106 | fatal (s1, s2) | 106 | fatal (const char *s1, const char *s2) |
| 107 | char *s1, *s2; | ||
| 108 | { | 107 | { |
| 109 | error (s1, s2); | 108 | error (s1, s2); |
| 110 | exit (EXIT_FAILURE); | 109 | exit (EXIT_FAILURE); |
| @@ -113,8 +112,7 @@ fatal (s1, s2) | |||
| 113 | /* Like malloc but get fatal error if memory is exhausted. */ | 112 | /* Like malloc but get fatal error if memory is exhausted. */ |
| 114 | 113 | ||
| 115 | void * | 114 | void * |
| 116 | xmalloc (size) | 115 | xmalloc (unsigned int size) |
| 117 | unsigned int size; | ||
| 118 | { | 116 | { |
| 119 | void *result = (void *) malloc (size); | 117 | void *result = (void *) malloc (size); |
| 120 | if (result == NULL) | 118 | if (result == NULL) |
| @@ -123,9 +121,7 @@ xmalloc (size) | |||
| 123 | } | 121 | } |
| 124 | 122 | ||
| 125 | int | 123 | int |
| 126 | main (argc, argv) | 124 | main (int argc, char **argv) |
| 127 | int argc; | ||
| 128 | char **argv; | ||
| 129 | { | 125 | { |
| 130 | int i; | 126 | int i; |
| 131 | int err_count = 0; | 127 | int err_count = 0; |
| @@ -187,8 +183,7 @@ main (argc, argv) | |||
| 187 | 183 | ||
| 188 | /* Add a source file name boundary marker in the output file. */ | 184 | /* Add a source file name boundary marker in the output file. */ |
| 189 | void | 185 | void |
| 190 | put_filename (filename) | 186 | put_filename (char *filename) |
| 191 | char *filename; | ||
| 192 | { | 187 | { |
| 193 | char *tmp; | 188 | char *tmp; |
| 194 | 189 | ||
| @@ -207,8 +202,7 @@ put_filename (filename) | |||
| 207 | /* Return 1 if file is not found, 0 if it is found. */ | 202 | /* Return 1 if file is not found, 0 if it is found. */ |
| 208 | 203 | ||
| 209 | int | 204 | int |
| 210 | scan_file (filename) | 205 | scan_file (char *filename) |
| 211 | char *filename; | ||
| 212 | { | 206 | { |
| 213 | int len = strlen (filename); | 207 | int len = strlen (filename); |
| 214 | 208 | ||
| @@ -239,10 +233,10 @@ struct rcsoc_state | |||
| 239 | 233 | ||
| 240 | /* 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 |
| 241 | not copied, and SAW_KEYWORD is set to true. */ | 235 | not copied, and SAW_KEYWORD is set to true. */ |
| 242 | char *keyword; | 236 | const char *keyword; |
| 243 | /* 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 |
| 244 | the input stream. */ | 238 | the input stream. */ |
| 245 | char *cur_keyword_ptr; | 239 | const char *cur_keyword_ptr; |
| 246 | /* Set to true if we saw an occurrence of KEYWORD. */ | 240 | /* Set to true if we saw an occurrence of KEYWORD. */ |
| 247 | int saw_keyword; | 241 | int saw_keyword; |
| 248 | }; | 242 | }; |
| @@ -251,9 +245,7 @@ struct rcsoc_state | |||
| 251 | spaces are output first. */ | 245 | spaces are output first. */ |
| 252 | 246 | ||
| 253 | static INLINE void | 247 | static INLINE void |
| 254 | put_char (ch, state) | 248 | put_char (int ch, struct rcsoc_state *state) |
| 255 | int ch; | ||
| 256 | struct rcsoc_state *state; | ||
| 257 | { | 249 | { |
| 258 | int out_ch; | 250 | int out_ch; |
| 259 | do | 251 | do |
| @@ -286,9 +278,7 @@ put_char (ch, state) | |||
| 286 | keyword, but were in fact not. */ | 278 | keyword, but were in fact not. */ |
| 287 | 279 | ||
| 288 | static void | 280 | static void |
| 289 | scan_keyword_or_put_char (ch, state) | 281 | scan_keyword_or_put_char (int ch, struct rcsoc_state *state) |
| 290 | int ch; | ||
| 291 | struct rcsoc_state *state; | ||
| 292 | { | 282 | { |
| 293 | if (state->keyword | 283 | if (state->keyword |
| 294 | && *state->cur_keyword_ptr == ch | 284 | && *state->cur_keyword_ptr == ch |
| @@ -336,7 +326,7 @@ scan_keyword_or_put_char (ch, state) | |||
| 336 | keyword, but it was a false alarm. Output the | 326 | keyword, but it was a false alarm. Output the |
| 337 | part we scanned. */ | 327 | part we scanned. */ |
| 338 | { | 328 | { |
| 339 | char *p; | 329 | const char *p; |
| 340 | 330 | ||
| 341 | for (p = state->keyword; p < state->cur_keyword_ptr; p++) | 331 | for (p = state->keyword; p < state->cur_keyword_ptr; p++) |
| 342 | put_char (*p, state); | 332 | put_char (*p, state); |
| @@ -359,11 +349,7 @@ scan_keyword_or_put_char (ch, state) | |||
| 359 | true if any were encountered. */ | 349 | true if any were encountered. */ |
| 360 | 350 | ||
| 361 | int | 351 | int |
| 362 | read_c_string_or_comment (infile, printflag, comment, saw_usage) | 352 | read_c_string_or_comment (FILE *infile, int printflag, int comment, int *saw_usage) |
| 363 | FILE *infile; | ||
| 364 | int printflag; | ||
| 365 | int *saw_usage; | ||
| 366 | int comment; | ||
| 367 | { | 353 | { |
| 368 | register int c; | 354 | register int c; |
| 369 | struct rcsoc_state state; | 355 | struct rcsoc_state state; |
| @@ -451,15 +437,12 @@ read_c_string_or_comment (infile, printflag, comment, saw_usage) | |||
| 451 | MINARGS and MAXARGS are the minimum and maximum number of arguments. */ | 437 | MINARGS and MAXARGS are the minimum and maximum number of arguments. */ |
| 452 | 438 | ||
| 453 | void | 439 | void |
| 454 | write_c_args (out, func, buf, minargs, maxargs) | 440 | write_c_args (FILE *out, char *func, char *buf, int minargs, int maxargs) |
| 455 | FILE *out; | ||
| 456 | char *func, *buf; | ||
| 457 | int minargs, maxargs; | ||
| 458 | { | 441 | { |
| 459 | register char *p; | 442 | register char *p; |
| 460 | int in_ident = 0; | 443 | int in_ident = 0; |
| 461 | int just_spaced = 0; | 444 | char *ident_start; |
| 462 | int need_space = 1; | 445 | int ident_length = 0; |
| 463 | 446 | ||
| 464 | fprintf (out, "(fn"); | 447 | fprintf (out, "(fn"); |
| 465 | 448 | ||
| @@ -469,9 +452,8 @@ write_c_args (out, func, buf, minargs, maxargs) | |||
| 469 | for (p = buf; *p; p++) | 452 | for (p = buf; *p; p++) |
| 470 | { | 453 | { |
| 471 | char c = *p; | 454 | char c = *p; |
| 472 | int ident_start = 0; | ||
| 473 | 455 | ||
| 474 | /* Notice when we start printing a new identifier. */ | 456 | /* Notice when a new identifier starts. */ |
| 475 | if ((('A' <= c && c <= 'Z') | 457 | if ((('A' <= c && c <= 'Z') |
| 476 | || ('a' <= c && c <= 'z') | 458 | || ('a' <= c && c <= 'z') |
| 477 | || ('0' <= c && c <= '9') | 459 | || ('0' <= c && c <= '9') |
| @@ -481,55 +463,56 @@ write_c_args (out, func, buf, minargs, maxargs) | |||
| 481 | if (!in_ident) | 463 | if (!in_ident) |
| 482 | { | 464 | { |
| 483 | in_ident = 1; | 465 | in_ident = 1; |
| 484 | ident_start = 1; | 466 | ident_start = p; |
| 485 | |||
| 486 | if (need_space) | ||
| 487 | putc (' ', out); | ||
| 488 | |||
| 489 | if (minargs == 0 && maxargs > 0) | ||
| 490 | fprintf (out, "&optional "); | ||
| 491 | just_spaced = 1; | ||
| 492 | |||
| 493 | minargs--; | ||
| 494 | maxargs--; | ||
| 495 | } | 467 | } |
| 496 | else | 468 | else |
| 497 | in_ident = 0; | 469 | { |
| 470 | in_ident = 0; | ||
| 471 | ident_length = p - ident_start; | ||
| 472 | } | ||
| 498 | } | 473 | } |
| 499 | 474 | ||
| 500 | /* Print the C argument list as it would appear in lisp: | 475 | /* Found the end of an argument, write out the last seen |
| 501 | print underscores as hyphens, and print commas and newlines | 476 | identifier. */ |
| 502 | as spaces. Collapse adjacent spaces into one. */ | 477 | if (c == ',' || c == ')') |
| 503 | if (c == '_') | ||
| 504 | c = '-'; | ||
| 505 | else if (c == ',' || c == '\n') | ||
| 506 | c = ' '; | ||
| 507 | |||
| 508 | /* In C code, `default' is a reserved word, so we spell it | ||
| 509 | `defalt'; unmangle that here. */ | ||
| 510 | if (ident_start | ||
| 511 | && strncmp (p, "defalt", 6) == 0 | ||
| 512 | && ! (('A' <= p[6] && p[6] <= 'Z') | ||
| 513 | || ('a' <= p[6] && p[6] <= 'z') | ||
| 514 | || ('0' <= p[6] && p[6] <= '9') | ||
| 515 | || p[6] == '_')) | ||
| 516 | { | 478 | { |
| 517 | fprintf (out, "DEFAULT"); | 479 | if (ident_length == 0) |
| 518 | p += 5; | 480 | { |
| 519 | in_ident = 0; | 481 | error ("empty arg list for `%s' should be (void), not ()", func); |
| 520 | just_spaced = 0; | 482 | continue; |
| 521 | } | 483 | } |
| 522 | else if (c != ' ' || !just_spaced) | 484 | |
| 523 | { | 485 | if (strncmp (ident_start, "void", ident_length) == 0) |
| 524 | if (c >= 'a' && c <= 'z') | 486 | continue; |
| 525 | /* Upcase the letter. */ | 487 | |
| 526 | c += 'A' - 'a'; | 488 | putc (' ', out); |
| 527 | putc (c, out); | 489 | |
| 528 | } | 490 | if (minargs == 0 && maxargs > 0) |
| 491 | fprintf (out, "&optional "); | ||
| 529 | 492 | ||
| 530 | just_spaced = c == ' '; | 493 | minargs--; |
| 531 | need_space = 0; | 494 | maxargs--; |
| 495 | |||
| 496 | /* In C code, `default' is a reserved word, so we spell it | ||
| 497 | `defalt'; unmangle that here. */ | ||
| 498 | if (ident_length == 6 && strncmp (ident_start, "defalt", 6) == 0) | ||
| 499 | fprintf (out, "DEFAULT"); | ||
| 500 | else | ||
| 501 | while (ident_length-- > 0) | ||
| 502 | { | ||
| 503 | c = *ident_start++; | ||
| 504 | if (c >= 'a' && c <= 'z') | ||
| 505 | /* Upcase the letter. */ | ||
| 506 | c += 'A' - 'a'; | ||
| 507 | else if (c == '_') | ||
| 508 | /* Print underscore as hyphen. */ | ||
| 509 | c = '-'; | ||
| 510 | putc (c, out); | ||
| 511 | } | ||
| 512 | } | ||
| 532 | } | 513 | } |
| 514 | |||
| 515 | putc (')', out); | ||
| 533 | } | 516 | } |
| 534 | 517 | ||
| 535 | /* Read through a c file. If a .o file is named, | 518 | /* Read through a c file. If a .o file is named, |
| @@ -538,8 +521,7 @@ write_c_args (out, func, buf, minargs, maxargs) | |||
| 538 | Accepts any word starting DEF... so it finds DEFSIMPLE and DEFPRED. */ | 521 | Accepts any word starting DEF... so it finds DEFSIMPLE and DEFPRED. */ |
| 539 | 522 | ||
| 540 | int | 523 | int |
| 541 | scan_c_file (filename, mode) | 524 | scan_c_file (char *filename, const char *mode) |
| 542 | char *filename, *mode; | ||
| 543 | { | 525 | { |
| 544 | FILE *infile; | 526 | FILE *infile; |
| 545 | register int c; | 527 | register int c; |
| @@ -815,8 +797,7 @@ scan_c_file (filename, mode) | |||
| 815 | */ | 797 | */ |
| 816 | 798 | ||
| 817 | void | 799 | void |
| 818 | skip_white (infile) | 800 | skip_white (FILE *infile) |
| 819 | FILE *infile; | ||
| 820 | { | 801 | { |
| 821 | char c = ' '; | 802 | char c = ' '; |
| 822 | while (c == ' ' || c == '\t' || c == '\n' || c == '\r') | 803 | while (c == ' ' || c == '\t' || c == '\n' || c == '\r') |
| @@ -825,9 +806,7 @@ skip_white (infile) | |||
| 825 | } | 806 | } |
| 826 | 807 | ||
| 827 | void | 808 | void |
| 828 | read_lisp_symbol (infile, buffer) | 809 | read_lisp_symbol (FILE *infile, char *buffer) |
| 829 | FILE *infile; | ||
| 830 | char *buffer; | ||
| 831 | { | 810 | { |
| 832 | char c; | 811 | char c; |
| 833 | char *fillp = buffer; | 812 | char *fillp = buffer; |
| @@ -855,8 +834,7 @@ read_lisp_symbol (infile, buffer) | |||
| 855 | } | 834 | } |
| 856 | 835 | ||
| 857 | int | 836 | int |
| 858 | scan_lisp_file (filename, mode) | 837 | scan_lisp_file (const char *filename, const char *mode) |
| 859 | char *filename, *mode; | ||
| 860 | { | 838 | { |
| 861 | FILE *infile; | 839 | FILE *infile; |
| 862 | register int c; | 840 | register int c; |
diff --git a/lib-src/makefile.w32-in b/lib-src/makefile.w32-in index cad3b838208..72a04ecff89 100644 --- a/lib-src/makefile.w32-in +++ b/lib-src/makefile.w32-in | |||
| @@ -143,11 +143,11 @@ $(BLD)/ctags.$(O): ctags.c | |||
| 143 | # | 143 | # |
| 144 | obj = dosfns.o msdos.o \ | 144 | obj = dosfns.o msdos.o \ |
| 145 | xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \ | 145 | xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \ |
| 146 | fontset.o \ | 146 | fontset.o menu.o \ |
| 147 | w32.o w32console.o w32fns.o w32heap.o w32inevt.o \ | 147 | w32.o w32console.o w32fns.o w32heap.o w32inevt.o \ |
| 148 | w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o \ | 148 | w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o \ |
| 149 | font.o w32font.o \ | 149 | font.o w32font.o w32uniscribe.o \ |
| 150 | dispnew.o frame.o scroll.o xdisp.o window.o \ | 150 | dispnew.o frame.o scroll.o xdisp.o window.o bidi.o \ |
| 151 | charset.o coding.o category.o ccl.o character.o chartab.o \ | 151 | charset.o coding.o category.o ccl.o character.o chartab.o \ |
| 152 | cm.o term.o terminal.o xfaces.o \ | 152 | cm.o term.o terminal.o xfaces.o \ |
| 153 | emacs.o keyboard.o macros.o keymap.o sysdep.o \ | 153 | emacs.o keyboard.o macros.o keymap.o sysdep.o \ |
| @@ -157,7 +157,7 @@ obj = dosfns.o msdos.o \ | |||
| 157 | alloc.o data.o doc.o editfns.o callint.o \ | 157 | alloc.o data.o doc.o editfns.o callint.o \ |
| 158 | eval.o floatfns.o fns.o print.o lread.o \ | 158 | eval.o floatfns.o fns.o print.o lread.o \ |
| 159 | syntax.o bytecode.o \ | 159 | syntax.o bytecode.o \ |
| 160 | process.o callproc.o \ | 160 | process.o callproc.o unexw32.o \ |
| 161 | region-cache.o sound.o atimer.o \ | 161 | region-cache.o sound.o atimer.o \ |
| 162 | doprnt.o strftime.o intervals.o textprop.o composite.o md5.o | 162 | doprnt.o strftime.o intervals.o textprop.o composite.o md5.o |
| 163 | 163 | ||
| @@ -247,7 +247,7 @@ lisp2 = \ | |||
| 247 | $(lispsource)language/slovak.el \ | 247 | $(lispsource)language/slovak.el \ |
| 248 | $(lispsource)language/romanian.el \ | 248 | $(lispsource)language/romanian.el \ |
| 249 | $(lispsource)language/greek.el \ | 249 | $(lispsource)language/greek.el \ |
| 250 | $(lispsource)language/hebrew.el \ | 250 | $(lispsource)language/hebrew.elc \ |
| 251 | $(lispsource)language/japanese.el \ | 251 | $(lispsource)language/japanese.el \ |
| 252 | $(lispsource)language/korean.el \ | 252 | $(lispsource)language/korean.el \ |
| 253 | $(lispsource)language/lao.el \ | 253 | $(lispsource)language/lao.el \ |
diff --git a/lib-src/movemail.c b/lib-src/movemail.c index ea307241351..4ccdc93688c 100644 --- a/lib-src/movemail.c +++ b/lib-src/movemail.c | |||
| @@ -69,6 +69,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 69 | #ifdef HAVE_FCNTL_H | 69 | #ifdef HAVE_FCNTL_H |
| 70 | #include <fcntl.h> | 70 | #include <fcntl.h> |
| 71 | #endif | 71 | #endif |
| 72 | #ifdef HAVE_STRING_H | ||
| 73 | #include <string.h> | ||
| 74 | #endif | ||
| 72 | #include "syswait.h" | 75 | #include "syswait.h" |
| 73 | #ifdef MAIL_USE_POP | 76 | #ifdef MAIL_USE_POP |
| 74 | #include "pop.h" | 77 | #include "pop.h" |
| @@ -140,33 +143,29 @@ static char *mail_spool_name (); | |||
| 140 | #endif | 143 | #endif |
| 141 | #endif | 144 | #endif |
| 142 | 145 | ||
| 143 | char *strerror (); | 146 | #ifndef HAVE_STRERROR |
| 144 | #ifdef HAVE_INDEX | 147 | char *strerror (int); |
| 145 | extern char *index __P ((const char *, int)); | ||
| 146 | #endif | ||
| 147 | #ifdef HAVE_RINDEX | ||
| 148 | extern char *rindex __P((const char *, int)); | ||
| 149 | #endif | 148 | #endif |
| 150 | 149 | ||
| 151 | void fatal (); | 150 | static void fatal (const char *s1, const char *s2, const char *s3) NO_RETURN; |
| 152 | void error (); | 151 | static void error (const char *s1, const char *s2, const char *s3); |
| 153 | void pfatal_with_name (); | 152 | static void pfatal_with_name (char *name) NO_RETURN; |
| 154 | void pfatal_and_delete (); | 153 | static void pfatal_and_delete (char *name) NO_RETURN; |
| 155 | char *concat (); | 154 | static char *concat (const char *s1, const char *s2, const char *s3); |
| 156 | long *xmalloc (); | 155 | static long *xmalloc (unsigned int size); |
| 157 | int popmail (); | 156 | #ifdef MAIL_USE_POP |
| 158 | int pop_retr (); | 157 | static int popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order); |
| 159 | int mbx_write (); | 158 | static int pop_retr (popserver server, int msgno, FILE *arg); |
| 160 | int mbx_delimit_begin (); | 159 | static int mbx_write (char *line, int len, FILE *mbf); |
| 161 | int mbx_delimit_end (); | 160 | static int mbx_delimit_begin (FILE *mbf); |
| 161 | static int mbx_delimit_end (FILE *mbf); | ||
| 162 | #endif | ||
| 162 | 163 | ||
| 163 | /* Nonzero means this is name of a lock file to delete on fatal error. */ | 164 | /* Nonzero means this is name of a lock file to delete on fatal error. */ |
| 164 | char *delete_lockname; | 165 | char *delete_lockname; |
| 165 | 166 | ||
| 166 | int | 167 | int |
| 167 | main (argc, argv) | 168 | main (int argc, char **argv) |
| 168 | int argc; | ||
| 169 | char **argv; | ||
| 170 | { | 169 | { |
| 171 | char *inname, *outname; | 170 | char *inname, *outname; |
| 172 | int indesc, outdesc; | 171 | int indesc, outdesc; |
| @@ -559,7 +558,7 @@ mail_spool_name (inname) | |||
| 559 | char *indir, *fname; | 558 | char *indir, *fname; |
| 560 | int status; | 559 | int status; |
| 561 | 560 | ||
| 562 | if (! (fname = rindex (inname, '/'))) | 561 | if (! (fname = strrchr (inname, '/'))) |
| 563 | return NULL; | 562 | return NULL; |
| 564 | 563 | ||
| 565 | fname++; | 564 | fname++; |
| @@ -589,9 +588,8 @@ mail_spool_name (inname) | |||
| 589 | 588 | ||
| 590 | /* Print error message and exit. */ | 589 | /* Print error message and exit. */ |
| 591 | 590 | ||
| 592 | void | 591 | static void |
| 593 | fatal (s1, s2, s3) | 592 | fatal (const char *s1, const char *s2, const char *s3) |
| 594 | char *s1, *s2, *s3; | ||
| 595 | { | 593 | { |
| 596 | if (delete_lockname) | 594 | if (delete_lockname) |
| 597 | unlink (delete_lockname); | 595 | unlink (delete_lockname); |
| @@ -602,9 +600,8 @@ fatal (s1, s2, s3) | |||
| 602 | /* Print error message. `s1' is printf control string, `s2' and `s3' | 600 | /* Print error message. `s1' is printf control string, `s2' and `s3' |
| 603 | are args for it or null. */ | 601 | are args for it or null. */ |
| 604 | 602 | ||
| 605 | void | 603 | static void |
| 606 | error (s1, s2, s3) | 604 | error (const char *s1, const char *s2, const char *s3) |
| 607 | char *s1, *s2, *s3; | ||
| 608 | { | 605 | { |
| 609 | fprintf (stderr, "movemail: "); | 606 | fprintf (stderr, "movemail: "); |
| 610 | if (s3) | 607 | if (s3) |
| @@ -612,20 +609,18 @@ error (s1, s2, s3) | |||
| 612 | else if (s2) | 609 | else if (s2) |
| 613 | fprintf (stderr, s1, s2); | 610 | fprintf (stderr, s1, s2); |
| 614 | else | 611 | else |
| 615 | fprintf (stderr, s1); | 612 | fprintf (stderr, "%s", s1); |
| 616 | fprintf (stderr, "\n"); | 613 | fprintf (stderr, "\n"); |
| 617 | } | 614 | } |
| 618 | 615 | ||
| 619 | void | 616 | static void |
| 620 | pfatal_with_name (name) | 617 | pfatal_with_name (char *name) |
| 621 | char *name; | ||
| 622 | { | 618 | { |
| 623 | fatal ("%s for %s", strerror (errno), name); | 619 | fatal ("%s for %s", strerror (errno), name); |
| 624 | } | 620 | } |
| 625 | 621 | ||
| 626 | void | 622 | static void |
| 627 | pfatal_and_delete (name) | 623 | pfatal_and_delete (char *name) |
| 628 | char *name; | ||
| 629 | { | 624 | { |
| 630 | char *s = strerror (errno); | 625 | char *s = strerror (errno); |
| 631 | unlink (name); | 626 | unlink (name); |
| @@ -634,9 +629,8 @@ pfatal_and_delete (name) | |||
| 634 | 629 | ||
| 635 | /* 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. */ |
| 636 | 631 | ||
| 637 | char * | 632 | static char * |
| 638 | concat (s1, s2, s3) | 633 | concat (const char *s1, const char *s2, const char *s3) |
| 639 | char *s1, *s2, *s3; | ||
| 640 | { | 634 | { |
| 641 | int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); | 635 | int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); |
| 642 | char *result = (char *) xmalloc (len1 + len2 + len3 + 1); | 636 | char *result = (char *) xmalloc (len1 + len2 + len3 + 1); |
| @@ -651,9 +645,8 @@ concat (s1, s2, s3) | |||
| 651 | 645 | ||
| 652 | /* Like malloc but get fatal error if memory is exhausted. */ | 646 | /* Like malloc but get fatal error if memory is exhausted. */ |
| 653 | 647 | ||
| 654 | long * | 648 | static long * |
| 655 | xmalloc (size) | 649 | xmalloc (unsigned int size) |
| 656 | unsigned size; | ||
| 657 | { | 650 | { |
| 658 | long *result = (long *) malloc (size); | 651 | long *result = (long *) malloc (size); |
| 659 | if (!result) | 652 | if (!result) |
| @@ -702,25 +695,20 @@ char Errmsg[200]; /* POP errors, at least, can exceed | |||
| 702 | * Return a value suitable for passing to `exit'. | 695 | * Return a value suitable for passing to `exit'. |
| 703 | */ | 696 | */ |
| 704 | 697 | ||
| 705 | int | 698 | static int |
| 706 | popmail (mailbox, outfile, preserve, password, reverse_order) | 699 | popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order) |
| 707 | char *mailbox; | ||
| 708 | char *outfile; | ||
| 709 | int preserve; | ||
| 710 | char *password; | ||
| 711 | int reverse_order; | ||
| 712 | { | 700 | { |
| 713 | int nmsgs, nbytes; | 701 | int nmsgs, nbytes; |
| 714 | register int i; | 702 | register int i; |
| 715 | int mbfi; | 703 | int mbfi; |
| 716 | FILE *mbf; | 704 | FILE *mbf; |
| 717 | char *getenv (); | 705 | char *getenv (const char *); |
| 718 | popserver server; | 706 | popserver server; |
| 719 | int start, end, increment; | 707 | int start, end, increment; |
| 720 | char *user, *hostname; | 708 | char *user, *hostname; |
| 721 | 709 | ||
| 722 | user = mailbox; | 710 | user = mailbox; |
| 723 | if ((hostname = index(mailbox, ':'))) | 711 | if ((hostname = strchr (mailbox, ':'))) |
| 724 | *hostname++ = '\0'; | 712 | *hostname++ = '\0'; |
| 725 | 713 | ||
| 726 | server = pop_open (hostname, user, password, POP_NO_GETPASS); | 714 | server = pop_open (hostname, user, password, POP_NO_GETPASS); |
| @@ -833,13 +821,9 @@ popmail (mailbox, outfile, preserve, password, reverse_order) | |||
| 833 | return EXIT_SUCCESS; | 821 | return EXIT_SUCCESS; |
| 834 | } | 822 | } |
| 835 | 823 | ||
| 836 | int | 824 | static int |
| 837 | pop_retr (server, msgno, arg) | 825 | pop_retr (popserver server, int msgno, FILE *arg) |
| 838 | popserver server; | ||
| 839 | int msgno; | ||
| 840 | FILE *arg; | ||
| 841 | { | 826 | { |
| 842 | extern char *strerror (); | ||
| 843 | char *line; | 827 | char *line; |
| 844 | int ret; | 828 | int ret; |
| 845 | 829 | ||
| @@ -884,11 +868,8 @@ pop_retr (server, msgno, arg) | |||
| 884 | && (a[3] == 'm') \ | 868 | && (a[3] == 'm') \ |
| 885 | && (a[4] == ' ')) | 869 | && (a[4] == ' ')) |
| 886 | 870 | ||
| 887 | int | 871 | static int |
| 888 | mbx_write (line, len, mbf) | 872 | mbx_write (char *line, int len, FILE *mbf) |
| 889 | char *line; | ||
| 890 | int len; | ||
| 891 | FILE *mbf; | ||
| 892 | { | 873 | { |
| 893 | #ifdef MOVEMAIL_QUOTE_POP_FROM_LINES | 874 | #ifdef MOVEMAIL_QUOTE_POP_FROM_LINES |
| 894 | if (IS_FROM_LINE (line)) | 875 | if (IS_FROM_LINE (line)) |
| @@ -911,9 +892,8 @@ mbx_write (line, len, mbf) | |||
| 911 | return (OK); | 892 | return (OK); |
| 912 | } | 893 | } |
| 913 | 894 | ||
| 914 | int | 895 | static int |
| 915 | mbx_delimit_begin (mbf) | 896 | mbx_delimit_begin (FILE *mbf) |
| 916 | FILE *mbf; | ||
| 917 | { | 897 | { |
| 918 | time_t now; | 898 | time_t now; |
| 919 | struct tm *ltime; | 899 | struct tm *ltime; |
| @@ -929,9 +909,8 @@ mbx_delimit_begin (mbf) | |||
| 929 | return (OK); | 909 | return (OK); |
| 930 | } | 910 | } |
| 931 | 911 | ||
| 932 | int | 912 | static int |
| 933 | mbx_delimit_end (mbf) | 913 | mbx_delimit_end (FILE *mbf) |
| 934 | FILE *mbf; | ||
| 935 | { | 914 | { |
| 936 | if (putc ('\n', mbf) == EOF) | 915 | if (putc ('\n', mbf) == EOF) |
| 937 | return (NOTOK); | 916 | return (NOTOK); |
diff --git a/lib-src/ntlib.c b/lib-src/ntlib.c index c815f32d51d..c24b35d9a19 100644 --- a/lib-src/ntlib.c +++ b/lib-src/ntlib.c | |||
| @@ -38,7 +38,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | |||
| 38 | would necessitate including windows.h in the files that used it. | 38 | would necessitate including windows.h in the files that used it. |
| 39 | This is much easier. */ | 39 | This is much easier. */ |
| 40 | void | 40 | void |
| 41 | sleep(unsigned long seconds) | 41 | sleep (unsigned long seconds) |
| 42 | { | 42 | { |
| 43 | Sleep (seconds * 1000); | 43 | Sleep (seconds * 1000); |
| 44 | } | 44 | } |
| @@ -56,7 +56,7 @@ static HANDLE getppid_parent; | |||
| 56 | static int getppid_ppid; | 56 | static int getppid_ppid; |
| 57 | 57 | ||
| 58 | int | 58 | int |
| 59 | getppid(void) | 59 | getppid (void) |
| 60 | { | 60 | { |
| 61 | char *ppid; | 61 | char *ppid; |
| 62 | DWORD result; | 62 | DWORD result; |
| @@ -64,7 +64,7 @@ getppid(void) | |||
| 64 | ppid = getenv ("EM_PARENT_PROCESS_ID"); | 64 | ppid = getenv ("EM_PARENT_PROCESS_ID"); |
| 65 | if (!ppid) | 65 | if (!ppid) |
| 66 | { | 66 | { |
| 67 | printf("no pid.\n"); | 67 | printf ("no pid.\n"); |
| 68 | return 0; | 68 | return 0; |
| 69 | } | 69 | } |
| 70 | else | 70 | else |
| @@ -74,11 +74,11 @@ getppid(void) | |||
| 74 | 74 | ||
| 75 | if (!getppid_parent) | 75 | if (!getppid_parent) |
| 76 | { | 76 | { |
| 77 | getppid_parent = OpenProcess (SYNCHRONIZE, FALSE, atoi(ppid)); | 77 | getppid_parent = OpenProcess (SYNCHRONIZE, FALSE, atoi (ppid)); |
| 78 | if (!getppid_parent) | 78 | if (!getppid_parent) |
| 79 | { | 79 | { |
| 80 | printf ("Failed to open handle to parent process: %d\n", | 80 | printf ("Failed to open handle to parent process: %d\n", |
| 81 | GetLastError()); | 81 | GetLastError ()); |
| 82 | exit (1); | 82 | exit (1); |
| 83 | } | 83 | } |
| 84 | } | 84 | } |
| @@ -94,13 +94,13 @@ getppid(void) | |||
| 94 | return 1; | 94 | return 1; |
| 95 | case WAIT_FAILED: | 95 | case WAIT_FAILED: |
| 96 | default: | 96 | default: |
| 97 | printf ("Checking parent status failed: %d\n", GetLastError()); | 97 | printf ("Checking parent status failed: %d\n", GetLastError ()); |
| 98 | exit (1); | 98 | exit (1); |
| 99 | } | 99 | } |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | char * | 102 | char * |
| 103 | getlogin () | 103 | getlogin (void) |
| 104 | { | 104 | { |
| 105 | static char user_name[256]; | 105 | static char user_name[256]; |
| 106 | DWORD length = sizeof (user_name); | 106 | DWORD length = sizeof (user_name); |
| @@ -120,19 +120,19 @@ cuserid (char * s) | |||
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | unsigned | 122 | unsigned |
| 123 | getuid () | 123 | getuid (void) |
| 124 | { | 124 | { |
| 125 | return 0; | 125 | return 0; |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | unsigned | 128 | unsigned |
| 129 | getgid () | 129 | getgid (void) |
| 130 | { | 130 | { |
| 131 | return 0; | 131 | return 0; |
| 132 | } | 132 | } |
| 133 | 133 | ||
| 134 | unsigned | 134 | unsigned |
| 135 | getegid () | 135 | getegid (void) |
| 136 | { | 136 | { |
| 137 | return 0; | 137 | return 0; |
| 138 | } | 138 | } |
| @@ -219,7 +219,7 @@ sys_ctime (const time_t *t) | |||
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | FILE * | 221 | FILE * |
| 222 | sys_fopen(const char * path, const char * mode) | 222 | sys_fopen (const char * path, const char * mode) |
| 223 | { | 223 | { |
| 224 | return fopen (path, mode); | 224 | return fopen (path, mode); |
| 225 | } | 225 | } |
diff --git a/lib-src/ntlib.h b/lib-src/ntlib.h index fd51269fdfd..4dd6a32ee32 100644 --- a/lib-src/ntlib.h +++ b/lib-src/ntlib.h | |||
| @@ -30,14 +30,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 30 | #ifdef sleep | 30 | #ifdef sleep |
| 31 | #undef sleep | 31 | #undef sleep |
| 32 | #endif | 32 | #endif |
| 33 | void sleep(unsigned long seconds); | 33 | void sleep (unsigned long seconds); |
| 34 | char *getwd (char *dir); | 34 | char *getwd (char *dir); |
| 35 | int getppid(void); | 35 | int getppid (void); |
| 36 | char * getlogin (); | 36 | char * getlogin (void); |
| 37 | char * cuserid (char * s); | 37 | char * cuserid (char * s); |
| 38 | unsigned getuid (); | 38 | unsigned getuid (void); |
| 39 | unsigned getegid (); | 39 | unsigned getegid (void); |
| 40 | unsigned getgid (); | 40 | unsigned getgid (void); |
| 41 | int setuid (unsigned uid); | 41 | int setuid (unsigned uid); |
| 42 | int setegid (unsigned gid); | 42 | int setegid (unsigned gid); |
| 43 | char * getpass (const char * prompt); | 43 | char * getpass (const char * prompt); |
diff --git a/lib-src/pop.c b/lib-src/pop.c index 64488e7e3ea..9eabbd2041e 100644 --- a/lib-src/pop.c +++ b/lib-src/pop.c | |||
| @@ -108,24 +108,16 @@ extern int h_errno; | |||
| 108 | #endif | 108 | #endif |
| 109 | #endif | 109 | #endif |
| 110 | 110 | ||
| 111 | #ifndef __P | 111 | static int socket_connection (char *, int); |
| 112 | # ifdef __STDC__ | 112 | static int pop_getline (popserver, char **); |
| 113 | # define __P(a) a | 113 | static int sendline (popserver, const char *); |
| 114 | # else | 114 | static int fullwrite (int, char *, int); |
| 115 | # define __P(a) () | 115 | static int getok (popserver); |
| 116 | # endif /* __STDC__ */ | ||
| 117 | #endif /* ! __P */ | ||
| 118 | |||
| 119 | static int socket_connection __P((char *, int)); | ||
| 120 | static int pop_getline __P((popserver, char **)); | ||
| 121 | static int sendline __P((popserver, char *)); | ||
| 122 | static int fullwrite __P((int, char *, int)); | ||
| 123 | static int getok __P((popserver)); | ||
| 124 | #if 0 | 116 | #if 0 |
| 125 | static int gettermination __P((popserver)); | 117 | static int gettermination (popserver); |
| 126 | #endif | 118 | #endif |
| 127 | static void pop_trash __P((popserver)); | 119 | static void pop_trash (popserver); |
| 128 | static char *find_crlf __P((char *, int)); | 120 | static char *find_crlf (char *, int); |
| 129 | 121 | ||
| 130 | #define ERROR_MAX 160 /* a pretty arbitrary size, but needs | 122 | #define ERROR_MAX 160 /* a pretty arbitrary size, but needs |
| 131 | to be bigger than the original | 123 | to be bigger than the original |
| @@ -174,11 +166,7 @@ int pop_debug = 0; | |||
| 174 | * explanation of the error. | 166 | * explanation of the error. |
| 175 | */ | 167 | */ |
| 176 | popserver | 168 | popserver |
| 177 | pop_open (host, username, password, flags) | 169 | pop_open (char *host, char *username, char *password, int flags) |
| 178 | char *host; | ||
| 179 | char *username; | ||
| 180 | char *password; | ||
| 181 | int flags; | ||
| 182 | { | 170 | { |
| 183 | int sock; | 171 | int sock; |
| 184 | popserver server; | 172 | popserver server; |
| @@ -345,10 +333,7 @@ pop_open (host, username, password, flags) | |||
| 345 | * connection impossible. | 333 | * connection impossible. |
| 346 | */ | 334 | */ |
| 347 | int | 335 | int |
| 348 | pop_stat (server, count, size) | 336 | pop_stat (popserver server, int *count, int *size) |
| 349 | popserver server; | ||
| 350 | int *count; | ||
| 351 | int *size; | ||
| 352 | { | 337 | { |
| 353 | char *fromserver; | 338 | char *fromserver; |
| 354 | char *end_ptr; | 339 | char *end_ptr; |
| @@ -421,11 +406,7 @@ pop_stat (server, count, size) | |||
| 421 | * connection impossible. | 406 | * connection impossible. |
| 422 | */ | 407 | */ |
| 423 | int | 408 | int |
| 424 | pop_list (server, message, IDs, sizes) | 409 | pop_list (popserver server, int message, int **IDs, int **sizes) |
| 425 | popserver server; | ||
| 426 | int message; | ||
| 427 | int **IDs; | ||
| 428 | int **sizes; | ||
| 429 | { | 410 | { |
| 430 | int how_many, i; | 411 | int how_many, i; |
| 431 | char *fromserver; | 412 | char *fromserver; |
| @@ -484,7 +465,7 @@ pop_list (server, message, IDs, sizes) | |||
| 484 | return (-1); | 465 | return (-1); |
| 485 | } | 466 | } |
| 486 | (*IDs)[0] = atoi (&fromserver[4]); | 467 | (*IDs)[0] = atoi (&fromserver[4]); |
| 487 | fromserver = index (&fromserver[4], ' '); | 468 | fromserver = strchr (&fromserver[4], ' '); |
| 488 | if (! fromserver) | 469 | if (! fromserver) |
| 489 | { | 470 | { |
| 490 | strcpy (pop_error, | 471 | strcpy (pop_error, |
| @@ -515,7 +496,7 @@ pop_list (server, message, IDs, sizes) | |||
| 515 | return (-1); | 496 | return (-1); |
| 516 | } | 497 | } |
| 517 | (*IDs)[i] = atoi (fromserver); | 498 | (*IDs)[i] = atoi (fromserver); |
| 518 | fromserver = index (fromserver, ' '); | 499 | fromserver = strchr (fromserver, ' '); |
| 519 | if (! fromserver) | 500 | if (! fromserver) |
| 520 | { | 501 | { |
| 521 | strcpy (pop_error, | 502 | strcpy (pop_error, |
| @@ -567,11 +548,7 @@ pop_list (server, message, IDs, sizes) | |||
| 567 | * Side effects: May kill connection on error. | 548 | * Side effects: May kill connection on error. |
| 568 | */ | 549 | */ |
| 569 | int | 550 | int |
| 570 | pop_retrieve (server, message, markfrom, msg_buf) | 551 | pop_retrieve (popserver server, int message, int markfrom, char **msg_buf) |
| 571 | popserver server; | ||
| 572 | int message; | ||
| 573 | int markfrom; | ||
| 574 | char **msg_buf; | ||
| 575 | { | 552 | { |
| 576 | int *IDs, *sizes, bufsize, fromcount = 0, cp = 0; | 553 | int *IDs, *sizes, bufsize, fromcount = 0, cp = 0; |
| 577 | char *ptr, *fromserver; | 554 | char *ptr, *fromserver; |
| @@ -635,7 +612,7 @@ pop_retrieve (server, message, markfrom, msg_buf) | |||
| 635 | } | 612 | } |
| 636 | ptr[cp++] = '>'; | 613 | ptr[cp++] = '>'; |
| 637 | } | 614 | } |
| 638 | bcopy (fromserver, &ptr[cp], ret); | 615 | memcpy (&ptr[cp], fromserver, ret); |
| 639 | cp += ret; | 616 | cp += ret; |
| 640 | ptr[cp++] = '\n'; | 617 | ptr[cp++] = '\n'; |
| 641 | } | 618 | } |
| @@ -645,10 +622,7 @@ pop_retrieve (server, message, markfrom, msg_buf) | |||
| 645 | } | 622 | } |
| 646 | 623 | ||
| 647 | int | 624 | int |
| 648 | pop_retrieve_first (server, message, response) | 625 | pop_retrieve_first (popserver server, int message, char **response) |
| 649 | popserver server; | ||
| 650 | int message; | ||
| 651 | char **response; | ||
| 652 | { | 626 | { |
| 653 | sprintf (pop_error, "RETR %d", message); | 627 | sprintf (pop_error, "RETR %d", message); |
| 654 | return (pop_multi_first (server, pop_error, response)); | 628 | return (pop_multi_first (server, pop_error, response)); |
| @@ -663,25 +637,19 @@ pop_retrieve_first (server, message, response) | |||
| 663 | */ | 637 | */ |
| 664 | 638 | ||
| 665 | int | 639 | int |
| 666 | pop_retrieve_next (server, line) | 640 | pop_retrieve_next (popserver server, char **line) |
| 667 | popserver server; | ||
| 668 | char **line; | ||
| 669 | { | 641 | { |
| 670 | return (pop_multi_next (server, line)); | 642 | return (pop_multi_next (server, line)); |
| 671 | } | 643 | } |
| 672 | 644 | ||
| 673 | int | 645 | int |
| 674 | pop_retrieve_flush (server) | 646 | pop_retrieve_flush (popserver server) |
| 675 | popserver server; | ||
| 676 | { | 647 | { |
| 677 | return (pop_multi_flush (server)); | 648 | return (pop_multi_flush (server)); |
| 678 | } | 649 | } |
| 679 | 650 | ||
| 680 | int | 651 | int |
| 681 | pop_top_first (server, message, lines, response) | 652 | pop_top_first (popserver server, int message, int lines, char **response) |
| 682 | popserver server; | ||
| 683 | int message, lines; | ||
| 684 | char **response; | ||
| 685 | { | 653 | { |
| 686 | sprintf (pop_error, "TOP %d %d", message, lines); | 654 | sprintf (pop_error, "TOP %d %d", message, lines); |
| 687 | return (pop_multi_first (server, pop_error, response)); | 655 | return (pop_multi_first (server, pop_error, response)); |
| @@ -696,25 +664,19 @@ pop_top_first (server, message, lines, response) | |||
| 696 | */ | 664 | */ |
| 697 | 665 | ||
| 698 | int | 666 | int |
| 699 | pop_top_next (server, line) | 667 | pop_top_next (popserver server, char **line) |
| 700 | popserver server; | ||
| 701 | char **line; | ||
| 702 | { | 668 | { |
| 703 | return (pop_multi_next (server, line)); | 669 | return (pop_multi_next (server, line)); |
| 704 | } | 670 | } |
| 705 | 671 | ||
| 706 | int | 672 | int |
| 707 | pop_top_flush (server) | 673 | pop_top_flush (popserver server) |
| 708 | popserver server; | ||
| 709 | { | 674 | { |
| 710 | return (pop_multi_flush (server)); | 675 | return (pop_multi_flush (server)); |
| 711 | } | 676 | } |
| 712 | 677 | ||
| 713 | int | 678 | int |
| 714 | pop_multi_first (server, command, response) | 679 | pop_multi_first (popserver server, const char *command, char **response) |
| 715 | popserver server; | ||
| 716 | char *command; | ||
| 717 | char **response; | ||
| 718 | { | 680 | { |
| 719 | if (server->in_multi) | 681 | if (server->in_multi) |
| 720 | { | 682 | { |
| @@ -757,9 +719,7 @@ pop_multi_first (server, command, response) | |||
| 757 | 0, LINE is set to null. */ | 719 | 0, LINE is set to null. */ |
| 758 | 720 | ||
| 759 | int | 721 | int |
| 760 | pop_multi_next (server, line) | 722 | pop_multi_next (popserver server, char **line) |
| 761 | popserver server; | ||
| 762 | char **line; | ||
| 763 | { | 723 | { |
| 764 | char *fromserver; | 724 | char *fromserver; |
| 765 | int ret; | 725 | int ret; |
| @@ -797,8 +757,7 @@ pop_multi_next (server, line) | |||
| 797 | } | 757 | } |
| 798 | 758 | ||
| 799 | int | 759 | int |
| 800 | pop_multi_flush (server) | 760 | pop_multi_flush (popserver server) |
| 801 | popserver server; | ||
| 802 | { | 761 | { |
| 803 | char *line; | 762 | char *line; |
| 804 | int ret; | 763 | int ret; |
| @@ -829,9 +788,7 @@ pop_multi_flush (server) | |||
| 829 | * otherwise. | 788 | * otherwise. |
| 830 | */ | 789 | */ |
| 831 | int | 790 | int |
| 832 | pop_delete (server, message) | 791 | pop_delete (popserver server, int message) |
| 833 | popserver server; | ||
| 834 | int message; | ||
| 835 | { | 792 | { |
| 836 | if (server->in_multi) | 793 | if (server->in_multi) |
| 837 | { | 794 | { |
| @@ -861,8 +818,7 @@ pop_delete (server, message) | |||
| 861 | * Side effects: Closes connection on error. | 818 | * Side effects: Closes connection on error. |
| 862 | */ | 819 | */ |
| 863 | int | 820 | int |
| 864 | pop_noop (server) | 821 | pop_noop (popserver server) |
| 865 | popserver server; | ||
| 866 | { | 822 | { |
| 867 | if (server->in_multi) | 823 | if (server->in_multi) |
| 868 | { | 824 | { |
| @@ -891,8 +847,7 @@ pop_noop (server) | |||
| 891 | * Side effects: Closes the connection on error. | 847 | * Side effects: Closes the connection on error. |
| 892 | */ | 848 | */ |
| 893 | int | 849 | int |
| 894 | pop_last (server) | 850 | pop_last (popserver server) |
| 895 | popserver server; | ||
| 896 | { | 851 | { |
| 897 | char *fromserver; | 852 | char *fromserver; |
| 898 | 853 | ||
| @@ -949,8 +904,7 @@ pop_last (server) | |||
| 949 | * Side effects: Closes the connection on error. | 904 | * Side effects: Closes the connection on error. |
| 950 | */ | 905 | */ |
| 951 | int | 906 | int |
| 952 | pop_reset (server) | 907 | pop_reset (popserver server) |
| 953 | popserver server; | ||
| 954 | { | 908 | { |
| 955 | if (pop_retrieve_flush (server)) | 909 | if (pop_retrieve_flush (server)) |
| 956 | { | 910 | { |
| @@ -978,8 +932,7 @@ pop_reset (server) | |||
| 978 | * function is called, even if an error occurs. | 932 | * function is called, even if an error occurs. |
| 979 | */ | 933 | */ |
| 980 | int | 934 | int |
| 981 | pop_quit (server) | 935 | pop_quit (popserver server) |
| 982 | popserver server; | ||
| 983 | { | 936 | { |
| 984 | int ret = 0; | 937 | int ret = 0; |
| 985 | 938 | ||
| @@ -1023,9 +976,7 @@ static int have_winsock = 0; | |||
| 1023 | * into pop_error. | 976 | * into pop_error. |
| 1024 | */ | 977 | */ |
| 1025 | static int | 978 | static int |
| 1026 | socket_connection (host, flags) | 979 | socket_connection (char *host, int flags) |
| 1027 | char *host; | ||
| 1028 | int flags; | ||
| 1029 | { | 980 | { |
| 1030 | #ifdef HAVE_GETADDRINFO | 981 | #ifdef HAVE_GETADDRINFO |
| 1031 | struct addrinfo *res, *it; | 982 | struct addrinfo *res, *it; |
| @@ -1037,7 +988,7 @@ socket_connection (host, flags) | |||
| 1037 | struct servent *servent; | 988 | struct servent *servent; |
| 1038 | struct sockaddr_in addr; | 989 | struct sockaddr_in addr; |
| 1039 | char found_port = 0; | 990 | char found_port = 0; |
| 1040 | char *service; | 991 | const char *service; |
| 1041 | int sock; | 992 | int sock; |
| 1042 | char *realhost; | 993 | char *realhost; |
| 1043 | #ifdef KERBEROS | 994 | #ifdef KERBEROS |
| @@ -1069,7 +1020,7 @@ socket_connection (host, flags) | |||
| 1069 | } | 1020 | } |
| 1070 | #endif | 1021 | #endif |
| 1071 | 1022 | ||
| 1072 | bzero ((char *) &addr, sizeof (addr)); | 1023 | memset (&addr, 0, sizeof (addr)); |
| 1073 | addr.sin_family = AF_INET; | 1024 | addr.sin_family = AF_INET; |
| 1074 | 1025 | ||
| 1075 | /** "kpop" service is never used: look for 20060515 to see why **/ | 1026 | /** "kpop" service is never used: look for 20060515 to see why **/ |
| @@ -1145,8 +1096,7 @@ socket_connection (host, flags) | |||
| 1145 | if (it->ai_addrlen == sizeof (addr)) | 1096 | if (it->ai_addrlen == sizeof (addr)) |
| 1146 | { | 1097 | { |
| 1147 | struct sockaddr_in *in_a = (struct sockaddr_in *) it->ai_addr; | 1098 | struct sockaddr_in *in_a = (struct sockaddr_in *) it->ai_addr; |
| 1148 | bcopy (&in_a->sin_addr, (char *) &addr.sin_addr, | 1099 | memcpy (&addr.sin_addr, &in_a->sin_addr, sizeof (addr.sin_addr)); |
| 1149 | sizeof (addr.sin_addr)); | ||
| 1150 | if (! connect (sock, (struct sockaddr *) &addr, sizeof (addr))) | 1100 | if (! connect (sock, (struct sockaddr *) &addr, sizeof (addr))) |
| 1151 | break; | 1101 | break; |
| 1152 | } | 1102 | } |
| @@ -1174,8 +1124,7 @@ socket_connection (host, flags) | |||
| 1174 | 1124 | ||
| 1175 | while (*hostent->h_addr_list) | 1125 | while (*hostent->h_addr_list) |
| 1176 | { | 1126 | { |
| 1177 | bcopy (*hostent->h_addr_list, (char *) &addr.sin_addr, | 1127 | memcpy (&addr.sin_addr, *hostent->h_addr_list, hostent->h_length); |
| 1178 | hostent->h_length); | ||
| 1179 | if (! connect (sock, (struct sockaddr *) &addr, sizeof (addr))) | 1128 | if (! connect (sock, (struct sockaddr *) &addr, sizeof (addr))) |
| 1180 | break; | 1129 | break; |
| 1181 | hostent->h_addr_list++; | 1130 | hostent->h_addr_list++; |
| @@ -1335,9 +1284,7 @@ socket_connection (host, flags) | |||
| 1335 | * THE RETURNED LINE MAY CONTAIN EMBEDDED NULLS! | 1284 | * THE RETURNED LINE MAY CONTAIN EMBEDDED NULLS! |
| 1336 | */ | 1285 | */ |
| 1337 | static int | 1286 | static int |
| 1338 | pop_getline (server, line) | 1287 | pop_getline (popserver server, char **line) |
| 1339 | popserver server; | ||
| 1340 | char **line; | ||
| 1341 | { | 1288 | { |
| 1342 | #define GETLINE_ERROR "Error reading from server: " | 1289 | #define GETLINE_ERROR "Error reading from server: " |
| 1343 | 1290 | ||
| @@ -1369,8 +1316,8 @@ pop_getline (server, line) | |||
| 1369 | } | 1316 | } |
| 1370 | else | 1317 | else |
| 1371 | { | 1318 | { |
| 1372 | bcopy (server->buffer + server->buffer_index, | 1319 | memmove (server->buffer, server->buffer + server->buffer_index, |
| 1373 | server->buffer, server->data); | 1320 | server->data); |
| 1374 | /* Record the fact that we've searched the data already in | 1321 | /* Record the fact that we've searched the data already in |
| 1375 | the buffer for a CRLF, so that when we search below, we | 1322 | the buffer for a CRLF, so that when we search below, we |
| 1376 | don't have to search the same data twice. There's a "- | 1323 | don't have to search the same data twice. There's a "- |
| @@ -1467,9 +1414,7 @@ pop_getline (server, line) | |||
| 1467 | * Side effects: Closes the connection on error. | 1414 | * Side effects: Closes the connection on error. |
| 1468 | */ | 1415 | */ |
| 1469 | static int | 1416 | static int |
| 1470 | sendline (server, line) | 1417 | sendline (popserver server, const char *line) |
| 1471 | popserver server; | ||
| 1472 | char *line; | ||
| 1473 | { | 1418 | { |
| 1474 | #define SENDLINE_ERROR "Error writing to POP server: " | 1419 | #define SENDLINE_ERROR "Error writing to POP server: " |
| 1475 | int ret; | 1420 | int ret; |
| @@ -1516,10 +1461,7 @@ sendline (server, line) | |||
| 1516 | * Return value: Same as write. Pop_error is not set. | 1461 | * Return value: Same as write. Pop_error is not set. |
| 1517 | */ | 1462 | */ |
| 1518 | static int | 1463 | static int |
| 1519 | fullwrite (fd, buf, nbytes) | 1464 | fullwrite (int fd, char *buf, int nbytes) |
| 1520 | int fd; | ||
| 1521 | char *buf; | ||
| 1522 | int nbytes; | ||
| 1523 | { | 1465 | { |
| 1524 | char *cp; | 1466 | char *cp; |
| 1525 | int ret = 0; | 1467 | int ret = 0; |
| @@ -1549,8 +1491,7 @@ fullwrite (fd, buf, nbytes) | |||
| 1549 | * Side effects: On failure, may make the connection unusable. | 1491 | * Side effects: On failure, may make the connection unusable. |
| 1550 | */ | 1492 | */ |
| 1551 | static int | 1493 | static int |
| 1552 | getok (server) | 1494 | getok (popserver server) |
| 1553 | popserver server; | ||
| 1554 | { | 1495 | { |
| 1555 | char *fromline; | 1496 | char *fromline; |
| 1556 | 1497 | ||
| @@ -1621,8 +1562,7 @@ gettermination (server) | |||
| 1621 | * since the last pop_reset) may be lost. | 1562 | * since the last pop_reset) may be lost. |
| 1622 | */ | 1563 | */ |
| 1623 | void | 1564 | void |
| 1624 | pop_close (server) | 1565 | pop_close (popserver server) |
| 1625 | popserver server; | ||
| 1626 | { | 1566 | { |
| 1627 | pop_trash (server); | 1567 | pop_trash (server); |
| 1628 | free ((char *) server); | 1568 | free ((char *) server); |
| @@ -1638,8 +1578,7 @@ pop_close (server) | |||
| 1638 | * pop_close or pop_quit after this function has been called. | 1578 | * pop_close or pop_quit after this function has been called. |
| 1639 | */ | 1579 | */ |
| 1640 | static void | 1580 | static void |
| 1641 | pop_trash (server) | 1581 | pop_trash (popserver server) |
| 1642 | popserver server; | ||
| 1643 | { | 1582 | { |
| 1644 | if (server->file >= 0) | 1583 | if (server->file >= 0) |
| 1645 | { | 1584 | { |
| @@ -1671,9 +1610,7 @@ pop_trash (server) | |||
| 1671 | null, or 0 if it does not contain one. */ | 1610 | null, or 0 if it does not contain one. */ |
| 1672 | 1611 | ||
| 1673 | static char * | 1612 | static char * |
| 1674 | find_crlf (in_string, len) | 1613 | find_crlf (char *in_string, int len) |
| 1675 | char *in_string; | ||
| 1676 | int len; | ||
| 1677 | { | 1614 | { |
| 1678 | while (len--) | 1615 | while (len--) |
| 1679 | { | 1616 | { |
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/profile.c b/lib-src/profile.c index 0347350a799..37653e63c49 100644 --- a/lib-src/profile.c +++ b/lib-src/profile.c | |||
| @@ -40,7 +40,7 @@ static char time_string[30]; | |||
| 40 | /* Reset the stopwatch to zero. */ | 40 | /* Reset the stopwatch to zero. */ |
| 41 | 41 | ||
| 42 | void | 42 | void |
| 43 | reset_watch () | 43 | reset_watch (void) |
| 44 | { | 44 | { |
| 45 | EMACS_GET_TIME (TV1); | 45 | EMACS_GET_TIME (TV1); |
| 46 | watch_not_started = 0; | 46 | watch_not_started = 0; |
| @@ -51,7 +51,7 @@ reset_watch () | |||
| 51 | If reset_watch was not called yet, exit. */ | 51 | If reset_watch was not called yet, exit. */ |
| 52 | 52 | ||
| 53 | char * | 53 | char * |
| 54 | get_time () | 54 | get_time (void) |
| 55 | { | 55 | { |
| 56 | if (watch_not_started) | 56 | if (watch_not_started) |
| 57 | exit (EXIT_FAILURE); /* call reset_watch first ! */ | 57 | exit (EXIT_FAILURE); /* call reset_watch first ! */ |
| @@ -79,7 +79,7 @@ gettimeofday (tp, tzp) | |||
| 79 | #endif | 79 | #endif |
| 80 | 80 | ||
| 81 | int | 81 | int |
| 82 | main () | 82 | main (void) |
| 83 | { | 83 | { |
| 84 | int c; | 84 | int c; |
| 85 | while ((c = getchar ()) != EOF) | 85 | while ((c = getchar ()) != EOF) |
diff --git a/lib-src/sorted-doc.c b/lib-src/sorted-doc.c index ce58529193a..db3f3029532 100644 --- a/lib-src/sorted-doc.c +++ b/lib-src/sorted-doc.c | |||
| @@ -65,8 +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 (s1, s2) | 68 | error (const char *s1, const char *s2) |
| 69 | char *s1, *s2; | ||
| 70 | { | 69 | { |
| 71 | fprintf (stderr, "sorted-doc: "); | 70 | fprintf (stderr, "sorted-doc: "); |
| 72 | fprintf (stderr, s1, s2); | 71 | fprintf (stderr, s1, s2); |
| @@ -76,8 +75,7 @@ error (s1, s2) | |||
| 76 | /* Print error message and exit. */ | 75 | /* Print error message and exit. */ |
| 77 | 76 | ||
| 78 | void | 77 | void |
| 79 | fatal (s1, s2) | 78 | fatal (const char *s1, const char *s2) |
| 80 | char *s1, *s2; | ||
| 81 | { | 79 | { |
| 82 | error (s1, s2); | 80 | error (s1, s2); |
| 83 | exit (EXIT_FAILURE); | 81 | exit (EXIT_FAILURE); |
| @@ -86,8 +84,7 @@ fatal (s1, s2) | |||
| 86 | /* Like malloc but get fatal error if memory is exhausted. */ | 84 | /* Like malloc but get fatal error if memory is exhausted. */ |
| 87 | 85 | ||
| 88 | char * | 86 | char * |
| 89 | xmalloc (size) | 87 | xmalloc (int size) |
| 90 | int size; | ||
| 91 | { | 88 | { |
| 92 | char *result = malloc ((unsigned)size); | 89 | char *result = malloc ((unsigned)size); |
| 93 | if (result == NULL) | 90 | if (result == NULL) |
| @@ -96,8 +93,7 @@ xmalloc (size) | |||
| 96 | } | 93 | } |
| 97 | 94 | ||
| 98 | char * | 95 | char * |
| 99 | xstrdup (str) | 96 | xstrdup (char *str) |
| 100 | char * str; | ||
| 101 | { | 97 | { |
| 102 | char *buf = xmalloc (strlen (str) + 1); | 98 | char *buf = xmalloc (strlen (str) + 1); |
| 103 | (void) strcpy (buf, str); | 99 | (void) strcpy (buf, str); |
| @@ -107,28 +103,27 @@ xstrdup (str) | |||
| 107 | /* Comparison function for qsort to call. */ | 103 | /* Comparison function for qsort to call. */ |
| 108 | 104 | ||
| 109 | int | 105 | int |
| 110 | cmpdoc (a, b) | 106 | cmpdoc (const void *va, const void *vb) |
| 111 | DOCSTR **a; | ||
| 112 | DOCSTR **b; | ||
| 113 | { | 107 | { |
| 108 | DOCSTR *const *a = va; | ||
| 109 | DOCSTR *const *b = vb; | ||
| 114 | register int val = strcmp ((*a)->name, (*b)->name); | 110 | register int val = strcmp ((*a)->name, (*b)->name); |
| 115 | if (val) return val; | 111 | if (val) return val; |
| 116 | return (*a)->type - (*b)->type; | 112 | return (*a)->type - (*b)->type; |
| 117 | } | 113 | } |
| 118 | 114 | ||
| 119 | |||
| 120 | enum state | 115 | enum state |
| 121 | { | 116 | { |
| 122 | WAITING, BEG_NAME, NAME_GET, BEG_DESC, DESC_GET | 117 | WAITING, BEG_NAME, NAME_GET, BEG_DESC, DESC_GET |
| 123 | }; | 118 | }; |
| 124 | 119 | ||
| 125 | char *states[] = | 120 | const char *states[] = |
| 126 | { | 121 | { |
| 127 | "WAITING", "BEG_NAME", "NAME_GET", "BEG_DESC", "DESC_GET" | 122 | "WAITING", "BEG_NAME", "NAME_GET", "BEG_DESC", "DESC_GET" |
| 128 | }; | 123 | }; |
| 129 | 124 | ||
| 130 | int | 125 | int |
| 131 | main () | 126 | main (void) |
| 132 | { | 127 | { |
| 133 | register DOCSTR *dp = NULL; /* allocated DOCSTR */ | 128 | register DOCSTR *dp = NULL; /* allocated DOCSTR */ |
| 134 | register LINE *lp = NULL; /* allocated line */ | 129 | register LINE *lp = NULL; /* allocated line */ |
diff --git a/lib-src/test-distrib.c b/lib-src/test-distrib.c index a6c7c187f8a..880bd115882 100644 --- a/lib-src/test-distrib.c +++ b/lib-src/test-distrib.c | |||
| @@ -52,10 +52,7 @@ char buf[300]; | |||
| 52 | 52 | ||
| 53 | /* Like `read' but keeps trying until it gets SIZE bytes or reaches eof. */ | 53 | /* Like `read' but keeps trying until it gets SIZE bytes or reaches eof. */ |
| 54 | int | 54 | int |
| 55 | cool_read (fd, buf, size) | 55 | cool_read (int fd, char *buf, int size) |
| 56 | int fd; | ||
| 57 | char *buf; | ||
| 58 | int size; | ||
| 59 | { | 56 | { |
| 60 | int num, sofar = 0; | 57 | int num, sofar = 0; |
| 61 | 58 | ||
| @@ -70,9 +67,7 @@ cool_read (fd, buf, size) | |||
| 70 | } | 67 | } |
| 71 | 68 | ||
| 72 | int | 69 | int |
| 73 | main (argc, argv) | 70 | main (int argc, char **argv) |
| 74 | int argc; | ||
| 75 | char **argv; | ||
| 76 | { | 71 | { |
| 77 | int fd; | 72 | int fd; |
| 78 | 73 | ||
diff --git a/lib-src/update-game-score.c b/lib-src/update-game-score.c index 24fd45f72d3..b8e1147d1c1 100644 --- a/lib-src/update-game-score.c +++ b/lib-src/update-game-score.c | |||
| @@ -60,25 +60,19 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 60 | extern char *optarg; | 60 | extern char *optarg; |
| 61 | extern int optind, opterr; | 61 | extern int optind, opterr; |
| 62 | 62 | ||
| 63 | int usage (int err) NO_RETURN; | ||
| 64 | |||
| 63 | #define MAX_ATTEMPTS 5 | 65 | #define MAX_ATTEMPTS 5 |
| 64 | #define MAX_SCORES 200 | 66 | #define MAX_SCORES 200 |
| 65 | #define MAX_DATA_LEN 1024 | 67 | #define MAX_DATA_LEN 1024 |
| 66 | 68 | ||
| 67 | /* Declare the prototype for a general external function. */ | ||
| 68 | #if defined (PROTOTYPES) || defined (WINDOWSNT) | ||
| 69 | #define P_(proto) proto | ||
| 70 | #else | ||
| 71 | #define P_(proto) () | ||
| 72 | #endif | ||
| 73 | |||
| 74 | #ifndef HAVE_DIFFTIME | 69 | #ifndef HAVE_DIFFTIME |
| 75 | /* OK on POSIX (time_t is arithmetic type) modulo overflow in subtraction. */ | 70 | /* OK on POSIX (time_t is arithmetic type) modulo overflow in subtraction. */ |
| 76 | #define difftime(t1, t0) (double)((t1) - (t0)) | 71 | #define difftime(t1, t0) (double)((t1) - (t0)) |
| 77 | #endif | 72 | #endif |
| 78 | 73 | ||
| 79 | int | 74 | int |
| 80 | usage (err) | 75 | usage (int err) |
| 81 | int err; | ||
| 82 | { | 76 | { |
| 83 | fprintf (stdout, "Usage: update-game-score [-m MAX ] [ -r ] game/scorefile SCORE DATA\n"); | 77 | fprintf (stdout, "Usage: update-game-score [-m MAX ] [ -r ] game/scorefile SCORE DATA\n"); |
| 84 | fprintf (stdout, " update-game-score -h\n"); | 78 | fprintf (stdout, " update-game-score -h\n"); |
| @@ -89,8 +83,8 @@ usage (err) | |||
| 89 | exit (err); | 83 | exit (err); |
| 90 | } | 84 | } |
| 91 | 85 | ||
| 92 | int lock_file P_ ((const char *filename, void **state)); | 86 | int lock_file (const char *filename, void **state); |
| 93 | int unlock_file P_ ((const char *filename, void *state)); | 87 | int unlock_file (const char *filename, void *state); |
| 94 | 88 | ||
| 95 | struct score_entry | 89 | struct score_entry |
| 96 | { | 90 | { |
| @@ -99,25 +93,24 @@ struct score_entry | |||
| 99 | char *data; | 93 | char *data; |
| 100 | }; | 94 | }; |
| 101 | 95 | ||
| 102 | int read_scores P_ ((const char *filename, struct score_entry **scores, | 96 | int read_scores (const char *filename, struct score_entry **scores, |
| 103 | int *count)); | 97 | int *count); |
| 104 | int push_score P_ ((struct score_entry **scores, int *count, | 98 | int push_score (struct score_entry **scores, int *count, |
| 105 | int newscore, char *username, char *newdata)); | 99 | int newscore, char *username, char *newdata); |
| 106 | void sort_scores P_ ((struct score_entry *scores, int count, int reverse)); | 100 | void sort_scores (struct score_entry *scores, int count, int reverse); |
| 107 | int write_scores P_ ((const char *filename, const struct score_entry *scores, | 101 | int write_scores (const char *filename, const struct score_entry *scores, |
| 108 | int count)); | 102 | int count); |
| 109 | 103 | ||
| 110 | void lose P_ ((const char *msg)) NO_RETURN; | 104 | void lose (const char *msg) NO_RETURN; |
| 111 | 105 | ||
| 112 | void | 106 | void |
| 113 | lose (msg) | 107 | lose (const char *msg) |
| 114 | const char *msg; | ||
| 115 | { | 108 | { |
| 116 | fprintf (stderr, "%s\n", msg); | 109 | fprintf (stderr, "%s\n", msg); |
| 117 | exit (EXIT_FAILURE); | 110 | exit (EXIT_FAILURE); |
| 118 | } | 111 | } |
| 119 | 112 | ||
| 120 | void lose_syserr P_ ((const char *msg)) NO_RETURN; | 113 | void lose_syserr (const char *msg) NO_RETURN; |
| 121 | 114 | ||
| 122 | /* Taken from sysdep.c. */ | 115 | /* Taken from sysdep.c. */ |
| 123 | #ifndef HAVE_STRERROR | 116 | #ifndef HAVE_STRERROR |
| @@ -137,15 +130,14 @@ strerror (errnum) | |||
| 137 | #endif /* ! HAVE_STRERROR */ | 130 | #endif /* ! HAVE_STRERROR */ |
| 138 | 131 | ||
| 139 | void | 132 | void |
| 140 | lose_syserr (msg) | 133 | lose_syserr (const char *msg) |
| 141 | const char *msg; | ||
| 142 | { | 134 | { |
| 143 | fprintf (stderr, "%s: %s\n", msg, strerror (errno)); | 135 | fprintf (stderr, "%s: %s\n", msg, strerror (errno)); |
| 144 | exit (EXIT_FAILURE); | 136 | exit (EXIT_FAILURE); |
| 145 | } | 137 | } |
| 146 | 138 | ||
| 147 | char * | 139 | char * |
| 148 | get_user_id P_ ((void)) | 140 | get_user_id (void) |
| 149 | { | 141 | { |
| 150 | char *name; | 142 | char *name; |
| 151 | struct passwd *buf = getpwuid (getuid ()); | 143 | struct passwd *buf = getpwuid (getuid ()); |
| @@ -165,10 +157,8 @@ get_user_id P_ ((void)) | |||
| 165 | return buf->pw_name; | 157 | return buf->pw_name; |
| 166 | } | 158 | } |
| 167 | 159 | ||
| 168 | char * | 160 | const char * |
| 169 | get_prefix (running_suid, user_prefix) | 161 | get_prefix (int running_suid, const char *user_prefix) |
| 170 | int running_suid; | ||
| 171 | char *user_prefix; | ||
| 172 | { | 162 | { |
| 173 | if (!running_suid && user_prefix == NULL) | 163 | if (!running_suid && user_prefix == NULL) |
| 174 | lose ("Not using a shared game directory, and no prefix given."); | 164 | lose ("Not using a shared game directory, and no prefix given."); |
| @@ -184,13 +174,12 @@ get_prefix (running_suid, user_prefix) | |||
| 184 | } | 174 | } |
| 185 | 175 | ||
| 186 | int | 176 | int |
| 187 | main (argc, argv) | 177 | main (int argc, char **argv) |
| 188 | int argc; | ||
| 189 | char **argv; | ||
| 190 | { | 178 | { |
| 191 | int c, running_suid; | 179 | int c, running_suid; |
| 192 | void *lockstate; | 180 | void *lockstate; |
| 193 | char *user_id, *scorefile, *prefix, *user_prefix = NULL; | 181 | char *user_id, *scorefile; |
| 182 | const char *prefix, *user_prefix = NULL; | ||
| 194 | struct stat buf; | 183 | struct stat buf; |
| 195 | struct score_entry *scores; | 184 | struct score_entry *scores; |
| 196 | int newscore, scorecount, reverse = 0, max = MAX_SCORES; | 185 | int newscore, scorecount, reverse = 0, max = MAX_SCORES; |
| @@ -273,9 +262,7 @@ main (argc, argv) | |||
| 273 | } | 262 | } |
| 274 | 263 | ||
| 275 | int | 264 | int |
| 276 | read_score (f, score) | 265 | read_score (FILE *f, struct score_entry *score) |
| 277 | FILE *f; | ||
| 278 | struct score_entry *score; | ||
| 279 | { | 266 | { |
| 280 | int c; | 267 | int c; |
| 281 | if (feof (f)) | 268 | if (feof (f)) |
| @@ -359,10 +346,7 @@ read_score (f, score) | |||
| 359 | } | 346 | } |
| 360 | 347 | ||
| 361 | int | 348 | int |
| 362 | read_scores (filename, scores, count) | 349 | read_scores (const char *filename, struct score_entry **scores, int *count) |
| 363 | const char *filename; | ||
| 364 | struct score_entry **scores; | ||
| 365 | int *count; | ||
| 366 | { | 350 | { |
| 367 | int readval, scorecount, cursize; | 351 | int readval, scorecount, cursize; |
| 368 | struct score_entry *ret; | 352 | struct score_entry *ret; |
| @@ -395,9 +379,7 @@ read_scores (filename, scores, count) | |||
| 395 | } | 379 | } |
| 396 | 380 | ||
| 397 | int | 381 | int |
| 398 | score_compare (a, b) | 382 | score_compare (const void *a, const void *b) |
| 399 | const void *a; | ||
| 400 | const void *b; | ||
| 401 | { | 383 | { |
| 402 | const struct score_entry *sa = (const struct score_entry *) a; | 384 | const struct score_entry *sa = (const struct score_entry *) a; |
| 403 | const struct score_entry *sb = (const struct score_entry *) b; | 385 | const struct score_entry *sb = (const struct score_entry *) b; |
| @@ -405,9 +387,7 @@ score_compare (a, b) | |||
| 405 | } | 387 | } |
| 406 | 388 | ||
| 407 | int | 389 | int |
| 408 | score_compare_reverse (a, b) | 390 | score_compare_reverse (const void *a, const void *b) |
| 409 | const void *a; | ||
| 410 | const void *b; | ||
| 411 | { | 391 | { |
| 412 | const struct score_entry *sa = (const struct score_entry *) a; | 392 | const struct score_entry *sa = (const struct score_entry *) a; |
| 413 | const struct score_entry *sb = (const struct score_entry *) b; | 393 | const struct score_entry *sb = (const struct score_entry *) b; |
| @@ -415,11 +395,7 @@ score_compare_reverse (a, b) | |||
| 415 | } | 395 | } |
| 416 | 396 | ||
| 417 | int | 397 | int |
| 418 | push_score (scores, count, newscore, username, newdata) | 398 | push_score (struct score_entry **scores, int *count, int newscore, char *username, char *newdata) |
| 419 | struct score_entry **scores; | ||
| 420 | int *count; int newscore; | ||
| 421 | char *username; | ||
| 422 | char *newdata; | ||
| 423 | { | 399 | { |
| 424 | struct score_entry *newscores | 400 | struct score_entry *newscores |
| 425 | = (struct score_entry *) realloc (*scores, | 401 | = (struct score_entry *) realloc (*scores, |
| @@ -435,20 +411,14 @@ push_score (scores, count, newscore, username, newdata) | |||
| 435 | } | 411 | } |
| 436 | 412 | ||
| 437 | void | 413 | void |
| 438 | sort_scores (scores, count, reverse) | 414 | sort_scores (struct score_entry *scores, int count, int reverse) |
| 439 | struct score_entry *scores; | ||
| 440 | int count; | ||
| 441 | int reverse; | ||
| 442 | { | 415 | { |
| 443 | qsort (scores, count, sizeof (struct score_entry), | 416 | qsort (scores, count, sizeof (struct score_entry), |
| 444 | reverse ? score_compare_reverse : score_compare); | 417 | reverse ? score_compare_reverse : score_compare); |
| 445 | } | 418 | } |
| 446 | 419 | ||
| 447 | int | 420 | int |
| 448 | write_scores (filename, scores, count) | 421 | write_scores (const char *filename, const struct score_entry *scores, int count) |
| 449 | const char *filename; | ||
| 450 | const struct score_entry * scores; | ||
| 451 | int count; | ||
| 452 | { | 422 | { |
| 453 | FILE *f; | 423 | FILE *f; |
| 454 | int i; | 424 | int i; |
| @@ -477,14 +447,12 @@ write_scores (filename, scores, count) | |||
| 477 | } | 447 | } |
| 478 | 448 | ||
| 479 | int | 449 | int |
| 480 | lock_file (filename, state) | 450 | lock_file (const char *filename, void **state) |
| 481 | const char *filename; | ||
| 482 | void **state; | ||
| 483 | { | 451 | { |
| 484 | int fd; | 452 | int fd; |
| 485 | struct stat buf; | 453 | struct stat buf; |
| 486 | int attempts = 0; | 454 | int attempts = 0; |
| 487 | char *lockext = ".lockfile"; | 455 | const char *lockext = ".lockfile"; |
| 488 | char *lockpath = malloc (strlen (filename) + strlen (lockext) + 60); | 456 | char *lockpath = malloc (strlen (filename) + strlen (lockext) + 60); |
| 489 | if (!lockpath) | 457 | if (!lockpath) |
| 490 | return -1; | 458 | return -1; |
| @@ -520,9 +488,7 @@ lock_file (filename, state) | |||
| 520 | } | 488 | } |
| 521 | 489 | ||
| 522 | int | 490 | int |
| 523 | unlock_file (filename, state) | 491 | unlock_file (const char *filename, void *state) |
| 524 | const char *filename; | ||
| 525 | void *state; | ||
| 526 | { | 492 | { |
| 527 | char *lockpath = (char *) state; | 493 | char *lockpath = (char *) state; |
| 528 | int ret = unlink (lockpath); | 494 | int ret = unlink (lockpath); |