aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/.gitignore1
-rw-r--r--lib-src/ChangeLog493
-rw-r--r--lib-src/Makefile.in67
-rw-r--r--lib-src/ebrowse.c285
-rw-r--r--lib-src/emacsclient.c198
-rw-r--r--lib-src/etags.c72
-rw-r--r--lib-src/fakemail.c739
-rw-r--r--lib-src/make-docfile.c246
-rw-r--r--lib-src/makefile.w32-in37
-rw-r--r--lib-src/movemail.c129
-rw-r--r--lib-src/ntlib.c1
-rw-r--r--lib-src/pop.c9
-rw-r--r--lib-src/profile.c4
-rw-r--r--lib-src/test-distrib.c9
-rw-r--r--lib-src/update-game-score.c64
15 files changed, 1030 insertions, 1324 deletions
diff --git a/lib-src/.gitignore b/lib-src/.gitignore
index e1693b13c5e..c931a15d7b6 100644
--- a/lib-src/.gitignore
+++ b/lib-src/.gitignore
@@ -1,6 +1,5 @@
1DOC 1DOC
2ctags.c 2ctags.c
3getopt.h
4stamp_BLD 3stamp_BLD
5echolisp.tmp 4echolisp.tmp
6 5
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 3f4e4b1b9ff..ec123e85036 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,13 +1,298 @@
12011-06-10 Paul Eggert <eggert@cs.ucla.edu>
2
3 * movemail.c: Fix race condition and related bugs (Bug#8836).
4 (main) [!MAIL_USE_SYSTEM_LOCK]: Prefer mkstemp to mktemp, as this
5 fixes some race conditions. Report mkstemp/mktemp errno rather
6 than a possibly-garbage errno. Reinitialize the template each
7 time through the loop, as earlier mkstemp/mktemp calls could have
8 trashed it. Pass 0600 (not 0666) to mktemp, for consistency
9 with mkstemp; the permissions don't matter anyway.
10
112011-06-01 Dan Nicolaescu <dann@ics.uci.edu>
12
13 * emacsclient.c (socket_status): Use constant pointer.
14
152011-05-28 Paul Eggert <eggert@cs.ucla.edu>
16
17 Use 'inline', not 'INLINE'.
18 * etags.c (hash): Now inline unconditionally.
19 * make-docfile.c (put_char): inline, not INLINE.
20
212011-05-25 Glenn Morris <rgm@gnu.org>
22
23 * Makefile.in (.c.o): Remove (every .o file has an explicit rule).
24 (insrcdir): New.
25 (stamp-rcs2log, stamp-rcs-checkin, stamp-grep-changelog, stamp-vcdiff):
26 Use $insrcdir to suppress unaesthetic ignored errors.
27 (clean): Simplify list of things to delete.
28 (all, clean): Use $EXE_FILES.
29
30 * Makefile.in (movemail${EXEEXT}): Build in one step, not via .o file.
31
32 * Makefile.in (REGEXPOBJ, REGEXPDEPS): Remove. Replace by expansion.
33 (etags${EXEEXT}): Just depend on regex.o, not regex.h as well.
34
352011-05-24 Glenn Morris <rgm@gnu.org>
36
37 * Makefile.in (update-game-score${EXEEXT}): Use a single rule.
38
392011-05-19 Glenn Morris <rgm@gnu.org>
40
41 * makefile.w32-in (echolisp): Remove rule that is no longer needed.
42 (clean): No more echolisp.tmp.
43
442011-05-18 Glenn Morris <rgm@gnu.org>
45
46 * fakemail.c: Remove file.
47 * makefile.w32-in ($(BLD)/fakemail.exe, fakemail)
48 ($(BLD)/fakemail.$(O)): Remove.
49 * Makefile.in (UTILITIES): Remove fakemail${EXEEXT}.
50 (fakemail${EXEEXT}): Remove rule.
51
522011-04-24 Teodor Zlatanov <tzz@lifelogs.com>
53
54 * makefile.w32-in (obj): Add gnutls.o.
55
562011-04-16 Paul Eggert <eggert@cs.ucla.edu>
57
58 Static checks with GCC 4.6.0 and non-default toolkits.
59
60 * movemail.c (mail_spool_name): Protoize.
61 (main): Remove unused var. Mark var as initialized.
62 Move locals to avoid shadowing, and use time_t for times.
63
64 * fakemail.c (xmalloc, xreallc): Use standard C prototypes
65 with void *. This avoids warnings about pointer casts.
66
67 * emacsclient.c (main): Don't use uninitialized var.
68 (IS_ANY_SEP): Remove; unused.
69 (get_current_dir_name): Add an extern decl.
70
712011-04-06 Paul Eggert <eggert@cs.ucla.edu>
72
73 Fix more problems found by GCC 4.6.0's static checks.
74
75 * emacsclient.c (message): Mark it as a printf-like function.
76
77 * make-docfile.c (IF_LINT): New macro, copied from emacsclient.c.
78 (write_c_args): Use it to suppress GCC warning.
79
802011-03-30 Paul Eggert <eggert@cs.ucla.edu>
81
82 Fix a problem found by GCC 4.6.0's static checks.
83 * etags.c (just_read_file): Remove dummy variable and simplify.
84
852011-03-27 Glenn Morris <rgm@gnu.org>
86
87 * emacsclient.c: Replace SIGTYPE with void.
88
892011-03-23 Juanma Barranquero <lekktu@gmail.com>
90
91 * ntlib.c: Include <ctype.h>.
92
932011-03-23 Glenn Morris <rgm@gnu.org>
94
95 * Makefile.in ($(DESTDIR)${archlibdir}):
96 Use `install-sh -d' rather than mkinstalldirs.
97
982011-03-23 Paul Eggert <eggert@cs.ucla.edu>
99
100 * ebrowse.c: Use size_t, not int, for sizes.
101 This avoids a warning with gcc -Wstrict-overflow, and works
102 better for very large objects.
103 (inbuffer_size): Now size_t. All uses changed.
104 (xmalloc, xrealloc, operator_name, process_file): Use size_t for
105 sizes. Don't bother testing whether a size_t value can be negative.
106
107 * etags.c (Ada_funcs): Redo slightly to avoid overflow warning.
108
109 etags: In Prolog functions, don't assume int fits in size_t.
110 This avoids a warning with gcc -Wstrict-overflow.
111 * etags.c (Prolog_functions, prolog_pr, prolog_atom): Use size_t,
112 not int, to store sizes.
113 (prolog_atom): Return 0, not -1, on error. All callers changed.
114
115 update-game-score: fix bug with -r
116 * update-game-score.c (main): Don't set 'scores' to garbage when
117 -r is specified and scorecount != MAX_SCORES (Bug#8310). This bug
118 was introduced in the 2002-04-10 change, and was found with gcc
119 -Wstrict-overflow (GCC 4.5.2, x86-64).
120
121 fakemail: Remove dependency on ignore-value.
122 This undoes some of the recent fakemail-related changes.
123 It is made possible due to recent changes to gnulib's stdio module.
124 * Makefile.in (fakemail${EXEEXT}): Do not depend on ignore-value.h.
125 * fakemail.c: Do not include ignore-value.h.
126 (put_line): Do not use ignore_value.
127
1282011-03-07 Chong Yidong <cyd@stupidchicken.com>
129
130 * Version 23.3 released.
131
1322011-03-03 Drake Wilson <drake@begriffli.ch> (tiny change)
133
134 * emacsclient.c (longopts): Add quiet.
135 (decode_options): Handle q/quiet.
136 (print_help_and_exit): Add q/quiet.
137 (main): Suppress some messages if quiet option is used.
138
1392011-02-26 Eli Zaretskii <eliz@gnu.org>
140
141 * Makefile.in (fakemail${EXEEXT}): Depend on lib/ignore-value.h.
142
143 * emacsclient.c (xstrdup) [WINDOWSNT]: Function added back.
144 (w32_getenv): Use xstrdup to return all values in malloc'ed
145 storage.
146
1472011-02-26 Paul Eggert <eggert@cs.ucla.edu>
148
149 * ebrowse.c (parse_qualified_param_ident_or_type): Make it clear
150 to reader (and to the compiler) that the loop always executes at
151 least once. This prevents a warning with recent GCC.
152 (BROWSE_STRUCT): Remove unused macro.
153
154 * fakemail.c: Include <ignore-value.h>.
155 (put_line): Explicitly ignore fwrite return value, for benefit of
156 recent glibc + gcc.
157 (close_the_streams): Diagnose output errors instead of merely
158 exiting with nonzero status.
159 (my_fclose, main): Diagnose input errors, and exit with nonzero status.
160 Formerly, input errors were silently ignored.
161
162 * ebrowse.c (putstr): Rename from PUTSTR and turn into a function.
163 All callers changed. This is cleaner, and avoids GCC warnings about
164 passing NULL to fputs.
165 (insert_keyword): Rename parameter to avoid shadowing diagnostic.
166
1672011-02-25 Paul Eggert <eggert@cs.ucla.edu>
168
169 * emacsclient.c (main): Avoid dangling 'if'.
170 (xstrdup): Remove; no longer needed.
171 (get_current_dir_name, w32_getenv, get_server_config, find_tty):
172 (set_local_socket, main):
173 Use const char *, not char *, for pointers that are not assigned
174 through.
175 (IF_LINT): New macro.
176 (set_local_socket, main): Use it to suppress warnings with
177 GCC -Wuninitialized.
178
179 * emacsclient.c: Redo local variables to avoid shadowing problems.
180 (message, socket_status, start_daemon_and_retry_set_socket):
181 Rename locals.
182 (main): Move decl of "i".
183
184 * etags.c (ISUPPER): Move to inside the only #ifdef where it's used.
185 This avoids an unused-macro warning with some GCC settings.
186
187 * make-docfile.c (write_globals): Change char * to char const *
188 to avoid a GCC "assignment discards qualifiers" diagnostic
189 in some configurations.
190 (scan_c_file): Refactor local variable decls to make their scope
191 more accurate and to avoid a GCC -Wuninitialized diagnostic.
192
1932011-02-22 Eli Zaretskii <eliz@gnu.org>
194
195 * etags.c (canonicalize_filename, ISUPPER): Fix last change.
196
197 * makefile.w32-in ($(BLD)/ebrowse.$(O), $(BLD)/pop.$(O)): Depend
198 on ../lib/min-max.h.
199
2002011-02-22 Paul Eggert <eggert@cs.ucla.edu>
201
202 etags: Downcase drive letters, for consistency with Emacs proper.
203 * etags.c (upcase): Remove; no longer used.
204 (canonicalize_filename): Downcase drive letters.
205
206 Assume S_ISLNK etc. work, since gnulib supports this.
207 * etags.c (S_ISREG): Remove.
208
2092011-02-22 Paul Eggert <eggert@cs.ucla.edu>
210
211 Assume S_ISLNK etc. work, since gnulib supports this.
212 * etags.c (S_ISREG): Remove.
213
2142011-02-22 Juanma Barranquero <lekktu@gmail.com>
215
216 * makefile.w32-in (obj): Remove filemode.o.
217
2182011-02-21 Paul Eggert <eggert@cs.ucla.edu>
219
220 New file "lib/min-max.h".
221 * ebrowse.c (min, max): Define them by including <min-max.h>
222 instead of defining it ourselves.
223 * pop.c (min): Likewise.
224 * Makefile.in (ebrowse${EXEEXT}, pop.o): Depend on min-max.h.
225
226 * movemail.c (popmail): Report fchown failure instead of ignoring it.
227 But if the file already has the right ownership, don't worry about it.
228
229 * make-docfile.c (input_buffer): Rename variables to avoid shadowing.
230 * test-distrib.c (buf): Make this local, to avoid shadowing.
231
232 * movemail.c (main, pop_retr): Rename locals to avoid shadowing.
233 (progname, sfi, sfo, ibuffer, obuffer): Remove unused vars.
234 (DONE): Remove unused macro.
235 (DIRECTORY_SEP, IS_DIRECTORY_SEP, IS_FROM_LINE):
236 Define these macros only in the contexts that need them.
237 * pop.c (index): Remove unused macro.
238 (KPOP_PORT): Define only if KERBEROS is defined.
239
240 Declare file-scope functions and variables static if not exported.
241 This is more consistent, and is nicer with gcc -Wstrict-prototypes.
242 * ebrowse.c, emacsclient.c, fakemail.c, make-docfile.c, movemail.c:
243 * profile.c, test-distrib.c, update-game-score.c:
244 Declare non-'main' functions and variables to be static.
245 * ebrowse.c: Omit redundant function prototypes.
246
2472011-02-21 Eli Zaretskii <eliz@gnu.org>
248
249 * makefile.w32-in ($(BLD)/ctags.$(O), $(BLD)/emacsclient.$(O))
250 ($(BLD)/etags.$(O), $(BLD)/movemail.$(O), $(BLD)/ntlib.$(O)):
251 Depend on $(EMACS_ROOT)/nt/inc/sys/stat.h.
252
2532011-02-21 Ben Key <bkey76@gmail.com>
254
255 * make-docfile.c (scan_c_file): Adapt DEFVAR_PER_BUFFER case to
256 the new BVAR macro.
257
2582011-02-20 Juanma Barranquero <lekktu@gmail.com>
259
260 * makefile.w32-in (obj): Remove md5.o.
261
2622011-02-18 Karl Chen <Karl.Chen@quarl.org>
263
264 * emacsclient.c (main): Loop while `recv' return EINTR.
265
2662011-02-09 Paul Eggert <eggert@cs.ucla.edu>
267
268 * make-docfile.c (EMACS_INTEGER): Rename from EMACS_INT.
269 This avoids collision with config.h's EMACS_INT on some
270 configurations. All uses changed.
271
2722011-02-08 Tom Tromey <tromey@redhat.com>
273
274 * make-docfile.c: Unconditionally include stdlib.h.
275 (generate_globals): New global.
276 (xrealloc): New function.
277 (main): Handle '-g'. Call start_globals, write_globals.
278 (scan_file): Conditionally call put_filename.
279 (start_globals): New function.
280 (struct global): New.
281 (num_globals, globals): New globals.
282 (add_global, compare_globals, write_globals): New functions.
283 (scan_c_file): Update for "-g".
284 (scan_lisp_file): Fail if "-g".
285
12011-02-05 Paul Eggert <eggert@cs.ucla.edu> 2862011-02-05 Paul Eggert <eggert@cs.ucla.edu>
2 287
3 * emacsclient.c: conform to C89 pointer rules 288 * emacsclient.c: Conform to C89 pointer rules.
4 (file_name_absolute_p): Accept const char *, not const unsigned 289 (file_name_absolute_p): Accept const char *, not const unsigned
5 char *, to satisfy C89 rules. 290 char *, to satisfy C89 rules.
6 291
72011-02-02 Eli Zaretskii <eliz@gnu.org> 2922011-02-02 Eli Zaretskii <eliz@gnu.org>
8 293
9 * makefile.w32-in (ETAGS_CFLAGS, CTAGS_CFLAGS): Add 294 * makefile.w32-in (ETAGS_CFLAGS, CTAGS_CFLAGS):
10 ``-DEMACS_NAME="\"GNU Emacs\""''. 295 Add ``-DEMACS_NAME="\"GNU Emacs\""''.
11 (obj): Remove strftime.o. 296 (obj): Remove strftime.o.
12 297
132011-01-31 Eli Zaretskii <eliz@gnu.org> 2982011-01-31 Eli Zaretskii <eliz@gnu.org>
@@ -158,7 +443,7 @@
158 * test-distrib.c (cool_read): 443 * test-distrib.c (cool_read):
159 * movemail.c (main, concat): 444 * movemail.c (main, concat):
160 * make-docfile.c (scan_file, write_c_args): 445 * make-docfile.c (scan_file, write_c_args):
161 * emacsclient.c (get_server_config): Fix -Wconversion warning. 446 * emacsclient.c (get_server_config): Fix -Wconversion warning.
162 (egetenv): Move conditional definition earlier. 447 (egetenv): Move conditional definition earlier.
163 (progname): Use const. 448 (progname): Use const.
164 * sorted-doc.c (xstrdup): Use const. 449 * sorted-doc.c (xstrdup): Use const.
@@ -212,8 +497,8 @@
212 497
213 * movemail.c (fatal, error, concat): Use const char *. 498 * movemail.c (fatal, error, concat): Use const char *.
214 499
215 * make-docfile.c (error, fatal, scan_c_file, scan_lisp_file): Use 500 * make-docfile.c (error, fatal, scan_c_file, scan_lisp_file):
216 const char *. 501 Use const char *.
217 502
218 * etags.c (compressor, language, Ada_suffix, Ada_help, Asm_suffixes) 503 * etags.c (compressor, language, Ada_suffix, Ada_help, Asm_suffixes)
219 (Asm_help, default_C_suffixes, default_C_help, Cplusplus_suffixes) 504 (Asm_help, default_C_suffixes, default_C_help, Cplusplus_suffixes)
@@ -518,7 +803,7 @@
518 autoconf, not cpp. 803 autoconf, not cpp.
519 (ALL_CFLAGS): Use them as make variables. 804 (ALL_CFLAGS): Use them as make variables.
520 805
5212010-04-07 Christoph <cschol2112@googlemail.com> (tiny change) 8062010-04-07 Christoph Scholtes <cschol2112@googlemail.com>
522 807
523 * makefile.w32-in (OTHER_PLATFORM_SUPPORT): Use parenthesis 808 * makefile.w32-in (OTHER_PLATFORM_SUPPORT): Use parenthesis
524 for macros for nmake compatibility. 809 for macros for nmake compatibility.
@@ -531,8 +816,8 @@
531 816
5322010-04-02 Dan Rosenberg <dan.j.rosenberg@gmail.com> (tiny change) 8172010-04-02 Dan Rosenberg <dan.j.rosenberg@gmail.com> (tiny change)
533 818
534 * movemail.c (main): Check return values of setuid. Avoid 819 * movemail.c (main): Check return values of setuid.
535 possibility of symlink attack when movemail is setgid mail 820 Avoid possibility of symlink attack when movemail is setgid mail
536 (CVE-2010-0825). 821 (CVE-2010-0825).
537 822
5382010-04-02 Dan Nicolaescu <dann@ics.uci.edu> 8232010-04-02 Dan Nicolaescu <dann@ics.uci.edu>
@@ -2238,7 +2523,7 @@
2238 (wchar.h): Include, maybe. 2523 (wchar.h): Include, maybe.
2239 (attribute_hidden): Define if not defined. 2524 (attribute_hidden): Define if not defined.
2240 (__getopt_initialized): Use attribute_hidden. 2525 (__getopt_initialized): Use attribute_hidden.
2241 (__libc_argc, __libc_argv): Renamed from original_argc, etc. 2526 (__libc_argc, __libc_argv): Rename from original_argc, etc.
2242 (__getopt_nonoption_flags, nonoption_flags_max_len) 2527 (__getopt_nonoption_flags, nonoption_flags_max_len)
2243 (nonoption_flags_len): Conditional on USE_NONOPTION_FLAGS. 2528 (nonoption_flags_len): Conditional on USE_NONOPTION_FLAGS.
2244 (SWAP_FLAGS): New definitions. 2529 (SWAP_FLAGS): New definitions.
@@ -2341,7 +2626,7 @@
23412002-08-29 Francesco Potortì <pot@gnu.org> 26262002-08-29 Francesco Potortì <pot@gnu.org>
2342 2627
2343 * etags.c (C_entries): Correct a problem with const C++ funcs. 2628 * etags.c (C_entries): Correct a problem with const C++ funcs.
2344 (ignoreindent): Renamed from noindentypedefs. 2629 (ignoreindent): Rename from noindentypedefs.
2345 (cjava, cplpl): They are now macros instead of local vars. 2630 (cjava, cplpl): They are now macros instead of local vars.
2346 2631
23472002-08-28 Francesco Potortì <pot@gnu.org> 26322002-08-28 Francesco Potortì <pot@gnu.org>
@@ -2357,7 +2642,7 @@
2357 (strcaseeq): Make it into a macro. 2642 (strcaseeq): Make it into a macro.
2358 2643
2359 * etags.c (make_tag): Never generate null length tag names. 2644 * etags.c (make_tag): Never generate null length tag names.
2360 (linebuffer_init): Renamed from initbuffer. All callers changed. 2645 (linebuffer_init): Rename from initbuffer. All callers changed.
2361 (pattern): Structure renamed to `regexp', member regex renamed to 2646 (pattern): Structure renamed to `regexp', member regex renamed to
2362 pattern. 2647 pattern.
2363 (node_st): Member pat renamed to regex. 2648 (node_st): Member pat renamed to regex.
@@ -2514,8 +2799,8 @@
2514 2799
25152002-05-30 Richard M. Stallman <rms@gnu.org> 28002002-05-30 Richard M. Stallman <rms@gnu.org>
2516 2801
2517 * Makefile.in (LIBS_MAIL): Renamed from LIB_MAIL. 2802 * Makefile.in (LIBS_MAIL): Rename from LIB_MAIL.
2518 (LIBS_MOVE): Renamed from MOVE_LIBS. 2803 (LIBS_MOVE): Rename from MOVE_LIBS.
2519 2804
25202002-05-26 Paul Eggert <eggert@twinsun.com> 28052002-05-26 Paul Eggert <eggert@twinsun.com>
2521 2806
@@ -2796,21 +3081,21 @@
2796 (get_tag): Return a pointer to the tag that is found. 3081 (get_tag): Return a pointer to the tag that is found.
2797 3082
2798 * etags.c (LOOKING_AT): Use !intoken instead of iswhite. 3083 * etags.c (LOOKING_AT): Use !intoken instead of iswhite.
2799 (F_takeprec): Renamed from takeprec. All callers changed. 3084 (F_takeprec): Rename from takeprec. All callers changed.
2800 (F_getit): Renamed from getit. All callers changed. 3085 (F_getit): Rename from getit. All callers changed.
2801 (nocase_tail): Renamed from tail. All callers changed. 3086 (nocase_tail): Rename from tail. All callers changed.
2802 (Ada_getit): Renamed from adagetit. All callers changed. 3087 (Ada_getit): Rename from adagetit. All callers changed.
2803 (L_getit): Simplify by using get_tag. 3088 (L_getit): Simplify by using get_tag.
2804 (Perl_functions, Postscript_functions, erlang_attribute): Use the 3089 (Perl_functions, Postscript_functions, erlang_attribute): Use the
2805 modified LOOKING_AT. 3090 modified LOOKING_AT.
2806 (notinname): Removed '[' and added ')' to the recognised chars. 3091 (notinname): Remove '[' and added ')' to the recognised chars.
2807 (LOOKING_AT, get_tag, PHP_functions): Use notinname. 3092 (LOOKING_AT, get_tag, PHP_functions): Use notinname.
2808 (Ada_getit, Ada_funcs, Python_functions, Scheme_functions): 3093 (Ada_getit, Ada_funcs, Python_functions, Scheme_functions):
2809 Clarified, using strneq or notinname. 3094 Clarified, using strneq or notinname.
2810 (L_isdef, L_isquote): Removed. 3095 (L_isdef, L_isquote): Removed.
2811 (Lisp_functions, L_getit): Clarified. 3096 (Lisp_functions, L_getit): Clarified.
2812 3097
2813 * etags.c (P_): Renamed to __P for consistency with config.h. 3098 * etags.c (P_): Rename to __P for consistency with config.h.
2814 [HAVE_CONFIG_H]: Let config.h deal with __P. 3099 [HAVE_CONFIG_H]: Let config.h deal with __P.
2815 [__STDC__] [!HAVE_CONFIG_H]: Define PTR as in config.h. 3100 [__STDC__] [!HAVE_CONFIG_H]: Define PTR as in config.h.
2816 [!__STDC__] [!HAVE_CONFIG_H]: Do not undefine static, because 3101 [!__STDC__] [!HAVE_CONFIG_H]: Do not undefine static, because
@@ -2869,7 +3154,7 @@
2869 (Perl_functions, Python_functions, PHP_functions) 3154 (Perl_functions, Python_functions, PHP_functions)
2870 (Scheme_functions, Texinfo_nodes): Use it. 3155 (Scheme_functions, Texinfo_nodes): Use it.
2871 (Perl_functions): Use strneq. 3156 (Perl_functions): Use strneq.
2872 (prolog_pred): Renamed to prolog_pr. 3157 (prolog_pred): Rename to prolog_pr.
2873 (prolog_pr): Recognise Prolog rules in addition to predicates. 3158 (prolog_pr): Recognise Prolog rules in addition to predicates.
2874 [ETAGS_REGEXPS] [!HAVE_CONFIG_H] [__CYGWIN__]: Prevent 3159 [ETAGS_REGEXPS] [!HAVE_CONFIG_H] [__CYGWIN__]: Prevent
2875 unmodified compile, as Cygwin's regex.h is incompatible with us. 3160 unmodified compile, as Cygwin's regex.h is incompatible with us.
@@ -2968,7 +3253,7 @@
2968 3253
29692001-10-13 Gerd Moellmann <gerd@gnu.org> 32542001-10-13 Gerd Moellmann <gerd@gnu.org>
2970 3255
2971 * make-docfile.c (read_c_string_or_comment): Renamed from 3256 * make-docfile.c (read_c_string_or_comment): Rename from
2972 read_c_string. Add parameter COMMENT. Read C-style comments. 3257 read_c_string. Add parameter COMMENT. Read C-style comments.
2973 (scan_c_file): Handle doc strings in C comments. 3258 (scan_c_file): Handle doc strings in C comments.
2974 3259
@@ -3227,12 +3512,12 @@
3227 3512
32282001-01-25 Francesco Potortì <pot@gnu.org> 35132001-01-25 Francesco Potortì <pot@gnu.org>
3229 3514
3230 * etags.c (struct tok): Renamed from struct token. 3515 * etags.c (struct tok): Rename from struct token.
3231 (token): Renamed from tok. 3516 (token): Rename from tok.
3232 (structtype): Make it a local variable. 3517 (structtype): Make it a local variable.
3233 [DEBUG]: Use assert. 3518 [DEBUG]: Use assert.
3234 (xrnew): Change the synopsis. 3519 (xrnew): Change the synopsis.
3235 (typedefs_or_cplusplus): Renamed from typedefs_and_cplusplus. 3520 (typedefs_or_cplusplus): Rename from typedefs_and_cplusplus.
3236 (grow_linebuffer): Don't call xrnew when not needed. 3521 (grow_linebuffer): Don't call xrnew when not needed.
3237 (token): Buffer renamed to line. 3522 (token): Buffer renamed to line.
3238 (C_entries): Three calls to inibuffer moved here from main. 3523 (C_entries): Three calls to inibuffer moved here from main.
@@ -3261,16 +3546,16 @@
3261 3546
32622001-01-14 Francesco Potortì <pot@gnu.org> 35472001-01-14 Francesco Potortì <pot@gnu.org>
3263 3548
3264 * etags.c (get_language_from_langname): Renamed from 3549 * etags.c (get_language_from_langname): Rename from
3265 get_language_from_name. 3550 get_language_from_name.
3266 (get_language_from_filename): Renamed from get_language_from_suffix. 3551 (get_language_from_filename): Rename from get_language_from_suffix.
3267 Now first looks for the complete file name. 3552 Now first looks for the complete file name.
3268 (language): New member char **filenames. 3553 (language): New member char **filenames.
3269 (Makefile_filenames): List of possible filenames for makefiles. 3554 (Makefile_filenames): List of possible filenames for makefiles.
3270 (lang_names): Add a NULL member for every entry, added an entry 3555 (lang_names): Add a NULL member for every entry, added an entry
3271 for makefiles. 3556 for makefiles.
3272 (Makefile_targets): New function. 3557 (Makefile_targets): New function.
3273 (Texinfo_nodes): Renamed from Texinfo_fuctions and made 3558 (Texinfo_nodes): Rename from Texinfo_fuctions and made
3274 it conformant to the style of the rest of the code. 3559 it conformant to the style of the rest of the code.
3275 3560
32762001-01-13 Gerd Moellmann <gerd@gnu.org> 35612001-01-13 Gerd Moellmann <gerd@gnu.org>
@@ -3409,7 +3694,7 @@
3409 3694
34102000-07-14 Gerd Moellmann <gerd@gnu.org> 36952000-07-14 Gerd Moellmann <gerd@gnu.org>
3411 3696
3412 * ebrowse.c (xrealloc, xmalloc): Renamed from yrealloc and ymalloc. 3697 * ebrowse.c (xrealloc, xmalloc): Rename from yrealloc and ymalloc.
3413 3698
3414 * etags.c (xmalloc, xrealloc): Make externally visible, for use 3699 * etags.c (xmalloc, xrealloc): Make externally visible, for use
3415 by alloca.o. 3700 by alloca.o.
@@ -3446,8 +3731,8 @@
3446 3731
34472000-06-06 Gerd Moellmann <gerd@gnu.org> 37322000-06-06 Gerd Moellmann <gerd@gnu.org>
3448 3733
3449 * ebrowse.c (ymalloc): Renamed from xmalloc. 3734 * ebrowse.c (ymalloc): Rename from xmalloc.
3450 (yrealloc): Renamed from xrealloc. 3735 (yrealloc): Rename from xrealloc.
3451 3736
34522000-05-21 Dave Love <fx@gnu.org> 37372000-05-21 Dave Love <fx@gnu.org>
3453 3738
@@ -3670,7 +3955,7 @@
3670 corrects a bug. All callers changed. 3955 corrects a bug. All callers changed.
3671 (canonicalize_filename): New function. 3956 (canonicalize_filename): New function.
3672 (process_file, etags_getcwd, absolute_dirname): Use it. 3957 (process_file, etags_getcwd, absolute_dirname): Use it.
3673 (relative_filename, absolute_filename): Removed var shadowing. 3958 (relative_filename, absolute_filename): Remove var shadowing.
3674 (C_entries, Pascal_functions): Add fake initializations to keep 3959 (C_entries, Pascal_functions): Add fake initializations to keep
3675 compilers quiet. 3960 compilers quiet.
3676 (TeX_functions, Prolog_functions, Erlang_functions): Cleanup. 3961 (TeX_functions, Prolog_functions, Erlang_functions): Cleanup.
@@ -3960,8 +4245,8 @@
3960 4245
39611998-05-01 Andrew Innes <andrewi@harlequin.co.uk> 42461998-05-01 Andrew Innes <andrewi@harlequin.co.uk>
3962 4247
3963 * movemail.c [WINDOWSNT]: Undefine DISABLE_DIRECT_ACCESS. Force 4248 * movemail.c [WINDOWSNT]: Undefine DISABLE_DIRECT_ACCESS.
3964 all file i/o to be in binary mode. Include ntlib.h. 4249 Force all file i/o to be in binary mode. Include ntlib.h.
3965 4250
39661998-04-27 Andreas Schwab <schwab@delysid.gnu.org> 42511998-04-27 Andreas Schwab <schwab@delysid.gnu.org>
3967 4252
@@ -3993,8 +4278,8 @@
3993 return types. Add forward declarations. 4278 return types. Add forward declarations.
3994 * emacsclient.c: Include <stdlib.h> and <unistd.h> if available. 4279 * emacsclient.c: Include <stdlib.h> and <unistd.h> if available.
3995 Don't declare geteuid. 4280 Don't declare geteuid.
3996 (print_help_and_exit): Change return type to void. Forward 4281 (print_help_and_exit): Change return type to void.
3997 declare it. 4282 Forward declare it.
3998 * b2m.c: Include <stdlib.h> if available. 4283 * b2m.c: Include <stdlib.h> if available.
3999 (main): Explicitly declare return type. 4284 (main): Explicitly declare return type.
4000 4285
@@ -4006,7 +4291,7 @@
4006 4291
40071998-03-26 Richard Stallman <rms@psilocin.gnu.org> 42921998-03-26 Richard Stallman <rms@psilocin.gnu.org>
4008 4293
4009 * pop.c (pop_getline): Renamed from getline. 4294 * pop.c (pop_getline): Rename from getline.
4010 4295
40111998-03-05 Richard Stallman <rms@psilocin.gnu.org> 42961998-03-05 Richard Stallman <rms@psilocin.gnu.org>
4012 4297
@@ -4031,8 +4316,8 @@
4031 with a '>' any lines starting with "From " read from the POP server, 4316 with a '>' any lines starting with "From " read from the POP server,
4032 but leave the code in place, wrapped in #ifdef 4317 but leave the code in place, wrapped in #ifdef
4033 MOVEMAIL_QUOTE_POP_FROM_LINES, in case we have to restore it later 4318 MOVEMAIL_QUOTE_POP_FROM_LINES, in case we have to restore it later
4034 because it turns out that something is depending on it. Change 4319 because it turns out that something is depending on it.
4035 suggested by Paul Eggert <eggert@twinsun.com>. 4320 Change suggested by Paul Eggert <eggert@twinsun.com>.
4036 Convert the character \037 (^_) at the beginning of a line into 4321 Convert the character \037 (^_) at the beginning of a line into
4037 the character '^' followed by the character '_', because otherwise 4322 the character '^' followed by the character '_', because otherwise
4038 Emacs can't parse the resulting file as a valid BABYL file. 4323 Emacs can't parse the resulting file as a valid BABYL file.
@@ -4049,8 +4334,8 @@
4049 quotes with a '>' any lines starting with "From " read from the 4334 quotes with a '>' any lines starting with "From " read from the
4050 POP server, but leave the code in place, wrapped in #ifdef 4335 POP server, but leave the code in place, wrapped in #ifdef
4051 MOVEMAIL_QUOTE_POP_FROM_LINES, in case we have to restore it later 4336 MOVEMAIL_QUOTE_POP_FROM_LINES, in case we have to restore it later
4052 because it turns out that something is depending on it. Change 4337 because it turns out that something is depending on it.
4053 suggested by Paul Eggert <eggert@twinsun.com>. 4338 Change suggested by Paul Eggert <eggert@twinsun.com>.
4054 4339
4055 Convert the character \037 (^_) at the beginning of a line into 4340 Convert the character \037 (^_) at the beginning of a line into
4056 the character '^' followed by the character '_', because otherwise 4341 the character '^' followed by the character '_', because otherwise
@@ -4066,8 +4351,8 @@
4066 4351
40671997-10-31 Jonathan I. Kamens <jik@kamens.brookline.ma.us> 43521997-10-31 Jonathan I. Kamens <jik@kamens.brookline.ma.us>
4068 4353
4069 * pop.c (fullwrite): Get rid of an extra call to write. Problem 4354 * pop.c (fullwrite): Get rid of an extra call to write.
4070 pointed out by Chiaki Ishikawa. 4355 Problem pointed out by Chiaki Ishikawa.
4071 4356
40721997-10-16 Dave Love <d.love@dl.ac.uk> 43571997-10-16 Dave Love <d.love@dl.ac.uk>
4073 4358
@@ -4207,8 +4492,8 @@
4207 (C_entries): Initialise tok.named. 4492 (C_entries): Initialise tok.named.
4208 (sym_type, C_stab_entry, consider_token): st_C_ignore is used to 4493 (sym_type, C_stab_entry, consider_token): st_C_ignore is used to
4209 get rid of "import", "package" and "friend". 4494 get rid of "import", "package" and "friend".
4210 (fvdef): Renamed from funcdef. Also some constants renamed. All 4495 (fvdef): Rename from funcdef. Also some constants renamed.
4211 users changed. 4496 All users changed.
4212 (C_entries): Make separate tags for variables separated by comma. 4497 (C_entries): Make separate tags for variables separated by comma.
4213 (globals, members): New flags. 4498 (globals, members): New flags.
4214 (main, C_entries): Use them. 4499 (main, C_entries): Use them.
@@ -4222,7 +4507,7 @@
4222 (consider_token, C_entries): Set the len member of token_name. 4507 (consider_token, C_entries): Set the len member of token_name.
4223 (prolog_pred): Cleanup according to GNU coding standards. 4508 (prolog_pred): Cleanup according to GNU coding standards.
4224 (Cobol_suffixes, lang_names, Cobol_paragraphs): Cobol support. 4509 (Cobol_suffixes, lang_names, Cobol_paragraphs): Cobol support.
4225 (prolog_white, erlang_white): Renamed to eat_white, callers changed. 4510 (prolog_white, erlang_white): Rename to eat_white, callers changed.
4226 4511
42271997-05-15 Francesco Potortì <F.Potorti@cnuce.cnr.it> 45121997-05-15 Francesco Potortì <F.Potorti@cnuce.cnr.it>
4228 4513
@@ -4425,7 +4710,7 @@
4425 4710
4426 * etags.c (relative_filename): Bug corrected. 4711 * etags.c (relative_filename): Bug corrected.
4427 (etags_getcwd): Avoid warning of unused variable. 4712 (etags_getcwd): Avoid warning of unused variable.
4428 (C_entries, consider_token): Added support for enum labels. 4713 (C_entries, consider_token): Add support for enum labels.
4429 4714
44301996-11-03 Paul Eggert <eggert@twinsun.com> 47151996-11-03 Paul Eggert <eggert@twinsun.com>
4431 4716
@@ -4668,14 +4953,14 @@
4668 4953
46691996-04-29 Richard Stallman <rms@delasyd.gnu.ai.mit.edu> 49541996-04-29 Richard Stallman <rms@delasyd.gnu.ai.mit.edu>
4670 4955
4671 * pop.c (SEND, RECV): Renamed from send, recv. 4956 * pop.c (SEND, RECV): Rename from send, recv.
4672 (pop_open, pop_trash): Make the trash_started code unconditional. 4957 (pop_open, pop_trash): Make the trash_started code unconditional.
4673 (socket_connection): Delete casts to void. 4958 (socket_connection): Delete casts to void.
4674 4959
46751996-04-28 Richard Stallman <rms@delasyd.gnu.ai.mit.edu> 49601996-04-28 Richard Stallman <rms@delasyd.gnu.ai.mit.edu>
4676 4961
4677 * movemail.c (DIRECTORY_SEP, IS_DIRECTORY_SEP): Definitions 4962 * movemail.c (DIRECTORY_SEP, IS_DIRECTORY_SEP):
4678 copied from lisp.h. 4963 Definitions copied from lisp.h.
4679 4964
46801996-04-22 Andrew Innes <andrewi@harlequin.co.uk> 49651996-04-22 Andrew Innes <andrewi@harlequin.co.uk>
4681 4966
@@ -4785,7 +5070,7 @@
4785 (lang_names): Erlang entry added. 5070 (lang_names): Erlang entry added.
4786 (prolog_getit): Accepts headers spanning several lines. 5071 (prolog_getit): Accepts headers spanning several lines.
4787 Always name tags. 5072 Always name tags.
4788 (Prolog_functions): Removed incorrect compensation for 5073 (Prolog_functions): Remove incorrect compensation for
4789 newline characters. 5074 newline characters.
4790 (readline_internal): Zero-terminate last line. 5075 (readline_internal): Zero-terminate last line.
4791 5076
@@ -4850,7 +5135,7 @@
4850 5135
48511995-12-01 Richard Stallman <rms@whiz-bang.gnu.ai.mit.edu> 51361995-12-01 Richard Stallman <rms@whiz-bang.gnu.ai.mit.edu>
4852 5137
4853 * Makefile.in (THIS_IS_MAKEFILE): Renamed from THIS_IS_YMAKEFILE. 5138 * Makefile.in (THIS_IS_MAKEFILE): Rename from THIS_IS_YMAKEFILE.
4854 5139
48551995-12-07 Francesco Potortì <pot@cnuce.cnr.it> 51401995-12-07 Francesco Potortì <pot@cnuce.cnr.it>
4856 5141
@@ -4867,11 +5152,11 @@
48671995-12-06 Francesco Potortì <pot@cnuce.cnr.it> 51521995-12-06 Francesco Potortì <pot@cnuce.cnr.it>
4868 5153
4869 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++. 5154 * etags.c (Cplusplus_suffixes): Add .M suffix for Objective C++.
4870 (gperf): Added keywords for Objective C and GNU macros. 5155 (gperf): Add keywords for Objective C and GNU macros.
4871 (sym_type): Added values to account for Objective C and GNU macros. 5156 (sym_type): Add values to account for Objective C and GNU macros.
4872 (begtk): The '@' character can start a token. 5157 (begtk): The '@' character can start a token.
4873 (objdef, methodlen, objtag): New variables for Objective C. 5158 (objdef, methodlen, objtag): New variables for Objective C.
4874 (consider_token, C_entries): Added code for Objective C. 5159 (consider_token, C_entries): Add code for Objective C.
4875 (plain_C_suffixes): Add .m and .lm for Objective C. 5160 (plain_C_suffixes): Add .m and .lm for Objective C.
4876 (Yacc_suffixes): Add .ym for Objective yacc. 5161 (Yacc_suffixes): Add .ym for Objective yacc.
4877 (GROW_LINEBUFFER): New macro. 5162 (GROW_LINEBUFFER): New macro.
@@ -4912,8 +5197,8 @@
4912 5197
49131995-11-06 Francesco Potortì (pot@cnuce.cnr.it) 51981995-11-06 Francesco Potortì (pot@cnuce.cnr.it)
4914 5199
4915 * etags.c (get_lang_from_name, get_lang_from_interpreter, 5200 * etags.c (get_lang_from_name, get_lang_from_interpreter)
4916 get_lang_from_suffix): New functions. 5201 (get_lang_from_suffix): New functions.
4917 (get_language): Function deleted. 5202 (get_language): Function deleted.
4918 (lang_entry): Two members added to struct. 5203 (lang_entry): Two members added to struct.
4919 (lang_names): Reflect the new layout of lang_entry. 5204 (lang_names): Reflect the new layout of lang_entry.
@@ -4928,12 +5213,12 @@
4928 * etags.c (lowcase): Use the standard tolower function. 5213 * etags.c (lowcase): Use the standard tolower function.
4929 (substitute): Remove some wrong and some useless code related with 5214 (substitute): Remove some wrong and some useless code related with
4930 escape '\' character in regexp replacement string. 5215 escape '\' character in regexp replacement string.
4931 (TEX_defenv): Added part, appendix, entry, index. Removed typeout. 5216 (TEX_defenv): Add part, appendix, entry, index. Remove typeout.
4932 (lang_suffixes): New suffixes: .hpp for C++; .f90 for Fortran; 5217 (lang_suffixes): New suffixes: .hpp for C++; .f90 for Fortran;
4933 .bib, .ltx, .TeX for TeX (.bbl, .dtx removed); .ml for Lisp; 5218 .bib, .ltx, .TeX for TeX (.bbl, .dtx removed); .ml for Lisp;
4934 .prolog for prolog (.pl removed). 5219 .prolog for prolog (.pl removed).
4935 (massage_name, etags_getcwd): Use lowcase instead of tolower. 5220 (massage_name, etags_getcwd): Use lowcase instead of tolower.
4936 (C_entries, find_entries): Added comments about memory leakage. 5221 (C_entries, find_entries): Add comments about memory leakage.
4937 (add_node): Dead code removed. 5222 (add_node): Dead code removed.
4938 5223
49391995-10-29 Richard Stallman <rms@mole.gnu.ai.mit.edu> 52241995-10-29 Richard Stallman <rms@mole.gnu.ai.mit.edu>
@@ -5175,7 +5460,7 @@
5175 5460
51761995-04-08 Richard Stallman <rms@mole.gnu.ai.mit.edu> 54611995-04-08 Richard Stallman <rms@mole.gnu.ai.mit.edu>
5177 5462
5178 * Makefile.in.in (BASE_CFLAGS): Renamed from ALLOCA_CFLAGS. 5463 * Makefile.in.in (BASE_CFLAGS): Rename from ALLOCA_CFLAGS.
5179 (alloca.o, regex.o): Use BASE_CFLAGS. 5464 (alloca.o, regex.o): Use BASE_CFLAGS.
5180 5465
51811995-04-06 Richard Stallman <rms@mole.gnu.ai.mit.edu> 54661995-04-06 Richard Stallman <rms@mole.gnu.ai.mit.edu>
@@ -5185,7 +5470,7 @@
51851995-04-04 Karl Heuer <kwzh@gnu.ai.mit.edu> 54701995-04-04 Karl Heuer <kwzh@gnu.ai.mit.edu>
5186 5471
5187 * Makefile.in.in (aixcc, aixcc.c): Targets deleted. 5472 * Makefile.in.in (aixcc, aixcc.c): Targets deleted.
5188 (SOURCES, distclean): Removed obsolete references to aixcc. 5473 (SOURCES, distclean): Remove obsolete references to aixcc.
5189 5474
51901995-04-02 Richard Stallman <rms@mole.gnu.ai.mit.edu> 54751995-04-02 Richard Stallman <rms@mole.gnu.ai.mit.edu>
5191 5476
@@ -5228,7 +5513,7 @@
5228 savetok.valid. Mark token as valid when it is initialised. 5513 savetok.valid. Mark token as valid when it is initialised.
5229 (make_tag): Make token only if token is valid and reset validity. 5514 (make_tag): Make token only if token is valid and reset validity.
5230 (CNL_SAVE_DEFINEDEF): Test for savetok.valid instead of token_saved. 5515 (CNL_SAVE_DEFINEDEF): Test for savetok.valid instead of token_saved.
5231 (TOKEN): Added a new member: valid. 5516 (TOKEN): Add a new member: valid.
5232 5517
52331995-02-15 Francesco Potortì (pot@cnuce.cnr.it) 55181995-02-15 Francesco Potortì (pot@cnuce.cnr.it)
5234 5519
@@ -5250,12 +5535,12 @@
5250 5535
52511995-02-07 Richard Stallman <rms@pogo.gnu.ai.mit.edu> 55361995-02-07 Richard Stallman <rms@pogo.gnu.ai.mit.edu>
5252 5537
5253 * Makefile.in.in (maintainer-clean): Renamed from realclean. 5538 * Makefile.in.in (maintainer-clean): Rename from realclean.
5254 5539
52551995-02-01 Francesco Potortì (pot@cnuce.cnr.it) 55401995-02-01 Francesco Potortì (pot@cnuce.cnr.it)
5256 5541
5257 * etags.c (pfnote): Initialise been_warned in the node. 5542 * etags.c (pfnote): Initialise been_warned in the node.
5258 (C_entries): Removed a speed hack for the sake of clarity. 5543 (C_entries): Remove a speed hack for the sake of clarity.
5259 5544
52601995-01-18 Francesco Potortì (pot@cnuce.cnr.it) 55451995-01-18 Francesco Potortì (pot@cnuce.cnr.it)
5261 5546
@@ -5374,7 +5659,7 @@
5374 (print_help): Help strings updated. Calls print_language_names. 5659 (print_help): Help strings updated. Calls print_language_names.
5375 (argument_type, ARGUMENT): Typedefs for dealing with language and 5660 (argument_type, ARGUMENT): Typedefs for dealing with language and
5376 regex options intermixed with filenames. 5661 regex options intermixed with filenames.
5377 (main): Changed the way of dealing with arguments on the command 5662 (main): Change the way of dealing with arguments on the command
5378 line to deal with language and regex options intermixed with 5663 line to deal with language and regex options intermixed with
5379 filenames. 5664 filenames.
5380 (get_language, default_C_entries, Cplusplus_entries, 5665 (get_language, default_C_entries, Cplusplus_entries,
@@ -5463,8 +5748,8 @@
5463 5748
5464 * pop.c: Don't include <string.h> and <strings.h>. 5749 * pop.c: Don't include <string.h> and <strings.h>.
5465 5750
5466 * pop.c: Include <des.h> before <krb.h>, rather than after. They 5751 * pop.c: Include <des.h> before <krb.h>, rather than after.
5467 should be interchangeable, and indeed the inclusion is done in 5752 They should be interchangeable, and indeed the inclusion is done in
5468 both orders in various files in the Kerberos 4 library sources, 5753 both orders in various files in the Kerberos 4 library sources,
5469 but djm@va.pubnix.com (David J. MacKenzie) reports that BSDI 5754 but djm@va.pubnix.com (David J. MacKenzie) reports that BSDI
5470 requires that <des.h> be included first, and I don't see any harm 5755 requires that <des.h> be included first, and I don't see any harm
@@ -5494,8 +5779,8 @@
5494 5779
54951994-10-17 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> 57801994-10-17 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
5496 5781
5497 * emacsserver.c [SYSV_IPC] (main): Catch SIGHUP as well. Don't 5782 * emacsserver.c [SYSV_IPC] (main): Catch SIGHUP as well.
5498 call kill with pid 0. Handle EINTR when receiving messages. 5783 Don't call kill with pid 0. Handle EINTR when receiving messages.
5499 5784
55001994-10-17 Karl Heuer <kwzh@gnu.ai.mit.edu> 57851994-10-17 Karl Heuer <kwzh@gnu.ai.mit.edu>
5501 5786
@@ -5526,7 +5811,7 @@
5526 * Makefile.in.in (clean): rm DOC* and *.tab.[ch]. 5811 * Makefile.in.in (clean): rm DOC* and *.tab.[ch].
5527 (distclean): Not here. 5812 (distclean): Not here.
5528 5813
5529 * Makefile.in.in (libexecdir): Renamed from libdir. 5814 * Makefile.in.in (libexecdir): Rename from libdir.
5530 5815
55311994-10-11 Francesco Potortì (pot@cnuce.cnr.it) 58161994-10-11 Francesco Potortì (pot@cnuce.cnr.it)
5532 5817
@@ -5756,7 +6041,7 @@
5756 print advice to run it, if it has anything significant to do. 6041 print advice to run it, if it has anything significant to do.
5757 And only if MOVEMAIL_NEEDS_BLESSING. 6042 And only if MOVEMAIL_NEEDS_BLESSING.
5758 (blessmail): Use emacs, not temacs. 6043 (blessmail): Use emacs, not temacs.
5759 (configuration): Renamed from configname. 6044 (configuration): Rename from configname.
5760 6045
57611994-04-30 Morten Welinder (terra@diku.dk) 60461994-04-30 Morten Welinder (terra@diku.dk)
5762 6047
@@ -5840,15 +6125,15 @@
5840 6125
58411994-04-08 Francesco Potortì (pot@fly.cnuce.cnr.it) 61261994-04-08 Francesco Potortì (pot@fly.cnuce.cnr.it)
5842 6127
5843 * etags.c (outf, outfiledir): Renamed to tagf, tagfiledir. 6128 * etags.c (outf, outfiledir): Rename to tagf, tagfiledir.
5844 (PF_funcs, Asm_funcs, L_funcs, PAS_funcs, TEX_funcs) 6129 (PF_funcs, Asm_funcs, L_funcs, PAS_funcs, TEX_funcs)
5845 (Scheme_funcs, prolog_funcs): Renamed to Fortran_functions, 6130 (Scheme_funcs, prolog_funcs): Rename to Fortran_functions,
5846 Asm_labels, Lisp_functions, Pascal_functions, Scheme_functions, 6131 Asm_labels, Lisp_functions, Pascal_functions, Scheme_functions,
5847 TeX_functions, Prolog_functions. 6132 TeX_functions, Prolog_functions.
5848 (inf): No more a global variable. 6133 (inf): No more a global variable.
5849 (C_entries): Take 2nd parameter `inf' instead of using the global one. 6134 (C_entries): Take 2nd parameter `inf' instead of using the global one.
5850 (find_entries): Added the cp1 var for optimisation. 6135 (find_entries): Add the cp1 var for optimisation.
5851 (find_entries): Added more suffixes for assembler files. 6136 (find_entries): Add more suffixes for assembler files.
5852 (Asm_funcs): Now finds labels even without an ending colon. 6137 (Asm_funcs): Now finds labels even without an ending colon.
5853 6138
58541994-03-30 Francesco Potortì (pot@fly.cnuce.cnr.it) 61391994-03-30 Francesco Potortì (pot@fly.cnuce.cnr.it)
@@ -5876,7 +6161,7 @@
5876 (process_file): Filenames in tags file are relative to the 6161 (process_file): Filenames in tags file are relative to the
5877 directory where the tags file is (useful with the -o option). 6162 directory where the tags file is (useful with the -o option).
5878 (main): Initialise the outfiledir var. 6163 (main): Initialise the outfiledir var.
5879 (TYPEDST): Added the `tignore' value. 6164 (TYPEDST): Add the `tignore' value.
5880 (C_entries): Corrected various small bugs. 6165 (C_entries): Corrected various small bugs.
5881 6166
58821994-03-19 Richard Stallman (rms@mole.gnu.ai.mit.edu) 61671994-03-19 Richard Stallman (rms@mole.gnu.ai.mit.edu)
@@ -5892,7 +6177,7 @@
5892 6177
58931994-03-14 Francesco Potortì (pot@cnuce.cnr.it) 61781994-03-14 Francesco Potortì (pot@cnuce.cnr.it)
5894 6179
5895 * etags.c (TYPEDST): Added the `tignore' value. 6180 * etags.c (TYPEDST): Add the `tignore' value.
5896 (C_entries): Corrected various bugs, now correctly parses the 6181 (C_entries): Corrected various bugs, now correctly parses the
5897 `extern "C" {' construction (patch by Tom R.Hageman). 6182 `extern "C" {' construction (patch by Tom R.Hageman).
5898 6183
@@ -5946,7 +6231,7 @@
5946 6231
59471994-02-14 Francesco Potortì (pot@fly) 62321994-02-14 Francesco Potortì (pot@fly)
5948 6233
5949 * etags.c (absolute_pathnames, cwd): Added global vars. 6234 * etags.c (absolute_pathnames, cwd): Add global vars.
5950 (longopts, print_help, main, process_file): Put absolute filenames 6235 (longopts, print_help, main, process_file): Put absolute filenames
5951 in the tag file if the -A --absolute-pathnames option is used. 6236 in the tag file if the -A --absolute-pathnames option is used.
5952 (print_help): Alphabetically order the options. 6237 (print_help): Alphabetically order the options.
@@ -5983,7 +6268,7 @@
5983 Use gperf generated hash table instead of linked list. 6268 Use gperf generated hash table instead of linked list.
5984 (C_stab_entry, hash, in_word_set, get_C_stab, C_symtype): Added. 6269 (C_stab_entry, hash, in_word_set, get_C_stab, C_symtype): Added.
5985 Mostly code generated by gperf. 6270 Mostly code generated by gperf.
5986 (consider_token): Removed unused parameter `lp'. 6271 (consider_token): Remove unused parameter `lp'.
5987 (PF_funcs, getit): Allow subroutine and similar declarations 6272 (PF_funcs, getit): Allow subroutine and similar declarations
5988 to span multiple lines. 6273 to span multiple lines.
5989 (C_entries): Check for newline if inchar to avoid bus errors. 6274 (C_entries): Check for newline if inchar to avoid bus errors.
@@ -6130,7 +6415,7 @@
6130 6415
61311993-11-02 Francesco Potortì (pot@cnuce.cnr.it) 64161993-11-02 Francesco Potortì (pot@cnuce.cnr.it)
6132 6417
6133 * etags.c (consider_token): Removed unused variable firsttok. 6418 * etags.c (consider_token): Remove unused variable firsttok.
6134 (prolog_getit): Call pfnote with the right number of arguments. 6419 (prolog_getit): Call pfnote with the right number of arguments.
6135 6420
61361993-10-19 Paul Eggert (eggert@twinsun.com) 64211993-10-19 Paul Eggert (eggert@twinsun.com)
@@ -6160,13 +6445,13 @@
6160 from current directory. Only chmod and chgrp files that we 6445 from current directory. Only chmod and chgrp files that we
6161 installed, which excludes ${INSTALLABLE_SCRIPTS}. They go in 6446 installed, which excludes ${INSTALLABLE_SCRIPTS}. They go in
6162 ${bindir}. 6447 ${bindir}.
6163 (INSTALLFLAGS): Deleted definition, since it is an unused variable 6448 (INSTALLFLAGS): Delete definition, since it is an unused variable
6164 now. 6449 now.
6165 6450
61661993-09-27 Brian J. Fox (bfox@ai.mit.edu) 64511993-09-27 Brian J. Fox (bfox@ai.mit.edu)
6167 6452
6168 * Makefile.in (INSTALL, INSTALL_PROGRAM, INSTALL_DATA): Let 6453 * Makefile.in (INSTALL, INSTALL_PROGRAM, INSTALL_DATA):
6169 configure figure out the correct values for these variables. 6454 Let configure figure out the correct values for these variables.
6170 6455
61711993-09-14 Brian J. Fox (bfox@ai.mit.edu) 64561993-09-14 Brian J. Fox (bfox@ai.mit.edu)
6172 6457
@@ -6251,7 +6536,7 @@
6251 6536
62521993-07-30 Francesco Potortì (pot@cnuce.cnr.it) 65371993-07-30 Francesco Potortì (pot@cnuce.cnr.it)
6253 6538
6254 * etags.c (FINCST): Added the fignore status. Means we are 6539 * etags.c (FINCST): Add the fignore status. Means we are
6255 after the parameter list and before the open curly brace. 6540 after the parameter list and before the open curly brace.
6256 Allows correct parsing of C++ constructors. 6541 Allows correct parsing of C++ constructors.
6257 (C_entries, consider_token): Make use of fignore. 6542 (C_entries, consider_token): Make use of fignore.
@@ -6290,7 +6575,7 @@
6290 6575
62911993-07-08 Francesco Potortì (pot@cnuce.cnr.it) 65761993-07-08 Francesco Potortì (pot@cnuce.cnr.it)
6292 6577
6293 * etags.c (alloca): Removed all references to it. 6578 * etags.c (alloca): Remove all references to it.
6294 (main): Now calls xnew instead of alloca for portability. 6579 (main): Now calls xnew instead of alloca for portability.
6295 (../src/config.h): Included only if HAVE_CONFIG_H. 6580 (../src/config.h): Included only if HAVE_CONFIG_H.
6296 (const): Void definition removed--config.h takes care of it. 6581 (const): Void definition removed--config.h takes care of it.
@@ -6302,7 +6587,7 @@
6302 6587
6303 * etags.c (LEVEL_OK_FOR_FUNCDEF): Removed. 6588 * etags.c (LEVEL_OK_FOR_FUNCDEF): Removed.
6304 (C_entries): Optimized the test that used LEVEL_OK_FOR_FUNCDEF. 6589 (C_entries): Optimized the test that used LEVEL_OK_FOR_FUNCDEF.
6305 (C_entries): Removed a piece of useless code. 6590 (C_entries): Remove a piece of useless code.
6306 (C_entries): Making typedef tags is delayed until a semicolon 6591 (C_entries): Making typedef tags is delayed until a semicolon
6307 is met. This handles "typedef int X, Y, Z;" correctly. 6592 is met. This handles "typedef int X, Y, Z;" correctly.
6308 6593
@@ -6564,7 +6849,7 @@
6564 6849
65651993-04-09 Jim Blandy (jimb@totoro.cs.oberlin.edu) 68501993-04-09 Jim Blandy (jimb@totoro.cs.oberlin.edu)
6566 6851
6567 * Makefile.in (DEFS): Renamed from CONFIG_CFLAGS. 6852 * Makefile.in (DEFS): Rename from CONFIG_CFLAGS.
6568 6853
65691993-04-07 Jim Blandy (jimb@churchy.gnu.ai.mit.edu) 68541993-04-07 Jim Blandy (jimb@churchy.gnu.ai.mit.edu)
6570 6855
@@ -6586,7 +6871,7 @@
6586 (get_C_stab): c_ext becomes c_ext&C_PLPL. 6871 (get_C_stab): c_ext becomes c_ext&C_PLPL.
6587 (C_entries): Logical cplpl means c_ext&C_PLPL. 6872 (C_entries): Logical cplpl means c_ext&C_PLPL.
6588 (C_entries): Logical yacc_rules means we are after the first %%. 6873 (C_entries): Logical yacc_rules means we are after the first %%.
6589 (C_entries): Added logic for yacc files. 6874 (C_entries): Add logic for yacc files.
6590 6875
65911993-03-16 Francesco Potortì (pot@cnuce.cnr.it) 68761993-03-16 Francesco Potortì (pot@cnuce.cnr.it)
6592 6877
@@ -6604,7 +6889,7 @@
6604 (TOKEN): Member linestart removed. 6889 (TOKEN): Member linestart removed.
6605 (linepos, prev_linepos, lb1): Deleted. 6890 (linepos, prev_linepos, lb1): Deleted.
6606 (main): Call initbuffer on lbs array instead of lb1. 6891 (main): Call initbuffer on lbs array instead of lb1.
6607 (init): Removed the initialisation of the logical _gd array. 6892 (init): Remove the initialisation of the logical _gd array.
6608 (find_entries): A .sa suffix means assembler file. 6893 (find_entries): A .sa suffix means assembler file.
6609 (C_create_stab): "auto", "void", "extern", "static" are st_C_typespec. 6894 (C_create_stab): "auto", "void", "extern", "static" are st_C_typespec.
6610 All C state machines rewritten. 6895 All C state machines rewritten.
@@ -6614,7 +6899,7 @@
6614 6899
66151993-03-01 Francesco Potortì (pot@fly.CNUCE.CNR.IT) 69001993-03-01 Francesco Potortì (pot@fly.CNUCE.CNR.IT)
6616 6901
6617 * etags.c (C_entries): Added the quotednl logical variable. 6902 * etags.c (C_entries): Add the quotednl logical variable.
6618 Used for parsing of #define's spanning multiple lines. 6903 Used for parsing of #define's spanning multiple lines.
6619 6904
66201993-02-23 Francesco Potortì (pot@fly.CNUCE.CNR.IT) 69051993-02-23 Francesco Potortì (pot@fly.CNUCE.CNR.IT)
@@ -6624,7 +6909,7 @@
6624 6909
66251993-03-19 Eric S. Raymond (eric@geech.gnu.ai.mit.edu) 69101993-03-19 Eric S. Raymond (eric@geech.gnu.ai.mit.edu)
6626 6911
6627 * Makefile.in (EXECUTABLES): Added rcs-checkin. 6912 * Makefile.in (EXECUTABLES): Add rcs-checkin.
6628 6913
6629 * Makefile.in (unlock, relock): New productions. 6914 * Makefile.in (unlock, relock): New productions.
6630 6915
@@ -6685,7 +6970,7 @@
6685 * Makefile.in (CFLAGS): #define HAVE_CONFIG_H, too. 6970 * Makefile.in (CFLAGS): #define HAVE_CONFIG_H, too.
6686 6971
6687 * Makefile.in (libdir): Default to ${prefix}/lib. 6972 * Makefile.in (libdir): Default to ${prefix}/lib.
6688 (archlibdir): Adjusted to match. 6973 (archlibdir): Adjust to match.
6689 6974
6690 * Makefile.in (distclean): Don't delete backup or autosave files. 6975 * Makefile.in (distclean): Don't delete backup or autosave files.
6691 (extraclean): Like realclean, but does delete backup and autosave 6976 (extraclean): Like realclean, but does delete backup and autosave
@@ -6720,7 +7005,7 @@
6720 7005
67211992-11-05 Jim Blandy (jimb@totoro.cs.oberlin.edu) 70061992-11-05 Jim Blandy (jimb@totoro.cs.oberlin.edu)
6722 7007
6723 * Makefile.in (getdate.o): Added explicit target for this, so we 7008 * Makefile.in (getdate.o): Add explicit target for this, so we
6724 can indicate that it depends on ../src/config.h. 7009 can indicate that it depends on ../src/config.h.
6725 7010
67261992-11-04 Jim Blandy (jimb@totoro.cs.oberlin.edu) 70111992-11-04 Jim Blandy (jimb@totoro.cs.oberlin.edu)
@@ -6788,7 +7073,7 @@
6788 array. When an event fires, move the last event in the array into 7073 array. When an event fires, move the last event in the array into
6789 its spot. Use num_events to determine whether or not there are 7074 its spot. Use num_events to determine whether or not there are
6790 any pending events, not wait_for. 7075 any pending events, not wait_for.
6791 (getevent): Deleted unused variable `ep'. 7076 (getevent): Delete unused variable `ep'.
6792 (sigcatch): It's now easier to find all the active events. 7077 (sigcatch): It's now easier to find all the active events.
6793 (main): Initialize num_events. 7078 (main): Initialize num_events.
6794 7079
@@ -6801,7 +7086,7 @@
6801 (process_file, find_entries, pfnote, TEX_funcs, TEX_decode_env, 7086 (process_file, find_entries, pfnote, TEX_funcs, TEX_decode_env,
6802 TEX_getit, substr): Use the etags_*index functions, rather than 7087 TEX_getit, substr): Use the etags_*index functions, rather than
6803 the native *index functions. 7088 the native *index functions.
6804 (rindex, index): Renamed to etags_rindex and tags_rindex, and 7089 (rindex, index): Rename to etags_rindex and tags_rindex, and
6805 made them unconditionally defined, rather than having them depend 7090 made them unconditionally defined, rather than having them depend
6806 on NEED_*INDEX. 7091 on NEED_*INDEX.
6807 7092
@@ -6888,7 +7173,7 @@
6888 7173
68891992-05-10 Roland McGrath (roland@albert.gnu.ai.mit.edu) 71741992-05-10 Roland McGrath (roland@albert.gnu.ai.mit.edu)
6890 7175
6891 * etags.c (C_entries): Fixed reading of "..." strings. 7176 * etags.c (C_entries): Fix reading of "..." strings.
6892 (consider_token): Recognize `SYSCALL' and `PSEUDO' macros, used in 7177 (consider_token): Recognize `SYSCALL' and `PSEUDO' macros, used in
6893 the C library source. 7178 the C library source.
6894 7179
@@ -6916,7 +7201,7 @@
6916 7201
69171992-04-17 Jim Blandy (jimb@pogo.cs.oberlin.edu) 72021992-04-17 Jim Blandy (jimb@pogo.cs.oberlin.edu)
6918 7203
6919 * timer.c (getevent): Removed declaration of memcpy; since 7204 * timer.c (getevent): Remove declaration of memcpy; since
6920 different systems have different return types, and we're not even 7205 different systems have different return types, and we're not even
6921 using the return type anyway, it wasn't doing us any good. 7206 using the return type anyway, it wasn't doing us any good.
6922 7207
@@ -6951,7 +7236,7 @@
6951 7236
69521992-04-06 Jim Blandy (jimb@pogo.cs.oberlin.edu) 72371992-04-06 Jim Blandy (jimb@pogo.cs.oberlin.edu)
6953 7238
6954 * etags.c (C_entries): Removed comment saying that \" in a string 7239 * etags.c (C_entries): Remove comment saying that \" in a string
6955 isn't recognized as magic, because it is correctly handled. 7240 isn't recognized as magic, because it is correctly handled.
6956 7241
6957 * getopt.c, getopt.h: New files, from GNU C library. 7242 * getopt.c, getopt.h: New files, from GNU C library.
@@ -6961,8 +7246,8 @@
6961 optind. 7246 optind.
6962 (main): Argument processing loop rewritten to call getopt to get 7247 (main): Argument processing loop rewritten to call getopt to get
6963 next option. Options which take parameters (-o and -i) rewritten 7248 next option. Options which take parameters (-o and -i) rewritten
6964 to get parameter from optarg instead of argv[1]. Filename 7249 to get parameter from optarg instead of argv[1].
6965 preprocessing loop and update command changed similarly. 7250 Filename preprocessing loop and update command changed similarly.
6966 * Makefile (etags, ctags): Depend on and link with getopt.h, 7251 * Makefile (etags, ctags): Depend on and link with getopt.h,
6967 getopt.o, and getopt1.o. 7252 getopt.o, and getopt1.o.
6968 (getopt.o, getopt1.o): New targets for the GNU getopt routines. 7253 (getopt.o, getopt1.o): New targets for the GNU getopt routines.
@@ -7103,8 +7388,8 @@
71031991-01-25 Jim Blandy (jimb@churchy.ai.mit.edu) 73881991-01-25 Jim Blandy (jimb@churchy.ai.mit.edu)
7104 7389
7105 * make-docfile: Find the arguments to a C function correctly, 7390 * make-docfile: Find the arguments to a C function correctly,
7106 by not ignoring the character that read_c_string returns. Don't 7391 by not ignoring the character that read_c_string returns.
7107 even try to find argument names for functions that take MANY 7392 Don't even try to find argument names for functions that take MANY
7108 or UNEVALLED arguments, since they're a figment of the docstring's 7393 or UNEVALLED arguments, since they're a figment of the docstring's
7109 imagination. 7394 imagination.
7110 7395
@@ -7492,8 +7777,8 @@
7492 7777
74931988-05-13 Chris Hanson (cph@kleph) 77781988-05-13 Chris Hanson (cph@kleph)
7494 7779
7495 * emacsclient.c: Delete references to unused variable `out'. This 7780 * emacsclient.c: Delete references to unused variable `out'.
7496 caused a bus error when used under hp-ux. 7781 This caused a bus error when used under hp-ux.
7497 7782
74981988-05-06 Richard Stallman (rms@frosted-flakes.ai.mit.edu) 77831988-05-06 Richard Stallman (rms@frosted-flakes.ai.mit.edu)
7499 7784
diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in
index 96975613104..f619febbb2b 100644
--- a/lib-src/Makefile.in
+++ b/lib-src/Makefile.in
@@ -117,8 +117,8 @@ STAMP_INST_SCRIPTS = stamp-rcs-checkin stamp-grep-changelog
117 117
118# Things that Emacs runs internally, or during the build process, 118# Things that Emacs runs internally, or during the build process,
119# which should not be installed in bindir. 119# which should not be installed in bindir.
120UTILITIES = profile${EXEEXT} movemail${EXEEXT} fakemail${EXEEXT} \ 120UTILITIES = profile${EXEEXT} movemail${EXEEXT} hexl${EXEEXT} \
121 hexl${EXEEXT} update-game-score${EXEEXT} 121 update-game-score${EXEEXT}
122 122
123DONT_INSTALL= test-distrib${EXEEXT} make-docfile${EXEEXT} 123DONT_INSTALL= test-distrib${EXEEXT} make-docfile${EXEEXT}
124 124
@@ -178,33 +178,27 @@ CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS}
178LOADLIBES = ../lib/libgnu.a $(LIBS_SYSTEM) 178LOADLIBES = ../lib/libgnu.a $(LIBS_SYSTEM)
179$(EXE_FILES): ../lib/libgnu.a 179$(EXE_FILES): ../lib/libgnu.a
180 180
181## This is the default compilation command. 181all: ${EXE_FILES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS} ${STAMP_INST_SCRIPTS} ${STAMP_SCRIPTS}
182## But we should never rely on it, because some make version failed to
183## find it for getopt.o.
184## Using an explicit command made it work.
185.c.o:
186 ${CC} -c ${CPP_CFLAGS} $<
187
188all: ${DONT_INSTALL} ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS} ${STAMP_INST_SCRIPTS} ${STAMP_SCRIPTS}
189 182
190## These targets copy the scripts into the build directory so that 183## These targets copy the scripts into the build directory so that
191## they can be run from there in an uninstalled Emacs. 184## they can be run from there in an uninstalled Emacs.
192## The "-" is prepended because some versions of cp barf when srcdir 185## Nothing to do if pwd = srcdir.
193## is the current directory, and thus the file will be copied into itself. 186insrcdir=[ "`/bin/pwd`" = "`(cd $(srcdir) && /bin/pwd)`" ]
187
194stamp-rcs2log: $(srcdir)/rcs2log 188stamp-rcs2log: $(srcdir)/rcs2log
195 -cp -p $(srcdir)/rcs2log rcs2log 189 $(insrcdir) || cp -p $(srcdir)/rcs2log rcs2log
196 touch $@ 190 touch $@
197 191
198stamp-rcs-checkin: $(srcdir)/rcs-checkin 192stamp-rcs-checkin: $(srcdir)/rcs-checkin
199 -cp -p $(srcdir)/rcs-checkin rcs-checkin 193 $(insrcdir) || cp -p $(srcdir)/rcs-checkin rcs-checkin
200 touch $@ 194 touch $@
201 195
202stamp-grep-changelog: $(srcdir)/grep-changelog 196stamp-grep-changelog: $(srcdir)/grep-changelog
203 -cp -p $(srcdir)/grep-changelog grep-changelog 197 $(insrcdir) || cp -p $(srcdir)/grep-changelog grep-changelog
204 touch $@ 198 touch $@
205 199
206stamp-vcdiff: $(srcdir)/vcdiff 200stamp-vcdiff: $(srcdir)/vcdiff
207 -cp -p $(srcdir)/vcdiff vcdiff 201 $(insrcdir) || cp -p $(srcdir)/vcdiff vcdiff
208 touch $@ 202 touch $@
209 203
210## Only used if we need blessmail, but no harm in always defining. 204## Only used if we need blessmail, but no harm in always defining.
@@ -235,13 +229,13 @@ maybe-blessmail: $(BLESSMAIL_TARGET)
235$(DESTDIR)${archlibdir}: all 229$(DESTDIR)${archlibdir}: all
236 @echo 230 @echo
237 @echo "Installing utilities run internally by Emacs." 231 @echo "Installing utilities run internally by Emacs."
238 umask 022; $(top_srcdir)/mkinstalldirs $(DESTDIR)${archlibdir} 232 umask 022; $(top_srcdir)/install-sh -d $(DESTDIR)${archlibdir}
239 if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` != `/bin/pwd` ]; then \ 233 if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` != `/bin/pwd` ]; then \
240 for file in ${UTILITIES}; do \ 234 for file in ${UTILITIES}; do \
241 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file $(DESTDIR)${archlibdir}/$$file ; \ 235 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file $(DESTDIR)${archlibdir}/$$file ; \
242 done ; \ 236 done ; \
243 fi 237 fi
244 umask 022; $(top_srcdir)/mkinstalldirs $(DESTDIR)${gamedir}; \ 238 umask 022; $(top_srcdir)/install-sh -d $(DESTDIR)${gamedir}; \
245 touch $(DESTDIR)${gamedir}/snake-scores; \ 239 touch $(DESTDIR)${gamedir}/snake-scores; \
246 touch $(DESTDIR)${gamedir}/tetris-scores 240 touch $(DESTDIR)${gamedir}/tetris-scores
247 -if chown ${gameuser} $(DESTDIR)${archlibdir}/update-game-score && chmod u+s $(DESTDIR)${archlibdir}/update-game-score; then \ 241 -if chown ${gameuser} $(DESTDIR)${archlibdir}/update-game-score && chmod u+s $(DESTDIR)${archlibdir}/update-game-score; then \
@@ -281,8 +275,8 @@ mostlyclean:
281 -rm -f core *.o 275 -rm -f core *.o
282 276
283clean: mostlyclean 277clean: mostlyclean
284 -rm -f ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL} 278 -rm -f ${EXE_FILES}
285 -rm -f fns*.el *.tab.c *.tab.h stamp-* 279 -rm -f ${STAMP_INST_SCRIPTS} ${STAMP_SCRIPTS}
286 280
287distclean: clean 281distclean: clean
288 -rm -f TAGS 282 -rm -f TAGS
@@ -313,19 +307,16 @@ test-distrib${EXEEXT}: ${srcdir}/test-distrib.c
313../lib/libgnu.a: ../src/config.h 307../lib/libgnu.a: ../src/config.h
314 cd ../lib && $(MAKE) libgnu.a 308 cd ../lib && $(MAKE) libgnu.a
315 309
316REGEXPOBJ = regex.o
317REGEXPDEPS = $(REGEXPOBJ) $(srcdir)/../src/regex.h
318
319regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h ../src/config.h 310regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h ../src/config.h
320 ${CC} -c ${CPP_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER \ 311 ${CC} -c ${CPP_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER \
321 ${srcdir}/../src/regex.c 312 ${srcdir}/../src/regex.c
322 313
323etags${EXEEXT}: ${srcdir}/etags.c $(REGEXPDEPS) ../src/config.h 314etags${EXEEXT}: ${srcdir}/etags.c regex.o ../src/config.h
324 $(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" \ 315 $(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" \
325 -DVERSION="\"${version}\"" ${srcdir}/etags.c \ 316 -DVERSION="\"${version}\"" ${srcdir}/etags.c \
326 $(REGEXPOBJ) $(LOADLIBES) -o etags 317 regex.o $(LOADLIBES) -o etags
327 318
328ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ../src/config.h 319ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h ../src/config.h
329 $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \ 320 $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \
330 ${srcdir}/ebrowse.c $(LOADLIBES) -o ebrowse 321 ${srcdir}/ebrowse.c $(LOADLIBES) -o ebrowse
331 322
@@ -334,7 +325,7 @@ ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ../src/config.h
334ctags${EXEEXT}: etags${EXEEXT} 325ctags${EXEEXT}: etags${EXEEXT}
335 $(CC) ${ALL_CFLAGS} -DCTAGS -DEMACS_NAME="\"GNU Emacs\"" \ 326 $(CC) ${ALL_CFLAGS} -DCTAGS -DEMACS_NAME="\"GNU Emacs\"" \
336 -DVERSION="\"${version}\"" ${srcdir}/etags.c \ 327 -DVERSION="\"${version}\"" ${srcdir}/etags.c \
337 $(REGEXPOBJ) $(LOADLIBES) -o ctags 328 regex.o $(LOADLIBES) -o ctags
338 329
339profile${EXEEXT}: ${srcdir}/profile.c ../src/config.h 330profile${EXEEXT}: ${srcdir}/profile.c ../src/config.h
340 $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c $(LOADLIBES) -o profile 331 $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c $(LOADLIBES) -o profile
@@ -343,19 +334,13 @@ make-docfile${EXEEXT}: ${srcdir}/make-docfile.c ../src/config.h
343 $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) \ 334 $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) \
344 -o make-docfile 335 -o make-docfile
345 336
346movemail${EXEEXT}: movemail.o pop.o 337movemail${EXEEXT}: ${srcdir}/movemail.c pop.o ../src/config.h
347 $(CC) ${LINK_CFLAGS} ${MOVE_FLAGS} movemail.o pop.o \ 338 $(CC) ${ALL_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c pop.o \
348 $(LOADLIBES) $(LIBS_MOVE) -o movemail 339 $(LOADLIBES) $(LIBS_MOVE) -o movemail
349 340
350movemail.o: ${srcdir}/movemail.c ../src/config.h 341pop.o: ${srcdir}/pop.c ${srcdir}/../lib/min-max.h ../src/config.h
351 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c
352
353pop.o: ${srcdir}/pop.c ../src/config.h
354 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c 342 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c
355 343
356fakemail${EXEEXT}: ${srcdir}/fakemail.c ../src/config.h
357 $(CC) ${ALL_CFLAGS} ${srcdir}/fakemail.c $(LOADLIBES) -o fakemail
358
359emacsclient${EXEEXT}: ${srcdir}/emacsclient.c ../src/config.h 344emacsclient${EXEEXT}: ${srcdir}/emacsclient.c ../src/config.h
360 $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c \ 345 $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c \
361 -DVERSION="\"${version}\"" \ 346 -DVERSION="\"${version}\"" \
@@ -364,12 +349,8 @@ emacsclient${EXEEXT}: ${srcdir}/emacsclient.c ../src/config.h
364hexl${EXEEXT}: ${srcdir}/hexl.c ../src/config.h 349hexl${EXEEXT}: ${srcdir}/hexl.c ../src/config.h
365 $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl 350 $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl
366 351
367update-game-score${EXEEXT}: update-game-score.o 352update-game-score${EXEEXT}: ${srcdir}/update-game-score.c ../src/config.h
368 $(CC) ${LINK_CFLAGS} update-game-score.o \ 353 $(CC) ${ALL_CFLAGS} -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \
369 $(LOADLIBES) -o update-game-score 354 ${srcdir}/update-game-score.c $(LOADLIBES) -o update-game-score
370
371update-game-score.o: ${srcdir}/update-game-score.c ../src/config.h
372 $(CC) -c ${CPP_CFLAGS} ${srcdir}/update-game-score.c \
373 -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\""
374 355
375## Makefile ends here. 356## Makefile ends here.
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c
index 59a1dde7634..7871a804997 100644
--- a/lib-src/ebrowse.c
+++ b/lib-src/ebrowse.c
@@ -41,12 +41,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
41 41
42#define streq(X, Y) (*(X) == *(Y) && strcmp ((X) + 1, (Y) + 1) == 0) 42#define streq(X, Y) (*(X) == *(Y) && strcmp ((X) + 1, (Y) + 1) == 0)
43 43
44/* The ubiquitous `max' and `min' macros. */ 44#include <min-max.h>
45
46#ifndef max
47#define max(X, Y) ((X) > (Y) ? (X) : (Y))
48#define min(X, Y) ((X) < (Y) ? (X) : (Y))
49#endif
50 45
51/* Files are read in chunks of this number of bytes. */ 46/* Files are read in chunks of this number of bytes. */
52 47
@@ -82,7 +77,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
82#define TREE_HEADER_STRUCT "[ebrowse-hs " 77#define TREE_HEADER_STRUCT "[ebrowse-hs "
83#define TREE_STRUCT "[ebrowse-ts " 78#define TREE_STRUCT "[ebrowse-ts "
84#define MEMBER_STRUCT "[ebrowse-ms " 79#define MEMBER_STRUCT "[ebrowse-ms "
85#define BROWSE_STRUCT "[ebrowse-bs "
86#define CLASS_STRUCT "[ebrowse-cs " 80#define CLASS_STRUCT "[ebrowse-cs "
87 81
88/* The name of the symbol table entry for global functions, variables, 82/* The name of the symbol table entry for global functions, variables,
@@ -384,7 +378,7 @@ int max_regexp = 50;
384 378
385char *inbuffer; 379char *inbuffer;
386char *in; 380char *in;
387int inbuffer_size; 381size_t inbuffer_size;
388 382
389/* Return the current buffer position in the input file. */ 383/* Return the current buffer position in the input file. */
390 384
@@ -465,59 +459,16 @@ struct search_path *search_path_tail;
465 459
466/* Function prototypes. */ 460/* Function prototypes. */
467 461
468int yylex (void); 462static char *matching_regexp (void);
469void yyparse (void); 463static struct sym *add_sym (const char *, struct sym *);
470void re_init_parser (void); 464static void add_global_defn (char *, char *, int, unsigned, int, int, int);
471const char *token_string (int); 465static void add_global_decl (char *, char *, int, unsigned, int, int, int);
472char *matching_regexp (void); 466static struct member *add_member (struct sym *, char *, int, int, unsigned);
473void init_sym (void); 467static void class_definition (struct sym *, int, int, int);
474struct sym *add_sym (const char *, struct sym *); 468static char *operator_name (int *);
475void add_link (struct sym *, struct sym *); 469static void parse_qualified_param_ident_or_type (char **);
476void add_member_defn (struct sym *, char *, char *, 470static void usage (int) NO_RETURN;
477 int, unsigned, int, int, int); 471static void version (void) NO_RETURN;
478void add_member_decl (struct sym *, char *, char *, int,
479 unsigned, int, int, int, int);
480void dump_roots (FILE *);
481void *xmalloc (int);
482void xfree (void *);
483void add_global_defn (char *, char *, int, unsigned, int, int, int);
484void add_global_decl (char *, char *, int, unsigned, int, int, int);
485void add_define (char *, char *, int);
486void mark_inherited_virtual (void);
487void leave_namespace (void);
488void enter_namespace (char *);
489void register_namespace_alias (char *, struct link *);
490void insert_keyword (const char *, int);
491void re_init_scanner (void);
492void init_scanner (void);
493void process_file (char *);
494void add_search_path (char *);
495FILE *open_file (char *);
496int process_pp_line (void);
497int dump_members (FILE *, struct member *);
498void dump_sym (FILE *, struct sym *);
499int dump_tree (FILE *, struct sym *);
500struct member *find_member (struct sym *, char *, int, int, unsigned);
501struct member *add_member (struct sym *, char *, int, int, unsigned);
502void mark_virtual (struct sym *);
503struct sym *make_namespace (char *, struct sym *);
504char *sym_scope (struct sym *);
505char *sym_scope_1 (struct sym *);
506int skip_to (int);
507void skip_matching (void);
508void member (struct sym *, int);
509void class_body (struct sym *, int);
510void class_definition (struct sym *, int, int, int);
511void declaration (int);
512unsigned parm_list (int *);
513char *operator_name (int *);
514struct sym *parse_classname (void);
515struct sym *parse_qualified_ident_or_type (char **);
516void parse_qualified_param_ident_or_type (char **);
517int globals (int);
518void yyerror (const char *, const char *);
519void usage (int) NO_RETURN;
520void version (void) NO_RETURN;
521 472
522 473
523 474
@@ -528,7 +479,7 @@ void version (void) NO_RETURN;
528/* Print an error in a printf-like style with the current input file 479/* Print an error in a printf-like style with the current input file
529 name and line number. */ 480 name and line number. */
530 481
531void 482static void
532yyerror (const char *format, const char *s) 483yyerror (const char *format, const char *s)
533{ 484{
534 fprintf (stderr, "%s:%d: ", filename, yyline); 485 fprintf (stderr, "%s:%d: ", filename, yyline);
@@ -540,8 +491,8 @@ yyerror (const char *format, const char *s)
540/* Like malloc but print an error and exit if not enough memory is 491/* Like malloc but print an error and exit if not enough memory is
541 available. */ 492 available. */
542 493
543void * 494static void *
544xmalloc (int nbytes) 495xmalloc (size_t nbytes)
545{ 496{
546 void *p = malloc (nbytes); 497 void *p = malloc (nbytes);
547 if (p == NULL) 498 if (p == NULL)
@@ -555,8 +506,8 @@ xmalloc (int nbytes)
555 506
556/* Like realloc but print an error and exit if out of memory. */ 507/* Like realloc but print an error and exit if out of memory. */
557 508
558void * 509static void *
559xrealloc (void *p, int sz) 510xrealloc (void *p, size_t sz)
560{ 511{
561 p = realloc (p, sz); 512 p = realloc (p, sz);
562 if (p == NULL) 513 if (p == NULL)
@@ -571,7 +522,7 @@ xrealloc (void *p, int sz)
571/* Like strdup, but print an error and exit if not enough memory is 522/* Like strdup, but print an error and exit if not enough memory is
572 available.. If S is null, return null. */ 523 available.. If S is null, return null. */
573 524
574char * 525static char *
575xstrdup (char *s) 526xstrdup (char *s)
576{ 527{
577 if (s) 528 if (s)
@@ -588,7 +539,7 @@ xstrdup (char *s)
588/* Initialize the symbol table. This currently only sets up the 539/* Initialize the symbol table. This currently only sets up the
589 special symbol for globals (`*Globals*'). */ 540 special symbol for globals (`*Globals*'). */
590 541
591void 542static void
592init_sym (void) 543init_sym (void)
593{ 544{
594 global_symbols = add_sym (GLOBALS_NAME, NULL); 545 global_symbols = add_sym (GLOBALS_NAME, NULL);
@@ -602,7 +553,7 @@ init_sym (void)
602 If a symbol for NAME already exists, return that. Otherwise 553 If a symbol for NAME already exists, return that. Otherwise
603 create a new symbol and set it to default values. */ 554 create a new symbol and set it to default values. */
604 555
605struct sym * 556static struct sym *
606add_sym (const char *name, struct sym *nested_in_class) 557add_sym (const char *name, struct sym *nested_in_class)
607{ 558{
608 struct sym *sym; 559 struct sym *sym;
@@ -643,7 +594,7 @@ add_sym (const char *name, struct sym *nested_in_class)
643 594
644/* Add links between superclass SUPER and subclass SUB. */ 595/* Add links between superclass SUPER and subclass SUB. */
645 596
646void 597static void
647add_link (struct sym *super, struct sym *sub) 598add_link (struct sym *super, struct sym *sub)
648{ 599{
649 struct link *lnk, *lnk2, *p, *prev; 600 struct link *lnk, *lnk2, *p, *prev;
@@ -683,7 +634,7 @@ add_link (struct sym *super, struct sym *sub)
683 parameter types of functions. Value is a pointer to the member 634 parameter types of functions. Value is a pointer to the member
684 found or null if not found. */ 635 found or null if not found. */
685 636
686struct member * 637static struct member *
687find_member (struct sym *cls, char *name, int var, int sc, unsigned int hash) 638find_member (struct sym *cls, char *name, int var, int sc, unsigned int hash)
688{ 639{
689 struct member **list; 640 struct member **list;
@@ -733,7 +684,7 @@ find_member (struct sym *cls, char *name, int var, int sc, unsigned int hash)
733 a bit set giving additional information about the member (see the 684 a bit set giving additional information about the member (see the
734 F_* defines). */ 685 F_* defines). */
735 686
736void 687static void
737add_member_decl (struct sym *cls, char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int vis, int flags) 688add_member_decl (struct sym *cls, char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int vis, int flags)
738{ 689{
739 struct member *m; 690 struct member *m;
@@ -781,7 +732,7 @@ add_member_decl (struct sym *cls, char *name, char *regexp, int pos, unsigned in
781 a bit set giving additional information about the member (see the 732 a bit set giving additional information about the member (see the
782 F_* defines). */ 733 F_* defines). */
783 734
784void 735static void
785add_member_defn (struct sym *cls, char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags) 736add_member_defn (struct sym *cls, char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags)
786{ 737{
787 struct member *m; 738 struct member *m;
@@ -823,7 +774,7 @@ add_member_defn (struct sym *cls, char *name, char *regexp, int pos, unsigned in
823 REGEXP is a regular expression matching the define in the source, 774 REGEXP is a regular expression matching the define in the source,
824 if it is non-null. POS is the position in the file. */ 775 if it is non-null. POS is the position in the file. */
825 776
826void 777static void
827add_define (char *name, char *regexp, int pos) 778add_define (char *name, char *regexp, int pos)
828{ 779{
829 add_global_defn (name, regexp, pos, 0, 1, SC_FRIEND, F_DEFINE); 780 add_global_defn (name, regexp, pos, 0, 1, SC_FRIEND, F_DEFINE);
@@ -841,7 +792,7 @@ add_define (char *name, char *regexp, int pos)
841 a bit set giving additional information about the member (see the 792 a bit set giving additional information about the member (see the
842 F_* defines). */ 793 F_* defines). */
843 794
844void 795static void
845add_global_defn (char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags) 796add_global_defn (char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags)
846{ 797{
847 int i; 798 int i;
@@ -872,7 +823,7 @@ add_global_defn (char *name, char *regexp, int pos, unsigned int hash, int var,
872 a bit set giving additional information about the member (see the 823 a bit set giving additional information about the member (see the
873 F_* defines). */ 824 F_* defines). */
874 825
875void 826static void
876add_global_decl (char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags) 827add_global_decl (char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags)
877{ 828{
878 /* Add declaration only if not already declared. Header files must 829 /* Add declaration only if not already declared. Header files must
@@ -911,7 +862,7 @@ add_global_decl (char *name, char *regexp, int pos, unsigned int hash, int var,
911 member. HASH is a hash code for the parameter types of a function. 862 member. HASH is a hash code for the parameter types of a function.
912 Value is a pointer to the member's structure. */ 863 Value is a pointer to the member's structure. */
913 864
914struct member * 865static struct member *
915add_member (struct sym *cls, char *name, int var, int sc, unsigned int hash) 866add_member (struct sym *cls, char *name, int var, int sc, unsigned int hash)
916{ 867{
917 struct member *m = (struct member *) xmalloc (sizeof *m + strlen (name)); 868 struct member *m = (struct member *) xmalloc (sizeof *m + strlen (name));
@@ -982,7 +933,7 @@ add_member (struct sym *cls, char *name, int var, int sc, unsigned int hash)
982 recursively, marking functions as virtual that are declared virtual 933 recursively, marking functions as virtual that are declared virtual
983 in base classes. */ 934 in base classes. */
984 935
985void 936static void
986mark_virtual (struct sym *r) 937mark_virtual (struct sym *r)
987{ 938{
988 struct link *p; 939 struct link *p;
@@ -1006,7 +957,7 @@ mark_virtual (struct sym *r)
1006/* For all roots of the class tree, mark functions as virtual that 957/* For all roots of the class tree, mark functions as virtual that
1007 are virtual because of a virtual declaration in a base class. */ 958 are virtual because of a virtual declaration in a base class. */
1008 959
1009void 960static void
1010mark_inherited_virtual (void) 961mark_inherited_virtual (void)
1011{ 962{
1012 struct sym *r; 963 struct sym *r;
@@ -1021,7 +972,7 @@ mark_inherited_virtual (void)
1021 972
1022/* Create and return a symbol for a namespace with name NAME. */ 973/* Create and return a symbol for a namespace with name NAME. */
1023 974
1024struct sym * 975static struct sym *
1025make_namespace (char *name, struct sym *context) 976make_namespace (char *name, struct sym *context)
1026{ 977{
1027 struct sym *s = (struct sym *) xmalloc (sizeof *s + strlen (name)); 978 struct sym *s = (struct sym *) xmalloc (sizeof *s + strlen (name));
@@ -1036,7 +987,7 @@ make_namespace (char *name, struct sym *context)
1036 987
1037/* Find the symbol for namespace NAME. If not found, retrun NULL */ 988/* Find the symbol for namespace NAME. If not found, retrun NULL */
1038 989
1039struct sym * 990static struct sym *
1040check_namespace (char *name, struct sym *context) 991check_namespace (char *name, struct sym *context)
1041{ 992{
1042 struct sym *p = NULL; 993 struct sym *p = NULL;
@@ -1053,7 +1004,7 @@ check_namespace (char *name, struct sym *context)
1053/* Find the symbol for namespace NAME. If not found, add a new symbol 1004/* Find the symbol for namespace NAME. If not found, add a new symbol
1054 for NAME to all_namespaces. */ 1005 for NAME to all_namespaces. */
1055 1006
1056struct sym * 1007static struct sym *
1057find_namespace (char *name, struct sym *context) 1008find_namespace (char *name, struct sym *context)
1058{ 1009{
1059 struct sym *p = check_namespace (name, context); 1010 struct sym *p = check_namespace (name, context);
@@ -1067,7 +1018,7 @@ find_namespace (char *name, struct sym *context)
1067 1018
1068/* Find namespace alias with name NAME. If not found return NULL. */ 1019/* Find namespace alias with name NAME. If not found return NULL. */
1069 1020
1070struct link * 1021static struct link *
1071check_namespace_alias (char *name) 1022check_namespace_alias (char *name)
1072{ 1023{
1073 struct link *p = NULL; 1024 struct link *p = NULL;
@@ -1091,7 +1042,7 @@ check_namespace_alias (char *name)
1091 1042
1092/* Register the name NEW_NAME as an alias for namespace list OLD_NAME. */ 1043/* Register the name NEW_NAME as an alias for namespace list OLD_NAME. */
1093 1044
1094void 1045static void
1095register_namespace_alias (char *new_name, struct link *old_name) 1046register_namespace_alias (char *new_name, struct link *old_name)
1096{ 1047{
1097 unsigned h; 1048 unsigned h;
@@ -1119,7 +1070,7 @@ register_namespace_alias (char *new_name, struct link *old_name)
1119 1070
1120/* Enter namespace with name NAME. */ 1071/* Enter namespace with name NAME. */
1121 1072
1122void 1073static void
1123enter_namespace (char *name) 1074enter_namespace (char *name)
1124{ 1075{
1125 struct sym *p = find_namespace (name, current_namespace); 1076 struct sym *p = find_namespace (name, current_namespace);
@@ -1140,7 +1091,7 @@ enter_namespace (char *name)
1140 1091
1141/* Leave the current namespace. */ 1092/* Leave the current namespace. */
1142 1093
1143void 1094static void
1144leave_namespace (void) 1095leave_namespace (void)
1145{ 1096{
1146 assert (namespace_sp > 0); 1097 assert (namespace_sp > 0);
@@ -1156,22 +1107,23 @@ leave_namespace (void)
1156/* Write string S to the output file FP in a Lisp-readable form. 1107/* Write string S to the output file FP in a Lisp-readable form.
1157 If S is null, write out `()'. */ 1108 If S is null, write out `()'. */
1158 1109
1159#define PUTSTR(s, fp) \ 1110static inline void
1160 do { \ 1111putstr (const char *s, FILE *fp)
1161 if (!s) \ 1112{
1162 { \ 1113 if (!s)
1163 putc ('(', fp); \ 1114 {
1164 putc (')', fp); \ 1115 putc ('(', fp);
1165 putc (' ', fp); \ 1116 putc (')', fp);
1166 } \ 1117 putc (' ', fp);
1167 else \ 1118 }
1168 { \ 1119 else
1169 putc ('"', fp); \ 1120 {
1170 fputs (s, fp); \ 1121 putc ('"', fp);
1171 putc ('"', fp); \ 1122 fputs (s, fp);
1172 putc (' ', fp); \ 1123 putc ('"', fp);
1173 } \ 1124 putc (' ', fp);
1174 } while (0) 1125 }
1126}
1175 1127
1176/* A dynamically allocated buffer for constructing a scope name. */ 1128/* A dynamically allocated buffer for constructing a scope name. */
1177 1129
@@ -1182,7 +1134,7 @@ int scope_buffer_len;
1182 1134
1183/* Make sure scope_buffer has enough room to add LEN chars to it. */ 1135/* Make sure scope_buffer has enough room to add LEN chars to it. */
1184 1136
1185void 1137static void
1186ensure_scope_buffer_room (int len) 1138ensure_scope_buffer_room (int len)
1187{ 1139{
1188 if (scope_buffer_len + len >= scope_buffer_size) 1140 if (scope_buffer_len + len >= scope_buffer_size)
@@ -1198,7 +1150,7 @@ ensure_scope_buffer_room (int len)
1198 namespaces to scope_buffer. Value is a pointer to the complete 1150 namespaces to scope_buffer. Value is a pointer to the complete
1199 scope name constructed. */ 1151 scope name constructed. */
1200 1152
1201char * 1153static char *
1202sym_scope_1 (struct sym *p) 1154sym_scope_1 (struct sym *p)
1203{ 1155{
1204 int len; 1156 int len;
@@ -1232,7 +1184,7 @@ sym_scope_1 (struct sym *p)
1232/* Return the scope of symbol P in printed representation, i.e. 1184/* Return the scope of symbol P in printed representation, i.e.
1233 as it would appear in a C*+ source file. */ 1185 as it would appear in a C*+ source file. */
1234 1186
1235char * 1187static char *
1236sym_scope (struct sym *p) 1188sym_scope (struct sym *p)
1237{ 1189{
1238 if (!scope_buffer) 1190 if (!scope_buffer)
@@ -1254,7 +1206,7 @@ sym_scope (struct sym *p)
1254/* Dump the list of members M to file FP. Value is the length of the 1206/* Dump the list of members M to file FP. Value is the length of the
1255 list. */ 1207 list. */
1256 1208
1257int 1209static int
1258dump_members (FILE *fp, struct member *m) 1210dump_members (FILE *fp, struct member *m)
1259{ 1211{
1260 int n; 1212 int n;
@@ -1264,16 +1216,16 @@ dump_members (FILE *fp, struct member *m)
1264 for (n = 0; m; m = m->next, ++n) 1216 for (n = 0; m; m = m->next, ++n)
1265 { 1217 {
1266 fputs (MEMBER_STRUCT, fp); 1218 fputs (MEMBER_STRUCT, fp);
1267 PUTSTR (m->name, fp); 1219 putstr (m->name, fp);
1268 PUTSTR (NULL, fp); /* FIXME? scope for globals */ 1220 putstr (NULL, fp); /* FIXME? scope for globals */
1269 fprintf (fp, "%u ", (unsigned) m->flags); 1221 fprintf (fp, "%u ", (unsigned) m->flags);
1270 PUTSTR (m->filename, fp); 1222 putstr (m->filename, fp);
1271 PUTSTR (m->regexp, fp); 1223 putstr (m->regexp, fp);
1272 fprintf (fp, "%u ", (unsigned) m->pos); 1224 fprintf (fp, "%u ", (unsigned) m->pos);
1273 fprintf (fp, "%u ", (unsigned) m->vis); 1225 fprintf (fp, "%u ", (unsigned) m->vis);
1274 putc (' ', fp); 1226 putc (' ', fp);
1275 PUTSTR (m->def_filename, fp); 1227 putstr (m->def_filename, fp);
1276 PUTSTR (m->def_regexp, fp); 1228 putstr (m->def_regexp, fp);
1277 fprintf (fp, "%u", (unsigned) m->def_pos); 1229 fprintf (fp, "%u", (unsigned) m->def_pos);
1278 putc (']', fp); 1230 putc (']', fp);
1279 putc ('\n', fp); 1231 putc ('\n', fp);
@@ -1287,24 +1239,24 @@ dump_members (FILE *fp, struct member *m)
1287 1239
1288/* Dump class ROOT to stream FP. */ 1240/* Dump class ROOT to stream FP. */
1289 1241
1290void 1242static void
1291dump_sym (FILE *fp, struct sym *root) 1243dump_sym (FILE *fp, struct sym *root)
1292{ 1244{
1293 fputs (CLASS_STRUCT, fp); 1245 fputs (CLASS_STRUCT, fp);
1294 PUTSTR (root->name, fp); 1246 putstr (root->name, fp);
1295 1247
1296 /* Print scope, if any. */ 1248 /* Print scope, if any. */
1297 if (root->namesp) 1249 if (root->namesp)
1298 PUTSTR (sym_scope (root), fp); 1250 putstr (sym_scope (root), fp);
1299 else 1251 else
1300 PUTSTR (NULL, fp); 1252 putstr (NULL, fp);
1301 1253
1302 /* Print flags. */ 1254 /* Print flags. */
1303 fprintf (fp, "%u", root->flags); 1255 fprintf (fp, "%u", root->flags);
1304 PUTSTR (root->filename, fp); 1256 putstr (root->filename, fp);
1305 PUTSTR (root->regexp, fp); 1257 putstr (root->regexp, fp);
1306 fprintf (fp, "%u", (unsigned) root->pos); 1258 fprintf (fp, "%u", (unsigned) root->pos);
1307 PUTSTR (root->sfilename, fp); 1259 putstr (root->sfilename, fp);
1308 putc (']', fp); 1260 putc (']', fp);
1309 putc ('\n', fp); 1261 putc ('\n', fp);
1310} 1262}
@@ -1313,7 +1265,7 @@ dump_sym (FILE *fp, struct sym *root)
1313/* Dump class ROOT and its subclasses to file FP. Value is the 1265/* Dump class ROOT and its subclasses to file FP. Value is the
1314 number of classes written. */ 1266 number of classes written. */
1315 1267
1316int 1268static int
1317dump_tree (FILE *fp, struct sym *root) 1269dump_tree (FILE *fp, struct sym *root)
1318{ 1270{
1319 struct link *lk; 1271 struct link *lk;
@@ -1360,7 +1312,7 @@ dump_tree (FILE *fp, struct sym *root)
1360 1312
1361/* Dump the entire class tree to file FP. */ 1313/* Dump the entire class tree to file FP. */
1362 1314
1363void 1315static void
1364dump_roots (FILE *fp) 1316dump_roots (FILE *fp)
1365{ 1317{
1366 int i, n = 0; 1318 int i, n = 0;
@@ -1371,7 +1323,7 @@ dump_roots (FILE *fp)
1371 if (!f_append) 1323 if (!f_append)
1372 { 1324 {
1373 fputs (TREE_HEADER_STRUCT, fp); 1325 fputs (TREE_HEADER_STRUCT, fp);
1374 PUTSTR (EBROWSE_FILE_VERSION, fp); 1326 putstr (EBROWSE_FILE_VERSION, fp);
1375 1327
1376 putc ('\"', fp); 1328 putc ('\"', fp);
1377 if (!f_structs) 1329 if (!f_structs)
@@ -1434,7 +1386,7 @@ do { \
1434/* Process a preprocessor line. Value is the next character from the 1386/* Process a preprocessor line. Value is the next character from the
1435 input buffer not consumed. */ 1387 input buffer not consumed. */
1436 1388
1437int 1389static int
1438process_pp_line (void) 1390process_pp_line (void)
1439{ 1391{
1440 int in_comment = 0, in_string = 0; 1392 int in_comment = 0, in_string = 0;
@@ -1505,7 +1457,7 @@ process_pp_line (void)
1505 1457
1506/* Value is the next token from the input buffer. */ 1458/* Value is the next token from the input buffer. */
1507 1459
1508int 1460static int
1509yylex (void) 1461yylex (void)
1510{ 1462{
1511 int c; 1463 int c;
@@ -1927,7 +1879,7 @@ static char *matching_regexp_buffer, *matching_regexp_end_buf;
1927 position in the input buffer, or maybe a bit more if that string is 1879 position in the input buffer, or maybe a bit more if that string is
1928 shorter than min_regexp. */ 1880 shorter than min_regexp. */
1929 1881
1930char * 1882static char *
1931matching_regexp (void) 1883matching_regexp (void)
1932{ 1884{
1933 char *p; 1885 char *p;
@@ -1978,7 +1930,7 @@ matching_regexp (void)
1978 1930
1979/* Return a printable representation of token T. */ 1931/* Return a printable representation of token T. */
1980 1932
1981const char * 1933static const char *
1982token_string (int t) 1934token_string (int t)
1983{ 1935{
1984 static char b[3]; 1936 static char b[3];
@@ -2095,7 +2047,7 @@ token_string (int t)
2095 2047
2096/* Reinitialize the scanner for a new input file. */ 2048/* Reinitialize the scanner for a new input file. */
2097 2049
2098void 2050static void
2099re_init_scanner (void) 2051re_init_scanner (void)
2100{ 2052{
2101 in = inbuffer; 2053 in = inbuffer;
@@ -2110,11 +2062,11 @@ re_init_scanner (void)
2110} 2062}
2111 2063
2112 2064
2113/* Insert a keyword NAME with token value TK into the keyword hash 2065/* Insert a keyword NAME with token value TKV into the keyword hash
2114 table. */ 2066 table. */
2115 2067
2116void 2068static void
2117insert_keyword (const char *name, int tk) 2069insert_keyword (const char *name, int tkv)
2118{ 2070{
2119 const char *s; 2071 const char *s;
2120 unsigned h = 0; 2072 unsigned h = 0;
@@ -2125,7 +2077,7 @@ insert_keyword (const char *name, int tk)
2125 2077
2126 h %= KEYWORD_TABLE_SIZE; 2078 h %= KEYWORD_TABLE_SIZE;
2127 k->name = name; 2079 k->name = name;
2128 k->tk = tk; 2080 k->tk = tkv;
2129 k->next = keyword_table[h]; 2081 k->next = keyword_table[h];
2130 keyword_table[h] = k; 2082 keyword_table[h] = k;
2131} 2083}
@@ -2134,7 +2086,7 @@ insert_keyword (const char *name, int tk)
2134/* Initialize the scanner for the first file. This sets up the 2086/* Initialize the scanner for the first file. This sets up the
2135 character class vectors and fills the keyword hash table. */ 2087 character class vectors and fills the keyword hash table. */
2136 2088
2137void 2089static void
2138init_scanner (void) 2090init_scanner (void)
2139{ 2091{
2140 int i; 2092 int i;
@@ -2278,7 +2230,7 @@ init_scanner (void)
2278/* Skip forward until a given token TOKEN or YYEOF is seen and return 2230/* Skip forward until a given token TOKEN or YYEOF is seen and return
2279 the current lookahead token after skipping. */ 2231 the current lookahead token after skipping. */
2280 2232
2281int 2233static int
2282skip_to (int token) 2234skip_to (int token)
2283{ 2235{
2284 while (!LOOKING_AT2 (YYEOF, token)) 2236 while (!LOOKING_AT2 (YYEOF, token))
@@ -2289,7 +2241,7 @@ skip_to (int token)
2289/* Skip over pairs of tokens (parentheses, square brackets, 2241/* Skip over pairs of tokens (parentheses, square brackets,
2290 angle brackets, curly brackets) matching the current lookahead. */ 2242 angle brackets, curly brackets) matching the current lookahead. */
2291 2243
2292void 2244static void
2293skip_matching (void) 2245skip_matching (void)
2294{ 2246{
2295 int open, close, n; 2247 int open, close, n;
@@ -2332,7 +2284,7 @@ skip_matching (void)
2332 } 2284 }
2333} 2285}
2334 2286
2335void 2287static void
2336skip_initializer (void) 2288skip_initializer (void)
2337{ 2289{
2338 for (;;) 2290 for (;;)
@@ -2359,7 +2311,7 @@ skip_initializer (void)
2359 2311
2360/* Build qualified namespace alias (A::B::c) and return it. */ 2312/* Build qualified namespace alias (A::B::c) and return it. */
2361 2313
2362struct link * 2314static struct link *
2363match_qualified_namespace_alias (void) 2315match_qualified_namespace_alias (void)
2364{ 2316{
2365 struct link *head = NULL; 2317 struct link *head = NULL;
@@ -2396,7 +2348,7 @@ match_qualified_namespace_alias (void)
2396 2348
2397/* Re-initialize the parser by resetting the lookahead token. */ 2349/* Re-initialize the parser by resetting the lookahead token. */
2398 2350
2399void 2351static void
2400re_init_parser (void) 2352re_init_parser (void)
2401{ 2353{
2402 tk = -1; 2354 tk = -1;
@@ -2409,7 +2361,7 @@ re_init_parser (void)
2409 Returns a hash code for the parameter types. This value is used to 2361 Returns a hash code for the parameter types. This value is used to
2410 distinguish between overloaded functions. */ 2362 distinguish between overloaded functions. */
2411 2363
2412unsigned 2364static unsigned
2413parm_list (int *flags) 2365parm_list (int *flags)
2414{ 2366{
2415 unsigned hash = 0; 2367 unsigned hash = 0;
@@ -2522,7 +2474,7 @@ parm_list (int *flags)
2522 2474
2523/* Print position info to stdout. */ 2475/* Print position info to stdout. */
2524 2476
2525void 2477static void
2526print_info (void) 2478print_info (void)
2527{ 2479{
2528 if (info_position >= 0 && BUFFER_POS () <= info_position) 2480 if (info_position >= 0 && BUFFER_POS () <= info_position)
@@ -2537,7 +2489,7 @@ print_info (void)
2537 the access specifier for the member (private, protected, 2489 the access specifier for the member (private, protected,
2538 public). */ 2490 public). */
2539 2491
2540void 2492static void
2541member (struct sym *cls, int vis) 2493member (struct sym *cls, int vis)
2542{ 2494{
2543 char *id = NULL; 2495 char *id = NULL;
@@ -2746,7 +2698,7 @@ member (struct sym *cls, int vis)
2746/* Parse the body of class CLS. TAG is the tag of the class (struct, 2698/* Parse the body of class CLS. TAG is the tag of the class (struct,
2747 union, class). */ 2699 union, class). */
2748 2700
2749void 2701static void
2750class_body (struct sym *cls, int tag) 2702class_body (struct sym *cls, int tag)
2751{ 2703{
2752 int vis = tag == CLASS ? PRIVATE : PUBLIC; 2704 int vis = tag == CLASS ? PRIVATE : PUBLIC;
@@ -2807,7 +2759,7 @@ class_body (struct sym *cls, int tag)
2807 qualified ident has the form `X<..>::Y<...>::T<...>. Returns a 2759 qualified ident has the form `X<..>::Y<...>::T<...>. Returns a
2808 symbol for that class. */ 2760 symbol for that class. */
2809 2761
2810struct sym * 2762static struct sym *
2811parse_classname (void) 2763parse_classname (void)
2812{ 2764{
2813 struct sym *last_class = NULL; 2765 struct sym *last_class = NULL;
@@ -2837,13 +2789,13 @@ parse_classname (void)
2837 implicitly static operator has been parsed. Value is a pointer to 2789 implicitly static operator has been parsed. Value is a pointer to
2838 a static buffer holding the constructed operator name string. */ 2790 a static buffer holding the constructed operator name string. */
2839 2791
2840char * 2792static char *
2841operator_name (int *sc) 2793operator_name (int *sc)
2842{ 2794{
2843 static int id_size = 0; 2795 static size_t id_size = 0;
2844 static char *id = NULL; 2796 static char *id = NULL;
2845 const char *s; 2797 const char *s;
2846 int len; 2798 size_t len;
2847 2799
2848 MATCH (); 2800 MATCH ();
2849 2801
@@ -2859,7 +2811,7 @@ operator_name (int *sc)
2859 len = strlen (s) + 10; 2811 len = strlen (s) + 10;
2860 if (len > id_size) 2812 if (len > id_size)
2861 { 2813 {
2862 int new_size = max (len, 2 * id_size); 2814 size_t new_size = max (len, 2 * id_size);
2863 id = (char *) xrealloc (id, new_size); 2815 id = (char *) xrealloc (id, new_size);
2864 id_size = new_size; 2816 id_size = new_size;
2865 } 2817 }
@@ -2880,7 +2832,7 @@ operator_name (int *sc)
2880 } 2832 }
2881 else 2833 else
2882 { 2834 {
2883 int tokens_matched = 0; 2835 size_t tokens_matched = 0;
2884 2836
2885 len = 20; 2837 len = 20;
2886 if (len > id_size) 2838 if (len > id_size)
@@ -2901,7 +2853,7 @@ operator_name (int *sc)
2901 len += strlen (s) + 2; 2853 len += strlen (s) + 2;
2902 if (len > id_size) 2854 if (len > id_size)
2903 { 2855 {
2904 int new_size = max (len, 2 * id_size); 2856 size_t new_size = max (len, 2 * id_size);
2905 id = (char *) xrealloc (id, new_size); 2857 id = (char *) xrealloc (id, new_size);
2906 id_size = new_size; 2858 id_size = new_size;
2907 } 2859 }
@@ -2927,7 +2879,7 @@ operator_name (int *sc)
2927 `X::Y::z'. This IDENT is returned in LAST_ID. Value is the 2879 `X::Y::z'. This IDENT is returned in LAST_ID. Value is the
2928 symbol structure for the ident. */ 2880 symbol structure for the ident. */
2929 2881
2930struct sym * 2882static struct sym *
2931parse_qualified_ident_or_type (char **last_id) 2883parse_qualified_ident_or_type (char **last_id)
2932{ 2884{
2933 struct sym *cls = NULL; 2885 struct sym *cls = NULL;
@@ -2992,14 +2944,16 @@ parse_qualified_ident_or_type (char **last_id)
2992 `X::Y::z'. This IDENT is returned in LAST_ID. Value is the 2944 `X::Y::z'. This IDENT is returned in LAST_ID. Value is the
2993 symbol structure for the ident. */ 2945 symbol structure for the ident. */
2994 2946
2995void 2947static void
2996parse_qualified_param_ident_or_type (char **last_id) 2948parse_qualified_param_ident_or_type (char **last_id)
2997{ 2949{
2998 struct sym *cls = NULL; 2950 struct sym *cls = NULL;
2999 static char *id = NULL; 2951 static char *id = NULL;
3000 static int id_size = 0; 2952 static int id_size = 0;
3001 2953
3002 while (LOOKING_AT (IDENT)) 2954 assert (LOOKING_AT (IDENT));
2955
2956 do
3003 { 2957 {
3004 int len = strlen (yytext) + 1; 2958 int len = strlen (yytext) + 1;
3005 if (len > id_size) 2959 if (len > id_size)
@@ -3022,6 +2976,7 @@ parse_qualified_param_ident_or_type (char **last_id)
3022 else 2976 else
3023 break; 2977 break;
3024 } 2978 }
2979 while (LOOKING_AT (IDENT));
3025} 2980}
3026 2981
3027 2982
@@ -3034,7 +2989,7 @@ parse_qualified_param_ident_or_type (char **last_id)
3034 2989
3035 Current lookahead is the class name. */ 2990 Current lookahead is the class name. */
3036 2991
3037void 2992static void
3038class_definition (struct sym *containing, int tag, int flags, int nested) 2993class_definition (struct sym *containing, int tag, int flags, int nested)
3039{ 2994{
3040 struct sym *current; 2995 struct sym *current;
@@ -3131,7 +3086,7 @@ class_definition (struct sym *containing, int tag, int flags, int nested)
3131 the storage class of *ID. FLAGS is a bit set giving additional 3086 the storage class of *ID. FLAGS is a bit set giving additional
3132 information about the member (see the F_* defines). */ 3087 information about the member (see the F_* defines). */
3133 3088
3134void 3089static void
3135add_declarator (struct sym **cls, char **id, int flags, int sc) 3090add_declarator (struct sym **cls, char **id, int flags, int sc)
3136{ 3091{
3137 if (LOOKING_AT2 (';', ',')) 3092 if (LOOKING_AT2 (';', ','))
@@ -3174,7 +3129,7 @@ add_declarator (struct sym **cls, char **id, int flags, int sc)
3174 3129
3175/* Parse a declaration. */ 3130/* Parse a declaration. */
3176 3131
3177void 3132static void
3178declaration (int flags) 3133declaration (int flags)
3179{ 3134{
3180 char *id = NULL; 3135 char *id = NULL;
@@ -3328,7 +3283,7 @@ declaration (int flags)
3328 parsing in an `extern "C"' block. Value is 1 if EOF is reached, 0 3283 parsing in an `extern "C"' block. Value is 1 if EOF is reached, 0
3329 otherwise. */ 3284 otherwise. */
3330 3285
3331int 3286static int
3332globals (int start_flags) 3287globals (int start_flags)
3333{ 3288{
3334 int anonymous; 3289 int anonymous;
@@ -3446,7 +3401,7 @@ globals (int start_flags)
3446 3401
3447/* Parse the current input file. */ 3402/* Parse the current input file. */
3448 3403
3449void 3404static void
3450yyparse (void) 3405yyparse (void)
3451{ 3406{
3452 while (globals (0) == 0) 3407 while (globals (0) == 0)
@@ -3462,7 +3417,7 @@ yyparse (void)
3462/* Add the list of paths PATH_LIST to the current search path for 3417/* Add the list of paths PATH_LIST to the current search path for
3463 input files. */ 3418 input files. */
3464 3419
3465void 3420static void
3466add_search_path (char *path_list) 3421add_search_path (char *path_list)
3467{ 3422{
3468 while (*path_list) 3423 while (*path_list)
@@ -3497,7 +3452,7 @@ add_search_path (char *path_list)
3497 opened. Try to find FILE in search_path first, then try the 3452 opened. Try to find FILE in search_path first, then try the
3498 unchanged file name. */ 3453 unchanged file name. */
3499 3454
3500FILE * 3455static FILE *
3501open_file (char *file) 3456open_file (char *file)
3502{ 3457{
3503 FILE *fp = NULL; 3458 FILE *fp = NULL;
@@ -3556,7 +3511,7 @@ Usage: ebrowse [options] {files}\n\
3556 --version display version info\n\ 3511 --version display version info\n\
3557" 3512"
3558 3513
3559void 3514static void
3560usage (int error) 3515usage (int error)
3561{ 3516{
3562 puts (USAGE); 3517 puts (USAGE);
@@ -3571,7 +3526,7 @@ usage (int error)
3571# define VERSION "21" 3526# define VERSION "21"
3572#endif 3527#endif
3573 3528
3574void 3529static void
3575version (void) 3530version (void)
3576{ 3531{
3577 /* Makes it easier to update automatically. */ 3532 /* Makes it easier to update automatically. */
@@ -3587,7 +3542,7 @@ version (void)
3587/* Parse one input file FILE, adding classes and members to the symbol 3542/* Parse one input file FILE, adding classes and members to the symbol
3588 table. */ 3543 table. */
3589 3544
3590void 3545static void
3591process_file (char *file) 3546process_file (char *file)
3592{ 3547{
3593 FILE *fp; 3548 FILE *fp;
@@ -3595,7 +3550,7 @@ process_file (char *file)
3595 fp = open_file (file); 3550 fp = open_file (file);
3596 if (fp) 3551 if (fp)
3597 { 3552 {
3598 int nread, nbytes; 3553 size_t nread, nbytes;
3599 3554
3600 /* Give a progress indication if needed. */ 3555 /* Give a progress indication if needed. */
3601 if (f_very_verbose) 3556 if (f_very_verbose)
@@ -3619,12 +3574,10 @@ process_file (char *file)
3619 } 3574 }
3620 3575
3621 nbytes = fread (inbuffer + nread, 1, READ_CHUNK_SIZE, fp); 3576 nbytes = fread (inbuffer + nread, 1, READ_CHUNK_SIZE, fp);
3622 if (nbytes <= 0) 3577 if (nbytes == 0)
3623 break; 3578 break;
3624 nread += nbytes; 3579 nread += nbytes;
3625 } 3580 }
3626 if (nread < 0)
3627 nread = 0;
3628 inbuffer[nread] = '\0'; 3581 inbuffer[nread] = '\0';
3629 3582
3630 /* Reinitialize scanner and parser for the new input file. */ 3583 /* Reinitialize scanner and parser for the new input file. */
@@ -3642,7 +3595,7 @@ process_file (char *file)
3642 containing its contents without the terminating newline. Value 3595 containing its contents without the terminating newline. Value
3643 is null when EOF is reached. */ 3596 is null when EOF is reached. */
3644 3597
3645char * 3598static char *
3646read_line (FILE *fp) 3599read_line (FILE *fp)
3647{ 3600{
3648 static char *buffer; 3601 static char *buffer;
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index e5484b987e2..c334fb6a196 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -112,6 +112,13 @@ char *(getcwd) (char *, size_t);
112/* Additional space when allocating buffers for filenames, etc. */ 112/* Additional space when allocating buffers for filenames, etc. */
113#define EXTRA_SPACE 100 113#define EXTRA_SPACE 100
114 114
115/* Use this to suppress gcc's `...may be used before initialized' warnings. */
116#ifdef lint
117# define IF_LINT(Code) Code
118#else
119# define IF_LINT(Code) /* empty */
120#endif
121
115 122
116/* Name used to invoke this program. */ 123/* Name used to invoke this program. */
117const char *progname; 124const char *progname;
@@ -122,6 +129,9 @@ char **main_argv;
122/* Nonzero means don't wait for a response from Emacs. --no-wait. */ 129/* Nonzero means don't wait for a response from Emacs. --no-wait. */
123int nowait = 0; 130int nowait = 0;
124 131
132/* Nonzero means don't print messages for successful operations. --quiet. */
133int quiet = 0;
134
125/* Nonzero means args are expressions to be evaluated. --eval. */ 135/* Nonzero means args are expressions to be evaluated. --eval. */
126int eval = 0; 136int eval = 0;
127 137
@@ -150,13 +160,14 @@ const char *server_file = NULL;
150/* PID of the Emacs server process. */ 160/* PID of the Emacs server process. */
151int emacs_pid = 0; 161int emacs_pid = 0;
152 162
153void print_help_and_exit (void) NO_RETURN; 163static void print_help_and_exit (void) NO_RETURN;
154void fail (void) NO_RETURN; 164static void fail (void) NO_RETURN;
155 165
156 166
157struct option longopts[] = 167struct option longopts[] =
158{ 168{
159 { "no-wait", no_argument, NULL, 'n' }, 169 { "no-wait", no_argument, NULL, 'n' },
170 { "quiet", no_argument, NULL, 'q' },
160 { "eval", no_argument, NULL, 'e' }, 171 { "eval", no_argument, NULL, 'e' },
161 { "help", no_argument, NULL, 'H' }, 172 { "help", no_argument, NULL, 'H' },
162 { "version", no_argument, NULL, 'V' }, 173 { "version", no_argument, NULL, 'V' },
@@ -178,7 +189,7 @@ struct option longopts[] =
178 189
179/* Like malloc but get fatal error if memory is exhausted. */ 190/* Like malloc but get fatal error if memory is exhausted. */
180 191
181long * 192static long *
182xmalloc (unsigned int size) 193xmalloc (unsigned int size)
183{ 194{
184 long *result = (long *) malloc (size); 195 long *result = (long *) malloc (size);
@@ -190,20 +201,6 @@ xmalloc (unsigned int size)
190 return result; 201 return result;
191} 202}
192 203
193/* Like strdup but get a fatal error if memory is exhausted. */
194
195char *
196xstrdup (const char *s)
197{
198 char *result = strdup (s);
199 if (result == NULL)
200 {
201 perror ("strdup");
202 exit (EXIT_FAILURE);
203 }
204 return result;
205}
206
207/* From sysdep.c */ 204/* From sysdep.c */
208#if !defined (HAVE_GET_CURRENT_DIR_NAME) || defined (BROKEN_GET_CURRENT_DIR_NAME) 205#if !defined (HAVE_GET_CURRENT_DIR_NAME) || defined (BROKEN_GET_CURRENT_DIR_NAME)
209 206
@@ -221,10 +218,8 @@ xstrdup (const char *s)
221#define IS_DEVICE_SEP(_c_) ((_c_) == DEVICE_SEP) 218#define IS_DEVICE_SEP(_c_) ((_c_) == DEVICE_SEP)
222#endif 219#endif
223#endif 220#endif
224#ifndef IS_ANY_SEP
225#define IS_ANY_SEP(_c_) (IS_DIRECTORY_SEP (_c_))
226#endif
227 221
222char *get_current_dir_name (void);
228 223
229/* Return the current working directory. Returns NULL on errors. 224/* Return the current working directory. Returns NULL on errors.
230 Any other returned value must be freed with free. This is used 225 Any other returned value must be freed with free. This is used
@@ -233,7 +228,7 @@ char*
233get_current_dir_name (void) 228get_current_dir_name (void)
234{ 229{
235 char *buf; 230 char *buf;
236 char *pwd; 231 const char *pwd;
237 struct stat dotstat, pwdstat; 232 struct stat dotstat, pwdstat;
238 /* If PWD is accurate, use it instead of calling getwd. PWD is 233 /* If PWD is accurate, use it instead of calling getwd. PWD is
239 sometimes a nicer name, and using it may avoid a fatal error if a 234 sometimes a nicer name, and using it may avoid a fatal error if a
@@ -300,6 +295,20 @@ get_current_dir_name (void)
300 295
301#ifdef WINDOWSNT 296#ifdef WINDOWSNT
302 297
298/* Like strdup but get a fatal error if memory is exhausted. */
299
300char *
301xstrdup (const char *s)
302{
303 char *result = strdup (s);
304 if (result == NULL)
305 {
306 perror ("strdup");
307 exit (EXIT_FAILURE);
308 }
309 return result;
310}
311
303#define REG_ROOT "SOFTWARE\\GNU\\Emacs" 312#define REG_ROOT "SOFTWARE\\GNU\\Emacs"
304 313
305/* Retrieve an environment variable from the Emacs subkeys of the registry. 314/* Retrieve an environment variable from the Emacs subkeys of the registry.
@@ -335,9 +344,11 @@ w32_get_resource (HKEY predefined, char *key, LPDWORD type)
335/* 344/*
336 getenv wrapper for Windows 345 getenv wrapper for Windows
337 346
338 This is needed to duplicate Emacs's behavior, which is to look for environment 347 Value is allocated on the heap, and can be free'd.
339 variables in the registry if they don't appear in the environment. 348
340*/ 349 This is needed to duplicate Emacs's behavior, which is to look for
350 environment variables in the registry if they don't appear in the
351 environment. */
341char * 352char *
342w32_getenv (char *envvar) 353w32_getenv (char *envvar)
343{ 354{
@@ -345,8 +356,9 @@ w32_getenv (char *envvar)
345 DWORD dwType; 356 DWORD dwType;
346 357
347 if (value = getenv (envvar)) 358 if (value = getenv (envvar))
348 /* Found in the environment. */ 359 /* Found in the environment. strdup it, because values returned
349 return value; 360 by getenv cannot be free'd. */
361 return xstrdup (value);
350 362
351 if (! (value = w32_get_resource (HKEY_CURRENT_USER, envvar, &dwType)) && 363 if (! (value = w32_get_resource (HKEY_CURRENT_USER, envvar, &dwType)) &&
352 ! (value = w32_get_resource (HKEY_LOCAL_MACHINE, envvar, &dwType))) 364 ! (value = w32_get_resource (HKEY_LOCAL_MACHINE, envvar, &dwType)))
@@ -473,14 +485,15 @@ ttyname (int fd)
473 485
474/* Display a normal or error message. 486/* Display a normal or error message.
475 On Windows, use a message box if compiled as a Windows app. */ 487 On Windows, use a message box if compiled as a Windows app. */
476void 488static void message (int, const char *, ...) ATTRIBUTE_FORMAT_PRINTF (2, 3);
477message (int is_error, const char *message, ...) 489static void
490message (int is_error, const char *format, ...)
478{ 491{
479 char msg[2048]; 492 char msg[2048];
480 va_list args; 493 va_list args;
481 494
482 va_start (args, message); 495 va_start (args, format);
483 vsprintf (msg, message, args); 496 vsprintf (msg, format, args);
484 va_end (args); 497 va_end (args);
485 498
486#ifdef WINDOWSNT 499#ifdef WINDOWSNT
@@ -504,7 +517,7 @@ message (int is_error, const char *message, ...)
504/* Decode the options from argv and argc. 517/* Decode the options from argv and argc.
505 The global variable `optind' will say how many arguments we used up. */ 518 The global variable `optind' will say how many arguments we used up. */
506 519
507void 520static void
508decode_options (int argc, char **argv) 521decode_options (int argc, char **argv)
509{ 522{
510 alternate_editor = egetenv ("ALTERNATE_EDITOR"); 523 alternate_editor = egetenv ("ALTERNATE_EDITOR");
@@ -513,9 +526,9 @@ decode_options (int argc, char **argv)
513 { 526 {
514 int opt = getopt_long_only (argc, argv, 527 int opt = getopt_long_only (argc, argv,
515#ifndef NO_SOCKETS_IN_FILE_SYSTEM 528#ifndef NO_SOCKETS_IN_FILE_SYSTEM
516 "VHnea:s:f:d:tc", 529 "VHneqa:s:f:d:tc",
517#else 530#else
518 "VHnea:f:d:tc", 531 "VHneqa:f:d:tc",
519#endif 532#endif
520 longopts, 0); 533 longopts, 0);
521 534
@@ -559,6 +572,10 @@ decode_options (int argc, char **argv)
559 eval = 1; 572 eval = 1;
560 break; 573 break;
561 574
575 case 'q':
576 quiet = 1;
577 break;
578
562 case 'V': 579 case 'V':
563 message (FALSE, "emacsclient %s\n", VERSION); 580 message (FALSE, "emacsclient %s\n", VERSION);
564 exit (EXIT_SUCCESS); 581 exit (EXIT_SUCCESS);
@@ -630,7 +647,7 @@ an empty string");
630} 647}
631 648
632 649
633void 650static void
634print_help_and_exit (void) 651print_help_and_exit (void)
635{ 652{
636 /* Spaces and tabs are significant in this message; they're chosen so the 653 /* Spaces and tabs are significant in this message; they're chosen so the
@@ -650,6 +667,7 @@ The following OPTIONS are accepted:\n\
650 use the current Emacs frame\n\ 667 use the current Emacs frame\n\
651-e, --eval Evaluate the FILE arguments as ELisp expressions\n\ 668-e, --eval Evaluate the FILE arguments as ELisp expressions\n\
652-n, --no-wait Don't wait for the server to return\n\ 669-n, --no-wait Don't wait for the server to return\n\
670-q, --quiet Don't display messages on success\n\
653-d DISPLAY, --display=DISPLAY\n\ 671-d DISPLAY, --display=DISPLAY\n\
654 Visit the file in the given display\n\ 672 Visit the file in the given display\n\
655--parent-id=ID Open in parent window ID, via XEmbed\n" 673--parent-id=ID Open in parent window ID, via XEmbed\n"
@@ -675,7 +693,7 @@ Report bugs with M-x report-emacs-bug.\n", progname);
675 defined-- exit with an errorcode. 693 defined-- exit with an errorcode.
676 Uses argv, but gets it from the global variable main_argv. 694 Uses argv, but gets it from the global variable main_argv.
677*/ 695*/
678void 696static void
679fail (void) 697fail (void)
680{ 698{
681 if (alternate_editor) 699 if (alternate_editor)
@@ -718,7 +736,7 @@ HSOCKET emacs_socket = 0;
718 736
719/* On Windows, the socket library was historically separate from the standard 737/* On Windows, the socket library was historically separate from the standard
720 C library, so errors are handled differently. */ 738 C library, so errors are handled differently. */
721void 739static void
722sock_err_message (const char *function_name) 740sock_err_message (const char *function_name)
723{ 741{
724#ifdef WINDOWSNT 742#ifdef WINDOWSNT
@@ -742,7 +760,7 @@ sock_err_message (const char *function_name)
742 - the data ends in "\n", or 760 - the data ends in "\n", or
743 - the buffer is full (but this shouldn't happen) 761 - the buffer is full (but this shouldn't happen)
744 Otherwise, we just accumulate it. */ 762 Otherwise, we just accumulate it. */
745void 763static void
746send_to_emacs (HSOCKET s, const char *data) 764send_to_emacs (HSOCKET s, const char *data)
747{ 765{
748 while (data) 766 while (data)
@@ -781,7 +799,7 @@ send_to_emacs (HSOCKET s, const char *data)
781 return value never contains a space. 799 return value never contains a space.
782 800
783 Does not change the string. Outputs the result to S. */ 801 Does not change the string. Outputs the result to S. */
784void 802static void
785quote_argument (HSOCKET s, const char *str) 803quote_argument (HSOCKET s, const char *str)
786{ 804{
787 char *copy = (char *) xmalloc (strlen (str) * 2 + 1); 805 char *copy = (char *) xmalloc (strlen (str) * 2 + 1);
@@ -822,7 +840,7 @@ quote_argument (HSOCKET s, const char *str)
822/* The inverse of quote_argument. Removes quoting in string STR by 840/* The inverse of quote_argument. Removes quoting in string STR by
823 modifying the string in place. Returns STR. */ 841 modifying the string in place. Returns STR. */
824 842
825char * 843static char *
826unquote_argument (char *str) 844unquote_argument (char *str)
827{ 845{
828 char *p, *q; 846 char *p, *q;
@@ -853,7 +871,7 @@ unquote_argument (char *str)
853} 871}
854 872
855 873
856int 874static int
857file_name_absolute_p (const char *filename) 875file_name_absolute_p (const char *filename)
858{ 876{
859 /* Sanity check, it shouldn't happen. */ 877 /* Sanity check, it shouldn't happen. */
@@ -907,7 +925,7 @@ initialize_sockets (void)
907 * Read the information needed to set up a TCP comm channel with 925 * Read the information needed to set up a TCP comm channel with
908 * the Emacs server: host, port, and authentication string. 926 * the Emacs server: host, port, and authentication string.
909 */ 927 */
910int 928static int
911get_server_config (struct sockaddr_in *server, char *authentication) 929get_server_config (struct sockaddr_in *server, char *authentication)
912{ 930{
913 char dotted[32]; 931 char dotted[32];
@@ -918,7 +936,7 @@ get_server_config (struct sockaddr_in *server, char *authentication)
918 config = fopen (server_file, "rb"); 936 config = fopen (server_file, "rb");
919 else 937 else
920 { 938 {
921 char *home = egetenv ("HOME"); 939 const char *home = egetenv ("HOME");
922 940
923 if (home) 941 if (home)
924 { 942 {
@@ -965,7 +983,7 @@ get_server_config (struct sockaddr_in *server, char *authentication)
965 return TRUE; 983 return TRUE;
966} 984}
967 985
968HSOCKET 986static HSOCKET
969set_tcp_socket (void) 987set_tcp_socket (void)
970{ 988{
971 HSOCKET s; 989 HSOCKET s;
@@ -976,7 +994,7 @@ set_tcp_socket (void)
976 if (! get_server_config (&server, auth_string)) 994 if (! get_server_config (&server, auth_string))
977 return INVALID_SOCKET; 995 return INVALID_SOCKET;
978 996
979 if (server.sin_addr.s_addr != inet_addr ("127.0.0.1")) 997 if (server.sin_addr.s_addr != inet_addr ("127.0.0.1") && !quiet)
980 message (FALSE, "%s: connected to remote socket at %s\n", 998 message (FALSE, "%s: connected to remote socket at %s\n",
981 progname, inet_ntoa (server.sin_addr)); 999 progname, inet_ntoa (server.sin_addr));
982 1000
@@ -1024,11 +1042,11 @@ strprefix (const char *prefix, const char *string)
1024 and the name in TTY_NAME, and return 1. Otherwise, fail if NOABORT 1042 and the name in TTY_NAME, and return 1. Otherwise, fail if NOABORT
1025 is zero, or return 0 if NOABORT is non-zero. */ 1043 is zero, or return 0 if NOABORT is non-zero. */
1026 1044
1027int 1045static int
1028find_tty (char **tty_type, char **tty_name, int noabort) 1046find_tty (const char **tty_type, const char **tty_name, int noabort)
1029{ 1047{
1030 char *type = egetenv ("TERM"); 1048 const char *type = egetenv ("TERM");
1031 char *name = ttyname (fileno (stdout)); 1049 const char *name = ttyname (fileno (stdout));
1032 1050
1033 if (!name) 1051 if (!name)
1034 { 1052 {
@@ -1080,11 +1098,11 @@ find_tty (char **tty_type, char **tty_name, int noabort)
1080 0 - success: none of the above */ 1098 0 - success: none of the above */
1081 1099
1082static int 1100static int
1083socket_status (char *socket_name) 1101socket_status (const char *name)
1084{ 1102{
1085 struct stat statbfr; 1103 struct stat statbfr;
1086 1104
1087 if (stat (socket_name, &statbfr) == -1) 1105 if (stat (name, &statbfr) == -1)
1088 return 2; 1106 return 2;
1089 1107
1090 if (statbfr.st_uid != geteuid ()) 1108 if (statbfr.st_uid != geteuid ())
@@ -1097,7 +1115,7 @@ socket_status (char *socket_name)
1097/* A signal handler that passes the signal to the Emacs process. 1115/* A signal handler that passes the signal to the Emacs process.
1098 Useful for SIGWINCH. */ 1116 Useful for SIGWINCH. */
1099 1117
1100SIGTYPE 1118static void
1101pass_signal_to_emacs (int signalnum) 1119pass_signal_to_emacs (int signalnum)
1102{ 1120{
1103 int old_errno = errno; 1121 int old_errno = errno;
@@ -1112,7 +1130,7 @@ pass_signal_to_emacs (int signalnum)
1112/* Signal handler for SIGCONT; notify the Emacs process that it can 1130/* Signal handler for SIGCONT; notify the Emacs process that it can
1113 now resume our tty frame. */ 1131 now resume our tty frame. */
1114 1132
1115SIGTYPE 1133static void
1116handle_sigcont (int signalnum) 1134handle_sigcont (int signalnum)
1117{ 1135{
1118 int old_errno = errno; 1136 int old_errno = errno;
@@ -1138,7 +1156,7 @@ handle_sigcont (int signalnum)
1138 reality, we may get a SIGTSTP on C-z. Handling this signal and 1156 reality, we may get a SIGTSTP on C-z. Handling this signal and
1139 notifying Emacs about it should get things under control again. */ 1157 notifying Emacs about it should get things under control again. */
1140 1158
1141SIGTYPE 1159static void
1142handle_sigtstp (int signalnum) 1160handle_sigtstp (int signalnum)
1143{ 1161{
1144 int old_errno = errno; 1162 int old_errno = errno;
@@ -1162,7 +1180,7 @@ handle_sigtstp (int signalnum)
1162 1180
1163/* Set up signal handlers before opening a frame on the current tty. */ 1181/* Set up signal handlers before opening a frame on the current tty. */
1164 1182
1165void 1183static void
1166init_signals (void) 1184init_signals (void)
1167{ 1185{
1168 /* Set up signal handlers. */ 1186 /* Set up signal handlers. */
@@ -1182,7 +1200,7 @@ init_signals (void)
1182} 1200}
1183 1201
1184 1202
1185HSOCKET 1203static HSOCKET
1186set_local_socket (void) 1204set_local_socket (void)
1187{ 1205{
1188 HSOCKET s; 1206 HSOCKET s;
@@ -1205,7 +1223,7 @@ set_local_socket (void)
1205 int default_sock = !socket_name; 1223 int default_sock = !socket_name;
1206 int saved_errno = 0; 1224 int saved_errno = 0;
1207 const char *server_name = "server"; 1225 const char *server_name = "server";
1208 const char *tmpdir; 1226 const char *tmpdir IF_LINT ( = NULL);
1209 1227
1210 if (socket_name && !strchr (socket_name, '/') 1228 if (socket_name && !strchr (socket_name, '/')
1211 && !strchr (socket_name, '\\')) 1229 && !strchr (socket_name, '\\'))
@@ -1260,10 +1278,10 @@ set_local_socket (void)
1260 associated with the name. This is reminiscent of the logic 1278 associated with the name. This is reminiscent of the logic
1261 that init_editfns uses to set the global Vuser_full_name. */ 1279 that init_editfns uses to set the global Vuser_full_name. */
1262 1280
1263 char *user_name = (char *) egetenv ("LOGNAME"); 1281 const char *user_name = egetenv ("LOGNAME");
1264 1282
1265 if (!user_name) 1283 if (!user_name)
1266 user_name = (char *) egetenv ("USER"); 1284 user_name = egetenv ("USER");
1267 1285
1268 if (user_name) 1286 if (user_name)
1269 { 1287 {
@@ -1331,7 +1349,7 @@ To start the server in Emacs, type \"M-x server-start\".\n",
1331} 1349}
1332#endif /* ! NO_SOCKETS_IN_FILE_SYSTEM */ 1350#endif /* ! NO_SOCKETS_IN_FILE_SYSTEM */
1333 1351
1334HSOCKET 1352static HSOCKET
1335set_socket (int no_exit_if_error) 1353set_socket (int no_exit_if_error)
1336{ 1354{
1337 HSOCKET s; 1355 HSOCKET s;
@@ -1447,7 +1465,7 @@ w32_give_focus (void)
1447 1465
1448/* Start the emacs daemon and try to connect to it. */ 1466/* Start the emacs daemon and try to connect to it. */
1449 1467
1450void 1468static void
1451start_daemon_and_retry_set_socket (void) 1469start_daemon_and_retry_set_socket (void)
1452{ 1470{
1453#ifndef WINDOWSNT 1471#ifndef WINDOWSNT
@@ -1483,8 +1501,8 @@ start_daemon_and_retry_set_socket (void)
1483 else 1501 else
1484 { 1502 {
1485 char emacs[] = "emacs"; 1503 char emacs[] = "emacs";
1486 char daemon[] = "--daemon"; 1504 char daemon_option[] = "--daemon";
1487 char *d_argv[] = {emacs, daemon, 0 }; 1505 char *d_argv[] = {emacs, daemon_option, 0 };
1488 if (socket_name != NULL) 1506 if (socket_name != NULL)
1489 { 1507 {
1490 /* Pass --daemon=socket_name as argument. */ 1508 /* Pass --daemon=socket_name as argument. */
@@ -1504,10 +1522,12 @@ start_daemon_and_retry_set_socket (void)
1504int 1522int
1505main (int argc, char **argv) 1523main (int argc, char **argv)
1506{ 1524{
1507 int i, rl, needlf = 0; 1525 int rl = 0, needlf = 0;
1508 char *cwd, *str; 1526 char *cwd, *str;
1509 char string[BUFSIZ+1]; 1527 char string[BUFSIZ+1];
1510 int null_socket_name, null_server_file, start_daemon_if_needed; 1528 int null_socket_name IF_LINT ( = 0);
1529 int null_server_file IF_LINT ( = 0);
1530 int start_daemon_if_needed;
1511 int exit_status = EXIT_SUCCESS; 1531 int exit_status = EXIT_SUCCESS;
1512 1532
1513 main_argv = argv; 1533 main_argv = argv;
@@ -1543,21 +1563,21 @@ main (int argc, char **argv)
1543 null_server_file = (server_file == NULL); 1563 null_server_file = (server_file == NULL);
1544 } 1564 }
1545 1565
1546 if ((emacs_socket = set_socket (alternate_editor 1566 emacs_socket = set_socket (alternate_editor || start_daemon_if_needed);
1547 || start_daemon_if_needed)) == INVALID_SOCKET) 1567 if (emacs_socket == INVALID_SOCKET)
1548 if (start_daemon_if_needed) 1568 {
1549 { 1569 if (! start_daemon_if_needed)
1550 /* Reset socket_name and server_file if they were NULL 1570 fail ();
1551 before the set_socket call. */ 1571
1552 if (null_socket_name) 1572 /* Reset socket_name and server_file if they were NULL
1553 socket_name = NULL; 1573 before the set_socket call. */
1554 if (null_server_file) 1574 if (null_socket_name)
1555 server_file = NULL; 1575 socket_name = NULL;
1556 1576 if (null_server_file)
1557 start_daemon_and_retry_set_socket (); 1577 server_file = NULL;
1558 } 1578
1559 else 1579 start_daemon_and_retry_set_socket ();
1560 fail (); 1580 }
1561 1581
1562 cwd = get_current_dir_name (); 1582 cwd = get_current_dir_name ();
1563 if (cwd == 0) 1583 if (cwd == 0)
@@ -1615,7 +1635,7 @@ main (int argc, char **argv)
1615 frame is available. */ 1635 frame is available. */
1616 if (tty || (current_frame && !eval)) 1636 if (tty || (current_frame && !eval))
1617 { 1637 {
1618 char *tty_type, *tty_name; 1638 const char *tty_type, *tty_name;
1619 1639
1620 if (find_tty (&tty_type, &tty_name, !tty)) 1640 if (find_tty (&tty_type, &tty_name, !tty))
1621 { 1641 {
@@ -1635,6 +1655,7 @@ main (int argc, char **argv)
1635 1655
1636 if ((argc - optind > 0)) 1656 if ((argc - optind > 0))
1637 { 1657 {
1658 int i;
1638 for (i = optind; i < argc; i++) 1659 for (i = optind; i < argc; i++)
1639 { 1660 {
1640 1661
@@ -1699,7 +1720,7 @@ main (int argc, char **argv)
1699 send_to_emacs (emacs_socket, "\n"); 1720 send_to_emacs (emacs_socket, "\n");
1700 1721
1701 /* Wait for an answer. */ 1722 /* Wait for an answer. */
1702 if (!eval && !tty && !nowait) 1723 if (!eval && !tty && !nowait && !quiet)
1703 { 1724 {
1704 printf ("Waiting for Emacs..."); 1725 printf ("Waiting for Emacs...");
1705 needlf = 2; 1726 needlf = 2;
@@ -1708,10 +1729,21 @@ main (int argc, char **argv)
1708 fsync (1); 1729 fsync (1);
1709 1730
1710 /* Now, wait for an answer and print any messages. */ 1731 /* Now, wait for an answer and print any messages. */
1711 while (exit_status == EXIT_SUCCESS 1732 while (exit_status == EXIT_SUCCESS)
1712 && (rl = recv (emacs_socket, string, BUFSIZ, 0)) > 0)
1713 { 1733 {
1714 char *p; 1734 char *p;
1735 do
1736 {
1737 errno = 0;
1738 rl = recv (emacs_socket, string, BUFSIZ, 0);
1739 }
1740 /* If we receive a signal (e.g. SIGWINCH, which we pass
1741 through to Emacs), on some OSes we get EINTR and must retry. */
1742 while (rl < 0 && errno == EINTR);
1743
1744 if (rl <= 0)
1745 break;
1746
1715 string[rl] = '\0'; 1747 string[rl] = '\0';
1716 1748
1717 p = string + strlen (string) - 1; 1749 p = string + strlen (string) - 1;
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 9471c0fe29f..693c999047f 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -93,8 +93,11 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4";
93 93
94#ifdef HAVE_CONFIG_H 94#ifdef HAVE_CONFIG_H
95# include <config.h> 95# include <config.h>
96 /* On some systems, Emacs defines static as nothing for the sake 96 /* This is probably not necessary any more. On some systems, config.h
97 of unexec. We don't want that here since we don't use unexec. */ 97 used to define static as nothing for the sake of unexec. We don't
98 want that here since we don't use unexec. None of these systems
99 are supported any more, but the idea is still mentioned in
100 etc/PROBLEMS. */
98# undef static 101# undef static
99# ifndef PTR /* for XEmacs */ 102# ifndef PTR /* for XEmacs */
100# define PTR void * 103# define PTR void *
@@ -190,10 +193,6 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4";
190# define assert(x) ((void) 0) 193# define assert(x) ((void) 0)
191#endif 194#endif
192 195
193#if !defined (S_ISREG) && defined (S_IFREG)
194# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
195#endif
196
197#ifdef NO_LONG_OPTIONS /* define this if you don't have GNU getopt */ 196#ifdef NO_LONG_OPTIONS /* define this if you don't have GNU getopt */
198# define NO_LONG_OPTIONS TRUE 197# define NO_LONG_OPTIONS TRUE
199# define getopt_long(argc,argv,optstr,lopts,lind) getopt (argc, argv, optstr) 198# define getopt_long(argc,argv,optstr,lopts,lind) getopt (argc, argv, optstr)
@@ -243,7 +242,6 @@ If you want regular expression support, you should delete this notice and
243#define ISLOWER(c) islower (CHAR(c)) 242#define ISLOWER(c) islower (CHAR(c))
244 243
245#define lowcase(c) tolower (CHAR(c)) 244#define lowcase(c) tolower (CHAR(c))
246#define upcase(c) toupper (CHAR(c))
247 245
248 246
249/* 247/*
@@ -2362,14 +2360,7 @@ and replace lines between %< and %> with its output, then:
2362struct C_stab_entry { const char *name; int c_ext; enum sym_type type; }; 2360struct C_stab_entry { const char *name; int c_ext; enum sym_type type; };
2363/* maximum key range = 33, duplicates = 0 */ 2361/* maximum key range = 33, duplicates = 0 */
2364 2362
2365#ifdef __GNUC__ 2363static inline unsigned int
2366__inline
2367#else
2368#ifdef __cplusplus
2369inline
2370#endif
2371#endif
2372static unsigned int
2373hash (register const char *str, register unsigned int len) 2364hash (register const char *str, register unsigned int len)
2374{ 2365{
2375 static unsigned char asso_values[] = 2366 static unsigned char asso_values[] =
@@ -3983,10 +3974,8 @@ Yacc_entries (FILE *inf)
3983static void 3974static void
3984just_read_file (FILE *inf) 3975just_read_file (FILE *inf)
3985{ 3976{
3986 register char *dummy; 3977 while (!feof (inf))
3987 3978 readline (&lb, inf);
3988 LOOP_ON_INPUT_LINES (inf, lb, dummy)
3989 continue;
3990} 3979}
3991 3980
3992 3981
@@ -4203,7 +4192,7 @@ Ada_funcs (FILE *inf)
4203 /* Skip a string i.e. "abcd". */ 4192 /* Skip a string i.e. "abcd". */
4204 if (inquote || (*dbp == '"')) 4193 if (inquote || (*dbp == '"'))
4205 { 4194 {
4206 dbp = etags_strchr ((inquote) ? dbp : dbp+1, '"'); 4195 dbp = etags_strchr (dbp + !inquote, '"');
4207 if (dbp != NULL) 4196 if (dbp != NULL)
4208 { 4197 {
4209 inquote = FALSE; 4198 inquote = FALSE;
@@ -5259,16 +5248,16 @@ HTML_labels (FILE *inf)
5259 * Original code by Sunichirou Sugou (1989) 5248 * Original code by Sunichirou Sugou (1989)
5260 * Rewritten by Anders Lindgren (1996) 5249 * Rewritten by Anders Lindgren (1996)
5261 */ 5250 */
5262static int prolog_pr (char *, char *); 5251static size_t prolog_pr (char *, char *);
5263static void prolog_skip_comment (linebuffer *, FILE *); 5252static void prolog_skip_comment (linebuffer *, FILE *);
5264static int prolog_atom (char *, int); 5253static size_t prolog_atom (char *, size_t);
5265 5254
5266static void 5255static void
5267Prolog_functions (FILE *inf) 5256Prolog_functions (FILE *inf)
5268{ 5257{
5269 char *cp, *last; 5258 char *cp, *last;
5270 int len; 5259 size_t len;
5271 int allocated; 5260 size_t allocated;
5272 5261
5273 allocated = 0; 5262 allocated = 0;
5274 len = 0; 5263 len = 0;
@@ -5325,16 +5314,16 @@ prolog_skip_comment (linebuffer *plb, FILE *inf)
5325 * Return the size of the name of the predicate or rule, or 0 if no 5314 * Return the size of the name of the predicate or rule, or 0 if no
5326 * header was found. 5315 * header was found.
5327 */ 5316 */
5328static int 5317static size_t
5329prolog_pr (char *s, char *last) 5318prolog_pr (char *s, char *last)
5330 5319
5331 /* Name of last clause. */ 5320 /* Name of last clause. */
5332{ 5321{
5333 int pos; 5322 size_t pos;
5334 int len; 5323 size_t len;
5335 5324
5336 pos = prolog_atom (s, 0); 5325 pos = prolog_atom (s, 0);
5337 if (pos < 1) 5326 if (! pos)
5338 return 0; 5327 return 0;
5339 5328
5340 len = pos; 5329 len = pos;
@@ -5344,7 +5333,7 @@ prolog_pr (char *s, char *last)
5344 || (s[pos] == '(' && (pos += 1)) 5333 || (s[pos] == '(' && (pos += 1))
5345 || (s[pos] == ':' && s[pos + 1] == '-' && (pos += 2))) 5334 || (s[pos] == ':' && s[pos + 1] == '-' && (pos += 2)))
5346 && (last == NULL /* save only the first clause */ 5335 && (last == NULL /* save only the first clause */
5347 || len != (int)strlen (last) 5336 || len != strlen (last)
5348 || !strneq (s, last, len))) 5337 || !strneq (s, last, len)))
5349 { 5338 {
5350 make_tag (s, len, TRUE, s, pos, lineno, linecharno); 5339 make_tag (s, len, TRUE, s, pos, lineno, linecharno);
@@ -5356,17 +5345,17 @@ prolog_pr (char *s, char *last)
5356 5345
5357/* 5346/*
5358 * Consume a Prolog atom. 5347 * Consume a Prolog atom.
5359 * Return the number of bytes consumed, or -1 if there was an error. 5348 * Return the number of bytes consumed, or 0 if there was an error.
5360 * 5349 *
5361 * A prolog atom, in this context, could be one of: 5350 * A prolog atom, in this context, could be one of:
5362 * - An alphanumeric sequence, starting with a lower case letter. 5351 * - An alphanumeric sequence, starting with a lower case letter.
5363 * - A quoted arbitrary string. Single quotes can escape themselves. 5352 * - A quoted arbitrary string. Single quotes can escape themselves.
5364 * Backslash quotes everything. 5353 * Backslash quotes everything.
5365 */ 5354 */
5366static int 5355static size_t
5367prolog_atom (char *s, int pos) 5356prolog_atom (char *s, size_t pos)
5368{ 5357{
5369 int origpos; 5358 size_t origpos;
5370 5359
5371 origpos = pos; 5360 origpos = pos;
5372 5361
@@ -5395,11 +5384,11 @@ prolog_atom (char *s, int pos)
5395 } 5384 }
5396 else if (s[pos] == '\0') 5385 else if (s[pos] == '\0')
5397 /* Multiline quoted atoms are ignored. */ 5386 /* Multiline quoted atoms are ignored. */
5398 return -1; 5387 return 0;
5399 else if (s[pos] == '\\') 5388 else if (s[pos] == '\\')
5400 { 5389 {
5401 if (s[pos+1] == '\0') 5390 if (s[pos+1] == '\0')
5402 return -1; 5391 return 0;
5403 pos += 2; 5392 pos += 2;
5404 } 5393 }
5405 else 5394 else
@@ -5408,7 +5397,7 @@ prolog_atom (char *s, int pos)
5408 return pos - origpos; 5397 return pos - origpos;
5409 } 5398 }
5410 else 5399 else
5411 return -1; 5400 return 0;
5412} 5401}
5413 5402
5414 5403
@@ -5484,7 +5473,7 @@ Erlang_functions (FILE *inf)
5484 */ 5473 */
5485static int 5474static int
5486erlang_func (char *s, char *last) 5475erlang_func (char *s, char *last)
5487 5476
5488 /* Name of last clause. */ 5477 /* Name of last clause. */
5489{ 5478{
5490 int pos; 5479 int pos;
@@ -6642,7 +6631,7 @@ filename_is_absolute (char *fn)
6642 ); 6631 );
6643} 6632}
6644 6633
6645/* Upcase DOS drive letter and collapse separators into single slashes. 6634/* Downcase DOS drive letter and collapse separators into single slashes.
6646 Works in place. */ 6635 Works in place. */
6647static void 6636static void
6648canonicalize_filename (register char *fn) 6637canonicalize_filename (register char *fn)
@@ -6652,8 +6641,9 @@ canonicalize_filename (register char *fn)
6652 6641
6653#ifdef DOS_NT 6642#ifdef DOS_NT
6654 /* Canonicalize drive letter case. */ 6643 /* Canonicalize drive letter case. */
6655 if (fn[0] != '\0' && fn[1] == ':' && ISLOWER (fn[0])) 6644# define ISUPPER(c) isupper (CHAR(c))
6656 fn[0] = upcase (fn[0]); 6645 if (fn[0] != '\0' && fn[1] == ':' && ISUPPER (fn[0]))
6646 fn[0] = lowcase (fn[0]);
6657 6647
6658 sep = '\\'; 6648 sep = '\\';
6659#endif 6649#endif
diff --git a/lib-src/fakemail.c b/lib-src/fakemail.c
deleted file mode 100644
index 4289e009e44..00000000000
--- a/lib-src/fakemail.c
+++ /dev/null
@@ -1,739 +0,0 @@
1/* sendmail-like interface to /bin/mail for system V,
2 Copyright (C) 1985, 1994, 1999, 2001-2011 Free Software Foundation, Inc.
3
4Author: Bill Rozas <jinx@martigny.ai.mit.edu>
5(according to ack.texi)
6
7This file is part of GNU Emacs.
8
9GNU Emacs is free software: you can redistribute it and/or modify
10it under the terms of the GNU General Public License as published by
11the Free Software Foundation, either version 3 of the License, or
12(at your option) any later version.
13
14GNU Emacs is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License
20along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21
22
23#define _XOPEN_SOURCE 500 /* for cuserid */
24
25#ifdef HAVE_CONFIG_H
26#include <config.h>
27#endif
28
29#if defined (BSD_SYSTEM) && !defined (USE_FAKEMAIL)
30/* This program isnot used in BSD, so just avoid loader complaints. */
31int
32main (void)
33{
34 return 0;
35}
36#else /* not BSD 4.2 (or newer) */
37#ifdef MSDOS
38int
39main ()
40{
41 return 0;
42}
43#else /* not MSDOS */
44/* This conditional contains all the rest of the file. */
45
46/* These are defined in config in some versions. */
47
48#ifdef static
49#undef static
50#endif
51
52#ifdef WINDOWSNT
53#include "ntlib.h"
54#endif
55
56#include <stdio.h>
57#include <string.h>
58#include <ctype.h>
59#include <time.h>
60#include <pwd.h>
61#include <stdlib.h>
62
63/* This is to declare cuserid. */
64#include <unistd.h>
65
66/* Type definitions */
67
68#define boolean int
69#define true 1
70#define false 0
71
72#define TM_YEAR_BASE 1900
73
74/* Nonzero if TM_YEAR is a struct tm's tm_year value that causes
75 asctime to have well-defined behavior. */
76#ifndef TM_YEAR_IN_ASCTIME_RANGE
77# define TM_YEAR_IN_ASCTIME_RANGE(tm_year) \
78 (1000 - TM_YEAR_BASE <= (tm_year) && (tm_year) <= 9999 - TM_YEAR_BASE)
79#endif
80
81/* Various lists */
82
83struct line_record
84{
85 char *string;
86 struct line_record *continuation;
87};
88typedef struct line_record *line_list;
89
90struct header_record
91{
92 line_list text;
93 struct header_record *next;
94 struct header_record *previous;
95};
96typedef struct header_record *header;
97
98struct stream_record
99{
100 FILE *handle;
101 int (*action)(FILE *);
102 struct stream_record *rest_streams;
103};
104typedef struct stream_record *stream_list;
105
106/* A `struct linebuffer' is a structure which holds a line of text.
107 * `readline' reads a line from a stream into a linebuffer
108 * and works regardless of the length of the line.
109 */
110
111struct linebuffer
112{
113 long size;
114 char *buffer;
115};
116
117struct linebuffer lb;
118
119#define new_list() \
120 ((line_list) xmalloc (sizeof (struct line_record)))
121#define new_header() \
122 ((header) xmalloc (sizeof (struct header_record)))
123#define new_stream() \
124 ((stream_list) xmalloc (sizeof (struct stream_record)))
125#define alloc_string(nchars) \
126 ((char *) xmalloc ((nchars) + 1))
127
128/* Global declarations */
129
130#define BUFLEN 1024
131#define KEYWORD_SIZE 256
132#define FROM_PREFIX "From"
133#define MY_NAME "fakemail"
134#define NIL ((line_list) NULL)
135#define INITIAL_LINE_SIZE 200
136
137#ifndef MAIL_PROGRAM_NAME
138#define MAIL_PROGRAM_NAME "/bin/mail"
139#endif
140
141static const char *my_name;
142static char *the_date;
143static char *the_user;
144static line_list file_preface;
145static stream_list the_streams;
146static boolean no_problems = true;
147
148static void fatal (const char *s1) NO_RETURN;
149
150#ifdef CURRENT_USER
151static struct passwd *my_entry;
152#define cuserid(s) \
153(my_entry = getpwuid (((int) geteuid ())), \
154 my_entry->pw_name)
155#endif
156
157/* Utilities */
158
159/* Print error message. `s1' is printf control string, `s2' is arg for it. */
160
161static void
162error (const char *s1, const char *s2)
163{
164 printf ("%s: ", my_name);
165 printf (s1, s2);
166 printf ("\n");
167 no_problems = false;
168}
169
170/* Print error message and exit. */
171
172static void
173fatal (const char *s1)
174{
175 error ("%s", s1);
176 exit (EXIT_FAILURE);
177}
178
179/* Like malloc but get fatal error if memory is exhausted. */
180
181static long *
182xmalloc (int size)
183{
184 long *result = (long *) malloc (((unsigned) size));
185 if (result == ((long *) NULL))
186 fatal ("virtual memory exhausted");
187 return result;
188}
189
190static long *
191xrealloc (long int *ptr, int size)
192{
193 long *result = (long *) realloc (ptr, ((unsigned) size));
194 if (result == ((long *) NULL))
195 fatal ("virtual memory exhausted");
196 return result;
197}
198
199/* Initialize a linebuffer for use */
200
201void
202init_linebuffer (struct linebuffer *linebuffer)
203{
204 linebuffer->size = INITIAL_LINE_SIZE;
205 linebuffer->buffer = ((char *) xmalloc (INITIAL_LINE_SIZE));
206}
207
208/* Read a line of text from `stream' into `linebuffer'.
209 Return the length of the line. */
210
211long
212readline (struct linebuffer *linebuffer, FILE *stream)
213{
214 char *buffer = linebuffer->buffer;
215 char *p = linebuffer->buffer;
216 char *end = p + linebuffer->size;
217
218 while (true)
219 {
220 int c = getc (stream);
221 if (p == end)
222 {
223 linebuffer->size *= 2;
224 buffer = ((char *) xrealloc ((long *)buffer, linebuffer->size));
225 p = buffer + (p - linebuffer->buffer);
226 end = buffer + linebuffer->size;
227 linebuffer->buffer = buffer;
228 }
229 if (c < 0 || c == '\n')
230 {
231 *p = 0;
232 break;
233 }
234 *p++ = c;
235 }
236
237 return p - buffer;
238}
239
240/* Extract a colon-terminated keyword from the string FIELD.
241 Return that keyword as a string stored in a static buffer.
242 Store the address of the rest of the string into *REST.
243
244 If there is no keyword, return NULL and don't alter *REST. */
245
246char *
247get_keyword (register char *field, char **rest)
248{
249 static char keyword[KEYWORD_SIZE];
250 register char *ptr;
251 register int c;
252
253 ptr = &keyword[0];
254 c = (unsigned char) *field++;
255 if (isspace (c) || c == ':')
256 return ((char *) NULL);
257 *ptr++ = (islower (c) ? toupper (c) : c);
258 while (((c = (unsigned char) *field++) != ':') && ! isspace (c))
259 *ptr++ = (islower (c) ? toupper (c) : c);
260 *ptr++ = '\0';
261 while (isspace (c))
262 c = (unsigned char) *field++;
263 if (c != ':')
264 return ((char *) NULL);
265 *rest = field;
266 return &keyword[0];
267}
268
269/* Nonzero if the string FIELD starts with a colon-terminated keyword. */
270
271boolean
272has_keyword (char *field)
273{
274 char *ignored;
275 return (get_keyword (field, &ignored) != ((char *) NULL));
276}
277
278/* Store the string FIELD, followed by any lines in THE_LIST,
279 into the buffer WHERE.
280 Concatenate lines, putting just a space between them.
281 Delete everything contained in parentheses.
282 When a recipient name contains <...>, we discard
283 everything except what is inside the <...>.
284
285 We don't pay attention to overflowing WHERE;
286 the caller has to make it big enough. */
287
288char *
289add_field (line_list the_list, register char *field, register char *where)
290{
291 register char c;
292 while (true)
293 {
294 char *this_recipient_where;
295 int in_quotes = 0;
296
297 *where++ = ' ';
298 this_recipient_where = where;
299
300 while ((c = *field++) != '\0')
301 {
302 if (c == '\\')
303 *where++ = c;
304 else if (c == '"')
305 {
306 in_quotes = ! in_quotes;
307 *where++ = c;
308 }
309 else if (in_quotes)
310 *where++ = c;
311 else if (c == '(')
312 {
313 while (*field && *field != ')') ++field;
314 if (! (*field++)) break; /* no close */
315 continue;
316 }
317 else if (c == ',')
318 {
319 *where++ = ' ';
320 /* When we get to the end of one recipient,
321 don't discard it if the next one has <...>. */
322 this_recipient_where = where;
323 }
324 else if (c == '<')
325 /* Discard everything we got before the `<'. */
326 where = this_recipient_where;
327 else if (c == '>')
328 /* Discard the rest of this name that follows the `>'. */
329 {
330 while (*field && *field != ',') ++field;
331 if (! (*field++)) break; /* no comma */
332 continue;
333 }
334 else
335 *where++ = c;
336 }
337 if (the_list == NIL) break;
338 field = the_list->string;
339 the_list = the_list->continuation;
340 }
341 return where;
342}
343
344line_list
345make_file_preface (void)
346{
347 char *the_string, *temp;
348 long idiotic_interface;
349 struct tm *tm;
350 long prefix_length;
351 long user_length;
352 long date_length;
353 line_list result;
354
355 prefix_length = strlen (FROM_PREFIX);
356 time (&idiotic_interface);
357 /* Convert to a string, checking for out-of-range time stamps.
358 Don't use 'ctime', as that might dump core if the hardware clock
359 is set to a bizarre value. */
360 tm = localtime (&idiotic_interface);
361 if (! (tm && TM_YEAR_IN_ASCTIME_RANGE (tm->tm_year)
362 && (the_date = asctime (tm))))
363 fatal ("current time is out of range");
364 /* the_date has an unwanted newline at the end */
365 date_length = strlen (the_date) - 1;
366 the_date[date_length] = '\0';
367 temp = cuserid ((char *) NULL);
368 user_length = strlen (temp);
369 the_user = alloc_string (user_length + 1);
370 strcpy (the_user, temp);
371 the_string = alloc_string (3 + prefix_length
372 + user_length
373 + date_length);
374 temp = the_string;
375 strcpy (temp, FROM_PREFIX);
376 temp = &temp[prefix_length];
377 *temp++ = ' ';
378 strcpy (temp, the_user);
379 temp = &temp[user_length];
380 *temp++ = ' ';
381 strcpy (temp, the_date);
382 result = new_list ();
383 result->string = the_string;
384 result->continuation = ((line_list) NULL);
385 return result;
386}
387
388void
389write_line_list (register line_list the_list, FILE *the_stream)
390{
391 for ( ;
392 the_list != ((line_list) NULL) ;
393 the_list = the_list->continuation)
394 {
395 fputs (the_list->string, the_stream);
396 putc ('\n', the_stream);
397 }
398 return;
399}
400
401int
402close_the_streams (void)
403{
404 register stream_list rem;
405 for (rem = the_streams;
406 rem != ((stream_list) NULL);
407 rem = rem->rest_streams)
408 no_problems = (no_problems &&
409 ((*rem->action) (rem->handle) == 0));
410 the_streams = ((stream_list) NULL);
411 return (no_problems ? EXIT_SUCCESS : EXIT_FAILURE);
412}
413
414void
415add_a_stream (FILE *the_stream, int (*closing_action) (FILE *))
416{
417 stream_list old = the_streams;
418 the_streams = new_stream ();
419 the_streams->handle = the_stream;
420 the_streams->action = closing_action;
421 the_streams->rest_streams = old;
422 return;
423}
424
425int
426my_fclose (FILE *the_file)
427{
428 putc ('\n', the_file);
429 fflush (the_file);
430 return fclose (the_file);
431}
432
433boolean
434open_a_file (char *name)
435{
436 FILE *the_stream = fopen (name, "a");
437 if (the_stream != ((FILE *) NULL))
438 {
439 add_a_stream (the_stream, my_fclose);
440 if (the_user == ((char *) NULL))
441 file_preface = make_file_preface ();
442 write_line_list (file_preface, the_stream);
443 return true;
444 }
445 return false;
446}
447
448void
449put_string (char *s)
450{
451 register stream_list rem;
452 for (rem = the_streams;
453 rem != ((stream_list) NULL);
454 rem = rem->rest_streams)
455 fputs (s, rem->handle);
456 return;
457}
458
459void
460put_line (const char *string)
461{
462 register stream_list rem;
463 for (rem = the_streams;
464 rem != ((stream_list) NULL);
465 rem = rem->rest_streams)
466 {
467 const char *s = string;
468 int column = 0;
469
470 /* Divide STRING into lines. */
471 while (*s != 0)
472 {
473 const char *breakpos;
474
475 /* Find the last char that fits. */
476 for (breakpos = s; *breakpos && column < 78; ++breakpos)
477 {
478 if (*breakpos == '\t')
479 column += 8;
480 else
481 column++;
482 }
483 /* If we didn't reach end of line, break the line. */
484 if (*breakpos)
485 {
486 /* Back up to just after the last comma that fits. */
487 while (breakpos != s && breakpos[-1] != ',') --breakpos;
488
489 if (breakpos == s)
490 {
491 /* If no comma fits, move past the first address anyway. */
492 while (*breakpos != 0 && *breakpos != ',') ++breakpos;
493 if (*breakpos != 0)
494 /* Include the comma after it. */
495 ++breakpos;
496 }
497 }
498 /* Output that much, then break the line. */
499 fwrite (s, 1, breakpos - s, rem->handle);
500 column = 8;
501
502 /* Skip whitespace and prepare to print more addresses. */
503 s = breakpos;
504 while (*s == ' ' || *s == '\t') ++s;
505 if (*s != 0)
506 fputs ("\n\t", rem->handle);
507 }
508 putc ('\n', rem->handle);
509 }
510 return;
511}
512
513#define mail_error error
514
515/* Handle an FCC field. FIELD is the text of the first line (after
516 the header name), and THE_LIST holds the continuation lines if any.
517 Call open_a_file for each file. */
518
519void
520setup_files (register line_list the_list, register char *field)
521{
522 register char *start;
523 register char c;
524 while (true)
525 {
526 while (((c = *field) != '\0')
527 && (c == ' '
528 || c == '\t'
529 || c == ','))
530 field += 1;
531 if (c != '\0')
532 {
533 start = field;
534 while (((c = *field) != '\0')
535 && c != ' '
536 && c != '\t'
537 && c != ',')
538 field += 1;
539 *field = '\0';
540 if (!open_a_file (start))
541 mail_error ("Could not open file %s", start);
542 *field = c;
543 if (c != '\0') continue;
544 }
545 if (the_list == ((line_list) NULL))
546 return;
547 field = the_list->string;
548 the_list = the_list->continuation;
549 }
550}
551
552/* Compute the total size of all recipient names stored in THE_HEADER.
553 The result says how big to make the buffer to pass to parse_header. */
554
555int
556args_size (header the_header)
557{
558 register header old = the_header;
559 register line_list rem;
560 register int size = 0;
561 do
562 {
563 char *field;
564 register char *keyword = get_keyword (the_header->text->string, &field);
565 if ((strcmp (keyword, "TO") == 0)
566 || (strcmp (keyword, "CC") == 0)
567 || (strcmp (keyword, "BCC") == 0))
568 {
569 size += 1 + strlen (field);
570 for (rem = the_header->text->continuation;
571 rem != NIL;
572 rem = rem->continuation)
573 size += 1 + strlen (rem->string);
574 }
575 the_header = the_header->next;
576 } while (the_header != old);
577 return size;
578}
579
580/* Scan the header described by the lists THE_HEADER,
581 and put all recipient names into the buffer WHERE.
582 Precede each recipient name with a space.
583
584 Also, if the header has any FCC fields, call setup_files for each one. */
585
586void
587parse_header (header the_header, register char *where)
588{
589 register header old = the_header;
590 do
591 {
592 char *field;
593 register char *keyword = get_keyword (the_header->text->string, &field);
594 if (strcmp (keyword, "TO") == 0)
595 where = add_field (the_header->text->continuation, field, where);
596 else if (strcmp (keyword, "CC") == 0)
597 where = add_field (the_header->text->continuation, field, where);
598 else if (strcmp (keyword, "BCC") == 0)
599 {
600 where = add_field (the_header->text->continuation, field, where);
601 the_header->previous->next = the_header->next;
602 the_header->next->previous = the_header->previous;
603 }
604 else if (strcmp (keyword, "FCC") == 0)
605 setup_files (the_header->text->continuation, field);
606 the_header = the_header->next;
607 } while (the_header != old);
608 *where = '\0';
609 return;
610}
611
612/* Read lines from the input until we get a blank line.
613 Create a list of `header' objects, one for each header field,
614 each of which points to a list of `line_list' objects,
615 one for each line in that field.
616 Continuation lines are grouped in the headers they continue. */
617
618header
619read_header (void)
620{
621 register header the_header = ((header) NULL);
622 register line_list *next_line = ((line_list *) NULL);
623
624 init_linebuffer (&lb);
625
626 do
627 {
628 long length;
629 register char *line;
630
631 readline (&lb, stdin);
632 line = lb.buffer;
633 length = strlen (line);
634 if (length == 0) break;
635
636 if (has_keyword (line))
637 {
638 register header old = the_header;
639 the_header = new_header ();
640 if (old == ((header) NULL))
641 {
642 the_header->next = the_header;
643 the_header->previous = the_header;
644 }
645 else
646 {
647 the_header->previous = old;
648 the_header->next = old->next;
649 old->next = the_header;
650 }
651 next_line = &(the_header->text);
652 }
653
654 if (next_line == ((line_list *) NULL))
655 {
656 /* Not a valid header */
657 exit (EXIT_FAILURE);
658 }
659 *next_line = new_list ();
660 (*next_line)->string = alloc_string (length);
661 strcpy (((*next_line)->string), line);
662 next_line = &((*next_line)->continuation);
663 *next_line = NIL;
664
665 } while (true);
666
667 if (! the_header)
668 fatal ("input message has no header");
669 return the_header->next;
670}
671
672void
673write_header (header the_header)
674{
675 register header old = the_header;
676 do
677 {
678 register line_list the_list;
679 for (the_list = the_header->text;
680 the_list != NIL;
681 the_list = the_list->continuation)
682 put_line (the_list->string);
683 the_header = the_header->next;
684 } while (the_header != old);
685 put_line ("");
686 return;
687}
688
689int
690main (int argc, char **argv)
691{
692 char *command_line;
693 header the_header;
694 long name_length;
695 const char *mail_program_name;
696 char buf[BUFLEN + 1];
697 register int size;
698 FILE *the_pipe;
699
700 mail_program_name = getenv ("FAKEMAILER");
701 if (!(mail_program_name && *mail_program_name))
702 mail_program_name = MAIL_PROGRAM_NAME;
703 name_length = strlen (mail_program_name);
704
705 my_name = MY_NAME;
706 the_streams = ((stream_list) NULL);
707 the_date = ((char *) NULL);
708 the_user = ((char *) NULL);
709
710 the_header = read_header ();
711 command_line = alloc_string (name_length + args_size (the_header));
712 strcpy (command_line, mail_program_name);
713 parse_header (the_header, &command_line[name_length]);
714
715 the_pipe = popen (command_line, "w");
716 if (the_pipe == ((FILE *) NULL))
717 fatal ("cannot open pipe to real mailer");
718
719 add_a_stream (the_pipe, pclose);
720
721 write_header (the_header);
722
723 /* Dump the message itself */
724
725 while (!feof (stdin))
726 {
727 size = fread (buf, 1, BUFLEN, stdin);
728 buf[size] = '\0';
729 put_string (buf);
730 }
731
732 exit (close_the_streams ());
733}
734
735#endif /* not MSDOS */
736#endif /* not BSD 4.2 (or newer) */
737
738
739/* fakemail.c ends here */
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c
index 8addbda0489..ba54202954b 100644
--- a/lib-src/make-docfile.c
+++ b/lib-src/make-docfile.c
@@ -41,11 +41,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
41#undef chdir 41#undef chdir
42 42
43#include <stdio.h> 43#include <stdio.h>
44#include <stdlib.h>
44#ifdef MSDOS 45#ifdef MSDOS
45#include <fcntl.h> 46#include <fcntl.h>
46#endif /* MSDOS */ 47#endif /* MSDOS */
47#ifdef WINDOWSNT 48#ifdef WINDOWSNT
48#include <stdlib.h>
49#include <fcntl.h> 49#include <fcntl.h>
50#include <direct.h> 50#include <direct.h>
51#endif /* WINDOWSNT */ 51#endif /* WINDOWSNT */
@@ -66,10 +66,19 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
66#define IS_DIRECTORY_SEP(_c_) ((_c_) == DIRECTORY_SEP) 66#define IS_DIRECTORY_SEP(_c_) ((_c_) == DIRECTORY_SEP)
67#endif 67#endif
68 68
69int scan_file (char *filename); 69/* Use this to suppress gcc's `...may be used before initialized' warnings. */
70int scan_lisp_file (const char *filename, const char *mode); 70#ifdef lint
71int scan_c_file (char *filename, const char *mode); 71# define IF_LINT(Code) Code
72void fatal (const char *s1, const char *s2) NO_RETURN; 72#else
73# define IF_LINT(Code) /* empty */
74#endif
75
76static int scan_file (char *filename);
77static int scan_lisp_file (const char *filename, const char *mode);
78static int scan_c_file (char *filename, const char *mode);
79static void fatal (const char *s1, const char *s2) NO_RETURN;
80static void start_globals (void);
81static void write_globals (void);
73 82
74#ifdef MSDOS 83#ifdef MSDOS
75/* s/msdos.h defines this as sys_chdir, but we're not linking with the 84/* s/msdos.h defines this as sys_chdir, but we're not linking with the
@@ -85,10 +94,13 @@ FILE *outfile;
85/* Name this program was invoked with. */ 94/* Name this program was invoked with. */
86char *progname; 95char *progname;
87 96
97/* Nonzero if this invocation is generating globals.h. */
98int generate_globals;
99
88/* Print error message. `s1' is printf control string, `s2' is arg for it. */ 100/* Print error message. `s1' is printf control string, `s2' is arg for it. */
89 101
90/* VARARGS1 */ 102/* VARARGS1 */
91void 103static void
92error (const char *s1, const char *s2) 104error (const char *s1, const char *s2)
93{ 105{
94 fprintf (stderr, "%s: ", progname); 106 fprintf (stderr, "%s: ", progname);
@@ -99,7 +111,7 @@ error (const char *s1, const char *s2)
99/* Print error message and exit. */ 111/* Print error message and exit. */
100 112
101/* VARARGS1 */ 113/* VARARGS1 */
102void 114static void
103fatal (const char *s1, const char *s2) 115fatal (const char *s1, const char *s2)
104{ 116{
105 error (s1, s2); 117 error (s1, s2);
@@ -108,7 +120,7 @@ fatal (const char *s1, const char *s2)
108 120
109/* Like malloc but get fatal error if memory is exhausted. */ 121/* Like malloc but get fatal error if memory is exhausted. */
110 122
111void * 123static void *
112xmalloc (unsigned int size) 124xmalloc (unsigned int size)
113{ 125{
114 void *result = (void *) malloc (size); 126 void *result = (void *) malloc (size);
@@ -116,6 +128,18 @@ xmalloc (unsigned int size)
116 fatal ("virtual memory exhausted", 0); 128 fatal ("virtual memory exhausted", 0);
117 return result; 129 return result;
118} 130}
131
132/* Like realloc but get fatal error if memory is exhausted. */
133
134static void *
135xrealloc (void *arg, unsigned int size)
136{
137 void *result = (void *) realloc (arg, size);
138 if (result == NULL)
139 fatal ("virtual memory exhausted", 0);
140 return result;
141}
142
119 143
120int 144int
121main (int argc, char **argv) 145main (int argc, char **argv)
@@ -164,10 +188,18 @@ main (int argc, char **argv)
164 } 188 }
165 i += 2; 189 i += 2;
166 } 190 }
191 if (argc > i && !strcmp (argv[i], "-g"))
192 {
193 generate_globals = 1;
194 ++i;
195 }
167 196
168 if (outfile == 0) 197 if (outfile == 0)
169 fatal ("No output file specified", ""); 198 fatal ("No output file specified", "");
170 199
200 if (generate_globals)
201 start_globals ();
202
171 first_infile = i; 203 first_infile = i;
172 for (; i < argc; i++) 204 for (; i < argc; i++)
173 { 205 {
@@ -179,11 +211,15 @@ main (int argc, char **argv)
179 if (j == i) 211 if (j == i)
180 err_count += scan_file (argv[i]); 212 err_count += scan_file (argv[i]);
181 } 213 }
214
215 if (err_count == 0 && generate_globals)
216 write_globals ();
217
182 return (err_count > 0 ? EXIT_FAILURE : EXIT_SUCCESS); 218 return (err_count > 0 ? EXIT_FAILURE : EXIT_SUCCESS);
183} 219}
184 220
185/* Add a source file name boundary marker in the output file. */ 221/* Add a source file name boundary marker in the output file. */
186void 222static void
187put_filename (char *filename) 223put_filename (char *filename)
188{ 224{
189 char *tmp; 225 char *tmp;
@@ -202,13 +238,14 @@ put_filename (char *filename)
202/* Read file FILENAME and output its doc strings to outfile. */ 238/* Read file FILENAME and output its doc strings to outfile. */
203/* Return 1 if file is not found, 0 if it is found. */ 239/* Return 1 if file is not found, 0 if it is found. */
204 240
205int 241static int
206scan_file (char *filename) 242scan_file (char *filename)
207{ 243{
208 244
209 size_t len = strlen (filename); 245 size_t len = strlen (filename);
210 246
211 put_filename (filename); 247 if (!generate_globals)
248 put_filename (filename);
212 if (len > 4 && !strcmp (filename + len - 4, ".elc")) 249 if (len > 4 && !strcmp (filename + len - 4, ".elc"))
213 return scan_lisp_file (filename, READ_BINARY); 250 return scan_lisp_file (filename, READ_BINARY);
214 else if (len > 3 && !strcmp (filename + len - 3, ".el")) 251 else if (len > 3 && !strcmp (filename + len - 3, ".el"))
@@ -216,8 +253,16 @@ scan_file (char *filename)
216 else 253 else
217 return scan_c_file (filename, READ_TEXT); 254 return scan_c_file (filename, READ_TEXT);
218} 255}
256
257static void
258start_globals (void)
259{
260 fprintf (outfile, "/* This file was auto-generated by make-docfile. */\n");
261 fprintf (outfile, "/* DO NOT EDIT. */\n");
262 fprintf (outfile, "struct emacs_globals {\n");
263}
219 264
220char buf[128]; 265static char input_buffer[128];
221 266
222/* Some state during the execution of `read_c_string_or_comment'. */ 267/* Some state during the execution of `read_c_string_or_comment'. */
223struct rcsoc_state 268struct rcsoc_state
@@ -246,7 +291,7 @@ struct rcsoc_state
246/* Output CH to the file or buffer in STATE. Any pending newlines or 291/* Output CH to the file or buffer in STATE. Any pending newlines or
247 spaces are output first. */ 292 spaces are output first. */
248 293
249static INLINE void 294static inline void
250put_char (int ch, struct rcsoc_state *state) 295put_char (int ch, struct rcsoc_state *state)
251{ 296{
252 int out_ch; 297 int out_ch;
@@ -350,14 +395,14 @@ scan_keyword_or_put_char (int ch, struct rcsoc_state *state)
350 at the beginning of a line will be removed, and *SAW_USAGE set to 395 at the beginning of a line will be removed, and *SAW_USAGE set to
351 true if any were encountered. */ 396 true if any were encountered. */
352 397
353int 398static int
354read_c_string_or_comment (FILE *infile, int printflag, int comment, int *saw_usage) 399read_c_string_or_comment (FILE *infile, int printflag, int comment, int *saw_usage)
355{ 400{
356 register int c; 401 register int c;
357 struct rcsoc_state state; 402 struct rcsoc_state state;
358 403
359 state.in_file = infile; 404 state.in_file = infile;
360 state.buf_ptr = (printflag < 0 ? buf : 0); 405 state.buf_ptr = (printflag < 0 ? input_buffer : 0);
361 state.out_file = (printflag > 0 ? outfile : 0); 406 state.out_file = (printflag > 0 ? outfile : 0);
362 state.pending_spaces = 0; 407 state.pending_spaces = 0;
363 state.pending_newlines = 0; 408 state.pending_newlines = 0;
@@ -438,12 +483,12 @@ read_c_string_or_comment (FILE *infile, int printflag, int comment, int *saw_usa
438/* Write to file OUT the argument names of function FUNC, whose text is in BUF. 483/* Write to file OUT the argument names of function FUNC, whose text is in BUF.
439 MINARGS and MAXARGS are the minimum and maximum number of arguments. */ 484 MINARGS and MAXARGS are the minimum and maximum number of arguments. */
440 485
441void 486static void
442write_c_args (FILE *out, char *func, char *buf, int minargs, int maxargs) 487write_c_args (FILE *out, char *func, char *buf, int minargs, int maxargs)
443{ 488{
444 register char *p; 489 register char *p;
445 int in_ident = 0; 490 int in_ident = 0;
446 char *ident_start; 491 char *ident_start IF_LINT (= NULL);
447 size_t ident_length = 0; 492 size_t ident_length = 0;
448 493
449 fprintf (out, "(fn"); 494 fprintf (out, "(fn");
@@ -517,20 +562,109 @@ write_c_args (FILE *out, char *func, char *buf, int minargs, int maxargs)
517 putc (')', out); 562 putc (')', out);
518} 563}
519 564
565/* The types of globals. */
566enum global_type
567{
568 EMACS_INTEGER,
569 BOOLEAN,
570 LISP_OBJECT,
571 INVALID
572};
573
574/* A single global. */
575struct global
576{
577 enum global_type type;
578 char *name;
579};
580
581/* All the variable names we saw while scanning C sources in `-g'
582 mode. */
583int num_globals;
584int num_globals_allocated;
585struct global *globals;
586
587static void
588add_global (enum global_type type, char *name)
589{
590 /* Ignore the one non-symbol that can occur. */
591 if (strcmp (name, "..."))
592 {
593 ++num_globals;
594
595 if (num_globals_allocated == 0)
596 {
597 num_globals_allocated = 100;
598 globals = xmalloc (num_globals_allocated * sizeof (struct global));
599 }
600 else if (num_globals == num_globals_allocated)
601 {
602 num_globals_allocated *= 2;
603 globals = xrealloc (globals,
604 num_globals_allocated * sizeof (struct global));
605 }
606
607 globals[num_globals - 1].type = type;
608 globals[num_globals - 1].name = name;
609 }
610}
611
612static int
613compare_globals (const void *a, const void *b)
614{
615 const struct global *ga = a;
616 const struct global *gb = b;
617 return strcmp (ga->name, gb->name);
618}
619
620static void
621write_globals (void)
622{
623 int i;
624 qsort (globals, num_globals, sizeof (struct global), compare_globals);
625 for (i = 0; i < num_globals; ++i)
626 {
627 char const *type;
628
629 switch (globals[i].type)
630 {
631 case EMACS_INTEGER:
632 type = "EMACS_INT";
633 break;
634 case BOOLEAN:
635 type = "int";
636 break;
637 case LISP_OBJECT:
638 type = "Lisp_Object";
639 break;
640 default:
641 fatal ("not a recognized DEFVAR_", 0);
642 }
643
644 fprintf (outfile, " %s f_%s;\n", type, globals[i].name);
645 fprintf (outfile, "#define %s globals.f_%s\n",
646 globals[i].name, globals[i].name);
647 while (i + 1 < num_globals
648 && !strcmp (globals[i].name, globals[i + 1].name))
649 ++i;
650 }
651
652 fprintf (outfile, "};\n");
653 fprintf (outfile, "extern struct emacs_globals globals;\n");
654}
655
656
520/* Read through a c file. If a .o file is named, 657/* Read through a c file. If a .o file is named,
521 the corresponding .c or .m file is read instead. 658 the corresponding .c or .m file is read instead.
522 Looks for DEFUN constructs such as are defined in ../src/lisp.h. 659 Looks for DEFUN constructs such as are defined in ../src/lisp.h.
523 Accepts any word starting DEF... so it finds DEFSIMPLE and DEFPRED. */ 660 Accepts any word starting DEF... so it finds DEFSIMPLE and DEFPRED. */
524 661
525int 662static int
526scan_c_file (char *filename, const char *mode) 663scan_c_file (char *filename, const char *mode)
527{ 664{
528 FILE *infile; 665 FILE *infile;
529 register int c; 666 register int c;
530 register int commas; 667 register int commas;
531 register int defunflag;
532 register int defvarperbufferflag;
533 register int defvarflag;
534 int minargs, maxargs; 668 int minargs, maxargs;
535 int extension = filename[strlen (filename) - 1]; 669 int extension = filename[strlen (filename) - 1];
536 670
@@ -562,6 +696,10 @@ scan_c_file (char *filename, const char *mode)
562 while (!feof (infile)) 696 while (!feof (infile))
563 { 697 {
564 int doc_keyword = 0; 698 int doc_keyword = 0;
699 int defunflag = 0;
700 int defvarperbufferflag = 0;
701 int defvarflag = 0;
702 enum global_type type = INVALID;
565 703
566 if (c != '\n' && c != '\r') 704 if (c != '\n' && c != '\r')
567 { 705 {
@@ -595,12 +733,24 @@ scan_c_file (char *filename, const char *mode)
595 continue; 733 continue;
596 734
597 defvarflag = 1; 735 defvarflag = 1;
598 defunflag = 0;
599 736
600 c = getc (infile); 737 c = getc (infile);
601 defvarperbufferflag = (c == 'P'); 738 defvarperbufferflag = (c == 'P');
739 if (generate_globals)
740 {
741 if (c == 'I')
742 type = EMACS_INTEGER;
743 else if (c == 'L')
744 type = LISP_OBJECT;
745 else if (c == 'B')
746 type = BOOLEAN;
747 }
602 748
603 c = getc (infile); 749 c = getc (infile);
750 /* We need to distinguish between DEFVAR_BOOL and
751 DEFVAR_BUFFER_DEFAULTS. */
752 if (generate_globals && type == BOOLEAN && c != 'O')
753 type = INVALID;
604 } 754 }
605 else if (c == 'D') 755 else if (c == 'D')
606 { 756 {
@@ -612,11 +762,13 @@ scan_c_file (char *filename, const char *mode)
612 continue; 762 continue;
613 c = getc (infile); 763 c = getc (infile);
614 defunflag = c == 'U'; 764 defunflag = c == 'U';
615 defvarflag = 0;
616 defvarperbufferflag = 0;
617 } 765 }
618 else continue; 766 else continue;
619 767
768 if (generate_globals && (!defvarflag || defvarperbufferflag
769 || type == INVALID))
770 continue;
771
620 while (c != '(') 772 while (c != '(')
621 { 773 {
622 if (c < 0) 774 if (c < 0)
@@ -630,6 +782,34 @@ scan_c_file (char *filename, const char *mode)
630 continue; 782 continue;
631 c = read_c_string_or_comment (infile, -1, 0, 0); 783 c = read_c_string_or_comment (infile, -1, 0, 0);
632 784
785 if (generate_globals)
786 {
787 int i = 0;
788 char *name;
789
790 /* Skip "," and whitespace. */
791 do
792 {
793 c = getc (infile);
794 }
795 while (c == ',' || c == ' ' || c == '\t' || c == '\n' || c == '\r');
796
797 /* Read in the identifier. */
798 do
799 {
800 input_buffer[i++] = c;
801 c = getc (infile);
802 }
803 while (! (c == ',' || c == ' ' || c == '\t' ||
804 c == '\n' || c == '\r'));
805 input_buffer[i] = '\0';
806
807 name = xmalloc (i + 1);
808 memcpy (name, input_buffer, i + 1);
809 add_global (type, name);
810 continue;
811 }
812
633 /* DEFVAR_LISP ("name", addr, "doc") 813 /* DEFVAR_LISP ("name", addr, "doc")
634 DEFVAR_LISP ("name", addr /\* doc *\/) 814 DEFVAR_LISP ("name", addr /\* doc *\/)
635 DEFVAR_LISP ("name", addr, doc: /\* doc *\/) */ 815 DEFVAR_LISP ("name", addr, doc: /\* doc *\/) */
@@ -637,7 +817,7 @@ scan_c_file (char *filename, const char *mode)
637 if (defunflag) 817 if (defunflag)
638 commas = 5; 818 commas = 5;
639 else if (defvarperbufferflag) 819 else if (defvarperbufferflag)
640 commas = 2; 820 commas = 3;
641 else if (defvarflag) 821 else if (defvarflag)
642 commas = 1; 822 commas = 1;
643 else /* For DEFSIMPLE and DEFPRED */ 823 else /* For DEFSIMPLE and DEFPRED */
@@ -710,7 +890,7 @@ scan_c_file (char *filename, const char *mode)
710 890
711 putc (037, outfile); 891 putc (037, outfile);
712 putc (defvarflag ? 'V' : 'F', outfile); 892 putc (defvarflag ? 'V' : 'F', outfile);
713 fprintf (outfile, "%s\n", buf); 893 fprintf (outfile, "%s\n", input_buffer);
714 894
715 if (comment) 895 if (comment)
716 getc (infile); /* Skip past `*' */ 896 getc (infile); /* Skip past `*' */
@@ -753,11 +933,12 @@ scan_c_file (char *filename, const char *mode)
753 *p = '\0'; 933 *p = '\0';
754 /* Output them. */ 934 /* Output them. */
755 fprintf (outfile, "\n\n"); 935 fprintf (outfile, "\n\n");
756 write_c_args (outfile, buf, argbuf, minargs, maxargs); 936 write_c_args (outfile, input_buffer, argbuf, minargs, maxargs);
757 } 937 }
758 else if (defunflag && maxargs == -1 && !saw_usage) 938 else if (defunflag && maxargs == -1 && !saw_usage)
759 /* The DOC should provide the usage form. */ 939 /* The DOC should provide the usage form. */
760 fprintf (stderr, "Missing `usage' for function `%s'.\n", buf); 940 fprintf (stderr, "Missing `usage' for function `%s'.\n",
941 input_buffer);
761 } 942 }
762 } 943 }
763 eof: 944 eof:
@@ -801,7 +982,7 @@ scan_c_file (char *filename, const char *mode)
801 An entry is output only if DOCSTRING has \ newline just after the opening " 982 An entry is output only if DOCSTRING has \ newline just after the opening "
802 */ 983 */
803 984
804void 985static void
805skip_white (FILE *infile) 986skip_white (FILE *infile)
806{ 987{
807 char c = ' '; 988 char c = ' ';
@@ -810,7 +991,7 @@ skip_white (FILE *infile)
810 ungetc (c, infile); 991 ungetc (c, infile);
811} 992}
812 993
813void 994static void
814read_lisp_symbol (FILE *infile, char *buffer) 995read_lisp_symbol (FILE *infile, char *buffer)
815{ 996{
816 char c; 997 char c;
@@ -838,13 +1019,16 @@ read_lisp_symbol (FILE *infile, char *buffer)
838 skip_white (infile); 1019 skip_white (infile);
839} 1020}
840 1021
841int 1022static int
842scan_lisp_file (const char *filename, const char *mode) 1023scan_lisp_file (const char *filename, const char *mode)
843{ 1024{
844 FILE *infile; 1025 FILE *infile;
845 register int c; 1026 register int c;
846 char *saved_string = 0; 1027 char *saved_string = 0;
847 1028
1029 if (generate_globals)
1030 fatal ("scanning lisp file when -g specified", 0);
1031
848 infile = fopen (filename, mode); 1032 infile = fopen (filename, mode);
849 if (infile == NULL) 1033 if (infile == NULL)
850 { 1034 {
diff --git a/lib-src/makefile.w32-in b/lib-src/makefile.w32-in
index 52d1cb5680a..07f6170afe4 100644
--- a/lib-src/makefile.w32-in
+++ b/lib-src/makefile.w32-in
@@ -31,8 +31,6 @@ $(BLD)/make-docfile.exe: $(BLD)/make-docfile.$(O) $(BLD)/ntlib.$(O)
31 $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/make-docfile.$(O) $(BLD)/ntlib.$(O) $(LIBS) 31 $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/make-docfile.$(O) $(BLD)/ntlib.$(O) $(LIBS)
32$(BLD)/hexl.exe: $(BLD)/hexl.$(O) 32$(BLD)/hexl.exe: $(BLD)/hexl.$(O)
33 $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/hexl.$(O) $(LIBS) 33 $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/hexl.$(O) $(LIBS)
34$(BLD)/fakemail.exe: $(BLD)/fakemail.$(O) $(BLD)/ntlib.$(O)
35 $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/fakemail.$(O) $(BLD)/ntlib.$(O) $(LIBS)
36$(BLD)/test-distrib.exe: $(BLD)/test-distrib.$(O) 34$(BLD)/test-distrib.exe: $(BLD)/test-distrib.$(O)
37 $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/test-distrib.$(O) $(LIBS) 35 $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/test-distrib.$(O) $(LIBS)
38 36
@@ -42,7 +40,6 @@ etags: stamp_BLD $(BLD)/etags.exe
42ebrowse: stamp_BLD $(BLD)/ebrowse.exe 40ebrowse: stamp_BLD $(BLD)/ebrowse.exe
43hexl: stamp_BLD $(BLD)/hexl.exe 41hexl: stamp_BLD $(BLD)/hexl.exe
44movemail: stamp_BLD $(BLD)/movemail.exe 42movemail: stamp_BLD $(BLD)/movemail.exe
45fakemail: stamp_BLD $(BLD)/fakemail.exe
46emacsclient: stamp_BLD $(BLD)/emacsclient.exe $(BLD)/emacsclientw.exe 43emacsclient: stamp_BLD $(BLD)/emacsclient.exe $(BLD)/emacsclientw.exe
47 44
48test-distrib: stamp_BLD $(BLD)/test-distrib.exe 45test-distrib: stamp_BLD $(BLD)/test-distrib.exe
@@ -135,14 +132,15 @@ obj = dosfns.o msdos.o \
135 cm.o term.o terminal.o xfaces.o \ 132 cm.o term.o terminal.o xfaces.o \
136 emacs.o keyboard.o macros.o keymap.o sysdep.o \ 133 emacs.o keyboard.o macros.o keymap.o sysdep.o \
137 buffer.o filelock.o insdel.o marker.o \ 134 buffer.o filelock.o insdel.o marker.o \
138 minibuf.o fileio.o dired.o filemode.o \ 135 minibuf.o fileio.o dired.o \
139 cmds.o casetab.o casefiddle.o indent.o search.o regex.o undo.o \ 136 cmds.o casetab.o casefiddle.o indent.o search.o regex.o undo.o \
140 alloc.o data.o doc.o editfns.o callint.o \ 137 alloc.o data.o doc.o editfns.o callint.o \
141 eval.o floatfns.o fns.o print.o lread.o \ 138 eval.o floatfns.o fns.o print.o lread.o \
142 syntax.o bytecode.o \ 139 syntax.o bytecode.o \
143 process.o callproc.o unexw32.o \ 140 process.o callproc.o unexw32.o \
144 region-cache.o sound.o atimer.o \ 141 region-cache.o sound.o atimer.o \
145 doprnt.o intervals.o textprop.o composite.o md5.o 142 doprnt.o intervals.o textprop.o composite.o \
143 gnutls.o
146 144
147# 145#
148# These are the lisp files that are loaded up in loadup.el 146# These are the lisp files that are loaded up in loadup.el
@@ -271,11 +269,6 @@ lisp2 = \
271 $(lispsource)window.elc \ 269 $(lispsource)window.elc \
272 $(lispsource)version.el 270 $(lispsource)version.el
273 271
274# Used by batch-update-autoloads.
275echolisp:
276 @echo $(lisp1)
277 @echo $(lisp2)
278
279# This is needed the first time we build the tree, since temacs.exe 272# This is needed the first time we build the tree, since temacs.exe
280# does not exist yet, and the DOC rule needs it to rebuild DOC whenever 273# does not exist yet, and the DOC rule needs it to rebuild DOC whenever
281# Emacs is rebuilt. 274# Emacs is rebuilt.
@@ -332,7 +325,6 @@ clean:
332 - $(DEL) ctags.c 325 - $(DEL) ctags.c
333 - $(DEL_TREE) $(OBJDIR) 326 - $(DEL_TREE) $(OBJDIR)
334 - $(DEL) stamp_BLD 327 - $(DEL) stamp_BLD
335 - $(DEL) echolisp.tmp
336 328
337distclean: cleanall 329distclean: cleanall
338 - $(DEL) TAGS 330 - $(DEL) TAGS
@@ -374,14 +366,23 @@ $(BLD)/alloca.$(O) : \
374$(BLD)/ctags.$(O) : \ 366$(BLD)/ctags.$(O) : \
375 $(SRC)/ctags.c \ 367 $(SRC)/ctags.c \
376 $(EMACS_ROOT)/nt/inc/sys/param.h \ 368 $(EMACS_ROOT)/nt/inc/sys/param.h \
369 $(EMACS_ROOT)/nt/inc/sys/stat.h \
377 $(EMACS_ROOT)/src/s/ms-w32.h \ 370 $(EMACS_ROOT)/src/s/ms-w32.h \
378 $(EMACS_ROOT)/src/m/intel386.h \ 371 $(EMACS_ROOT)/src/m/intel386.h \
379 $(EMACS_ROOT)/lib-src/../src/config.h \ 372 $(EMACS_ROOT)/lib-src/../src/config.h \
380 $(SRC)/ntlib.h \ 373 $(SRC)/ntlib.h \
381 $(EMACS_ROOT)/lib/getopt.h 374 $(EMACS_ROOT)/lib/getopt.h
382 375
376$(BLD)/ebrowse.$(O) : \
377 $(SRC)/ebrowse.c \
378 $(EMACS_ROOT)/lib/min-max.h \
379 $(EMACS_ROOT)/src/s/ms-w32.h \
380 $(EMACS_ROOT)/src/m/intel386.h \
381 $(EMACS_ROOT)/lib-src/../src/config.h
382
383$(BLD)/emacsclient.$(O) : \ 383$(BLD)/emacsclient.$(O) : \
384 $(SRC)/emacsclient.c \ 384 $(SRC)/emacsclient.c \
385 $(EMACS_ROOT)/nt/inc/sys/stat.h \
385 $(EMACS_ROOT)/src/s/ms-w32.h \ 386 $(EMACS_ROOT)/src/s/ms-w32.h \
386 $(EMACS_ROOT)/src/m/intel386.h \ 387 $(EMACS_ROOT)/src/m/intel386.h \
387 $(EMACS_ROOT)/lib-src/../src/config.h 388 $(EMACS_ROOT)/lib-src/../src/config.h
@@ -389,20 +390,13 @@ $(BLD)/emacsclient.$(O) : \
389$(BLD)/etags.$(O) : \ 390$(BLD)/etags.$(O) : \
390 $(SRC)/etags.c \ 391 $(SRC)/etags.c \
391 $(EMACS_ROOT)/nt/inc/sys/param.h \ 392 $(EMACS_ROOT)/nt/inc/sys/param.h \
393 $(EMACS_ROOT)/nt/inc/sys/stat.h \
392 $(EMACS_ROOT)/src/s/ms-w32.h \ 394 $(EMACS_ROOT)/src/s/ms-w32.h \
393 $(EMACS_ROOT)/src/m/intel386.h \ 395 $(EMACS_ROOT)/src/m/intel386.h \
394 $(EMACS_ROOT)/lib-src/../src/config.h \ 396 $(EMACS_ROOT)/lib-src/../src/config.h \
395 $(SRC)/ntlib.h \ 397 $(SRC)/ntlib.h \
396 $(EMACS_ROOT)/lib/getopt.h 398 $(EMACS_ROOT)/lib/getopt.h
397 399
398$(BLD)/fakemail.$(O) : \
399 $(SRC)/fakemail.c \
400 $(SRC)/ntlib.h \
401 $(EMACS_ROOT)/src/s/ms-w32.h \
402 $(EMACS_ROOT)/src/m/intel386.h \
403 $(EMACS_ROOT)/lib-src/../src/config.h \
404 $(EMACS_ROOT)/nt/inc/pwd.h
405
406$(BLD)/getdate.$(O) : \ 400$(BLD)/getdate.$(O) : \
407 $(SRC)/getdate.c \ 401 $(SRC)/getdate.c \
408 $(EMACS_ROOT)/src/s/ms-w32.h \ 402 $(EMACS_ROOT)/src/s/ms-w32.h \
@@ -429,6 +423,7 @@ $(BLD)/movemail.$(O) : \
429 $(EMACS_ROOT)/src/m/intel386.h \ 423 $(EMACS_ROOT)/src/m/intel386.h \
430 $(EMACS_ROOT)/lib-src/../src/config.h \ 424 $(EMACS_ROOT)/lib-src/../src/config.h \
431 $(EMACS_ROOT)/nt/inc/sys/file.h \ 425 $(EMACS_ROOT)/nt/inc/sys/file.h \
426 $(EMACS_ROOT)/nt/inc/sys/stat.h \
432 $(EMACS_ROOT)/lib-src/../src/syswait.h \ 427 $(EMACS_ROOT)/lib-src/../src/syswait.h \
433 $(EMACS_ROOT)/nt/inc/pwd.h \ 428 $(EMACS_ROOT)/nt/inc/pwd.h \
434 $(SRC)/ntlib.h 429 $(SRC)/ntlib.h
@@ -437,11 +432,13 @@ $(BLD)/movemail.$(O) : \
437$(BLD)/ntlib.$(O) : \ 432$(BLD)/ntlib.$(O) : \
438 $(SRC)/ntlib.c \ 433 $(SRC)/ntlib.c \
439 $(SRC)/ntlib.h \ 434 $(SRC)/ntlib.h \
435 $(EMACS_ROOT)/nt/inc/sys/stat.h \
440 $(EMACS_ROOT)/nt/inc/pwd.h 436 $(EMACS_ROOT)/nt/inc/pwd.h
441 437
442$(BLD)/pop.$(O) : \ 438$(BLD)/pop.$(O) : \
443 $(SRC)/pop.c \ 439 $(SRC)/pop.c \
444 $(SRC)/pop.h \ 440 $(SRC)/pop.h \
441 $(EMACS_ROOT)/lib/min-max.h \
445 $(SRC)/ntlib.h 442 $(SRC)/ntlib.h
446 443
447$(BLD)/profile.$(O) : \ 444$(BLD)/profile.$(O) : \
@@ -469,7 +466,7 @@ $(BLD)/timer.$(O) : \
469# The following dependencies are for supporting parallel builds, where 466# The following dependencies are for supporting parallel builds, where
470# we must make sure $(BLD) exists before any compilation starts. 467# we must make sure $(BLD) exists before any compilation starts.
471# 468#
472$(BLD)/make-docfile.$(O) $(BLD)/hexl.$(O) $(BLD)/fakemail.$(O): stamp_BLD 469$(BLD)/make-docfile.$(O) $(BLD)/hexl.$(O): stamp_BLD
473 470
474$(BLD)/test-distrib.$(O) $(MOVEMAILOBJS): stamp_BLD 471$(BLD)/test-distrib.$(O) $(MOVEMAILOBJS): stamp_BLD
475 472
diff --git a/lib-src/movemail.c b/lib-src/movemail.c
index 682aa10aa39..e8c09f090f3 100644
--- a/lib-src/movemail.c
+++ b/lib-src/movemail.c
@@ -80,13 +80,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
80#undef access 80#undef access
81#endif /* MSDOS */ 81#endif /* MSDOS */
82 82
83#ifndef DIRECTORY_SEP
84#define DIRECTORY_SEP '/'
85#endif
86#ifndef IS_DIRECTORY_SEP
87#define IS_DIRECTORY_SEP(_c_) ((_c_) == DIRECTORY_SEP)
88#endif
89
90#ifdef WINDOWSNT 83#ifdef WINDOWSNT
91#include "ntlib.h" 84#include "ntlib.h"
92#undef access 85#undef access
@@ -138,7 +131,7 @@ extern int lk_open (), lk_close ();
138 files appear in. */ 131 files appear in. */
139#ifdef MAILDIR 132#ifdef MAILDIR
140#define MAIL_USE_MAILLOCK 133#define MAIL_USE_MAILLOCK
141static char *mail_spool_name (); 134static char *mail_spool_name (char *);
142#endif 135#endif
143#endif 136#endif
144 137
@@ -161,7 +154,7 @@ static int mbx_delimit_end (FILE *mbf);
161#endif 154#endif
162 155
163/* Nonzero means this is name of a lock file to delete on fatal error. */ 156/* Nonzero means this is name of a lock file to delete on fatal error. */
164char *delete_lockname; 157static char *delete_lockname;
165 158
166int 159int
167main (int argc, char **argv) 160main (int argc, char **argv)
@@ -169,15 +162,15 @@ main (int argc, char **argv)
169 char *inname, *outname; 162 char *inname, *outname;
170 int indesc, outdesc; 163 int indesc, outdesc;
171 ssize_t nread; 164 ssize_t nread;
172 int status; 165 int wait_status;
173 int c, preserve_mail = 0; 166 int c, preserve_mail = 0;
174 167
175#ifndef MAIL_USE_SYSTEM_LOCK 168#ifndef MAIL_USE_SYSTEM_LOCK
176 struct stat st; 169 struct stat st;
177 long now;
178 int tem; 170 int tem;
179 char *lockname, *p; 171 char *lockname;
180 char *tempname; 172 char *tempname;
173 size_t inname_dirlen;
181 int desc; 174 int desc;
182#endif /* not MAIL_USE_SYSTEM_LOCK */ 175#endif /* not MAIL_USE_SYSTEM_LOCK */
183 176
@@ -266,9 +259,22 @@ main (int argc, char **argv)
266#ifndef MAIL_USE_SYSTEM_LOCK 259#ifndef MAIL_USE_SYSTEM_LOCK
267#ifdef MAIL_USE_MAILLOCK 260#ifdef MAIL_USE_MAILLOCK
268 spool_name = mail_spool_name (inname); 261 spool_name = mail_spool_name (inname);
269 if (! spool_name) 262 if (spool_name)
263 {
264#ifdef lint
265 lockname = 0;
266#endif
267 }
268 else
270#endif 269#endif
271 { 270 {
271 #ifndef DIRECTORY_SEP
272 #define DIRECTORY_SEP '/'
273 #endif
274 #ifndef IS_DIRECTORY_SEP
275 #define IS_DIRECTORY_SEP(_c_) ((_c_) == DIRECTORY_SEP)
276 #endif
277
272 /* Use a lock file named after our first argument with .lock appended: 278 /* Use a lock file named after our first argument with .lock appended:
273 If it exists, the mail file is locked. */ 279 If it exists, the mail file is locked. */
274 /* Note: this locking mechanism is *required* by the mailer 280 /* Note: this locking mechanism is *required* by the mailer
@@ -293,26 +299,38 @@ main (int argc, char **argv)
293 to bug-gnu-emacs@prep.ai.mit.edu so we can fix it. */ 299 to bug-gnu-emacs@prep.ai.mit.edu so we can fix it. */
294 300
295 lockname = concat (inname, ".lock", ""); 301 lockname = concat (inname, ".lock", "");
296 tempname = (char *) xmalloc (strlen (inname) + strlen ("EXXXXXX") + 1); 302 for (inname_dirlen = strlen (inname);
297 strcpy (tempname, inname); 303 inname_dirlen && !IS_DIRECTORY_SEP (inname[inname_dirlen - 1]);
298 p = tempname + strlen (tempname); 304 inname_dirlen--)
299 while (p != tempname && !IS_DIRECTORY_SEP (p[-1])) 305 continue;
300 p--; 306 tempname = (char *) xmalloc (inname_dirlen + sizeof "EXXXXXX");
301 *p = 0;
302 strcpy (p, "EXXXXXX");
303 mktemp (tempname);
304 unlink (tempname);
305 307
306 while (1) 308 while (1)
307 { 309 {
308 /* Create the lock file, but not under the lock file name. */ 310 /* Create the lock file, but not under the lock file name. */
309 /* Give up if cannot do that. */ 311 /* Give up if cannot do that. */
310 desc = open (tempname, O_WRONLY | O_CREAT | O_EXCL, 0666); 312
313 memcpy (tempname, inname, inname_dirlen);
314 strcpy (tempname + inname_dirlen, "EXXXXXX");
315#ifdef HAVE_MKSTEMP
316 desc = mkstemp (tempname);
317#else
318 mktemp (tempname);
319 if (!*tempname)
320 desc = -1;
321 else
322 {
323 unlink (tempname);
324 desc = open (tempname, O_WRONLY | O_CREAT | O_EXCL, 0600);
325 }
326#endif
311 if (desc < 0) 327 if (desc < 0)
312 { 328 {
329 int mkstemp_errno = errno;
313 char *message = (char *) xmalloc (strlen (tempname) + 50); 330 char *message = (char *) xmalloc (strlen (tempname) + 50);
314 sprintf (message, "creating %s, which would become the lock file", 331 sprintf (message, "creating %s, which would become the lock file",
315 tempname); 332 tempname);
333 errno = mkstemp_errno;
316 pfatal_with_name (message); 334 pfatal_with_name (message);
317 } 335 }
318 close (desc); 336 close (desc);
@@ -336,7 +354,7 @@ main (int argc, char **argv)
336 by time differences between machines. */ 354 by time differences between machines. */
337 if (stat (lockname, &st) >= 0) 355 if (stat (lockname, &st) >= 0)
338 { 356 {
339 now = time (0); 357 time_t now = time (0);
340 if (st.st_ctime < now - 300) 358 if (st.st_ctime < now - 300)
341 unlink (lockname); 359 unlink (lockname);
342 } 360 }
@@ -352,7 +370,10 @@ main (int argc, char **argv)
352 int lockcount = 0; 370 int lockcount = 0;
353 int status = 0; 371 int status = 0;
354#if defined (MAIL_USE_MAILLOCK) && defined (HAVE_TOUCHLOCK) 372#if defined (MAIL_USE_MAILLOCK) && defined (HAVE_TOUCHLOCK)
355 time_t touched_lock, now; 373 time_t touched_lock;
374# ifdef lint
375 touched_lock = 0;
376# endif
356#endif 377#endif
357 378
358 if (setuid (getuid ()) < 0 || setregid (-1, real_gid) < 0) 379 if (setuid (getuid ()) < 0 || setregid (-1, real_gid) < 0)
@@ -462,7 +483,7 @@ main (int argc, char **argv)
462#if defined (MAIL_USE_MAILLOCK) && defined (HAVE_TOUCHLOCK) 483#if defined (MAIL_USE_MAILLOCK) && defined (HAVE_TOUCHLOCK)
463 if (spool_name) 484 if (spool_name)
464 { 485 {
465 now = time (0); 486 time_t now = time (0);
466 if (now - touched_lock > 60) 487 if (now - touched_lock > 60)
467 { 488 {
468 touchlock (); 489 touchlock ();
@@ -527,11 +548,11 @@ main (int argc, char **argv)
527 exit (EXIT_SUCCESS); 548 exit (EXIT_SUCCESS);
528 } 549 }
529 550
530 wait (&status); 551 wait (&wait_status);
531 if (!WIFEXITED (status)) 552 if (!WIFEXITED (wait_status))
532 exit (EXIT_FAILURE); 553 exit (EXIT_FAILURE);
533 else if (WRETCODE (status) != 0) 554 else if (WRETCODE (wait_status) != 0)
534 exit (WRETCODE (status)); 555 exit (WRETCODE (wait_status));
535 556
536#if !defined (MAIL_USE_MMDF) && !defined (MAIL_USE_SYSTEM_LOCK) 557#if !defined (MAIL_USE_MMDF) && !defined (MAIL_USE_SYSTEM_LOCK)
537#ifdef MAIL_USE_MAILLOCK 558#ifdef MAIL_USE_MAILLOCK
@@ -670,14 +691,8 @@ xmalloc (unsigned int size)
670 691
671#define NOTOK (-1) 692#define NOTOK (-1)
672#define OK 0 693#define OK 0
673#define DONE 1 694
674 695static char Errmsg[200]; /* POP errors, at least, can exceed
675char *progname;
676FILE *sfi;
677FILE *sfo;
678char ibuffer[BUFSIZ];
679char obuffer[BUFSIZ];
680char Errmsg[200]; /* POP errors, at least, can exceed
681 the original length of 80. */ 696 the original length of 80. */
682 697
683/* 698/*
@@ -736,7 +751,18 @@ popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse
736 error ("Error in open: %s, %s", strerror (errno), outfile); 751 error ("Error in open: %s, %s", strerror (errno), outfile);
737 return EXIT_FAILURE; 752 return EXIT_FAILURE;
738 } 753 }
739 fchown (mbfi, getuid (), -1); 754
755 if (fchown (mbfi, getuid (), -1) != 0)
756 {
757 int fchown_errno = errno;
758 struct stat st;
759 if (fstat (mbfi, &st) != 0 || st.st_uid != getuid ())
760 {
761 pop_close (server);
762 error ("Error in fchown: %s, %s", strerror (fchown_errno), outfile);
763 return EXIT_FAILURE;
764 }
765 }
740 766
741 if ((mbf = fdopen (mbfi, "wb")) == NULL) 767 if ((mbf = fdopen (mbfi, "wb")) == NULL)
742 { 768 {
@@ -828,10 +854,10 @@ pop_retr (popserver server, int msgno, FILE *arg)
828 854
829 if (pop_retrieve_first (server, msgno, &line)) 855 if (pop_retrieve_first (server, msgno, &line))
830 { 856 {
831 char *error = concat ("Error from POP server: ", pop_error, ""); 857 char *msg = concat ("Error from POP server: ", pop_error, "");
832 strncpy (Errmsg, error, sizeof (Errmsg)); 858 strncpy (Errmsg, msg, sizeof (Errmsg));
833 Errmsg[sizeof (Errmsg)-1] = '\0'; 859 Errmsg[sizeof (Errmsg)-1] = '\0';
834 free(error); 860 free (msg);
835 return (NOTOK); 861 return (NOTOK);
836 } 862 }
837 863
@@ -850,27 +876,26 @@ pop_retr (popserver server, int msgno, FILE *arg)
850 876
851 if (ret) 877 if (ret)
852 { 878 {
853 char *error = concat ("Error from POP server: ", pop_error, ""); 879 char *msg = concat ("Error from POP server: ", pop_error, "");
854 strncpy (Errmsg, error, sizeof (Errmsg)); 880 strncpy (Errmsg, msg, sizeof (Errmsg));
855 Errmsg[sizeof (Errmsg)-1] = '\0'; 881 Errmsg[sizeof (Errmsg)-1] = '\0';
856 free(error); 882 free (msg);
857 return (NOTOK); 883 return (NOTOK);
858 } 884 }
859 885
860 return (OK); 886 return (OK);
861} 887}
862 888
863/* Do this as a macro instead of using strcmp to save on execution time. */
864#define IS_FROM_LINE(a) ((a[0] == 'F') \
865 && (a[1] == 'r') \
866 && (a[2] == 'o') \
867 && (a[3] == 'm') \
868 && (a[4] == ' '))
869
870static int 889static int
871mbx_write (char *line, int len, FILE *mbf) 890mbx_write (char *line, int len, FILE *mbf)
872{ 891{
873#ifdef MOVEMAIL_QUOTE_POP_FROM_LINES 892#ifdef MOVEMAIL_QUOTE_POP_FROM_LINES
893 /* Do this as a macro instead of using strcmp to save on execution time. */
894 # define IS_FROM_LINE(a) ((a[0] == 'F') \
895 && (a[1] == 'r') \
896 && (a[2] == 'o') \
897 && (a[3] == 'm') \
898 && (a[4] == ' '))
874 if (IS_FROM_LINE (line)) 899 if (IS_FROM_LINE (line))
875 { 900 {
876 if (fputc ('>', mbf) == EOF) 901 if (fputc ('>', mbf) == EOF)
diff --git a/lib-src/ntlib.c b/lib-src/ntlib.c
index 0ecd4177d2c..83f653f3ea3 100644
--- a/lib-src/ntlib.c
+++ b/lib-src/ntlib.c
@@ -28,6 +28,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
28#include <sys/types.h> 28#include <sys/types.h>
29#include <sys/stat.h> 29#include <sys/stat.h>
30#include <errno.h> 30#include <errno.h>
31#include <ctype.h>
31 32
32#include "ntlib.h" 33#include "ntlib.h"
33 34
diff --git a/lib-src/pop.c b/lib-src/pop.c
index a3fda09d44f..426b39bd1fb 100644
--- a/lib-src/pop.c
+++ b/lib-src/pop.c
@@ -67,7 +67,6 @@ extern struct servent *hes_getservbyname (/* char *, char * */);
67#include <stdio.h> 67#include <stdio.h>
68#ifdef STDC_HEADERS 68#ifdef STDC_HEADERS
69#include <string.h> 69#include <string.h>
70#define index strchr
71#endif 70#endif
72#include <unistd.h> 71#include <unistd.h>
73 72
@@ -91,6 +90,8 @@ extern struct servent *hes_getservbyname (/* char *, char * */);
91# endif 90# endif
92#endif /* KERBEROS */ 91#endif /* KERBEROS */
93 92
93#include <min-max.h>
94
94#ifdef KERBEROS 95#ifdef KERBEROS
95#ifndef KERBEROS5 96#ifndef KERBEROS5
96extern int krb_sendauth (/* long, int, KTEXT, char *, char *, char *, 97extern int krb_sendauth (/* long, int, KTEXT, char *, char *, char *,
@@ -122,19 +123,15 @@ static char *find_crlf (char *, int);
122 to be bigger than the original 123 to be bigger than the original
123 value of 80 */ 124 value of 80 */
124#define POP_PORT 110 125#define POP_PORT 110
125#define KPOP_PORT 1109
126#define POP_SERVICE "pop3" /* we don't want the POP2 port! */ 126#define POP_SERVICE "pop3" /* we don't want the POP2 port! */
127#ifdef KERBEROS 127#ifdef KERBEROS
128#define KPOP_PORT 1109
128#define KPOP_SERVICE "kpop" /* never used: look for 20060515 to see why */ 129#define KPOP_SERVICE "kpop" /* never used: look for 20060515 to see why */
129#endif 130#endif
130 131
131char pop_error[ERROR_MAX]; 132char pop_error[ERROR_MAX];
132int pop_debug = 0; 133int pop_debug = 0;
133 134
134#ifndef min
135#define min(a,b) (((a) < (b)) ? (a) : (b))
136#endif
137
138/* 135/*
139 * Function: pop_open (char *host, char *username, char *password, 136 * Function: pop_open (char *host, char *username, char *password,
140 * int flags) 137 * int flags)
diff --git a/lib-src/profile.c b/lib-src/profile.c
index 9ce9993f4b1..086d8cc3e9d 100644
--- a/lib-src/profile.c
+++ b/lib-src/profile.c
@@ -38,7 +38,7 @@ static char time_string[30];
38 38
39/* Reset the stopwatch to zero. */ 39/* Reset the stopwatch to zero. */
40 40
41void 41static void
42reset_watch (void) 42reset_watch (void)
43{ 43{
44 EMACS_GET_TIME (TV1); 44 EMACS_GET_TIME (TV1);
@@ -49,7 +49,7 @@ reset_watch (void)
49 is returned as a string with the format <seconds>.<micro-seconds> 49 is returned as a string with the format <seconds>.<micro-seconds>
50 If reset_watch was not called yet, exit. */ 50 If reset_watch was not called yet, exit. */
51 51
52char * 52static char *
53get_time (void) 53get_time (void)
54{ 54{
55 if (watch_not_started) 55 if (watch_not_started)
diff --git a/lib-src/test-distrib.c b/lib-src/test-distrib.c
index acfb147325b..5ad19201118 100644
--- a/lib-src/test-distrib.c
+++ b/lib-src/test-distrib.c
@@ -26,18 +26,16 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
26/* Break string in two parts to avoid buggy C compilers that ignore characters 26/* Break string in two parts to avoid buggy C compilers that ignore characters
27 after nulls in strings. */ 27 after nulls in strings. */
28 28
29char string1[] = "Testing distribution of nonprinting chars:\n\ 29static char string1[] = "Testing distribution of nonprinting chars:\n\
30Should be 0177: \177 Should be 0377: \377 Should be 0212: \212.\n\ 30Should be 0177: \177 Should be 0377: \377 Should be 0212: \212.\n\
31Should be 0000: "; 31Should be 0000: ";
32 32
33char string2[] = ".\n\ 33static char string2[] = ".\n\
34This file is read by the `test-distribution' program.\n\ 34This file is read by the `test-distribution' program.\n\
35If you change it, you will make that program fail.\n"; 35If you change it, you will make that program fail.\n";
36 36
37char buf[300];
38
39/* Like `read' but keeps trying until it gets SIZE bytes or reaches eof. */ 37/* Like `read' but keeps trying until it gets SIZE bytes or reaches eof. */
40int 38static int
41cool_read (int fd, char *buf, size_t size) 39cool_read (int fd, char *buf, size_t size)
42{ 40{
43 ssize_t num; 41 ssize_t num;
@@ -57,6 +55,7 @@ int
57main (int argc, char **argv) 55main (int argc, char **argv)
58{ 56{
59 int fd; 57 int fd;
58 char buf[300];
60 59
61 if (argc != 2) 60 if (argc != 2)
62 { 61 {
diff --git a/lib-src/update-game-score.c b/lib-src/update-game-score.c
index 9466bf7b149..e95e2ce259d 100644
--- a/lib-src/update-game-score.c
+++ b/lib-src/update-game-score.c
@@ -57,7 +57,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
57extern char *optarg; 57extern char *optarg;
58extern int optind, opterr; 58extern int optind, opterr;
59 59
60int usage (int err) NO_RETURN; 60static int usage (int err) NO_RETURN;
61 61
62#define MAX_ATTEMPTS 5 62#define MAX_ATTEMPTS 5
63#define MAX_SCORES 200 63#define MAX_SCORES 200
@@ -68,7 +68,7 @@ int usage (int err) NO_RETURN;
68#define difftime(t1, t0) (double)((t1) - (t0)) 68#define difftime(t1, t0) (double)((t1) - (t0))
69#endif 69#endif
70 70
71int 71static int
72usage (int err) 72usage (int err)
73{ 73{
74 fprintf (stdout, "Usage: update-game-score [-m MAX ] [ -r ] game/scorefile SCORE DATA\n"); 74 fprintf (stdout, "Usage: update-game-score [-m MAX ] [ -r ] game/scorefile SCORE DATA\n");
@@ -80,8 +80,8 @@ usage (int err)
80 exit (err); 80 exit (err);
81} 81}
82 82
83int lock_file (const char *filename, void **state); 83static int lock_file (const char *filename, void **state);
84int unlock_file (const char *filename, void *state); 84static int unlock_file (const char *filename, void *state);
85 85
86struct score_entry 86struct score_entry
87{ 87{
@@ -90,24 +90,24 @@ struct score_entry
90 char *data; 90 char *data;
91}; 91};
92 92
93int read_scores (const char *filename, struct score_entry **scores, 93static int read_scores (const char *filename, struct score_entry **scores,
94 int *count); 94 int *count);
95int push_score (struct score_entry **scores, int *count, 95static int push_score (struct score_entry **scores, int *count,
96 int newscore, char *username, char *newdata); 96 int newscore, char *username, char *newdata);
97void sort_scores (struct score_entry *scores, int count, int reverse); 97static void sort_scores (struct score_entry *scores, int count, int reverse);
98int write_scores (const char *filename, const struct score_entry *scores, 98static int write_scores (const char *filename,
99 int count); 99 const struct score_entry *scores, int count);
100 100
101void lose (const char *msg) NO_RETURN; 101static void lose (const char *msg) NO_RETURN;
102 102
103void 103static void
104lose (const char *msg) 104lose (const char *msg)
105{ 105{
106 fprintf (stderr, "%s\n", msg); 106 fprintf (stderr, "%s\n", msg);
107 exit (EXIT_FAILURE); 107 exit (EXIT_FAILURE);
108} 108}
109 109
110void lose_syserr (const char *msg) NO_RETURN; 110static void lose_syserr (const char *msg) NO_RETURN;
111 111
112/* Taken from sysdep.c. */ 112/* Taken from sysdep.c. */
113#ifndef HAVE_STRERROR 113#ifndef HAVE_STRERROR
@@ -126,14 +126,14 @@ strerror (errnum)
126#endif /* not WINDOWSNT */ 126#endif /* not WINDOWSNT */
127#endif /* ! HAVE_STRERROR */ 127#endif /* ! HAVE_STRERROR */
128 128
129void 129static void
130lose_syserr (const char *msg) 130lose_syserr (const char *msg)
131{ 131{
132 fprintf (stderr, "%s: %s\n", msg, strerror (errno)); 132 fprintf (stderr, "%s: %s\n", msg, strerror (errno));
133 exit (EXIT_FAILURE); 133 exit (EXIT_FAILURE);
134} 134}
135 135
136char * 136static char *
137get_user_id (void) 137get_user_id (void)
138{ 138{
139 char *name; 139 char *name;
@@ -154,7 +154,7 @@ get_user_id (void)
154 return buf->pw_name; 154 return buf->pw_name;
155} 155}
156 156
157const char * 157static const char *
158get_prefix (int running_suid, const char *user_prefix) 158get_prefix (int running_suid, const char *user_prefix)
159{ 159{
160 if (!running_suid && user_prefix == NULL) 160 if (!running_suid && user_prefix == NULL)
@@ -242,13 +242,15 @@ main (int argc, char **argv)
242 push_score (&scores, &scorecount, newscore, user_id, newdata); 242 push_score (&scores, &scorecount, newscore, user_id, newdata);
243 sort_scores (scores, scorecount, reverse); 243 sort_scores (scores, scorecount, reverse);
244 /* Limit the number of scores. If we're using reverse sorting, then 244 /* Limit the number of scores. If we're using reverse sorting, then
245 we should increment the beginning of the array, to skip over the 245 also increment the beginning of the array, to skip over the
246 *smallest* scores. Otherwise, we just decrement the number of 246 *smallest* scores. Otherwise, just decrementing the number of
247 scores, since the smallest will be at the end. */ 247 scores suffices, since the smallest is at the end. */
248 if (scorecount > MAX_SCORES) 248 if (scorecount > MAX_SCORES)
249 scorecount -= (scorecount - MAX_SCORES); 249 {
250 if (reverse) 250 if (reverse)
251 scores += (scorecount - MAX_SCORES); 251 scores += (scorecount - MAX_SCORES);
252 scorecount = MAX_SCORES;
253 }
252 if (write_scores (scorefile, scores, scorecount) < 0) 254 if (write_scores (scorefile, scores, scorecount) < 0)
253 { 255 {
254 unlock_file (scorefile, lockstate); 256 unlock_file (scorefile, lockstate);
@@ -258,7 +260,7 @@ main (int argc, char **argv)
258 exit (EXIT_SUCCESS); 260 exit (EXIT_SUCCESS);
259} 261}
260 262
261int 263static int
262read_score (FILE *f, struct score_entry *score) 264read_score (FILE *f, struct score_entry *score)
263{ 265{
264 int c; 266 int c;
@@ -342,7 +344,7 @@ read_score (FILE *f, struct score_entry *score)
342 return 0; 344 return 0;
343} 345}
344 346
345int 347static int
346read_scores (const char *filename, struct score_entry **scores, int *count) 348read_scores (const char *filename, struct score_entry **scores, int *count)
347{ 349{
348 int readval, scorecount, cursize; 350 int readval, scorecount, cursize;
@@ -375,7 +377,7 @@ read_scores (const char *filename, struct score_entry **scores, int *count)
375 return 0; 377 return 0;
376} 378}
377 379
378int 380static int
379score_compare (const void *a, const void *b) 381score_compare (const void *a, const void *b)
380{ 382{
381 const struct score_entry *sa = (const struct score_entry *) a; 383 const struct score_entry *sa = (const struct score_entry *) a;
@@ -383,7 +385,7 @@ score_compare (const void *a, const void *b)
383 return (sb->score > sa->score) - (sb->score < sa->score); 385 return (sb->score > sa->score) - (sb->score < sa->score);
384} 386}
385 387
386int 388static int
387score_compare_reverse (const void *a, const void *b) 389score_compare_reverse (const void *a, const void *b)
388{ 390{
389 const struct score_entry *sa = (const struct score_entry *) a; 391 const struct score_entry *sa = (const struct score_entry *) a;
@@ -407,14 +409,14 @@ push_score (struct score_entry **scores, int *count, int newscore, char *usernam
407 return 0; 409 return 0;
408} 410}
409 411
410void 412static void
411sort_scores (struct score_entry *scores, int count, int reverse) 413sort_scores (struct score_entry *scores, int count, int reverse)
412{ 414{
413 qsort (scores, count, sizeof (struct score_entry), 415 qsort (scores, count, sizeof (struct score_entry),
414 reverse ? score_compare_reverse : score_compare); 416 reverse ? score_compare_reverse : score_compare);
415} 417}
416 418
417int 419static int
418write_scores (const char *filename, const struct score_entry *scores, int count) 420write_scores (const char *filename, const struct score_entry *scores, int count)
419{ 421{
420 FILE *f; 422 FILE *f;
@@ -443,7 +445,7 @@ write_scores (const char *filename, const struct score_entry *scores, int count)
443 return 0; 445 return 0;
444} 446}
445 447
446int 448static int
447lock_file (const char *filename, void **state) 449lock_file (const char *filename, void **state)
448{ 450{
449 int fd; 451 int fd;
@@ -484,7 +486,7 @@ lock_file (const char *filename, void **state)
484 return 0; 486 return 0;
485} 487}
486 488
487int 489static int
488unlock_file (const char *filename, void *state) 490unlock_file (const char *filename, void *state)
489{ 491{
490 char *lockpath = (char *) state; 492 char *lockpath = (char *) state;