aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorBill Wohler2014-02-23 18:04:35 -0800
committerBill Wohler2014-02-23 18:04:35 -0800
commit3e93bafb95608467e438ba7f725fd1f020669f8c (patch)
treef2f90109f283e06a18caea3cb2a2623abcfb3a92 /lib-src
parent791c0d7634e44bb92ca85af605be84ff2ae08963 (diff)
parente918e27fdf331e89268fc2c9d7cf838d3ecf7aa7 (diff)
downloademacs-3e93bafb95608467e438ba7f725fd1f020669f8c.tar.gz
emacs-3e93bafb95608467e438ba7f725fd1f020669f8c.zip
Merge from trunk; up to 2014-02-23T23:41:17Z!lekktu@gmail.com.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog899
-rw-r--r--lib-src/Makefile.in162
-rw-r--r--lib-src/ebrowse.c38
-rw-r--r--lib-src/emacsclient.c111
-rw-r--r--lib-src/etags.c636
-rwxr-xr-xlib-src/grep-changelog2
-rw-r--r--lib-src/hexl.c20
-rw-r--r--lib-src/make-docfile.c11
-rw-r--r--lib-src/makefile.w32-in9
-rw-r--r--lib-src/movemail.c46
-rw-r--r--lib-src/ntlib.c85
-rw-r--r--lib-src/ntlib.h11
-rw-r--r--lib-src/pop.c52
-rw-r--r--lib-src/pop.h9
-rw-r--r--lib-src/profile.c20
-rwxr-xr-xlib-src/rcs2log5
-rw-r--r--lib-src/test-distrib.c2
-rw-r--r--lib-src/update-game-score.c273
-rw-r--r--lib-src/update-game-score.exe.manifest10
19 files changed, 1119 insertions, 1282 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 81876d86165..fcdde8003bc 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,281 @@
12014-01-22 Eli Zaretskii <eliz@gnu.org>
2
3 * update-game-score.c (write_scores) [WINDOWSNT]: Use chmod
4 instead of fchmod.
5
62014-01-22 Paul Eggert <eggert@cs.ucla.edu>
7
8 Fix miscellaneous update-game-score bugs.
9 * update-game-score.c (difftime) [!HAVE_DIFFTIME]: Remove.
10 (read_score) [HAVE_GETDELIM]: Don't access uninitialized storage,
11 as that leads to undefined behavior, which is a bad thing
12 particularly in a setuid program.
13 (read_scores, write_scores): Check for fclose failure; on some
14 systems, I/O errors are not reported by primitives like getc and
15 putc, but instead are delayed until fclose, so fclose failures
16 should be diagnosed like other read and write errors.
17 (write_scores): Use fchmod, not chmod, to avoid a race.
18 Otherwise, if the lock is broken by some other process,
19 update-game-score might try to change the permission on someone
20 else's file or on a nonexistent file, and incorrectly report an
21 error when this fails.
22 (lock_file): Fix test for out-of-date lock file; it was reversed.
23 That is, it incorrectly broke locks when they were more than an
24 hour into the future, instead of when they were more than an hour
25 in the past. Use ordinary subtraction rather than difftime; since
26 we're already assuming POSIX we don't need to worry about the
27 possibility of time_t being a magic cookie, and since timestamps
28 are positive we don't need to worry about integer overflow when
29 subtracting them. Put two spaces, not just one, after a sentence
30 end in a comment.
31
322014-01-19 Paul Eggert <eggert@cs.ucla.edu>
33
34 update-game-score fixes for -m and integer overflow (Bug#16428)
35 * update-game-score.c: Include inttypes.h, stdbool.h.
36 (min): New macro, if not already defined.
37 (MAX_SCORES, main): Limit the maximum number of scores only from
38 limits imposed by the underyling platform, instead of the
39 arbitrary value 200.
40 (struct score_entry, main, read_score, write_score):
41 Scores are now intmax_t, not long.
42 (get_user_id): Reject user names containing spaces or newlines,
43 as they would mess up the score file.
44 Allow uids that don't fit in 'long'.
45 Increase the size of the buffer, to avoid overrun in weird cases.
46 (get_prefix, main): Use bool for boolean.
47 (main): Rewrite expr to avoid possibility of signed integer
48 overflow. Don't allow newlines in data, as this would mess up
49 the score file. Check for memory allocation failure when adding
50 the new score, or when unlockint the file. Implement -m.
51 (read_score): Check for integer overflow when reading a score.
52 (read_score) [!HAVE_GETDELIM]: Check for integer overflow when
53 data gets very long. Check only for space to delimit names,
54 since that's what's done in the HAVE_GETDELIM case.
55 (read_scores): New parameter ALLOC. Change counts to ptrdiff_t.
56 All uses changed. Use push_score to add individual scores;
57 that's simpler than repeating its contents.
58 (score_compare_reverse): Simplify.
59 (push_score): New parameter SIZE. Change counts to ptrdiff_t.
60 All uses changed. Check for integer overflow of size calculation.
61 (sort_scores, write_scores): Change counts to ptrdiff_t.
62 (unlock_file): Preserve errno on success, so that storage
63 exhaustion is diagnosed correctly.
64
652014-01-05 Paul Eggert <eggert@cs.ucla.edu>
66
67 Spelling fixes.
68 * Makefile.in (regex.o): Remove reference to no-longer-used macros
69 CONFIG_BROKETS and INHIBIT_STRING_HEADER. "BROKETS" was a
70 misspelling anyway....
71
722013-12-14 Paul Eggert <eggert@cs.ucla.edu>
73
74 Use bool for boolean, focusing on headers.
75 * emacsclient.c, etags.c, hexl.c (FALSE, TRUE):
76 Remove. All uses replaced with uncapitalized version.
77 * emacsclient.c (message):
78 * etags.c (make_tag, pfnote, consider_token, make_C_tag, lang_names):
79 * hexl.c (un_flag, iso_flag, endian):
80 * pop.c (pop_debug, pop_open, pop_multi_first, pop_multi_next)
81 (pop_trash):
82 Use bool for boolean.
83 * etags.c (bool): Remove.
84 * etags.c (globals, members, declarations, no_line_directive)
85 (no_duplicates): Use 'int' for boolean values that getopt requires
86 to be 'int'. Formerly, these were 'bool' and 'bool' was 'int',
87 but we can no longer rely on this implementation.
88 * pop.h (struct _popserver): Use bool_bf for boolean bit-fields.
89
902013-11-14 Paul Eggert <eggert@cs.ucla.edu>
91
92 * ebrowse.c (xstrdup):
93 * etags.c (savenstr): Prefer tail calls.
94 * etags.c (concat): Omit unnecessary assignment.
95
962013-10-24 Glenn Morris <rgm@gnu.org>
97
98 * Makefile.in ($(DESTDIR)${archlibdir}):
99 Avoid non-portable "`\" nesting.
100
101 * Makefile.in (abs_top_srcdir): New, set by configure.
102
1032013-10-23 Glenn Morris <rgm@gnu.org>
104
105 * Makefile.in ($(DESTDIR)${archlibdir}, need-blessmail, install)
106 (uninstall): Quote entities that might contain whitespace.
107
1082013-10-10 Glenn Morris <rgm@gnu.org>
109
110 * make-docfile.c (search_lisp_doc_at_eol):
111 Use int rather than char with getc. (Bug#15481)
112
1132013-09-20 Paul Eggert <eggert@cs.ucla.edu>
114
115 A simpler, centralized INLINE.
116 * profile.c (INLINE): New macro.
117 (SYSTIME_INLINE): Remove.
118
1192013-08-28 Paul Eggert <eggert@cs.ucla.edu>
120
121 * Makefile.in (SHELL): Now @SHELL@, not /bin/sh,
122 for portability to hosts where /bin/sh has problems.
123
1242013-08-10 Eli Zaretskii <eliz@gnu.org>
125
126 * update-game-score.exe.manifest: New file.
127
128 * Makefile.in (UPDATE_MANIFEST): New variable.
129 (SCRIPTS): Add $(UPDATE_MANIFEST).
130
1312013-08-05 Stefan Monnier <monnier@iro.umontreal.ca>
132
133 * makefile.w32-in (lisp2): Add nadvice.elc.
134
1352013-08-05 Eli Zaretskii <eliz@gnu.org>
136
137 * update-game-score.c (read_score): Try reading a character before
138 probing the stream for EOF. Initialize score->score to zero,
139 before reading and accumulating the score.
140 (read_scores): Fix logic that determines which value to return.
141 Close the input stream when finished reading the scores (avoids
142 failures in overwriting the file with a new one on MS-Windows,
143 since a file that is open cannot be deleted).
144
145 * ntlib.h (rename): Don't undefine.
146
147 * ntlib.c (sys_rename): New function, needed for
148 update-game-score.
149
1502013-08-04 Eli Zaretskii <eliz@gnu.org>
151
152 * ntlib.h: Include fcntl.h.
153 (mkostemp): Declare prototype.
154 (mktemp): Don't redefine.
155
156 * ntlib.c (mkostemp): New function. (Bug#15015)
157
1582013-08-04 Paul Eggert <eggert@cs.ucla.edu>
159
160 Fix some minor races in hosts lacking mkostemp (Bug#15015).
161 * movemail.c (main):
162 * update-game-score.c (write_scores):
163 Use mkostemp (which now works on all platforms, due to changes
164 in the portability layer) rather than mktemp (which has a race)
165 or mkstemp (which we no longer bother with).
166
1672013-07-10 Paul Eggert <eggert@cs.ucla.edu>
168
169 Port to C89.
170 * ebrowse.c (USAGE): Remove macro with too-long string literal ...
171 (usage_message): ... and replace it with this new static constant
172 containing multiple literals. All uses changed.
173 * emacsclient.c (print_help_and_exit):
174 Rewrite to avoid string literals longer than the C89 limits.
175 (start_daemon_and_retry_set_socket):
176 Rewrite to avoid non-constant array initializer.
177 * make-docfile.c (enum global_type): Omit trailing comma.
178
1792013-07-02 Paul Eggert <eggert@cs.ucla.edu>
180
181 Prefer plain 'static' to 'static inline' (Bug#12541).
182 I missed these instances of 'static inline' in an earlier sweep.
183 * ebrowse.c (putstr):
184 * etags.c (hash):
185 * make-docfile.c (put_char): No longer inline.
186 * etags.c (hash): Prefer int to unsigned when either will do.
187
1882013-06-21 Paul Eggert <eggert@cs.ucla.edu>
189
190 Use C99-style flexible array members if available.
191 * ebrowse.c: Include <stddef.h>, for offsetof.
192 (struct member, struct alias, struct sym):
193 Use FLEXIBLE_ARRAY_MEMBER.
194 (add_sym, add_member, make_namespace, register_namespace_alias):
195 Use offsetof (struct, flex_array_member), not sizeof (struct), as
196 that ports better to pre-C99 non-GCC.
197
1982013-05-29 Eli Zaretskii <eliz@gnu.org>
199
200 * Makefile.in (mostlyclean): Remove *.res files.
201
2022013-05-18 Paul Eggert <eggert@cs.ucla.edu>
203
204 Port --enable-gcc-warnings to clang.
205 * etags.c: Omit unnecessary forward decls.
206 (print_version, print_help): Declare _Noreturn.
207 * pop.c (socket_connection) [HAVE_GETADDRINFO]: Simplify.
208
2092013-05-16 Eli Zaretskii <eliz@gnu.org>
210
211 * update-game-score.c [WINDOWSNT]: Include "ntlib.h".
212
213 * ntlib.h (sleep): Update prototype.
214 (geteuid): Add prototype.
215
216 * ntlib.c (sleep): Now returns an unsigned value.
217 (getgid): New function.
218
219 * Makefile.in (CLIENTW, LIB_WSOCK32, LIBS_ECLIENT, NTLIB)
220 (CLIENTRES, WINDRES, NTINC, NTDEPS): New variables.
221 (INSTALLABLES): Add $(CLIENTW).
222 (LIBS_MOVE): Use $(LIB_WSOCK32).
223 ($(DESTDIR)${archlibdir}): Use $(EXEEXT) on update-game-score.
224 (test-distrib${EXEEXT}): Use $(EXEEXT) on test-distrib.
225 (etags${EXEEXT}, ebrowse${EXEEXT}, ctags${EXEEXT})
226 (profile${EXEEXT}, make-docfile${EXEEXT}, movemail${EXEEXT})
227 (emacsclient${EXEEXT}, hexl${EXEEXT}, update-game-score${EXEEXT}):
228 Add $(NTLIB) to prerequisites. Use $(EXEEXT).
229 (pop.o): Add pop.h to prerequisites.
230 (emacsclientw${EXEEXT}, ntlib.o): New targets.
231 (emacsclient.res): New target.
232
2332013-05-15 Stefan Monnier <monnier@iro.umontreal.ca>
234
235 * makefile.w32-in ($(DOC)): Use DOC rather than DOC-X.
236
2372013-05-06 Paul Eggert <eggert@cs.ucla.edu>
238
239 * make-docfile.c (search_lisp_doc_at_eol) [DEBUG]: Fix typo,
240 by removing references to no-longer-existing locals.
241
2422013-03-26 Eli Zaretskii <eliz@gnu.org>
243
244 Fix incompatibilities between MinGW.org and MinGW64 headers.
245 * ntlib.c (struct timespec) [!_TIMEZONE_DEFINED]: Define the
246 struct only if _TIMEZONE_DEFINED is not defined.
247
2482013-03-23 cg <chengang31@gmail.com> (tiny change)
249
250 * makefile.w32-in (LIB_SRC): Move before first use.
251
2522013-03-16 Paul Eggert <eggert@cs.ucla.edu>
253
254 * pop.c: Fix ERRMAX typo (Bug#13925).
255 (socket_connection) [!HAVE_KRB5_ERROR_TEXT && HAVE_KRB5_ERROR_E_TEXT]:
256 Use ERROR_MAX, not ERRMAX.
257
2582013-03-13 Paul Eggert <eggert@cs.ucla.edu>
259
260 File synchronization fixes (Bug#13944).
261 * Makefile.in (LIB_FDATASYNC): New macro.
262 (emacsclient${EXEEXT}): Use it.
263 * emacsclient.c (main): Use fdatasync, not fsync, since we don't
264 care about metadata. Keep trying if interrupted.
265 * movemail.c (main, popmail): Don't worry about BSD_SYSTEM, since
266 fsync is available everywhere (or there is a substitute).
267 Don't report an error if fsync returns EINVAL.
268
269 Static checking by Sun C 5.12.
270 * etags.c (analyse_regex): Omit unreachable code.
271
272 * movemail.c (main): Call umask on all systems.
273 This is OK since Emacs already assumes umask elsewhere.
274 Don't grant more read permissions than necessary.
275 The old 0333 dates back to before we called setuid,
276 so it was needed back then to ensure user-readability,
277 but 0377 should suffice now.
278
12013-02-08 Paul Eggert <eggert@cs.ucla.edu> 2792013-02-08 Paul Eggert <eggert@cs.ucla.edu>
2 280
3 * movemail.c (getenv): Remove decl (unused since 1994). 281 * movemail.c (getenv): Remove decl (unused since 1994).
@@ -478,7 +756,7 @@
478 756
4792012-05-05 Jim Meyering <meyering@redhat.com> 7572012-05-05 Jim Meyering <meyering@redhat.com>
480 758
481 * lib-src/pop.c (pop_stat, pop_list, pop_multi_first, pop_last): 759 * pop.c (pop_stat, pop_list, pop_multi_first, pop_last):
482 NUL-terminate the error buffer (Bug#11372). 760 NUL-terminate the error buffer (Bug#11372).
483 761
4842012-05-02 Juanma Barranquero <lekktu@gmail.com> 7622012-05-02 Juanma Barranquero <lekktu@gmail.com>
@@ -636,7 +914,7 @@
636 to avoid potential buffer overflow issues on typical 64-bit hosts. 914 to avoid potential buffer overflow issues on typical 64-bit hosts.
637 (whatlen_max): New static var. 915 (whatlen_max): New static var.
638 (main): Avoid buffer overflow if subsidiary command length is 916 (main): Avoid buffer overflow if subsidiary command length is
639 greater than BUFSIZ or 2*BUFSIZ + 20. Do not use sprintf when its 917 greater than BUFSIZ or 2*BUFSIZ + 20. Do not use sprintf when its
640 result might not fit in 'int'. 918 result might not fit in 'int'.
641 919
642 * movemail.c (main): Do not use sprintf when its result might not fit 920 * movemail.c (main): Do not use sprintf when its result might not fit
@@ -987,7 +1265,7 @@
987 1265
9882011-01-30 Jim Meyering <meyering@redhat.com> 12662011-01-30 Jim Meyering <meyering@redhat.com>
989 1267
990 make-docfile: don't corrupt heap for an invalid .elc file 1268 * make-docfile.c: Don't corrupt heap for an invalid .elc file
991 "printf '#@1a' > in.elc; ./make-docfile in.elc" would store 0 1269 "printf '#@1a' > in.elc; ./make-docfile in.elc" would store 0
992 one byte before just-malloc'd saved_string buffer. 1270 one byte before just-malloc'd saved_string buffer.
993 * make-docfile.c (scan_lisp_file): Diagnose an invalid dynamic 1271 * make-docfile.c (scan_lisp_file): Diagnose an invalid dynamic
@@ -3687,7 +3965,7 @@
3687 3965
36882002-03-05 Francesco Potortì <pot@gnu.org> 39662002-03-05 Francesco Potortì <pot@gnu.org>
3689 3967
3690 * etags.c: Honour #line directives. 3968 * etags.c: Honor #line directives.
3691 (no_line_directive): New global var; set it for old behavior. 3969 (no_line_directive): New global var; set it for old behavior.
3692 (main): Remove some #ifdef in the getopt switch. 3970 (main): Remove some #ifdef in the getopt switch.
3693 (add_node, put_entries): Code added to merge different chunks of 3971 (add_node, put_entries): Code added to merge different chunks of
@@ -4795,7 +5073,7 @@
47951999-06-23 Dave Love <fx@gnu.org> 50731999-06-23 Dave Love <fx@gnu.org>
4796 5074
4797 * etags.c (erlang_attribute): Fix undefined variable usage (after 5075 * etags.c (erlang_attribute): Fix undefined variable usage (after
4798 Potorti). 5076 Potortì).
4799 5077
48001999-05-02 Andrew Innes <andrewi@gnu.org> 50781999-05-02 Andrew Innes <andrewi@gnu.org>
4801 5079
@@ -5161,7 +5439,7 @@
5161 (longopts): New long options without short counterpart are 5439 (longopts): New long options without short counterpart are
5162 globals, members, no-globals, no-members. Regexp options are now 5440 globals, members, no-globals, no-members. Regexp options are now
5163 defined conditionally to ETAGS_REGEXPS. 5441 defined conditionally to ETAGS_REGEXPS.
5164 (print_help): Updated. 5442 (print_help): Update.
5165 5443
51661997-05-22 Francesco Potortì <F.Potorti@cnuce.cnr.it> 54441997-05-22 Francesco Potortì <F.Potorti@cnuce.cnr.it>
5167 5445
@@ -6034,7 +6312,7 @@
6034 6312
60351995-06-13 Geoff Voelker <voelker@cs.washington.edu> 63131995-06-13 Geoff Voelker <voelker@cs.washington.edu>
6036 6314
6037 * etags.c (process_file,absolute_filename): Handle filenames 6315 * etags.c (process_file, absolute_filename): Handle filenames
6038 starting with a drive letter. 6316 starting with a drive letter.
6039 6317
6040 * makefile.nt (install): Copy wakeup.exe properly. 6318 * makefile.nt (install): Copy wakeup.exe properly.
@@ -6061,12 +6339,12 @@
60611995-05-25 Geoff Voelker <voelker@cs.washington.edu> 63391995-05-25 Geoff Voelker <voelker@cs.washington.edu>
6062 6340
6063 * makefile.nt (LIBS): Use BASE_LIBS. 6341 * makefile.nt (LIBS): Use BASE_LIBS.
6064 (make-docfile.exe,hexl.exe,wakeup.exe,etags.exe): Don't depend 6342 (make-docfile.exe, hexl.exe, wakeup.exe, etags.exe): Don't depend
6065 upon LIBS. 6343 upon LIBS.
6066 (DOC): Use del instead of rm. 6344 (DOC): Use del instead of rm.
6067 (DOC) [WINDOWS95]: Use DOC. 6345 (DOC) [WINDOWS95]: Use DOC.
6068 (clean): Handle MSVC aux files. 6346 (clean): Handle MSVC aux files.
6069 (config.h,paths.h): Use $(CP) instead of cp. 6347 (config.h, paths.h): Use $(CP) instead of cp.
6070 (config.h): Use $(CONFIG_H) 6348 (config.h): Use $(CONFIG_H)
6071 (make-docfile.obj): Depend upon config.h. 6349 (make-docfile.obj): Depend upon config.h.
6072 Clean up comments. 6350 Clean up comments.
@@ -7889,14 +8167,6 @@
7889 * emacsserver.c (msgcatch): Use the SIGTYPE macro to declare the 8167 * emacsserver.c (msgcatch): Use the SIGTYPE macro to declare the
7890 type of this function. 8168 type of this function.
7891 8169
78921992-04-14 Jim Blandy (jimb@pogo.cs.oberlin.edu)
7893
7894 * ChangeLog: Since the old etc contents have been split into etc
7895 and lib-src, the old etc's ChangeLog has been duplicated in the
7896 new etc and lib-src. That means that each contains complete and
7897 coherent information, although each contains extraneous
7898 information.
7899
79001992-04-08 Jim Blandy (jimb@pogo.cs.oberlin.edu) 81701992-04-08 Jim Blandy (jimb@pogo.cs.oberlin.edu)
7901 8171
7902 * etags.c: "--no-warning" option renamed to "--no-warn", 8172 * etags.c: "--no-warning" option renamed to "--no-warn",
@@ -7905,595 +8175,24 @@
7905 * Makefile: Renamed to Makefile.in; the configure script 8175 * Makefile: Renamed to Makefile.in; the configure script
7906 will edit this to produce Makefile. 8176 will edit this to produce Makefile.
7907 8177
79081992-04-07 Jim Blandy (jimb@pogo.cs.oberlin.edu) 81781992-04-08 Jim Blandy (jimb@pogo.cs.oberlin.edu)
7909
7910 * etags.c (print_help, print_version): New functions.
7911 (main): Options added to support them.
7912
7913 * etags.c (longopts): New array of long names for the options.
7914 (main): Recognize them.
7915
79161992-04-06 Jim Blandy (jimb@pogo.cs.oberlin.edu)
7917
7918 * etags.c (C_entries): Remove comment saying that \" in a string
7919 isn't recognized as magic, because it is correctly handled.
7920
7921 * getopt.c, getopt.h: New files, from GNU C library.
7922 * etags.c: Rewritten to use getopt.
7923 #include "getopt.h".
7924 (file_num): Variable deleted; its role is now played by getopt's
7925 optind.
7926 (main): Argument processing loop rewritten to call getopt to get
7927 next option. Options which take parameters (-o and -i) rewritten
7928 to get parameter from optarg instead of argv[1].
7929 Filename preprocessing loop and update command changed similarly.
7930 * Makefile (etags, ctags): Depend on and link with getopt.h,
7931 getopt.o, and getopt1.o.
7932 (getopt.o, getopt1.o): New targets for the GNU getopt routines.
7933
7934 * etags.c (outfflag): Variable deleted; it is non-zero iff outfile
7935 is non-zero.
7936
7937 (main): In the argument processing loop, the 'goto next_arg'
7938 statements are breaking out of the switch statement in exactly the
7939 same way that a simple 'break' statement would; replace the gotos
7940 with breaks, and remove the label.
7941
79421992-04-06 Richard Stallman (rms@mole.gnu.ai.mit.edu)
7943
7944 * etags.c (C_entries): Clear tydef and next_token_is_func at start.
7945 (consider_token): Move next_token_is_func to global.
7946
79471992-04-02 Jim Blandy (jimb@pogo.cs.oberlin.edu)
7948
7949 * Makefile: Conform with GNU coding standards:
7950 (mostlyclean): New target, synonymous with clean.
7951 (TAGS, check): New targets.
7952 (INSTALL, INSTALLFLAGS): New variables.
7953
79541992-03-31 Jim Blandy (jimb@pogo.cs.oberlin.edu)
7955
7956 * lib-src/Makefile, etc/MACHINES, etc/NEWS: Changed references to
7957 `config.emacs' to `configure'.
7958
7959 * lib-src/Makefile: Adjusted for renaming of share-lib to etc.
7960 * etc/MACHINES: Same.
7961
79621992-03-30 Jim Blandy (jimb@pogo.cs.oberlin.edu)
7963
7964 * movemail.c (main): Allow tempname to be as long as necessary,
7965 instead of limiting it to 39 characters.
7966
7967 * movemail.c (main): Move declaration of buf from top of function
7968 to local block surrounding the copy loop. This makes it less
7969 likely to be confused with the buf used by the code which checks the
7970 permissions on outname's directory.
7971
79721992-03-20 Jim Kingdon (kingdon@albert.gnu.ai.mit.edu)
7973
7974 * SERVICE: Remove my entry.
7975
79761992-03-09 David J. MacKenzie (djm@nutrimat.gnu.ai.mit.edu)
7977
7978 * Makefile (emacstool, nemacstool, xvetool): Use ${CFLAGS}, not
7979 hardcoded -g.
7980
7981 * movemail.c (xmalloc): Return char *, not int.
7982 (main) [!MAIL_USE_FLOCK]: Add a new conditional, MAIL_UNLINK_SPOOL,
7983 that is off by default -- normally don't unlink the mail spool
7984 file, just empty it. Pass creat mode 0600, not 0666.
7985
79861992-02-07 Jim Blandy (jimb@pogo.cs.oberlin.edu)
7987
7988 * Makefile (../arch-lib): Depend on ${EXECUTABLES}.
7989 (all): Instead of here.
7990 (install): Don't use the -s option, since people need symbols to
7991 debug code.
7992
79931992-01-19 Eric Youngdale (youngdale@v6550c.nrl.navy.mil)
7994
7995 * etags-vmslib.c (fn_exp): Add type cast.
7996
79971992-01-18 Richard Stallman (rms@mole.gnu.ai.mit.edu)
7998
7999 * movemail.c: Changes in comments.
8000
80011992-01-13 Jim Blandy (jimb@pogo.cs.oberlin.edu)
8002
8003 * Makefile: Make the distclean target erase the DOC files from
8004 ../share-lib and the executables from ../arch-lib.
8005
80061992-01-09 Jim Blandy (jimb@pogo.cs.oberlin.edu)
8007
8008 * emacsclient.c: #include <sys/stat.h>
8009 (main): Do declare statbfr.
8010
80111991-12-21 Richard Stallman (rms@mole.gnu.ai.mit.edu)
8012
8013 * emacsserver.c, emacsclient.c [BSD]: Use either /tmp or ~
8014 for the socket, depending on SERVER_HOME_DIR.
8015 If using /tmp, put host name in the socket name.
8016
8017 * movemail.c (pfatal_and_delete): New function.
8018 (main, popmail): Use it.
8019 (popmail): Close output before deleting messages.
8020 Check for error on close and on fsync.
8021 Use `fatal' where appropriate.
8022 (main): Remove (void).
8023
8024 * aixcc.lex: New file. Not officially part of Emacs.
8025 * Makefile: Rules for that.
8026
80271991-12-04 Jim Blandy (jimb@pogo.gnu.ai.mit.edu)
8028
8029 * yow.c (main): Rename all references to PATH_EXEC to PATH_DATA.
8030
8031 * etags.c (main): Properly cast call to alloca that initializes
8032 included_files.
8033
80341991-08-17 Roland McGrath (roland@geech.gnu.ai.mit.edu)
8035
8036 * etags.c (files_are_tag_tables): Remove global var.
8037 (process_file): Don't test it. Also remove hack checking for a
8038 file named "TAGS".
8039 (main): -i now takes an arg which is the name of a file to include.
8040 Collect these names and emit include tags for them after processing
8041 all the argument files.
8042
80431991-07-30 Richard Stallman (rms@mole.gnu.ai.mit.edu)
8044
8045 * wakeup.c: Terminate if parent goes away.
8046
80471991-07-18 Richard Stallman (rms@mole.gnu.ai.mit.edu)
8048
8049 * etags.c (C_entries): Process token before handling end of line.
8050 When inner loops reach end of line, just back up.
8051 Let the real end of line processing happen in just one place.
8052 (consider_token): Likewise.
8053
80541991-04-11 Jim Blandy (jimb@geech.gnu.ai.mit.edu)
8055
8056 * etags.c (TEX_mode): Skip comments while scanning the text to see
8057 which escape character this file uses.
8058
80591991-03-29 Richard Stallman (rms@mole.gnu.ai.mit.edu)
8060
8061 * emacsserver.c [USG]: Terminate if msgrcv fails.
8062
80631991-03-03 Richard Stallman (rms@mole.ai.mit.edu)
8064
8065 * emacsserver.c [BSD]: Check for errors on stdin after scanf.
8066
80671991-01-25 Jim Blandy (jimb@churchy.ai.mit.edu)
8068
8069 * make-docfile: Find the arguments to a C function correctly,
8070 by not ignoring the character that read_c_string returns.
8071 Don't even try to find argument names for functions that take MANY
8072 or UNEVALLED arguments, since they're a figment of the docstring's
8073 imagination.
8074
80751991-01-14 Jim Blandy (jimb@churchy.ai.mit.edu)
8076
8077 * make-docfile: Read the .elc files generated by the new byte
8078 compiler.
8079
80801990-12-31 Richard Stallman (rms@mole.ai.mit.edu)
8081
8082 * refcard.tex: Use cm fonts, not am, in multi-column mode.
8083
80841990-11-29 Richard Stallman (rms@mole.ai.mit.edu)
8085
8086 * movemail.c (mbx_delimit_begin): Put space before `unseen'.
8087
80881990-11-27 Richard Stallman (rms@mole.ai.mit.edu)
8089
8090 * Makefile (install*): No need to install wakeup.
8091
80921990-11-26 Richard Stallman (rms@mole.ai.mit.edu)
8093
8094 * Makefile (install*): Install emacsclient like etags.
8095
80961990-11-13 Richard Stallman (rms@mole.ai.mit.edu)
8097
8098 * movemail.c (error): Handle 3 args.
8099 (main): Don't check input access if using pop.
8100
81011990-10-16 Richard Stallman (rms@mole.ai.mit.edu)
8102
8103 * etags.c (find_entries): Check for numbers after Scheme suffix.
8104
81051990-10-14 Richard Stallman (rms@mole.ai.mit.edu)
8106
8107 * termcap.dat (vt200-80): Fix ke and ks to frob flag 1.
8108
81091990-10-09 Richard Stallman (rms@mole.ai.mit.edu)
8110
8111 * Makefile (nemacstool, xvetool): New targets.
8112
81131990-09-26 Richard Stallman (rms@mole.ai.mit.edu)
8114
8115 * emacsclient.c: Include errno.h and define related variables.
8116
81171990-09-23 Richard Stallman (rms@mole.ai.mit.edu)
8118
8119 * emacsclient.c: Change usage message.
8120
81211990-08-30 David Lawrence (tale@pogo.ai.mit.edu)
8122
8123 * emacs.1: Add break before -nw option.
8124
81251990-08-19 David J. MacKenzie (djm@apple-gunkies)
8126
8127 * qsort.c: Replace with GNU version.
8128
81291990-08-14 David J. MacKenzie (djm@apple-gunkies)
8130
8131 * wakeup.c: New program replacing loadst.c.
8132
81331990-08-14 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8134
8135 * emacsclient.c [USG]: Pass msgsnd only 4 args.
8136
81371990-08-09 David J. MacKenzie (djm@pogo.ai.mit.edu)
8138
8139 * etags.c: Rename `flag' variables for what they do instead of
8140 which option character sets them.
8141
81421990-05-28 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8143
8144 * loadst.c (main): Conditional to get load average on Apollo.
8145
81461990-05-22 Joseph Arceneaux (jla@churchy.ai.mit.edu)
8147
8148 * emacsserver.c: Set the permission on the socket to 0600.
8149
81501990-03-27 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8151
8152 * emacsclient.c [BSD]: Print clean message for failing getwd.
8153
81541990-03-20 David Lawrence (tale@pogo.ai.mit.edu)
8155
8156 * getdate.y: Use the getdate.y from GNU tar for timer.
8157
81581990-03-18 Jim Kingdon (kingdon@pogo.ai.mit.edu)
8159
8160 * emacsclient.c (main): Don't put brackets around "filename" in
8161 usage message. It isn't optional.
8162
81631990-03-14 Joseph Arceneaux (jla@churchy.ai.mit.edu)
8164
8165 * etags.c (getit): Recognize '$' as beginning identifiers.
8166
81671990-02-22 David Lawrence (tale@pogo.ai.mit.edu)
8168
8169 * emacsserver.c: Renamed from server.c.
8170 * Makefile: Reference emacsserver rather than server.
8171 * MACHINES: Doc fix for new emacsserver name.
8172
81731990-01-25 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8174
8175 * emacsclient.c: Print program name in error messages.
8176
81771990-01-19 David Lawrence (tale@cocoa-puffs)
8178
8179 * timer.c, getdate.y (new files) and Makefile:
8180 Sub-process support for run-at-time in timer.el.
8181 Doesn't yet work correctly for USG.
8182
81831990-01-10 Jim Kingdon (kingdon@pogo)
8184
8185 * MACHINES: Add HP 300 running BSD.
8186
81871990-01-02 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8188
8189 * yow.c: Dynamically allocate buffer; skip header before random
8190 choice to avoid bias toward first item.
8191
81921989-12-24 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8193
8194 * etags.c (readline): Separate out init of `pend'.
8195
81961989-12-17 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8197
8198 * etags.c: Undo changes relating to isgoodhdr.
8199
82001989-12-16 Mosur Mohan (rms@sugar-bombs.ai.mit.edu)
8201
8202 * etags.c (isgoodhdr): New macro.
8203 (_gdh, notgdh): New variable used by that.
8204 (init): Initialize _gdh.
8205 (find_entries): Set header_file.
8206 (consider_token): Use isgoodhdr if in header file.
8207
8208 * etags.c (total_size_of_entries):
8209 Was miscalculating by 1 in rewritten case.
8210
8211 * etags.c (PAS_funcs): One arg to pfnote was missing.
8212
82131989-12-05 Joseph Arceneaux (jla@spiff)
8214
8215 * MACHINES: Change for the ULTRIX entry.
8216
82171989-11-21 Joseph Arceneaux (jla@spiff)
8218
8219 * etags.c (process_file): If file is not regular, return.
8220
82211989-11-06 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8222
8223 * loadst.c (main): Handle FIXUP_KERNEL_SYMBOL_ADDR.
8224
82251989-10-30 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8226
8227 * loadst.c (load_average): If HAVE_GETLOADAVG, use getloadavg.
8228 (main): If HAVE_GETLOADAVG, don't call `nlist'.
8229
82301989-10-25 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8231
8232 * etags.c (consider_token): Allow any number of typespec keywords
8233 after `typedef', before new type name.
8234 (enum sym_type): Add st_C_typespec.
8235 (C_create_stab): Put typespec kwds in table.
8236
82371989-08-27 Richard Stallman (rms@apple-gunkies.ai.mit.edu)
8238
8239 * etags.c (main): Don't depend on name invoked by.
8240 If CTAGS is not defined, assume it is ETAGS.
8241
82421989-07-31 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8243
8244 * etags.c (L_funcs): Allow package name in define construct,
8245 as in (foo::defmumble name-defined ...).
8246
82471989-07-30 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8248
8249 * etags.c (find_entries): Stupid bug testing for C filename suffixes.
8250
8251 * Makefile (yow): Depends on ../src/paths.h.
8252
82531989-07-04 Richard Stallman (rms@apple-gunkies.ai.mit.edu)
8254
8255 * etags.c: Fix compilation by moving Pascal after Fortran.
8256
82571989-06-15 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8258
8259 * movemail.c [USG]: Define F_OK, etc., if not found in header.
8260
82611989-05-27 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8262
8263 * hexl.c: New file, supports hexl-mode.
8264
82651989-05-14 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8266
8267 * movemail.c: New compilation flag MAIL_USE_MMDF.
8268
82691989-05-08 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8270
8271 * emacsclient.c: Use BSD code whenever HAVE_SOCKETS.
8272 * server.c: Likewise.
8273
8274 * make-docfile.c (scan_c_file): Output argument names at end of string.
8275 (write_c_args): New subroutine.
8276
82771989-04-27 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8278
8279 * movemail.c: Report failure of flock.
8280
82811989-04-19 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8282
8283 * etags.c (find_entries): Allow multi-letter extensions for fortran.
8284
82851989-04-18 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8286
8287 * loadst.c: On bsd4.3, use gettimeofday instead of CPUSTATES.
8288
82891989-03-15 Jeff Peck (rms@sugar-bombs.ai.mit.edu)
8290
8291 * emacstool.c: setenv IN_EMACSTOOL=t, TERM=sun, TERMCAP=.
8292
8293 * emacstool.1: Update to document environment variables.
8294
82951989-02-21 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8296
8297 * etags.c (PAS_funcs): New function by Mosur Mohan.
8298
8299 * movemail.c: On sysv, include unistd.h.
8300
83011989-02-18 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8302
8303 * b2m.c: New file.
8304
83051989-02-15 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8306
8307 * etags.c: Prolog support from Sunichirou Sugou.
8308
83091989-02-03 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8310
8311 * Makefile (clean): New target.
8312
83131989-01-25 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8314
8315 * fakemail.c (put_line): Break header lines at 79 cols.
8316
83171989-01-19 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8318
8319 * etags.c: Greatly rewritten by Sam Kendall for C++ support and for
8320 multiple tags per line.
8321
83221989-01-03 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8323
8324 * movemail.c: Check access before doing real work.
8325 Check that outfile is in a writable directory.
8326 On fatal error, delete the lock file.
8327
83281988-12-31 Richard Mlynarik (mly@rice-chex.ai.mit.edu)
8329
8330 * env.c: Add decl for my-index
8331 * etags.c (file-entries): .oak => scheme.
8332
83331988-12-30 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8334
8335 * movemail.c: Use `access' to check input and output files.
8336
83371988-12-28 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8338
8339 * emacsclient.c (main): Ignore all of CWD before first slash.
8340
83411988-12-27 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8342
8343 * etags.c (readline): Double linebuffer->size outside the xrealloc.
8344
83451988-12-22 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8346
8347 * server.c, emacsclient.c: Don't try to use gid_t; it isn't defined.
8348 * server.c: chmod the socket to 0700.
8349
83501988-12-09 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8351
8352 * fakemail.c (main): Let env var FAKEMAILER override pgm to run.
8353 (add_field): Delete comments and turn `<', `>' to spaces
8354 in header lines.
8355 (USE_FAKEMAIL): New customization macro says to make fakemail
8356 not be a no-op even on a BSD system.
8357
83581988-12-01 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8359
8360 * etags.c (consider_token): Skip comments just like whitespace.
8361 Notice `struct', etc. and set strtag for those tokens.
8362 Return 1 for the token following `struct' if an open-brace follows it.
8363 (C_entries): Special handling of token following `struct'
8364 needed because we have probably advanced to the following line
8365 to find the `{'.
8366 (main): New option `T' sets tflag and strflag.
8367 Set both of them by default if eflags.
8368
83691988-11-30 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8370
8371 * movemail.c: Do fsync before closing output.
8372
83731988-11-29 Richard Mlynarik (mly@pickled-brain.ai.mit.edu)
8374
8375 * movemail.c: Better error message when can't create tempname.
8376 This file needs a great deal of extra error-checking and lucid reporting...
8377
83781988-11-16 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8379
8380 * etags.c: Support assembler code for .s and .a files.
8381 (getit): Allow underscore in a tag.
8382
83831988-11-15 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8384
8385 * movemail.c: Close output and check errors before deleting input.
8386
83871988-10-01 Richard Stallman (rms@apple-gunkies.ai.mit.edu)
8388
8389 * emacsclient.c [SYSVIPC]: Compute cwd only once; decide properly
8390 whether to prefix it. Handle line number args.
8391
83921988-09-24 Richard Stallman (rms@gluteus.ai.mit.edu)
8393
8394 * etags.c (main): Default setting of eflag was backwards.
8395
83961988-09-23 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8397
8398 * etags.c: New option -i. -f renamed -o.
8399 `-' as input file means read input file names from stdin.
8400 -i spec'd or input file named TAGS means the input file is another
8401 tag table; output an "include" line for it.
8402
84031988-09-19 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8404
8405 * Makefile: New vars DESTDIR, BINDIR, LIBDIR, MANDIR, MANEXT.
8406 New targets install, install.sysv, install.xenix.
8407 This makefile is now responsible for installing executables
8408 and documentation from this directory into system directories.
8409
84101988-09-16 Richard Stallman (rms@corn-chex.ai.mit.edu)
8411
8412 * server.c, emacsclient.c (main): Compute socket name from euid.
8413
84141988-08-04 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8415
8416 * emacsclient.c: Args like +DIGITS are passed through unchanged.
8417
84181988-07-12 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8419
8420 * server.c: If both BSD and HAVE_SYSVIPC, use the latter.
8421 * emacsclient.c: Likewise.
8422 In the HAVE_SYSVIPC alternative, if BSD, use getwd instead of getcwd.
8423
84241988-06-23 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8425
8426 * etags.c: Handle `typedef struct foo {' (price@mcc.com).
8427 (istoken): New string-comparison macro.
8428 (consider_token): New arg `level'. New state `tag_ok' in `tydef'.
8429
84301988-06-14 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8431
8432 * etags.c: Changes for VMS.
8433 Always define ETAGS on VMS.
8434 Define macros GOOD and BAD for success and failure exit codes.
8435 (begtk, intk): Allow `$' in identifiers.
8436 (main): Don't support -B, -F or -u on VMS.
8437 Alternate loop for scanning filename arguments.
8438 (system): Delete definition of this function.
8439
8440 * etags-vmslib.c (system): Undefine this; VMS now provides it.
8441
84421988-06-08 Richard Stallman (rms@sugar-bombs.ai.mit.edu)
8443
8444 * loadst.c: Prevent multiple-def errors on BSD and BSD4_3
8445 around include of param.h. (Like fns.c.)
8446
84471988-05-16 Richard Stallman (rms@frosted-flakes.ai.mit.edu)
8448
8449 * loadst.c (load_average): Move load-average code to this new fn.
8450 Add conditionals to compute load ave on UMAX.
8451
84521988-05-14 Richard Stallman (rms@lucky-charms.ai.mit.edu)
8453
8454 * loadst.c: Change DK_HEADER_FILE to DKSTAT_HEADER_FILE
8455 with opposite sense.
8456
84571988-05-13 Chris Hanson (cph@kleph)
8458
8459 * emacsclient.c: Delete references to unused variable `out'.
8460 This caused a bus error when used under hp-ux.
8461
84621988-05-06 Richard Stallman (rms@frosted-flakes.ai.mit.edu)
8463
8464 * loadst.c: Control dk.h conditional with DK_HEADER_FILE.
8465
84661988-05-04 Richard Stallman (rms@rice-krispies.ai.mit.edu)
8467
8468 * etags.c (find_entries): `.t' or `.sch' means scheme code.
8469
84701988-04-29 Richard Stallman (rms@frosted-flakes.ai.mit.edu)
8471
8472 * loadst.c: Add BSD4_3 conditional for file dk.h instead of dkstat.h.
8473
84741988-04-28 Richard Stallman (rms@frosted-flakes.ai.mit.edu)
8475
8476 * movemail.c: #undef close, since config can #define it on V.3.
8477 * emacsclient.c, fakemail.c, loadst.c, server.c: Likewise.
8478
84791988-04-26 Richard Stallman (rms@lucky-charms.ai.mit.edu)
8480
8481 * etags.c (TEX_mode, etc.): Remove superfluous backslashes from
8482 invalid escape sequences such as `\{'.
8483
8484 * loadst.c: Add `sequent' conditional for file dk.h.
8485
84861988-03-20 Richard M. Stallman (rms@wilson)
8487
8488 * server.c [not BSD and not HAVE_SYSVIPC]: Fix error message.
8489 8179
8490 * loadst.c (main) [XENIX]: Use /usr/spool/mail, not /usr/mail. 8180 New directory, with files previously in ../etc. [approximate date]
8181 * README: New file.
8182 * Makefile: Copy here from ../etc/Makefile.
8183 * aixcc.lex, b2m.c, cvtmail.c, digest-doc.c:
8184 * emacsclient.c, emacsserver.c, emacstool.c, env.c:
8185 * etags-vmslib.c, etags.c, fakemail.c, getdate.c, getdate.y:
8186 * getopt.c, getopt.h, getopt1.c, hexl.c, leditcfns.c:
8187 * make-docfile.c, movemail.c, qsort.c, sorted-doc.c:
8188 * test-distrib.c, testfile, timer.c, wakeup.c, yow.c:
8189 Move here from ../etc.
8491 8190
8492;; Local Variables: 8191;; Local Variables:
8493;; coding: utf-8 8192;; coding: utf-8
8494;; End: 8193;; End:
8495 8194
8496 Copyright (C) 1988-1999, 2001-2013 Free Software Foundation, Inc. 8195 Copyright (C) 1988-1999, 2001-2014 Free Software Foundation, Inc.
8497 8196
8498 This file is part of GNU Emacs. 8197 This file is part of GNU Emacs.
8499 8198
diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in
index 8a6960ee2fe..56cdc09e0fe 100644
--- a/lib-src/Makefile.in
+++ b/lib-src/Makefile.in
@@ -1,5 +1,6 @@
1# Makefile for lib-src subdirectory in GNU Emacs. 1### @configure_input@
2# Copyright (C) 1985, 1987-1988, 1993-1994, 2001-2013 Free Software 2
3# Copyright (C) 1985, 1987-1988, 1993-1994, 2001-2014 Free Software
3# Foundation, Inc. 4# Foundation, Inc.
4 5
5# This file is part of GNU Emacs. 6# This file is part of GNU Emacs.
@@ -17,10 +18,7 @@
17# You should have received a copy of the GNU General Public License 18# You should have received a copy of the GNU General Public License
18# along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. 19# along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
19 20
20 21SHELL = @SHELL@
21# Avoid trouble on systems where the `SHELL' variable might be
22# inherited from the environment.
23SHELL = /bin/sh
24 22
25# Following ../lisp/Makefile.in. 23# Following ../lisp/Makefile.in.
26EMACS = ../src/emacs 24EMACS = ../src/emacs
@@ -39,6 +37,7 @@ C_SWITCH_MACHINE=@C_SWITCH_MACHINE@
39PROFILING_CFLAGS = @PROFILING_CFLAGS@ 37PROFILING_CFLAGS = @PROFILING_CFLAGS@
40WARN_CFLAGS = @WARN_CFLAGS@ 38WARN_CFLAGS = @WARN_CFLAGS@
41WERROR_CFLAGS = @WERROR_CFLAGS@ 39WERROR_CFLAGS = @WERROR_CFLAGS@
40UPDATE_MANIFEST = @UPDATE_MANIFEST@
42 41
43# Program name transformation. 42# Program name transformation.
44TRANSFORM = @program_transform_name@ 43TRANSFORM = @program_transform_name@
@@ -85,6 +84,8 @@ VPATH=@srcdir@
85 84
86# The top-level source directory, also set by configure. 85# The top-level source directory, also set by configure.
87top_srcdir=@top_srcdir@ 86top_srcdir=@top_srcdir@
87# MinGW CPPFLAGS may use this.
88abs_top_srcdir=@abs_top_srcdir@
88 89
89# ==================== Emacs-specific directories ==================== 90# ==================== Emacs-specific directories ====================
90 91
@@ -113,8 +114,11 @@ MKDIR_P = @MKDIR_P@
113 114
114# ========================== Lists of Files =========================== 115# ========================== Lists of Files ===========================
115 116
117# emacsclientw.exe for MinGW, empty otherwise
118CLIENTW = @CLIENTW@
119
116# Things that a user might actually run, which should be installed in bindir. 120# Things that a user might actually run, which should be installed in bindir.
117INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} \ 121INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} $(CLIENTW) \
118 ebrowse${EXEEXT} 122 ebrowse${EXEEXT}
119 123
120INSTALLABLE_SCRIPTS = grep-changelog 124INSTALLABLE_SCRIPTS = grep-changelog
@@ -128,7 +132,7 @@ DONT_INSTALL= test-distrib${EXEEXT} make-docfile${EXEEXT}
128 132
129# Like UTILITIES, but they're not system-dependent, and should not be 133# Like UTILITIES, but they're not system-dependent, and should not be
130# deleted by the distclean target. 134# deleted by the distclean target.
131SCRIPTS= rcs2log 135SCRIPTS= rcs2log $(UPDATE_MANIFEST)
132 136
133# All files that are created by the linker, i.e., whose names end in ${EXEEXT}. 137# All files that are created by the linker, i.e., whose names end in ${EXEEXT}.
134EXE_FILES = ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL} 138EXE_FILES = ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL}
@@ -143,17 +147,17 @@ MOVE_FLAGS=
143## Empty if either MAIL_USE_FLOCK or MAIL_USE_LOCKF, else need-blessmail. 147## Empty if either MAIL_USE_FLOCK or MAIL_USE_LOCKF, else need-blessmail.
144BLESSMAIL_TARGET=@BLESSMAIL_TARGET@ 148BLESSMAIL_TARGET=@BLESSMAIL_TARGET@
145 149
146## -lkrb if HAVE_LIBKRB or -lkrb4 if HAVE_LIBKRB4 150## -lkrb or -lkrb4 if needed
147KRB4LIB=@KRB4LIB@ 151KRB4LIB=@KRB4LIB@
148## -ldes if HAVE_LIBDES or -ldes425 if HAVE_LIBDES425 152## -ldes or -ldes425 if needed
149DESLIB=@DESLIB@ 153DESLIB=@DESLIB@
150## -lkrb5 if HAVE_LIBKRB5 154## -lkrb5 if needed
151KRB5LIB=@KRB5LIB@ 155KRB5LIB=@KRB5LIB@
152## -lk5crypto if HAVE_LIBK5CRYPTO or -lcrypto if HAVE_LIBCRYPTO 156## -lk5crypto or -lcrypto if needed
153CRYPTOLIB=@CRYPTOLIB@ 157CRYPTOLIB=@CRYPTOLIB@
154## -lcom_err if HAVE_LIBCOM_ERR 158## -lcom_err if needed
155COM_ERRLIB=@COM_ERRLIB@ 159COM_ERRLIB=@COM_ERRLIB@
156## -lhesiod if HAVE_LIBHESIOD 160## -lhesiod if needed
157LIBHESIOD=@LIBHESIOD@ 161LIBHESIOD=@LIBHESIOD@
158## -lresolv if HAVE_LIBRESOLV 162## -lresolv if HAVE_LIBRESOLV
159LIBRESOLV=@LIBRESOLV@ 163LIBRESOLV=@LIBRESOLV@
@@ -161,10 +165,23 @@ LIBRESOLV=@LIBRESOLV@
161LIBS_MAIL=@LIBS_MAIL@ 165LIBS_MAIL=@LIBS_MAIL@
162## empty or -lrt or -lposix4 if HAVE_CLOCK_GETTIME 166## empty or -lrt or -lposix4 if HAVE_CLOCK_GETTIME
163LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ 167LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
168## empty or -lrt or -lposix4 if HAVE_FDATASYNC
169LIB_FDATASYNC = @LIB_FDATASYNC@
170## empty or -lwsock2 for MinGW
171LIB_WSOCK32=@LIB_WSOCK32@
164 172
165## Extra libraries to use when linking movemail. 173## Extra libraries to use when linking movemail.
166LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) \ 174LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) \
167 $(COM_ERRLIB) $(LIBHESIOD) $(LIBRESOLV) 175 $(COM_ERRLIB) $(LIBHESIOD) $(LIBRESOLV) $(LIB_WSOCK32)
176
177## Extra libraries when linking emacsclient
178## (empty or -lcomctl32 for MinGW)
179LIBS_ECLIENT = @LIBS_ECLIENT@
180
181## Extra object files for linking for MinGW
182NTLIB = @NTLIB@
183CLIENTRES = @CLIENTRES@
184WINDRES = @WINDRES@
168 185
169## Some systems define this to request special libraries. 186## Some systems define this to request special libraries.
170LIBS_SYSTEM = @LIBS_SYSTEM@ 187LIBS_SYSTEM = @LIBS_SYSTEM@
@@ -199,10 +216,10 @@ blessmail:
199need-blessmail: blessmail 216need-blessmail: blessmail
200 @if [ `wc -l <blessmail` != 2 ] ; then \ 217 @if [ `wc -l <blessmail` != 2 ] ; then \
201 dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \ 218 dir=`sed -n -e 's/echo mail directory = \(.*\)/\1/p' blessmail`; \
202 echo Assuming $$dir is really the mail spool directory, you should; \ 219 echo "Assuming $$dir is really the mail spool directory, you should"; \
203 echo run lib-src/blessmail $(DESTDIR)${archlibdir}/movemail${EXEEXT}; \ 220 echo "run lib-src/blessmail $(DESTDIR)${archlibdir}/movemail${EXEEXT}"; \
204 echo as root, to give movemail${EXEEXT} appropriate permissions.; \ 221 echo "as root, to give movemail${EXEEXT} appropriate permissions."; \
205 echo Do that after running make install.; \ 222 echo "Do that after running make install."; \
206 fi 223 fi
207 224
208## This is the target invoked by the top-level Makefile. 225## This is the target invoked by the top-level Makefile.
@@ -216,23 +233,24 @@ maybe-blessmail: $(BLESSMAIL_TARGET)
216$(DESTDIR)${archlibdir}: all 233$(DESTDIR)${archlibdir}: all
217 @echo 234 @echo
218 @echo "Installing utilities run internally by Emacs." 235 @echo "Installing utilities run internally by Emacs."
219 umask 022; ${MKDIR_P} $(DESTDIR)${archlibdir} 236 umask 022; ${MKDIR_P} "$(DESTDIR)${archlibdir}"
220 if [ `cd $(DESTDIR)${archlibdir} && /bin/pwd` != `/bin/pwd` ]; then \ 237 exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && /bin/pwd`; \
238 if [ "$$exp_archlibdir" != "`/bin/pwd`" ]; then \
221 for file in ${UTILITIES}; do \ 239 for file in ${UTILITIES}; do \
222 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file $(DESTDIR)${archlibdir}/$$file ; \ 240 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file "$(DESTDIR)${archlibdir}/$$file" ; \
223 done ; \ 241 done ; \
224 fi 242 fi
225 umask 022; ${MKDIR_P} $(DESTDIR)${gamedir}; \ 243 umask 022; ${MKDIR_P} "$(DESTDIR)${gamedir}"; \
226 touch $(DESTDIR)${gamedir}/snake-scores; \ 244 touch "$(DESTDIR)${gamedir}/snake-scores"; \
227 touch $(DESTDIR)${gamedir}/tetris-scores 245 touch "$(DESTDIR)${gamedir}/tetris-scores"
228 -if chown ${gameuser} $(DESTDIR)${archlibdir}/update-game-score && chmod u+s $(DESTDIR)${archlibdir}/update-game-score; then \ 246 -if chown ${gameuser} "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" && chmod u+s "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}"; then \
229 chown ${gameuser} $(DESTDIR)${gamedir}; \ 247 chown ${gameuser} "$(DESTDIR)${gamedir}"; \
230 chmod u=rwx,g=rwx,o=rx $(DESTDIR)${gamedir}; \ 248 chmod u=rwx,g=rwx,o=rx "$(DESTDIR)${gamedir}"; \
231 fi 249 fi
232 if [ `cd $(DESTDIR)${archlibdir} && /bin/pwd` \ 250 if [ "`cd \"$(DESTDIR)${archlibdir}\" && /bin/pwd`" \
233 != `cd ${srcdir} && /bin/pwd` ]; then \ 251 != "`cd ${srcdir} && /bin/pwd`" ]; then \
234 for file in ${SCRIPTS}; do \ 252 for file in ${SCRIPTS}; do \
235 $(INSTALL_SCRIPT) ${srcdir}/$$file $(DESTDIR)${archlibdir}/$$file; \ 253 $(INSTALL_SCRIPT) ${srcdir}/$$file "$(DESTDIR)${archlibdir}/$$file"; \
236 done ; \ 254 done ; \
237 fi 255 fi
238 256
@@ -242,27 +260,27 @@ $(DESTDIR)${archlibdir}: all
242install: $(DESTDIR)${archlibdir} 260install: $(DESTDIR)${archlibdir}
243 @echo 261 @echo
244 @echo "Installing utilities for users to run." 262 @echo "Installing utilities for users to run."
245 umask 022; ${MKDIR_P} $(DESTDIR)${bindir} 263 umask 022; ${MKDIR_P} "$(DESTDIR)${bindir}"
246 for file in ${INSTALLABLES} ; do \ 264 for file in ${INSTALLABLES} ; do \
247 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} $(DESTDIR)${bindir}/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \ 265 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} "$(DESTDIR)${bindir}"/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \
248 done 266 done
249 for file in ${INSTALLABLE_SCRIPTS} ; do \ 267 for file in ${INSTALLABLE_SCRIPTS} ; do \
250 $(INSTALL_SCRIPT) ${srcdir}/$${file} $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \ 268 $(INSTALL_SCRIPT) ${srcdir}/$${file} "$(DESTDIR)${bindir}"/`echo $${file} | sed '$(TRANSFORM)'` ; \
251 done 269 done
252 270
253uninstall: 271uninstall:
254 for file in ${INSTALLABLES}; do \ 272 for file in ${INSTALLABLES}; do \
255 rm -f $(DESTDIR)${bindir}/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \ 273 rm -f "$(DESTDIR)${bindir}"/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \
256 done 274 done
257 for file in ${INSTALLABLE_SCRIPTS}; do \ 275 for file in ${INSTALLABLE_SCRIPTS}; do \
258 rm -f $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \ 276 rm -f "$(DESTDIR)${bindir}"/`echo $${file} | sed '$(TRANSFORM)'` ; \
259 done 277 done
260 if [ -d $(DESTDIR)${archlibdir} ]; then \ 278 if [ -d "$(DESTDIR)${archlibdir}" ]; then \
261 (cd $(DESTDIR)${archlibdir} && rm -f ${UTILITIES} ${SCRIPTS}) \ 279 (cd "$(DESTDIR)${archlibdir}" && rm -f ${UTILITIES} ${SCRIPTS}) \
262 fi 280 fi
263 281
264mostlyclean: 282mostlyclean:
265 -rm -f core *.o 283 -rm -f core *.o *.res
266 284
267clean: mostlyclean 285clean: mostlyclean
268 -rm -f ${EXE_FILES} 286 -rm -f ${EXE_FILES}
@@ -290,57 +308,77 @@ TAGS: etags${EXEEXT}
290## distribute Emacs. If they were clobbered, all the .elc files were 308## distribute Emacs. If they were clobbered, all the .elc files were
291## clobbered too. 309## clobbered too.
292test-distrib${EXEEXT}: ${srcdir}/test-distrib.c 310test-distrib${EXEEXT}: ${srcdir}/test-distrib.c
293 $(CC) ${ALL_CFLAGS} -o test-distrib ${srcdir}/test-distrib.c 311 $(CC) ${ALL_CFLAGS} -o test-distrib${EXEEXT} ${srcdir}/test-distrib.c
294 ./test-distrib ${srcdir}/testfile 312 ./test-distrib ${srcdir}/testfile
295 313
296../lib/libgnu.a: $(config_h) 314../lib/libgnu.a: $(config_h)
297 cd ../lib && $(MAKE) libgnu.a 315 cd ../lib && $(MAKE) libgnu.a
298 316
299regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h $(config_h) 317regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h $(config_h)
300 ${CC} -c ${CPP_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER \ 318 ${CC} -c ${CPP_CFLAGS} ${srcdir}/../src/regex.c
301 ${srcdir}/../src/regex.c
302 319
303etags${EXEEXT}: ${srcdir}/etags.c regex.o $(config_h) 320etags${EXEEXT}: ${srcdir}/etags.c regex.o $(NTLIB) $(config_h)
304 $(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" \ 321 $(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" \
305 -DVERSION="\"${version}\"" ${srcdir}/etags.c \ 322 -DVERSION="\"${version}\"" ${srcdir}/etags.c \
306 regex.o $(LOADLIBES) -o etags 323 regex.o $(LOADLIBES) $(NTLIB) -o etags${EXEEXT}
307 324
308ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h $(config_h) 325ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h $(NTLIB) \
326 $(config_h)
309 $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \ 327 $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \
310 ${srcdir}/ebrowse.c $(LOADLIBES) -o ebrowse 328 ${srcdir}/ebrowse.c $(LOADLIBES) $(NTLIB) -o ebrowse${EXEEXT}
311 329
312## We depend on etags to assure that parallel makes do not write two 330## We depend on etags to assure that parallel makes do not write two
313## etags.o files on top of each other. 331## etags.o files on top of each other.
314ctags${EXEEXT}: etags${EXEEXT} 332ctags${EXEEXT}: etags${EXEEXT}
315 $(CC) ${ALL_CFLAGS} -DCTAGS -DEMACS_NAME="\"GNU Emacs\"" \ 333 $(CC) ${ALL_CFLAGS} -DCTAGS -DEMACS_NAME="\"GNU Emacs\"" \
316 -DVERSION="\"${version}\"" ${srcdir}/etags.c \ 334 -DVERSION="\"${version}\"" ${srcdir}/etags.c \
317 regex.o $(LOADLIBES) -o ctags 335 regex.o $(LOADLIBES) $(NTLIB) -o ctags${EXEEXT}
318 336
319profile${EXEEXT}: ${srcdir}/profile.c $(config_h) 337profile${EXEEXT}: ${srcdir}/profile.c $(NTLIB) $(config_h)
320 $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c \ 338 $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c \
321 $(LOADLIBES) $(LIB_CLOCK_GETTIME) -o profile 339 $(LOADLIBES) $(NTLIB) $(LIB_CLOCK_GETTIME) -o profile${EXEEXT}
322 340
323make-docfile${EXEEXT}: ${srcdir}/make-docfile.c $(config_h) 341make-docfile${EXEEXT}: ${srcdir}/make-docfile.c $(NTLIB) $(config_h)
324 $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) \ 342 $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) $(NTLIB) \
325 -o make-docfile 343 -o make-docfile${EXEEXT}
326 344
327movemail${EXEEXT}: ${srcdir}/movemail.c pop.o $(config_h) 345movemail${EXEEXT}: ${srcdir}/movemail.c pop.o $(NTLIB) $(config_h)
328 $(CC) ${ALL_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c pop.o \ 346 $(CC) ${ALL_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c pop.o \
329 $(LOADLIBES) $(LIBS_MOVE) -o movemail 347 $(LOADLIBES) $(NTLIB) $(LIBS_MOVE) -o movemail${EXEEXT}
330 348
331pop.o: ${srcdir}/pop.c ${srcdir}/../lib/min-max.h $(config_h) 349pop.o: ${srcdir}/pop.c ${srcdir}/pop.h ${srcdir}/../lib/min-max.h $(config_h)
332 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c 350 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c
333 351
334emacsclient${EXEEXT}: ${srcdir}/emacsclient.c $(config_h) 352emacsclient${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(config_h)
335 $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c \ 353 $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c \
336 -DVERSION="\"${version}\"" \ 354 -DVERSION="\"${version}\"" $(NTLIB) $(LOADLIBES) $(LIB_FDATASYNC) \
337 $(LOADLIBES) -o emacsclient 355 $(LIB_WSOCK32) $(LIBS_ECLIENT) -o emacsclient${EXEEXT}
338 356
339hexl${EXEEXT}: ${srcdir}/hexl.c $(config_h) 357emacsclientw${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(CLIENTRES) $(config_h)
340 $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl 358 $(CC) ${ALL_CFLAGS} $(CLIENTRES) -mwindows ${srcdir}/emacsclient.c \
359 -DVERSION="\"${version}\"" $(LOADLIBES) $(LIB_FDATASYNC) \
360 $(LIB_WSOCK32) $(LIBS_ECLIENT) -o emacsclientw${EXEEXT}
341 361
342update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(config_h) 362NTINC = ${srcdir}/../nt/inc
363NTDEPS = $(NTINC)/ms-w32.h $(NTINC)/sys/stat.h $(NTINC)/inttypes.h \
364 $(NTINC)/stdint.h $(NTINC)/pwd.h $(NTINC)/sys/time.h $(NTINC)/stdbool.h \
365 $(NTINC)/sys/wait.h $(NTINC)/unistd.h $(NTINC)/sys/file.h $(NTINC)/netdb.h
366
367# The dependency on $(NTDEPS) is a trick intended to cause recompile of
368# programs on MinGW whenever some private header in nt/inc is modified.
369ntlib.o: ${srcdir}/ntlib.c ${srcdir}/ntlib.h $(NTDEPS)
370 $(CC) -c ${CPP_CFLAGS} ${srcdir}/ntlib.c
371
372hexl${EXEEXT}: ${srcdir}/hexl.c $(NTLIB) $(config_h)
373 $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl${EXEEXT}
374
375update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(NTLIB) $(config_h)
343 $(CC) ${ALL_CFLAGS} -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \ 376 $(CC) ${ALL_CFLAGS} -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \
344 ${srcdir}/update-game-score.c $(LOADLIBES) -o update-game-score 377 ${srcdir}/update-game-score.c $(LOADLIBES) $(NTLIB) \
378 -o update-game-score${EXEEXT}
379
380emacsclient.res: $(NTINC)/../emacsclient.rc
381 $(WINDRES) -O coff --include-dir=$(NTINC)/.. -o emacsclient.res \
382 $(NTINC)/../emacsclient.rc
345 383
346## Makefile ends here. 384## Makefile ends here.
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c
index 3a237daf5f8..29a88e85f02 100644
--- a/lib-src/ebrowse.c
+++ b/lib-src/ebrowse.c
@@ -1,6 +1,6 @@
1/* ebrowse.c --- parsing files for the ebrowse C++ browser 1/* ebrowse.c --- parsing files for the ebrowse C++ browser
2 2
3Copyright (C) 1992-2013 Free Software Foundation, Inc. 3Copyright (C) 1992-2014 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
6 6
@@ -19,6 +19,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
19 19
20 20
21#include <config.h> 21#include <config.h>
22#include <stddef.h>
22#include <stdio.h> 23#include <stdio.h>
23#include <stdlib.h> 24#include <stdlib.h>
24#include <string.h> 25#include <string.h>
@@ -237,7 +238,7 @@ struct member
237 char *def_regexp; /* Regular expression matching definition. */ 238 char *def_regexp; /* Regular expression matching definition. */
238 const char *def_filename; /* File name of definition. */ 239 const char *def_filename; /* File name of definition. */
239 int def_pos; /* Buffer position of definition. */ 240 int def_pos; /* Buffer position of definition. */
240 char name[1]; /* Member name. */ 241 char name[FLEXIBLE_ARRAY_MEMBER]; /* Member name. */
241}; 242};
242 243
243/* Structures of this type are used to connect class structures with 244/* Structures of this type are used to connect class structures with
@@ -256,7 +257,7 @@ struct alias
256 struct alias *next; /* Next in list. */ 257 struct alias *next; /* Next in list. */
257 struct sym *namesp; /* Namespace in which defined. */ 258 struct sym *namesp; /* Namespace in which defined. */
258 struct link *aliasee; /* List of aliased namespaces (A::B::C...). */ 259 struct link *aliasee; /* List of aliased namespaces (A::B::C...). */
259 char name[1]; /* Alias name. */ 260 char name[FLEXIBLE_ARRAY_MEMBER]; /* Alias name. */
260}; 261};
261 262
262/* The structure used to describe a class in the symbol table, 263/* The structure used to describe a class in the symbol table,
@@ -280,7 +281,7 @@ struct sym
280 const char *filename; /* File in which it can be found. */ 281 const char *filename; /* File in which it can be found. */
281 const char *sfilename; /* File in which members can be found. */ 282 const char *sfilename; /* File in which members can be found. */
282 struct sym *namesp; /* Namespace in which defined. . */ 283 struct sym *namesp; /* Namespace in which defined. . */
283 char name[1]; /* Name of the class. */ 284 char name[FLEXIBLE_ARRAY_MEMBER]; /* Name of the class. */
284}; 285};
285 286
286/* Experimental: Print info for `--position-info'. We print 287/* Experimental: Print info for `--position-info'. We print
@@ -513,7 +514,7 @@ static char *
513xstrdup (char *s) 514xstrdup (char *s)
514{ 515{
515 if (s) 516 if (s)
516 s = strcpy (xmalloc (strlen (s) + 1), s); 517 return strcpy (xmalloc (strlen (s) + 1), s);
517 return s; 518 return s;
518} 519}
519 520
@@ -567,8 +568,8 @@ add_sym (const char *name, struct sym *nested_in_class)
567 puts (name); 568 puts (name);
568 } 569 }
569 570
570 sym = (struct sym *) xmalloc (sizeof *sym + strlen (name)); 571 sym = xmalloc (offsetof (struct sym, name) + strlen (name) + 1);
571 memset (sym, 0, sizeof *sym); 572 memset (sym, 0, offsetof (struct sym, name));
572 strcpy (sym->name, name); 573 strcpy (sym->name, name);
573 sym->namesp = scope; 574 sym->namesp = scope;
574 sym->next = class_table[h]; 575 sym->next = class_table[h];
@@ -852,7 +853,8 @@ add_global_decl (char *name, char *regexp, int pos, unsigned int hash, int var,
852static struct member * 853static struct member *
853add_member (struct sym *cls, char *name, int var, int sc, unsigned int hash) 854add_member (struct sym *cls, char *name, int var, int sc, unsigned int hash)
854{ 855{
855 struct member *m = (struct member *) xmalloc (sizeof *m + strlen (name)); 856 struct member *m = xmalloc (offsetof (struct member, name)
857 + strlen (name) + 1);
856 struct member **list; 858 struct member **list;
857 struct member *p; 859 struct member *p;
858 struct member *prev; 860 struct member *prev;
@@ -962,8 +964,8 @@ mark_inherited_virtual (void)
962static struct sym * 964static struct sym *
963make_namespace (char *name, struct sym *context) 965make_namespace (char *name, struct sym *context)
964{ 966{
965 struct sym *s = (struct sym *) xmalloc (sizeof *s + strlen (name)); 967 struct sym *s = xmalloc (offsetof (struct sym, name) + strlen (name) + 1);
966 memset (s, 0, sizeof *s); 968 memset (s, 0, offsetof (struct sym, name));
967 strcpy (s->name, name); 969 strcpy (s->name, name);
968 s->next = all_namespaces; 970 s->next = all_namespaces;
969 s->namesp = context; 971 s->namesp = context;
@@ -1046,7 +1048,7 @@ register_namespace_alias (char *new_name, struct link *old_name)
1046 if (streq (new_name, al->name) && (al->namesp == current_namespace)) 1048 if (streq (new_name, al->name) && (al->namesp == current_namespace))
1047 return; 1049 return;
1048 1050
1049 al = (struct alias *) xmalloc (sizeof *al + strlen (new_name)); 1051 al = xmalloc (offsetof (struct alias, name) + strlen (new_name) + 1);
1050 strcpy (al->name, new_name); 1052 strcpy (al->name, new_name);
1051 al->next = namespace_alias_table[h]; 1053 al->next = namespace_alias_table[h];
1052 al->namesp = current_namespace; 1054 al->namesp = current_namespace;
@@ -1094,7 +1096,7 @@ leave_namespace (void)
1094/* Write string S to the output file FP in a Lisp-readable form. 1096/* Write string S to the output file FP in a Lisp-readable form.
1095 If S is null, write out `()'. */ 1097 If S is null, write out `()'. */
1096 1098
1097static inline void 1099static void
1098putstr (const char *s, FILE *fp) 1100putstr (const char *s, FILE *fp)
1099{ 1101{
1100 if (!s) 1102 if (!s)
@@ -3479,7 +3481,9 @@ open_file (char *file)
3479 3481
3480/* Display usage information and exit program. */ 3482/* Display usage information and exit program. */
3481 3483
3482#define USAGE "\ 3484static char const *const usage_message[] =
3485 {
3486 "\
3483Usage: ebrowse [options] {files}\n\ 3487Usage: ebrowse [options] {files}\n\
3484\n\ 3488\n\
3485 -a, --append append output to existing file\n\ 3489 -a, --append append output to existing file\n\
@@ -3487,6 +3491,8 @@ Usage: ebrowse [options] {files}\n\
3487 -I, --search-path=LIST set search path for input files\n\ 3491 -I, --search-path=LIST set search path for input files\n\
3488 -m, --min-regexp-length=N set minimum regexp length to N\n\ 3492 -m, --min-regexp-length=N set minimum regexp length to N\n\
3489 -M, --max-regexp-length=N set maximum regexp length to N\n\ 3493 -M, --max-regexp-length=N set maximum regexp length to N\n\
3494",
3495 "\
3490 -n, --no-nested-classes exclude nested classes\n\ 3496 -n, --no-nested-classes exclude nested classes\n\
3491 -o, --output-file=FILE set output file name to FILE\n\ 3497 -o, --output-file=FILE set output file name to FILE\n\
3492 -p, --position-info print info about position in file\n\ 3498 -p, --position-info print info about position in file\n\
@@ -3496,12 +3502,16 @@ Usage: ebrowse [options] {files}\n\
3496 -x, --no-regexps don't record regular expressions\n\ 3502 -x, --no-regexps don't record regular expressions\n\
3497 --help display this help\n\ 3503 --help display this help\n\
3498 --version display version info\n\ 3504 --version display version info\n\
3505\n\
3499" 3506"
3507 };
3500 3508
3501static _Noreturn void 3509static _Noreturn void
3502usage (int error) 3510usage (int error)
3503{ 3511{
3504 puts (USAGE); 3512 int i;
3513 for (i = 0; i < sizeof usage_message / sizeof *usage_message; i++)
3514 fputs (usage_message[i], stdout);
3505 exit (error ? EXIT_FAILURE : EXIT_SUCCESS); 3515 exit (error ? EXIT_FAILURE : EXIT_SUCCESS);
3506} 3516}
3507 3517
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 6feaf18ba60..6593b91e39a 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -1,6 +1,6 @@
1/* Client process that communicates with GNU Emacs acting as server. 1/* Client process that communicates with GNU Emacs acting as server.
2 2
3Copyright (C) 1986-1987, 1994, 1999-2013 Free Software Foundation, Inc. 3Copyright (C) 1986-1987, 1994, 1999-2014 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
6 6
@@ -103,14 +103,6 @@ char *getenv (const char *);
103#define EXIT_FAILURE 1 103#define EXIT_FAILURE 1
104#endif 104#endif
105 105
106#ifndef FALSE
107#define FALSE 0
108#endif
109
110#ifndef TRUE
111#define TRUE 1
112#endif
113
114/* Additional space when allocating buffers for filenames, etc. */ 106/* Additional space when allocating buffers for filenames, etc. */
115#define EXTRA_SPACE 100 107#define EXTRA_SPACE 100
116 108
@@ -433,9 +425,9 @@ ttyname (int fd)
433 425
434/* Display a normal or error message. 426/* Display a normal or error message.
435 On Windows, use a message box if compiled as a Windows app. */ 427 On Windows, use a message box if compiled as a Windows app. */
436static void message (int, const char *, ...) ATTRIBUTE_FORMAT_PRINTF (2, 3); 428static void message (bool, const char *, ...) ATTRIBUTE_FORMAT_PRINTF (2, 3);
437static void 429static void
438message (int is_error, const char *format, ...) 430message (bool is_error, const char *format, ...)
439{ 431{
440 va_list args; 432 va_list args;
441 433
@@ -528,7 +520,7 @@ decode_options (int argc, char **argv)
528 break; 520 break;
529 521
530 case 'V': 522 case 'V':
531 message (FALSE, "emacsclient %s\n", VERSION); 523 message (false, "emacsclient %s\n", VERSION);
532 exit (EXIT_SUCCESS); 524 exit (EXIT_SUCCESS);
533 break; 525 break;
534 526
@@ -555,7 +547,7 @@ decode_options (int argc, char **argv)
555 break; 547 break;
556 548
557 default: 549 default:
558 message (TRUE, "Try `%s --help' for more information\n", progname); 550 message (true, "Try `%s --help' for more information\n", progname);
559 exit (EXIT_FAILURE); 551 exit (EXIT_FAILURE);
560 break; 552 break;
561 } 553 }
@@ -614,7 +606,7 @@ decode_options (int argc, char **argv)
614 606
615 if (alternate_editor && alternate_editor[0] == '\0') 607 if (alternate_editor && alternate_editor[0] == '\0')
616 { 608 {
617 message (TRUE, "--alternate-editor argument or ALTERNATE_EDITOR variable cannot be\n\ 609 message (true, "--alternate-editor argument or ALTERNATE_EDITOR variable cannot be\n\
618an empty string"); 610an empty string");
619 exit (EXIT_FAILURE); 611 exit (EXIT_FAILURE);
620 } 612 }
@@ -629,8 +621,8 @@ print_help_and_exit (void)
629 message aligns properly both in a tty and in a Windows message box. 621 message aligns properly both in a tty and in a Windows message box.
630 Please try to preserve them; otherwise the output is very hard to read 622 Please try to preserve them; otherwise the output is very hard to read
631 when using emacsclientw. */ 623 when using emacsclientw. */
632 message (FALSE, 624 message (false,
633 "Usage: %s [OPTIONS] FILE...\n\ 625 "Usage: %s [OPTIONS] FILE...\n%s%s%s", progname, "\
634Tell the Emacs server to visit the specified files.\n\ 626Tell the Emacs server to visit the specified files.\n\
635Every FILE can be either just a FILENAME or [+LINE[:COLUMN]] FILENAME.\n\ 627Every FILE can be either just a FILENAME or [+LINE[:COLUMN]] FILENAME.\n\
636\n\ 628\n\
@@ -640,6 +632,7 @@ The following OPTIONS are accepted:\n\
640-nw, -t, --tty Open a new Emacs frame on the current terminal\n\ 632-nw, -t, --tty Open a new Emacs frame on the current terminal\n\
641-c, --create-frame Create a new frame instead of trying to\n\ 633-c, --create-frame Create a new frame instead of trying to\n\
642 use the current Emacs frame\n\ 634 use the current Emacs frame\n\
635", "\
643-F ALIST, --frame-parameters=ALIST\n\ 636-F ALIST, --frame-parameters=ALIST\n\
644 Set the parameters of a new frame\n\ 637 Set the parameters of a new frame\n\
645-e, --eval Evaluate the FILE arguments as ELisp expressions\n\ 638-e, --eval Evaluate the FILE arguments as ELisp expressions\n\
@@ -647,6 +640,7 @@ The following OPTIONS are accepted:\n\
647-q, --quiet Don't display messages on success\n\ 640-q, --quiet Don't display messages on success\n\
648-d DISPLAY, --display=DISPLAY\n\ 641-d DISPLAY, --display=DISPLAY\n\
649 Visit the file in the given display\n\ 642 Visit the file in the given display\n\
643", "\
650--parent-id=ID Open in parent window ID, via XEmbed\n" 644--parent-id=ID Open in parent window ID, via XEmbed\n"
651#ifndef NO_SOCKETS_IN_FILE_SYSTEM 645#ifndef NO_SOCKETS_IN_FILE_SYSTEM
652"-s SOCKET, --socket-name=SOCKET\n\ 646"-s SOCKET, --socket-name=SOCKET\n\
@@ -661,7 +655,7 @@ The following OPTIONS are accepted:\n\
661 mode and try connecting again\n" 655 mode and try connecting again\n"
662#endif /* not WINDOWSNT */ 656#endif /* not WINDOWSNT */
663"\n\ 657"\n\
664Report bugs with M-x report-emacs-bug.\n", progname); 658Report bugs with M-x report-emacs-bug.\n");
665 exit (EXIT_SUCCESS); 659 exit (EXIT_SUCCESS);
666} 660}
667 661
@@ -677,7 +671,7 @@ fail (void)
677 int i = optind - 1; 671 int i = optind - 1;
678 672
679 execvp (alternate_editor, main_argv + i); 673 execvp (alternate_editor, main_argv + i);
680 message (TRUE, "%s: error executing alternate editor \"%s\"\n", 674 message (true, "%s: error executing alternate editor \"%s\"\n",
681 progname, alternate_editor); 675 progname, alternate_editor);
682 } 676 }
683 exit (EXIT_FAILURE); 677 exit (EXIT_FAILURE);
@@ -691,7 +685,7 @@ main (int argc, char **argv)
691{ 685{
692 main_argv = argv; 686 main_argv = argv;
693 progname = argv[0]; 687 progname = argv[0];
694 message (TRUE, "%s: Sorry, the Emacs server is supported only\n" 688 message (true, "%s: Sorry, the Emacs server is supported only\n"
695 "on systems with Berkeley sockets.\n", 689 "on systems with Berkeley sockets.\n",
696 argv[0]); 690 argv[0]);
697 fail (); 691 fail ();
@@ -722,11 +716,11 @@ sock_err_message (const char *function_name)
722 | FORMAT_MESSAGE_ARGUMENT_ARRAY, 716 | FORMAT_MESSAGE_ARGUMENT_ARRAY,
723 NULL, WSAGetLastError (), 0, (LPTSTR)&msg, 0, NULL); 717 NULL, WSAGetLastError (), 0, (LPTSTR)&msg, 0, NULL);
724 718
725 message (TRUE, "%s: %s: %s\n", progname, function_name, msg); 719 message (true, "%s: %s: %s\n", progname, function_name, msg);
726 720
727 LocalFree (msg); 721 LocalFree (msg);
728#else 722#else
729 message (TRUE, "%s: %s: %s\n", progname, function_name, strerror (errno)); 723 message (true, "%s: %s: %s\n", progname, function_name, strerror (errno));
730#endif 724#endif
731} 725}
732 726
@@ -757,7 +751,7 @@ send_to_emacs (HSOCKET s, const char *data)
757 int sent = send (s, send_buffer, sblen, 0); 751 int sent = send (s, send_buffer, sblen, 0);
758 if (sent < 0) 752 if (sent < 0)
759 { 753 {
760 message (TRUE, "%s: failed to send %d bytes to socket: %s\n", 754 message (true, "%s: failed to send %d bytes to socket: %s\n",
761 progname, sblen, strerror (errno)); 755 progname, sblen, strerror (errno));
762 fail (); 756 fail ();
763 } 757 }
@@ -852,25 +846,25 @@ static int
852file_name_absolute_p (const char *filename) 846file_name_absolute_p (const char *filename)
853{ 847{
854 /* Sanity check, it shouldn't happen. */ 848 /* Sanity check, it shouldn't happen. */
855 if (! filename) return FALSE; 849 if (! filename) return false;
856 850
857 /* /xxx is always an absolute path. */ 851 /* /xxx is always an absolute path. */
858 if (filename[0] == '/') return TRUE; 852 if (filename[0] == '/') return true;
859 853
860 /* Empty filenames (which shouldn't happen) are relative. */ 854 /* Empty filenames (which shouldn't happen) are relative. */
861 if (filename[0] == '\0') return FALSE; 855 if (filename[0] == '\0') return false;
862 856
863#ifdef WINDOWSNT 857#ifdef WINDOWSNT
864 /* X:\xxx is always absolute. */ 858 /* X:\xxx is always absolute. */
865 if (isalpha ((unsigned char) filename[0]) 859 if (isalpha ((unsigned char) filename[0])
866 && filename[1] == ':' && (filename[2] == '\\' || filename[2] == '/')) 860 && filename[1] == ':' && (filename[2] == '\\' || filename[2] == '/'))
867 return TRUE; 861 return true;
868 862
869 /* Both \xxx and \\xxx\yyy are absolute. */ 863 /* Both \xxx and \\xxx\yyy are absolute. */
870 if (filename[0] == '\\') return TRUE; 864 if (filename[0] == '\\') return true;
871#endif 865#endif
872 866
873 return FALSE; 867 return false;
874} 868}
875 869
876#ifdef WINDOWSNT 870#ifdef WINDOWSNT
@@ -889,7 +883,7 @@ initialize_sockets (void)
889 883
890 if (WSAStartup (MAKEWORD (2, 0), &wsaData)) 884 if (WSAStartup (MAKEWORD (2, 0), &wsaData))
891 { 885 {
892 message (TRUE, "%s: error initializing WinSock2\n", progname); 886 message (true, "%s: error initializing WinSock2\n", progname);
893 exit (EXIT_FAILURE); 887 exit (EXIT_FAILURE);
894 } 888 }
895 889
@@ -940,14 +934,14 @@ get_server_config (const char *config_file, struct sockaddr_in *server,
940 } 934 }
941 935
942 if (! config) 936 if (! config)
943 return FALSE; 937 return false;
944 938
945 if (fgets (dotted, sizeof dotted, config) 939 if (fgets (dotted, sizeof dotted, config)
946 && (port = strchr (dotted, ':'))) 940 && (port = strchr (dotted, ':')))
947 *port++ = '\0'; 941 *port++ = '\0';
948 else 942 else
949 { 943 {
950 message (TRUE, "%s: invalid configuration info\n", progname); 944 message (true, "%s: invalid configuration info\n", progname);
951 exit (EXIT_FAILURE); 945 exit (EXIT_FAILURE);
952 } 946 }
953 947
@@ -957,13 +951,13 @@ get_server_config (const char *config_file, struct sockaddr_in *server,
957 951
958 if (! fread (authentication, AUTH_KEY_LENGTH, 1, config)) 952 if (! fread (authentication, AUTH_KEY_LENGTH, 1, config))
959 { 953 {
960 message (TRUE, "%s: cannot read authentication info\n", progname); 954 message (true, "%s: cannot read authentication info\n", progname);
961 exit (EXIT_FAILURE); 955 exit (EXIT_FAILURE);
962 } 956 }
963 957
964 fclose (config); 958 fclose (config);
965 959
966 return TRUE; 960 return true;
967} 961}
968 962
969static HSOCKET 963static HSOCKET
@@ -978,7 +972,7 @@ set_tcp_socket (const char *local_server_file)
978 return INVALID_SOCKET; 972 return INVALID_SOCKET;
979 973
980 if (server.sin_addr.s_addr != inet_addr ("127.0.0.1") && !quiet) 974 if (server.sin_addr.s_addr != inet_addr ("127.0.0.1") && !quiet)
981 message (FALSE, "%s: connected to remote socket at %s\n", 975 message (false, "%s: connected to remote socket at %s\n",
982 progname, inet_ntoa (server.sin_addr)); 976 progname, inet_ntoa (server.sin_addr));
983 977
984 /* Open up an AF_INET socket. */ 978 /* Open up an AF_INET socket. */
@@ -1031,7 +1025,7 @@ find_tty (const char **tty_type, const char **tty_name, int noabort)
1031 return 0; 1025 return 0;
1032 else 1026 else
1033 { 1027 {
1034 message (TRUE, "%s: could not get terminal name\n", progname); 1028 message (true, "%s: could not get terminal name\n", progname);
1035 fail (); 1029 fail ();
1036 } 1030 }
1037 } 1031 }
@@ -1042,7 +1036,7 @@ find_tty (const char **tty_type, const char **tty_name, int noabort)
1042 return 0; 1036 return 0;
1043 else 1037 else
1044 { 1038 {
1045 message (TRUE, "%s: please set the TERM variable to your terminal type\n", 1039 message (true, "%s: please set the TERM variable to your terminal type\n",
1046 progname); 1040 progname);
1047 fail (); 1041 fail ();
1048 } 1042 }
@@ -1055,7 +1049,7 @@ find_tty (const char **tty_type, const char **tty_name, int noabort)
1055 else 1049 else
1056 { 1050 {
1057 /* This causes nasty, MULTI_KBOARD-related input lockouts. */ 1051 /* This causes nasty, MULTI_KBOARD-related input lockouts. */
1058 message (TRUE, "%s: opening a frame in an Emacs term buffer" 1052 message (true, "%s: opening a frame in an Emacs term buffer"
1059 " is not supported\n", progname); 1053 " is not supported\n", progname);
1060 fail (); 1054 fail ();
1061 } 1055 }
@@ -1186,7 +1180,7 @@ set_local_socket (const char *local_socket_name)
1186 /* Open up an AF_UNIX socket in this person's home directory. */ 1180 /* Open up an AF_UNIX socket in this person's home directory. */
1187 if ((s = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) 1181 if ((s = socket (AF_UNIX, SOCK_STREAM, 0)) < 0)
1188 { 1182 {
1189 message (TRUE, "%s: socket: %s\n", progname, strerror (errno)); 1183 message (true, "%s: socket: %s\n", progname, strerror (errno));
1190 return INVALID_SOCKET; 1184 return INVALID_SOCKET;
1191 } 1185 }
1192 1186
@@ -1237,7 +1231,7 @@ set_local_socket (const char *local_socket_name)
1237 strcpy (server.sun_path, local_socket_name); 1231 strcpy (server.sun_path, local_socket_name);
1238 else 1232 else
1239 { 1233 {
1240 message (TRUE, "%s: socket-name %s too long\n", 1234 message (true, "%s: socket-name %s too long\n",
1241 progname, local_socket_name); 1235 progname, local_socket_name);
1242 fail (); 1236 fail ();
1243 } 1237 }
@@ -1276,7 +1270,7 @@ set_local_socket (const char *local_socket_name)
1276 strcpy (server.sun_path, user_socket_name); 1270 strcpy (server.sun_path, user_socket_name);
1277 else 1271 else
1278 { 1272 {
1279 message (TRUE, "%s: socket-name %s too long\n", 1273 message (true, "%s: socket-name %s too long\n",
1280 progname, user_socket_name); 1274 progname, user_socket_name);
1281 exit (EXIT_FAILURE); 1275 exit (EXIT_FAILURE);
1282 } 1276 }
@@ -1300,7 +1294,7 @@ set_local_socket (const char *local_socket_name)
1300 we are root. */ 1294 we are root. */
1301 if (0 != geteuid ()) 1295 if (0 != geteuid ())
1302 { 1296 {
1303 message (TRUE, "%s: Invalid socket owner\n", progname); 1297 message (true, "%s: Invalid socket owner\n", progname);
1304 return INVALID_SOCKET; 1298 return INVALID_SOCKET;
1305 } 1299 }
1306 break; 1300 break;
@@ -1308,12 +1302,12 @@ set_local_socket (const char *local_socket_name)
1308 case 2: 1302 case 2:
1309 /* `stat' failed */ 1303 /* `stat' failed */
1310 if (saved_errno == ENOENT) 1304 if (saved_errno == ENOENT)
1311 message (TRUE, 1305 message (true,
1312 "%s: can't find socket; have you started the server?\n\ 1306 "%s: can't find socket; have you started the server?\n\
1313To start the server in Emacs, type \"M-x server-start\".\n", 1307To start the server in Emacs, type \"M-x server-start\".\n",
1314 progname); 1308 progname);
1315 else 1309 else
1316 message (TRUE, "%s: can't stat %s: %s\n", 1310 message (true, "%s: can't stat %s: %s\n",
1317 progname, server.sun_path, strerror (saved_errno)); 1311 progname, server.sun_path, strerror (saved_errno));
1318 return INVALID_SOCKET; 1312 return INVALID_SOCKET;
1319 } 1313 }
@@ -1322,7 +1316,7 @@ To start the server in Emacs, type \"M-x server-start\".\n",
1322 if (connect (s, (struct sockaddr *) &server, strlen (server.sun_path) + 2) 1316 if (connect (s, (struct sockaddr *) &server, strlen (server.sun_path) + 2)
1323 < 0) 1317 < 0)
1324 { 1318 {
1325 message (TRUE, "%s: connect: %s\n", progname, strerror (errno)); 1319 message (true, "%s: connect: %s\n", progname, strerror (errno));
1326 return INVALID_SOCKET; 1320 return INVALID_SOCKET;
1327 } 1321 }
1328 1322
@@ -1345,7 +1339,7 @@ set_socket (int no_exit_if_error)
1345 s = set_local_socket (socket_name); 1339 s = set_local_socket (socket_name);
1346 if ((s != INVALID_SOCKET) || no_exit_if_error) 1340 if ((s != INVALID_SOCKET) || no_exit_if_error)
1347 return s; 1341 return s;
1348 message (TRUE, "%s: error accessing socket \"%s\"\n", 1342 message (true, "%s: error accessing socket \"%s\"\n",
1349 progname, socket_name); 1343 progname, socket_name);
1350 exit (EXIT_FAILURE); 1344 exit (EXIT_FAILURE);
1351 } 1345 }
@@ -1361,7 +1355,7 @@ set_socket (int no_exit_if_error)
1361 if ((s != INVALID_SOCKET) || no_exit_if_error) 1355 if ((s != INVALID_SOCKET) || no_exit_if_error)
1362 return s; 1356 return s;
1363 1357
1364 message (TRUE, "%s: error accessing server file \"%s\"\n", 1358 message (true, "%s: error accessing server file \"%s\"\n",
1365 progname, local_server_file); 1359 progname, local_server_file);
1366 exit (EXIT_FAILURE); 1360 exit (EXIT_FAILURE);
1367 } 1361 }
@@ -1379,7 +1373,7 @@ set_socket (int no_exit_if_error)
1379 return s; 1373 return s;
1380 1374
1381 /* No implicit or explicit socket, and no alternate editor. */ 1375 /* No implicit or explicit socket, and no alternate editor. */
1382 message (TRUE, "%s: No socket or alternate editor. Please use:\n\n" 1376 message (true, "%s: No socket or alternate editor. Please use:\n\n"
1383#ifndef NO_SOCKETS_IN_FILE_SYSTEM 1377#ifndef NO_SOCKETS_IN_FILE_SYSTEM
1384"\t--socket-name\n" 1378"\t--socket-name\n"
1385#endif 1379#endif
@@ -1488,15 +1482,15 @@ start_daemon_and_retry_set_socket (void)
1488 1482
1489 if ((w == -1) || !WIFEXITED (status) || WEXITSTATUS (status)) 1483 if ((w == -1) || !WIFEXITED (status) || WEXITSTATUS (status))
1490 { 1484 {
1491 message (TRUE, "Error: Could not start the Emacs daemon\n"); 1485 message (true, "Error: Could not start the Emacs daemon\n");
1492 exit (EXIT_FAILURE); 1486 exit (EXIT_FAILURE);
1493 } 1487 }
1494 1488
1495 /* Try connecting, the daemon should have started by now. */ 1489 /* Try connecting, the daemon should have started by now. */
1496 message (TRUE, "Emacs daemon should have started, trying to connect again\n"); 1490 message (true, "Emacs daemon should have started, trying to connect again\n");
1497 if ((emacs_socket = set_socket (1)) == INVALID_SOCKET) 1491 if ((emacs_socket = set_socket (1)) == INVALID_SOCKET)
1498 { 1492 {
1499 message (TRUE, "Error: Cannot connect even after starting the Emacs daemon\n"); 1493 message (true, "Error: Cannot connect even after starting the Emacs daemon\n");
1500 exit (EXIT_FAILURE); 1494 exit (EXIT_FAILURE);
1501 } 1495 }
1502 } 1496 }
@@ -1509,7 +1503,10 @@ start_daemon_and_retry_set_socket (void)
1509 { 1503 {
1510 char emacs[] = "emacs"; 1504 char emacs[] = "emacs";
1511 char daemon_option[] = "--daemon"; 1505 char daemon_option[] = "--daemon";
1512 char *d_argv[] = {emacs, daemon_option, 0 }; 1506 char *d_argv[3];
1507 d_argv[0] = emacs;
1508 d_argv[1] = daemon_option;
1509 d_argv[2] = 0;
1513 if (socket_name != NULL) 1510 if (socket_name != NULL)
1514 { 1511 {
1515 /* Pass --daemon=socket_name as argument. */ 1512 /* Pass --daemon=socket_name as argument. */
@@ -1521,7 +1518,7 @@ start_daemon_and_retry_set_socket (void)
1521 d_argv[1] = daemon_arg; 1518 d_argv[1] = daemon_arg;
1522 } 1519 }
1523 execvp ("emacs", d_argv); 1520 execvp ("emacs", d_argv);
1524 message (TRUE, "%s: error starting emacs daemon\n", progname); 1521 message (true, "%s: error starting emacs daemon\n", progname);
1525 } 1522 }
1526#endif /* WINDOWSNT */ 1523#endif /* WINDOWSNT */
1527} 1524}
@@ -1551,7 +1548,7 @@ main (int argc, char **argv)
1551 1548
1552 if ((argc - optind < 1) && !eval && current_frame) 1549 if ((argc - optind < 1) && !eval && current_frame)
1553 { 1550 {
1554 message (TRUE, "%s: file name or argument required\n" 1551 message (true, "%s: file name or argument required\n"
1555 "Try `%s --help' for more information\n", 1552 "Try `%s --help' for more information\n",
1556 progname, progname); 1553 progname, progname);
1557 exit (EXIT_FAILURE); 1554 exit (EXIT_FAILURE);
@@ -1574,7 +1571,7 @@ main (int argc, char **argv)
1574 cwd = get_current_dir_name (); 1571 cwd = get_current_dir_name ();
1575 if (cwd == 0) 1572 if (cwd == 0)
1576 { 1573 {
1577 message (TRUE, "%s: %s\n", progname, 1574 message (true, "%s: %s\n", progname,
1578 "Cannot get current working directory"); 1575 "Cannot get current working directory");
1579 fail (); 1576 fail ();
1580 } 1577 }
@@ -1724,7 +1721,8 @@ main (int argc, char **argv)
1724 needlf = 2; 1721 needlf = 2;
1725 } 1722 }
1726 fflush (stdout); 1723 fflush (stdout);
1727 fsync (1); 1724 while (fdatasync (1) != 0 && errno == EINTR)
1725 continue;
1728 1726
1729 /* Now, wait for an answer and print any messages. */ 1727 /* Now, wait for an answer and print any messages. */
1730 while (exit_status == EXIT_SUCCESS) 1728 while (exit_status == EXIT_SUCCESS)
@@ -1825,7 +1823,8 @@ main (int argc, char **argv)
1825 if (needlf) 1823 if (needlf)
1826 printf ("\n"); 1824 printf ("\n");
1827 fflush (stdout); 1825 fflush (stdout);
1828 fsync (1); 1826 while (fdatasync (1) != 0 && errno == EINTR)
1827 continue;
1829 1828
1830 if (rl < 0) 1829 if (rl < 0)
1831 exit_status = EXIT_FAILURE; 1830 exit_status = EXIT_FAILURE;
diff --git a/lib-src/etags.c b/lib-src/etags.c
index ec96f45fc94..66e7fbb467f 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -1,4 +1,4 @@
1/* Tags file maker to go with GNU Emacs -*- coding: latin-1 -*- 1/* Tags file maker to go with GNU Emacs -*- coding: utf-8 -*-
2 2
3Copyright (C) 1984 The Regents of the University of California 3Copyright (C) 1984 The Regents of the University of California
4 4
@@ -28,7 +28,7 @@ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
28IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 29
30 30
31Copyright (C) 1984, 1987-1989, 1993-1995, 1998-2013 Free Software 31Copyright (C) 1984, 1987-1989, 1993-1995, 1998-2014 Free Software
32Foundation, Inc. 32Foundation, Inc.
33 33
34This file is not considered part of GNU Emacs. 34This file is not considered part of GNU Emacs.
@@ -64,12 +64,12 @@ University of California, as described above. */
64 * 1985 Emacs TAGS format by Richard Stallman. 64 * 1985 Emacs TAGS format by Richard Stallman.
65 * 1989 Sam Kendall added C++. 65 * 1989 Sam Kendall added C++.
66 * 1992 Joseph B. Wells improved C and C++ parsing. 66 * 1992 Joseph B. Wells improved C and C++ parsing.
67 * 1993 Francesco Potortì reorganized C and C++. 67 * 1993 Francesco Potortì reorganized C and C++.
68 * 1994 Line-by-line regexp tags by Tom Tromey. 68 * 1994 Line-by-line regexp tags by Tom Tromey.
69 * 2001 Nested classes by Francesco Potortì (concept by Mykola Dzyuba). 69 * 2001 Nested classes by Francesco Potortì (concept by Mykola Dzyuba).
70 * 2002 #line directives by Francesco Potortì. 70 * 2002 #line directives by Francesco Potortì.
71 * 71 *
72 * Francesco Potortì <pot@gnu.org> has maintained and improved it since 1993. 72 * Francesco Potortì <pot@gnu.org> has maintained and improved it since 1993.
73 */ 73 */
74 74
75/* 75/*
@@ -80,14 +80,11 @@ University of California, as described above. */
80 80
81char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; 81char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4";
82 82
83#define TRUE 1
84#define FALSE 0
85
86#ifdef DEBUG 83#ifdef DEBUG
87# undef DEBUG 84# undef DEBUG
88# define DEBUG TRUE 85# define DEBUG true
89#else 86#else
90# define DEBUG FALSE 87# define DEBUG false
91# define NDEBUG /* disable assert */ 88# define NDEBUG /* disable assert */
92#endif 89#endif
93 90
@@ -107,12 +104,12 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4";
107 104
108#ifdef MSDOS 105#ifdef MSDOS
109# undef MSDOS 106# undef MSDOS
110# define MSDOS TRUE 107# define MSDOS true
111# include <fcntl.h> 108# include <fcntl.h>
112# include <sys/param.h> 109# include <sys/param.h>
113# include <io.h> 110# include <io.h>
114#else 111#else
115# define MSDOS FALSE 112# define MSDOS false
116#endif /* MSDOS */ 113#endif /* MSDOS */
117 114
118#ifdef WINDOWSNT 115#ifdef WINDOWSNT
@@ -150,9 +147,9 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4";
150 tag tables and tags typedefs, #defines and struct/union/enum by default. */ 147 tag tables and tags typedefs, #defines and struct/union/enum by default. */
151#ifdef CTAGS 148#ifdef CTAGS
152# undef CTAGS 149# undef CTAGS
153# define CTAGS TRUE 150# define CTAGS true
154#else 151#else
155# define CTAGS FALSE 152# define CTAGS false
156#endif 153#endif
157 154
158#define streq(s,t) (assert ((s)!=NULL || (t)!=NULL), !strcmp (s, t)) 155#define streq(s,t) (assert ((s)!=NULL || (t)!=NULL), !strcmp (s, t))
@@ -194,8 +191,6 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4";
194 (char *) (op), (n) * sizeof (Type))) 191 (char *) (op), (n) * sizeof (Type)))
195#endif 192#endif
196 193
197#define bool int
198
199typedef void Lang_function (FILE *); 194typedef void Lang_function (FILE *);
200 195
201typedef struct 196typedef struct
@@ -316,15 +311,7 @@ static void Texinfo_nodes (FILE *);
316static void Yacc_entries (FILE *); 311static void Yacc_entries (FILE *);
317static void just_read_file (FILE *); 312static void just_read_file (FILE *);
318 313
319static void print_language_names (void);
320static void print_version (void);
321static void print_help (argument *);
322int main (int, char **);
323
324static compressor *get_compressor_from_suffix (char *, char **);
325static language *get_language_from_langname (const char *); 314static language *get_language_from_langname (const char *);
326static language *get_language_from_interpreter (char *);
327static language *get_language_from_filename (char *, bool);
328static void readline (linebuffer *, FILE *); 315static void readline (linebuffer *, FILE *);
329static long readline_internal (linebuffer *, FILE *); 316static long readline_internal (linebuffer *, FILE *);
330static bool nocase_tail (const char *); 317static bool nocase_tail (const char *);
@@ -346,7 +333,6 @@ static void find_entries (FILE *);
346static void free_tree (node *); 333static void free_tree (node *);
347static void free_fdesc (fdesc *); 334static void free_fdesc (fdesc *);
348static void pfnote (char *, bool, char *, int, int, long); 335static void pfnote (char *, bool, char *, int, int, long);
349static void make_tag (const char *, int, bool, char *, int, int, long);
350static void invalidate_nodes (fdesc *, node **); 336static void invalidate_nodes (fdesc *, node **);
351static void put_entries (node *); 337static void put_entries (node *);
352 338
@@ -410,7 +396,7 @@ static const char
410 *midtk = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz$0123456789"; 396 *midtk = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz$0123456789";
411 397
412static bool append_to_tagfile; /* -a: append to tags */ 398static bool append_to_tagfile; /* -a: append to tags */
413/* The next five default to TRUE in C and derived languages. */ 399/* The next five default to true in C and derived languages. */
414static bool typedefs; /* -t: create tags for C and Ada typedefs */ 400static bool typedefs; /* -t: create tags for C and Ada typedefs */
415static bool typedefs_or_cplusplus; /* -T: create tags for C typedefs, level */ 401static bool typedefs_or_cplusplus; /* -T: create tags for C typedefs, level */
416 /* 0 struct/enum/union decls, and C++ */ 402 /* 0 struct/enum/union decls, and C++ */
@@ -418,18 +404,18 @@ static bool typedefs_or_cplusplus; /* -T: create tags for C typedefs, level */
418static bool constantypedefs; /* -d: create tags for C #define, enum */ 404static bool constantypedefs; /* -d: create tags for C #define, enum */
419 /* constants and variables. */ 405 /* constants and variables. */
420 /* -D: opposite of -d. Default under ctags. */ 406 /* -D: opposite of -d. Default under ctags. */
421static bool globals; /* create tags for global variables */ 407static int globals; /* create tags for global variables */
422static bool members; /* create tags for C member variables */ 408static int members; /* create tags for C member variables */
423static bool declarations; /* --declarations: tag them and extern in C&Co*/ 409static int declarations; /* --declarations: tag them and extern in C&Co*/
424static bool no_line_directive; /* ignore #line directives (undocumented) */ 410static int no_line_directive; /* ignore #line directives (undocumented) */
425static bool no_duplicates; /* no duplicate tags for ctags (undocumented) */ 411static int no_duplicates; /* no duplicate tags for ctags (undocumented) */
426static bool update; /* -u: update tags */ 412static bool update; /* -u: update tags */
427static bool vgrind_style; /* -v: create vgrind style index output */ 413static bool vgrind_style; /* -v: create vgrind style index output */
428static bool no_warnings; /* -w: suppress warnings (undocumented) */ 414static bool no_warnings; /* -w: suppress warnings (undocumented) */
429static bool cxref_style; /* -x: create cxref style output */ 415static bool cxref_style; /* -x: create cxref style output */
430static bool cplusplus; /* .[hc] means C++, not C (undocumented) */ 416static bool cplusplus; /* .[hc] means C++, not C (undocumented) */
431static bool ignoreindent; /* -I: ignore indentation in C */ 417static bool ignoreindent; /* -I: ignore indentation in C */
432static bool packages_only; /* --packages-only: in Ada, only tag packages*/ 418static int packages_only; /* --packages-only: in Ada, only tag packages*/
433 419
434/* STDIN is defined in LynxOS system headers */ 420/* STDIN is defined in LynxOS system headers */
435#ifdef STDIN 421#ifdef STDIN
@@ -445,17 +431,17 @@ static bool need_filebuf; /* some regexes are multi-line */
445static struct option longopts[] = 431static struct option longopts[] =
446{ 432{
447 { "append", no_argument, NULL, 'a' }, 433 { "append", no_argument, NULL, 'a' },
448 { "packages-only", no_argument, &packages_only, TRUE }, 434 { "packages-only", no_argument, &packages_only, 1 },
449 { "c++", no_argument, NULL, 'C' }, 435 { "c++", no_argument, NULL, 'C' },
450 { "declarations", no_argument, &declarations, TRUE }, 436 { "declarations", no_argument, &declarations, 1 },
451 { "no-line-directive", no_argument, &no_line_directive, TRUE }, 437 { "no-line-directive", no_argument, &no_line_directive, 1 },
452 { "no-duplicates", no_argument, &no_duplicates, TRUE }, 438 { "no-duplicates", no_argument, &no_duplicates, 1 },
453 { "help", no_argument, NULL, 'h' }, 439 { "help", no_argument, NULL, 'h' },
454 { "help", no_argument, NULL, 'H' }, 440 { "help", no_argument, NULL, 'H' },
455 { "ignore-indentation", no_argument, NULL, 'I' }, 441 { "ignore-indentation", no_argument, NULL, 'I' },
456 { "language", required_argument, NULL, 'l' }, 442 { "language", required_argument, NULL, 'l' },
457 { "members", no_argument, &members, TRUE }, 443 { "members", no_argument, &members, 1 },
458 { "no-members", no_argument, &members, FALSE }, 444 { "no-members", no_argument, &members, 0 },
459 { "output", required_argument, NULL, 'o' }, 445 { "output", required_argument, NULL, 'o' },
460 { "regex", required_argument, NULL, 'r' }, 446 { "regex", required_argument, NULL, 'r' },
461 { "no-regex", no_argument, NULL, 'R' }, 447 { "no-regex", no_argument, NULL, 'R' },
@@ -467,7 +453,7 @@ static struct option longopts[] =
467 { "backward-search", no_argument, NULL, 'B' }, 453 { "backward-search", no_argument, NULL, 'B' },
468 { "cxref", no_argument, NULL, 'x' }, 454 { "cxref", no_argument, NULL, 'x' },
469 { "defines", no_argument, NULL, 'd' }, 455 { "defines", no_argument, NULL, 'd' },
470 { "globals", no_argument, &globals, TRUE }, 456 { "globals", no_argument, &globals, 1 },
471 { "typedefs", no_argument, NULL, 't' }, 457 { "typedefs", no_argument, NULL, 't' },
472 { "typedefs-and-c++", no_argument, NULL, 'T' }, 458 { "typedefs-and-c++", no_argument, NULL, 'T' },
473 { "update", no_argument, NULL, 'u' }, 459 { "update", no_argument, NULL, 'u' },
@@ -476,7 +462,7 @@ static struct option longopts[] =
476 462
477#else /* Etags options */ 463#else /* Etags options */
478 { "no-defines", no_argument, NULL, 'D' }, 464 { "no-defines", no_argument, NULL, 'D' },
479 { "no-globals", no_argument, &globals, FALSE }, 465 { "no-globals", no_argument, &globals, 0 },
480 { "include", required_argument, NULL, 'i' }, 466 { "include", required_argument, NULL, 'i' },
481#endif 467#endif
482 { NULL } 468 { NULL }
@@ -770,7 +756,7 @@ static language lang_names [] =
770 { "scheme", Scheme_help, Scheme_functions, Scheme_suffixes }, 756 { "scheme", Scheme_help, Scheme_functions, Scheme_suffixes },
771 { "tex", TeX_help, TeX_commands, TeX_suffixes }, 757 { "tex", TeX_help, TeX_commands, TeX_suffixes },
772 { "texinfo", Texinfo_help, Texinfo_nodes, Texinfo_suffixes }, 758 { "texinfo", Texinfo_help, Texinfo_nodes, Texinfo_suffixes },
773 { "yacc", Yacc_help,Yacc_entries,Yacc_suffixes,NULL,NULL,TRUE}, 759 { "yacc", Yacc_help,Yacc_entries,Yacc_suffixes,NULL,NULL,true},
774 { "auto", auto_help }, /* default guessing scheme */ 760 { "auto", auto_help }, /* default guessing scheme */
775 { "none", none_help, just_read_file }, /* regexp matching only */ 761 { "none", none_help, just_read_file }, /* regexp matching only */
776 { NULL } /* end of list */ 762 { NULL } /* end of list */
@@ -816,7 +802,7 @@ etags --help --lang=ada.");
816#ifndef VERSION 802#ifndef VERSION
817# define VERSION "17.38.1.4" 803# define VERSION "17.38.1.4"
818#endif 804#endif
819static void 805static _Noreturn void
820print_version (void) 806print_version (void)
821{ 807{
822 char emacs_copyright[] = COPYRIGHT; 808 char emacs_copyright[] = COPYRIGHT;
@@ -829,13 +815,13 @@ print_version (void)
829} 815}
830 816
831#ifndef PRINT_UNDOCUMENTED_OPTIONS_HELP 817#ifndef PRINT_UNDOCUMENTED_OPTIONS_HELP
832# define PRINT_UNDOCUMENTED_OPTIONS_HELP FALSE 818# define PRINT_UNDOCUMENTED_OPTIONS_HELP false
833#endif 819#endif
834 820
835static void 821static _Noreturn void
836print_help (argument *argbuffer) 822print_help (argument *argbuffer)
837{ 823{
838 bool help_for_lang = FALSE; 824 bool help_for_lang = false;
839 825
840 for (; argbuffer->arg_type != at_end; argbuffer++) 826 for (; argbuffer->arg_type != at_end; argbuffer++)
841 if (argbuffer->arg_type == at_language) 827 if (argbuffer->arg_type == at_language)
@@ -843,7 +829,7 @@ print_help (argument *argbuffer)
843 if (help_for_lang) 829 if (help_for_lang)
844 puts (""); 830 puts ("");
845 puts (argbuffer->lang->help); 831 puts (argbuffer->lang->help);
846 help_for_lang = TRUE; 832 help_for_lang = true;
847 } 833 }
848 834
849 if (help_for_lang) 835 if (help_for_lang)
@@ -1014,7 +1000,7 @@ main (int argc, char **argv)
1014 argument *argbuffer; 1000 argument *argbuffer;
1015 int current_arg, file_count; 1001 int current_arg, file_count;
1016 linebuffer filename_lb; 1002 linebuffer filename_lb;
1017 bool help_asked = FALSE; 1003 bool help_asked = false;
1018 ptrdiff_t len; 1004 ptrdiff_t len;
1019 char *optstring; 1005 char *optstring;
1020 int opt; 1006 int opt;
@@ -1039,8 +1025,8 @@ main (int argc, char **argv)
1039 * Also default to find macro constants, enum constants, struct 1025 * Also default to find macro constants, enum constants, struct
1040 * members and global variables. Do it for both etags and ctags. 1026 * members and global variables. Do it for both etags and ctags.
1041 */ 1027 */
1042 typedefs = typedefs_or_cplusplus = constantypedefs = TRUE; 1028 typedefs = typedefs_or_cplusplus = constantypedefs = true;
1043 globals = members = TRUE; 1029 globals = members = true;
1044 1030
1045 /* When the optstring begins with a '-' getopt_long does not rearrange the 1031 /* When the optstring begins with a '-' getopt_long does not rearrange the
1046 non-options arguments to be at the end, but leaves them alone. */ 1032 non-options arguments to be at the end, but leaves them alone. */
@@ -1078,12 +1064,12 @@ main (int argc, char **argv)
1078 ++file_count; 1064 ++file_count;
1079 if (parsing_stdin) 1065 if (parsing_stdin)
1080 fatal ("cannot parse standard input more than once", (char *)NULL); 1066 fatal ("cannot parse standard input more than once", (char *)NULL);
1081 parsing_stdin = TRUE; 1067 parsing_stdin = true;
1082 break; 1068 break;
1083 1069
1084 /* Common options. */ 1070 /* Common options. */
1085 case 'a': append_to_tagfile = TRUE; break; 1071 case 'a': append_to_tagfile = true; break;
1086 case 'C': cplusplus = TRUE; break; 1072 case 'C': cplusplus = true; break;
1087 case 'f': /* for compatibility with old makefiles */ 1073 case 'f': /* for compatibility with old makefiles */
1088 case 'o': 1074 case 'o':
1089 if (tagfile) 1075 if (tagfile)
@@ -1096,7 +1082,7 @@ main (int argc, char **argv)
1096 break; 1082 break;
1097 case 'I': 1083 case 'I':
1098 case 'S': /* for backward compatibility */ 1084 case 'S': /* for backward compatibility */
1099 ignoreindent = TRUE; 1085 ignoreindent = true;
1100 break; 1086 break;
1101 case 'l': 1087 case 'l':
1102 { 1088 {
@@ -1131,22 +1117,22 @@ main (int argc, char **argv)
1131 break; 1117 break;
1132 case 'h': 1118 case 'h':
1133 case 'H': 1119 case 'H':
1134 help_asked = TRUE; 1120 help_asked = true;
1135 break; 1121 break;
1136 1122
1137 /* Etags options */ 1123 /* Etags options */
1138 case 'D': constantypedefs = FALSE; break; 1124 case 'D': constantypedefs = false; break;
1139 case 'i': included_files[nincluded_files++] = optarg; break; 1125 case 'i': included_files[nincluded_files++] = optarg; break;
1140 1126
1141 /* Ctags options. */ 1127 /* Ctags options. */
1142 case 'B': searchar = '?'; break; 1128 case 'B': searchar = '?'; break;
1143 case 'd': constantypedefs = TRUE; break; 1129 case 'd': constantypedefs = true; break;
1144 case 't': typedefs = TRUE; break; 1130 case 't': typedefs = true; break;
1145 case 'T': typedefs = typedefs_or_cplusplus = TRUE; break; 1131 case 'T': typedefs = typedefs_or_cplusplus = true; break;
1146 case 'u': update = TRUE; break; 1132 case 'u': update = true; break;
1147 case 'v': vgrind_style = TRUE; /*FALLTHRU*/ 1133 case 'v': vgrind_style = true; /*FALLTHRU*/
1148 case 'x': cxref_style = TRUE; break; 1134 case 'x': cxref_style = true; break;
1149 case 'w': no_warnings = TRUE; break; 1135 case 'w': no_warnings = true; break;
1150 default: 1136 default:
1151 suggest_asking_for_help (); 1137 suggest_asking_for_help ();
1152 /* NOTREACHED */ 1138 /* NOTREACHED */
@@ -1317,7 +1303,7 @@ main (int argc, char **argv)
1317 fatal ("failed to execute shell command", (char *)NULL); 1303 fatal ("failed to execute shell command", (char *)NULL);
1318 } 1304 }
1319 free (cmd); 1305 free (cmd);
1320 append_to_tagfile = TRUE; 1306 append_to_tagfile = true;
1321 } 1307 }
1322 1308
1323 tagf = fopen (tagfile, append_to_tagfile ? "a" : "w"); 1309 tagf = fopen (tagfile, append_to_tagfile ? "a" : "w");
@@ -1614,9 +1600,9 @@ process_file (FILE *fh, char *fn, language *lang)
1614 to the directory of the tags file. */ 1600 to the directory of the tags file. */
1615 fdp->taggedfname = relative_filename (fn, tagfiledir); 1601 fdp->taggedfname = relative_filename (fn, tagfiledir);
1616 } 1602 }
1617 fdp->usecharno = TRUE; /* use char position when making tags */ 1603 fdp->usecharno = true; /* use char position when making tags */
1618 fdp->prop = NULL; 1604 fdp->prop = NULL;
1619 fdp->written = FALSE; /* not written on tags file yet */ 1605 fdp->written = false; /* not written on tags file yet */
1620 1606
1621 fdhead = fdp; 1607 fdhead = fdp;
1622 curfdp = fdhead; /* the current file description */ 1608 curfdp = fdhead; /* the current file description */
@@ -1662,26 +1648,27 @@ process_file (FILE *fh, char *fn, language *lang)
1662 * This routine sets up the boolean pseudo-functions which work 1648 * This routine sets up the boolean pseudo-functions which work
1663 * by setting boolean flags dependent upon the corresponding character. 1649 * by setting boolean flags dependent upon the corresponding character.
1664 * Every char which is NOT in that string is not a white char. Therefore, 1650 * Every char which is NOT in that string is not a white char. Therefore,
1665 * all of the array "_wht" is set to FALSE, and then the elements 1651 * all of the array "_wht" is set to false, and then the elements
1666 * subscripted by the chars in "white" are set to TRUE. Thus "_wht" 1652 * subscripted by the chars in "white" are set to true. Thus "_wht"
1667 * of a char is TRUE if it is the string "white", else FALSE. 1653 * of a char is true if it is the string "white", else false.
1668 */ 1654 */
1669static void 1655static void
1670init (void) 1656init (void)
1671{ 1657{
1672 register const char *sp; 1658 const char *sp;
1673 register int i; 1659 int i;
1674 1660
1675 for (i = 0; i < CHARS; i++) 1661 for (i = 0; i < CHARS; i++)
1676 iswhite (i) = notinname (i) = begtoken (i) = intoken (i) = endtoken (i) = FALSE; 1662 iswhite (i) = notinname (i) = begtoken (i) = intoken (i) = endtoken (i)
1677 for (sp = white; *sp != '\0'; sp++) iswhite (*sp) = TRUE; 1663 = false;
1678 for (sp = nonam; *sp != '\0'; sp++) notinname (*sp) = TRUE; 1664 for (sp = white; *sp != '\0'; sp++) iswhite (*sp) = true;
1665 for (sp = nonam; *sp != '\0'; sp++) notinname (*sp) = true;
1679 notinname ('\0') = notinname ('\n'); 1666 notinname ('\0') = notinname ('\n');
1680 for (sp = begtk; *sp != '\0'; sp++) begtoken (*sp) = TRUE; 1667 for (sp = begtk; *sp != '\0'; sp++) begtoken (*sp) = true;
1681 begtoken ('\0') = begtoken ('\n'); 1668 begtoken ('\0') = begtoken ('\n');
1682 for (sp = midtk; *sp != '\0'; sp++) intoken (*sp) = TRUE; 1669 for (sp = midtk; *sp != '\0'; sp++) intoken (*sp) = true;
1683 intoken ('\0') = intoken ('\n'); 1670 intoken ('\0') = intoken ('\n');
1684 for (sp = endtk; *sp != '\0'; sp++) endtoken (*sp) = TRUE; 1671 for (sp = endtk; *sp != '\0'; sp++) endtoken (*sp) = true;
1685 endtoken ('\0') = endtoken ('\n'); 1672 endtoken ('\0') = endtoken ('\n');
1686} 1673}
1687 1674
@@ -1705,7 +1692,7 @@ find_entries (FILE *inf)
1705 /* Else try to guess the language given the file name. */ 1692 /* Else try to guess the language given the file name. */
1706 if (parser == NULL) 1693 if (parser == NULL)
1707 { 1694 {
1708 lang = get_language_from_filename (curfdp->infname, TRUE); 1695 lang = get_language_from_filename (curfdp->infname, true);
1709 if (lang != NULL && lang->function != NULL) 1696 if (lang != NULL && lang->function != NULL)
1710 { 1697 {
1711 curfdp->lang = lang; 1698 curfdp->lang = lang;
@@ -1752,7 +1739,7 @@ find_entries (FILE *inf)
1752 /* Else try to guess the language given the case insensitive file name. */ 1739 /* Else try to guess the language given the case insensitive file name. */
1753 if (parser == NULL) 1740 if (parser == NULL)
1754 { 1741 {
1755 lang = get_language_from_filename (curfdp->infname, FALSE); 1742 lang = get_language_from_filename (curfdp->infname, false);
1756 if (lang != NULL && lang->function != NULL) 1743 if (lang != NULL && lang->function != NULL)
1757 { 1744 {
1758 curfdp->lang = lang; 1745 curfdp->lang = lang;
@@ -1850,7 +1837,7 @@ find_entries (FILE *inf)
1850static void 1837static void
1851make_tag (const char *name, /* tag name, or NULL if unnamed */ 1838make_tag (const char *name, /* tag name, or NULL if unnamed */
1852 int namelen, /* tag length */ 1839 int namelen, /* tag length */
1853 int is_func, /* tag is a function */ 1840 bool is_func, /* tag is a function */
1854 char *linestart, /* start of the line where tag is */ 1841 char *linestart, /* start of the line where tag is */
1855 int linelen, /* length of the line where tag is */ 1842 int linelen, /* length of the line where tag is */
1856 int lno, /* line number */ 1843 int lno, /* line number */
@@ -1878,7 +1865,7 @@ make_tag (const char *name, /* tag name, or NULL if unnamed */
1878 && (cp == linestart 1865 && (cp == linestart
1879 || notinname (cp[-1])) /* rule #3 */ 1866 || notinname (cp[-1])) /* rule #3 */
1880 && strneq (name, cp, namelen)) /* rule #2 */ 1867 && strneq (name, cp, namelen)) /* rule #2 */
1881 named = FALSE; /* use implicit tag name */ 1868 named = false; /* use implicit tag name */
1882 } 1869 }
1883 } 1870 }
1884 1871
@@ -1890,7 +1877,8 @@ make_tag (const char *name, /* tag name, or NULL if unnamed */
1890 1877
1891/* Record a tag. */ 1878/* Record a tag. */
1892static void 1879static void
1893pfnote (char *name, int is_func, char *linestart, int linelen, int lno, long int cno) 1880pfnote (char *name, bool is_func, char *linestart, int linelen, int lno,
1881 long int cno)
1894 /* tag name, or NULL if unnamed */ 1882 /* tag name, or NULL if unnamed */
1895 /* tag is a function */ 1883 /* tag is a function */
1896 /* start of the line where tag is */ 1884 /* start of the line where tag is */
@@ -1917,8 +1905,8 @@ pfnote (char *name, int is_func, char *linestart, int linelen, int lno, long int
1917 } 1905 }
1918 else 1906 else
1919 np->name = name; 1907 np->name = name;
1920 np->valid = TRUE; 1908 np->valid = true;
1921 np->been_warned = FALSE; 1909 np->been_warned = false;
1922 np->fdp = curfdp; 1910 np->fdp = curfdp;
1923 np->is_func = is_func; 1911 np->is_func = is_func;
1924 np->lno = lno; 1912 np->lno = lno;
@@ -2052,7 +2040,7 @@ add_node (node *np, node **cur_node_p)
2052 (stderr, 2040 (stderr,
2053 "Duplicate entry in files %s and %s: %s (Warning only)\n", 2041 "Duplicate entry in files %s and %s: %s (Warning only)\n",
2054 np->fdp->infname, cur_node->fdp->infname, np->name); 2042 np->fdp->infname, cur_node->fdp->infname, np->name);
2055 cur_node->been_warned = TRUE; 2043 cur_node->been_warned = true;
2056 } 2044 }
2057 return; 2045 return;
2058 } 2046 }
@@ -2080,7 +2068,7 @@ invalidate_nodes (fdesc *badfdp, node **npp)
2080 if (np->left != NULL) 2068 if (np->left != NULL)
2081 invalidate_nodes (badfdp, &np->left); 2069 invalidate_nodes (badfdp, &np->left);
2082 if (np->fdp == badfdp) 2070 if (np->fdp == badfdp)
2083 np->valid = FALSE; 2071 np->valid = false;
2084 if (np->right != NULL) 2072 if (np->right != NULL)
2085 invalidate_nodes (badfdp, &np->right); 2073 invalidate_nodes (badfdp, &np->right);
2086 } 2074 }
@@ -2163,7 +2151,7 @@ put_entries (register node *np)
2163 fdp = np->fdp; 2151 fdp = np->fdp;
2164 fprintf (tagf, "\f\n%s,%d\n", 2152 fprintf (tagf, "\f\n%s,%d\n",
2165 fdp->taggedfname, total_size_of_entries (np)); 2153 fdp->taggedfname, total_size_of_entries (np));
2166 fdp->written = TRUE; 2154 fdp->written = true;
2167 } 2155 }
2168 fputs (np->regex, tagf); 2156 fputs (np->regex, tagf);
2169 fputc ('\177', tagf); 2157 fputc ('\177', tagf);
@@ -2249,10 +2237,6 @@ enum sym_type
2249 st_C_struct, st_C_extern, st_C_enum, st_C_define, st_C_typedef 2237 st_C_struct, st_C_extern, st_C_enum, st_C_define, st_C_typedef
2250}; 2238};
2251 2239
2252static unsigned int hash (const char *, unsigned int);
2253static struct C_stab_entry * in_word_set (const char *, unsigned int);
2254static enum sym_type C_symtype (char *, int, int);
2255
2256/* Feed stuff between (but not including) %[ and %] lines to: 2240/* Feed stuff between (but not including) %[ and %] lines to:
2257 gperf -m 5 2241 gperf -m 5
2258%[ 2242%[
@@ -2311,10 +2295,10 @@ and replace lines between %< and %> with its output, then:
2311struct C_stab_entry { const char *name; int c_ext; enum sym_type type; }; 2295struct C_stab_entry { const char *name; int c_ext; enum sym_type type; };
2312/* maximum key range = 33, duplicates = 0 */ 2296/* maximum key range = 33, duplicates = 0 */
2313 2297
2314static inline unsigned int 2298static int
2315hash (register const char *str, register unsigned int len) 2299hash (const char *str, int len)
2316{ 2300{
2317 static unsigned char asso_values[] = 2301 static char const asso_values[] =
2318 { 2302 {
2319 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 2303 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
2320 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 2304 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
@@ -2343,15 +2327,15 @@ hash (register const char *str, register unsigned int len)
2343 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 2327 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
2344 35, 35, 35, 35, 35, 35 2328 35, 35, 35, 35, 35, 35
2345 }; 2329 };
2346 register int hval = len; 2330 int hval = len;
2347 2331
2348 switch (hval) 2332 switch (hval)
2349 { 2333 {
2350 default: 2334 default:
2351 hval += asso_values[(unsigned char)str[2]]; 2335 hval += asso_values[(unsigned char) str[2]];
2352 /*FALLTHROUGH*/ 2336 /*FALLTHROUGH*/
2353 case 2: 2337 case 2:
2354 hval += asso_values[(unsigned char)str[1]]; 2338 hval += asso_values[(unsigned char) str[1]];
2355 break; 2339 break;
2356 } 2340 }
2357 return hval; 2341 return hval;
@@ -2409,11 +2393,11 @@ in_word_set (register const char *str, register unsigned int len)
2409 2393
2410 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) 2394 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
2411 { 2395 {
2412 register int key = hash (str, len); 2396 int key = hash (str, len);
2413 2397
2414 if (key <= MAX_HASH_VALUE && key >= 0) 2398 if (key <= MAX_HASH_VALUE && key >= 0)
2415 { 2399 {
2416 register const char *s = wordlist[key].name; 2400 const char *s = wordlist[key].name;
2417 2401
2418 if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0') 2402 if (*str == *s && !strncmp (str + 1, s + 1, len - 1) && s[len] == '\0')
2419 return &wordlist[key]; 2403 return &wordlist[key];
@@ -2638,7 +2622,7 @@ static void make_C_tag (bool);
2638 * function or variable, or corresponds to a typedef, or 2622 * function or variable, or corresponds to a typedef, or
2639 * is a struct/union/enum tag, or #define, or an enum constant. 2623 * is a struct/union/enum tag, or #define, or an enum constant.
2640 * 2624 *
2641 * *IS_FUNC gets TRUE if the token is a function or #define macro 2625 * *IS_FUNC_OR_VAR gets true if the token is a function or #define macro
2642 * with args. C_EXTP points to which language we are looking at. 2626 * with args. C_EXTP points to which language we are looking at.
2643 * 2627 *
2644 * Globals 2628 * Globals
@@ -2650,7 +2634,8 @@ static void make_C_tag (bool);
2650 */ 2634 */
2651 2635
2652static bool 2636static bool
2653consider_token (register char *str, register int len, register int c, int *c_extp, int bracelev, int parlev, int *is_func_or_var) 2637consider_token (char *str, int len, int c, int *c_extp,
2638 int bracelev, int parlev, bool *is_func_or_var)
2654 /* IN: token pointer */ 2639 /* IN: token pointer */
2655 /* IN: token length */ 2640 /* IN: token length */
2656 /* IN: first char after the token */ 2641 /* IN: first char after the token */
@@ -2674,8 +2659,8 @@ consider_token (register char *str, register int len, register int c, int *c_ext
2674 */ 2659 */
2675 if (toktype == st_C_attribute) 2660 if (toktype == st_C_attribute)
2676 { 2661 {
2677 inattribute = TRUE; 2662 inattribute = true;
2678 return FALSE; 2663 return false;
2679 } 2664 }
2680 2665
2681 /* 2666 /*
@@ -2688,7 +2673,7 @@ consider_token (register char *str, register int len, register int c, int *c_ext
2688 if (toktype == st_C_gnumacro) 2673 if (toktype == st_C_gnumacro)
2689 { 2674 {
2690 fvdef = fdefunkey; 2675 fvdef = fdefunkey;
2691 return FALSE; 2676 return false;
2692 } 2677 }
2693 break; 2678 break;
2694 case dsharpseen: 2679 case dsharpseen:
@@ -2700,20 +2685,20 @@ consider_token (register char *str, register int len, register int c, int *c_ext
2700 { 2685 {
2701 definedef = dignorerest; 2686 definedef = dignorerest;
2702 } 2687 }
2703 return FALSE; 2688 return false;
2704 case ddefineseen: 2689 case ddefineseen:
2705 /* 2690 /*
2706 * Make a tag for any macro, unless it is a constant 2691 * Make a tag for any macro, unless it is a constant
2707 * and constantypedefs is FALSE. 2692 * and constantypedefs is false.
2708 */ 2693 */
2709 definedef = dignorerest; 2694 definedef = dignorerest;
2710 *is_func_or_var = (c == '('); 2695 *is_func_or_var = (c == '(');
2711 if (!*is_func_or_var && !constantypedefs) 2696 if (!*is_func_or_var && !constantypedefs)
2712 return FALSE; 2697 return false;
2713 else 2698 else
2714 return TRUE; 2699 return true;
2715 case dignorerest: 2700 case dignorerest:
2716 return FALSE; 2701 return false;
2717 default: 2702 default:
2718 error ("internal error: definedef value."); 2703 error ("internal error: definedef value.");
2719 } 2704 }
@@ -2728,9 +2713,9 @@ consider_token (register char *str, register int len, register int c, int *c_ext
2728 { 2713 {
2729 if (typedefs) 2714 if (typedefs)
2730 typdef = tkeyseen; 2715 typdef = tkeyseen;
2731 fvextern = FALSE; 2716 fvextern = false;
2732 fvdef = fvnone; 2717 fvdef = fvnone;
2733 return FALSE; 2718 return false;
2734 } 2719 }
2735 break; 2720 break;
2736 case tkeyseen: 2721 case tkeyseen:
@@ -2747,7 +2732,7 @@ consider_token (register char *str, register int len, register int c, int *c_ext
2747 if (structdef == snone && fvdef == fvnone) 2732 if (structdef == snone && fvdef == fvnone)
2748 { 2733 {
2749 fvdef = fvnameseen; 2734 fvdef = fvnameseen;
2750 return TRUE; 2735 return true;
2751 } 2736 }
2752 break; 2737 break;
2753 case tend: 2738 case tend:
@@ -2756,9 +2741,9 @@ consider_token (register char *str, register int len, register int c, int *c_ext
2756 case st_C_class: 2741 case st_C_class:
2757 case st_C_struct: 2742 case st_C_struct:
2758 case st_C_enum: 2743 case st_C_enum:
2759 return FALSE; 2744 return false;
2760 } 2745 }
2761 return TRUE; 2746 return true;
2762 } 2747 }
2763 2748
2764 switch (toktype) 2749 switch (toktype)
@@ -2766,7 +2751,7 @@ consider_token (register char *str, register int len, register int c, int *c_ext
2766 case st_C_javastruct: 2751 case st_C_javastruct:
2767 if (structdef == stagseen) 2752 if (structdef == stagseen)
2768 structdef = scolonseen; 2753 structdef = scolonseen;
2769 return FALSE; 2754 return false;
2770 case st_C_template: 2755 case st_C_template:
2771 case st_C_class: 2756 case st_C_class:
2772 if ((*c_extp & C_AUTO) /* automatic detection of C++ language */ 2757 if ((*c_extp & C_AUTO) /* automatic detection of C++ language */
@@ -2790,13 +2775,13 @@ consider_token (register char *str, register int len, register int c, int *c_ext
2790 if (fvdef == fvnameseen) 2775 if (fvdef == fvnameseen)
2791 fvdef = fvnone; 2776 fvdef = fvnone;
2792 } 2777 }
2793 return FALSE; 2778 return false;
2794 } 2779 }
2795 2780
2796 if (structdef == skeyseen) 2781 if (structdef == skeyseen)
2797 { 2782 {
2798 structdef = stagseen; 2783 structdef = stagseen;
2799 return TRUE; 2784 return true;
2800 } 2785 }
2801 2786
2802 if (typdef != tnone) 2787 if (typdef != tnone)
@@ -2810,27 +2795,27 @@ consider_token (register char *str, register int len, register int c, int *c_ext
2810 { 2795 {
2811 case st_C_objprot: 2796 case st_C_objprot:
2812 objdef = oprotocol; 2797 objdef = oprotocol;
2813 return FALSE; 2798 return false;
2814 case st_C_objimpl: 2799 case st_C_objimpl:
2815 objdef = oimplementation; 2800 objdef = oimplementation;
2816 return FALSE; 2801 return false;
2817 } 2802 }
2818 break; 2803 break;
2819 case oimplementation: 2804 case oimplementation:
2820 /* Save the class tag for functions or variables defined inside. */ 2805 /* Save the class tag for functions or variables defined inside. */
2821 objtag = savenstr (str, len); 2806 objtag = savenstr (str, len);
2822 objdef = oinbody; 2807 objdef = oinbody;
2823 return FALSE; 2808 return false;
2824 case oprotocol: 2809 case oprotocol:
2825 /* Save the class tag for categories. */ 2810 /* Save the class tag for categories. */
2826 objtag = savenstr (str, len); 2811 objtag = savenstr (str, len);
2827 objdef = otagseen; 2812 objdef = otagseen;
2828 *is_func_or_var = TRUE; 2813 *is_func_or_var = true;
2829 return TRUE; 2814 return true;
2830 case oparenseen: 2815 case oparenseen:
2831 objdef = ocatseen; 2816 objdef = ocatseen;
2832 *is_func_or_var = TRUE; 2817 *is_func_or_var = true;
2833 return TRUE; 2818 return true;
2834 case oinbody: 2819 case oinbody:
2835 break; 2820 break;
2836 case omethodsign: 2821 case omethodsign:
@@ -2841,13 +2826,13 @@ consider_token (register char *str, register int len, register int c, int *c_ext
2841 linebuffer_setlen (&token_name, len); 2826 linebuffer_setlen (&token_name, len);
2842 memcpy (token_name.buffer, str, len); 2827 memcpy (token_name.buffer, str, len);
2843 token_name.buffer[len] = '\0'; 2828 token_name.buffer[len] = '\0';
2844 return TRUE; 2829 return true;
2845 } 2830 }
2846 return FALSE; 2831 return false;
2847 case omethodcolon: 2832 case omethodcolon:
2848 if (parlev == 0) 2833 if (parlev == 0)
2849 objdef = omethodparm; 2834 objdef = omethodparm;
2850 return FALSE; 2835 return false;
2851 case omethodparm: 2836 case omethodparm:
2852 if (parlev == 0) 2837 if (parlev == 0)
2853 { 2838 {
@@ -2857,9 +2842,9 @@ consider_token (register char *str, register int len, register int c, int *c_ext
2857 linebuffer_setlen (&token_name, oldlen + len); 2842 linebuffer_setlen (&token_name, oldlen + len);
2858 memcpy (token_name.buffer + oldlen, str, len); 2843 memcpy (token_name.buffer + oldlen, str, len);
2859 token_name.buffer[oldlen + len] = '\0'; 2844 token_name.buffer[oldlen + len] = '\0';
2860 return TRUE; 2845 return true;
2861 } 2846 }
2862 return FALSE; 2847 return false;
2863 case oignore: 2848 case oignore:
2864 if (toktype == st_C_objend) 2849 if (toktype == st_C_objend)
2865 { 2850 {
@@ -2871,14 +2856,14 @@ consider_token (register char *str, register int len, register int c, int *c_ext
2871 free (objtag); */ 2856 free (objtag); */
2872 objdef = onone; 2857 objdef = onone;
2873 } 2858 }
2874 return FALSE; 2859 return false;
2875 } 2860 }
2876 2861
2877 /* A function, variable or enum constant? */ 2862 /* A function, variable or enum constant? */
2878 switch (toktype) 2863 switch (toktype)
2879 { 2864 {
2880 case st_C_extern: 2865 case st_C_extern:
2881 fvextern = TRUE; 2866 fvextern = true;
2882 switch (fvdef) 2867 switch (fvdef)
2883 { 2868 {
2884 case finlist: 2869 case finlist:
@@ -2889,39 +2874,39 @@ consider_token (register char *str, register int len, register int c, int *c_ext
2889 default: 2874 default:
2890 fvdef = fvnone; 2875 fvdef = fvnone;
2891 } 2876 }
2892 return FALSE; 2877 return false;
2893 case st_C_ignore: 2878 case st_C_ignore:
2894 fvextern = FALSE; 2879 fvextern = false;
2895 fvdef = vignore; 2880 fvdef = vignore;
2896 return FALSE; 2881 return false;
2897 case st_C_operator: 2882 case st_C_operator:
2898 fvdef = foperator; 2883 fvdef = foperator;
2899 *is_func_or_var = TRUE; 2884 *is_func_or_var = true;
2900 return TRUE; 2885 return true;
2901 case st_none: 2886 case st_none:
2902 if (constantypedefs 2887 if (constantypedefs
2903 && structdef == snone 2888 && structdef == snone
2904 && structtype == st_C_enum && bracelev > structbracelev) 2889 && structtype == st_C_enum && bracelev > structbracelev)
2905 return TRUE; /* enum constant */ 2890 return true; /* enum constant */
2906 switch (fvdef) 2891 switch (fvdef)
2907 { 2892 {
2908 case fdefunkey: 2893 case fdefunkey:
2909 if (bracelev > 0) 2894 if (bracelev > 0)
2910 break; 2895 break;
2911 fvdef = fdefunname; /* GNU macro */ 2896 fvdef = fdefunname; /* GNU macro */
2912 *is_func_or_var = TRUE; 2897 *is_func_or_var = true;
2913 return TRUE; 2898 return true;
2914 case fvnone: 2899 case fvnone:
2915 switch (typdef) 2900 switch (typdef)
2916 { 2901 {
2917 case ttypeseen: 2902 case ttypeseen:
2918 return FALSE; 2903 return false;
2919 case tnone: 2904 case tnone:
2920 if ((strneq (str, "asm", 3) && endtoken (str[3])) 2905 if ((strneq (str, "asm", 3) && endtoken (str[3]))
2921 || (strneq (str, "__asm__", 7) && endtoken (str[7]))) 2906 || (strneq (str, "__asm__", 7) && endtoken (str[7])))
2922 { 2907 {
2923 fvdef = vignore; 2908 fvdef = vignore;
2924 return FALSE; 2909 return false;
2925 } 2910 }
2926 break; 2911 break;
2927 } 2912 }
@@ -2932,19 +2917,19 @@ consider_token (register char *str, register int len, register int c, int *c_ext
2932 if (*c_extp & C_AUTO) /* automatic detection of C++ */ 2917 if (*c_extp & C_AUTO) /* automatic detection of C++ */
2933 *c_extp = (*c_extp | C_PLPL) & ~C_AUTO; 2918 *c_extp = (*c_extp | C_PLPL) & ~C_AUTO;
2934 fvdef = foperator; 2919 fvdef = foperator;
2935 *is_func_or_var = TRUE; 2920 *is_func_or_var = true;
2936 return TRUE; 2921 return true;
2937 } 2922 }
2938 if (bracelev > 0 && !instruct) 2923 if (bracelev > 0 && !instruct)
2939 break; 2924 break;
2940 fvdef = fvnameseen; /* function or variable */ 2925 fvdef = fvnameseen; /* function or variable */
2941 *is_func_or_var = TRUE; 2926 *is_func_or_var = true;
2942 return TRUE; 2927 return true;
2943 } 2928 }
2944 break; 2929 break;
2945 } 2930 }
2946 2931
2947 return FALSE; 2932 return false;
2948} 2933}
2949 2934
2950 2935
@@ -2976,7 +2961,7 @@ do { \
2976 curlinepos = charno; \ 2961 curlinepos = charno; \
2977 readline (&curlb, inf); \ 2962 readline (&curlb, inf); \
2978 lp = curlb.buffer; \ 2963 lp = curlb.buffer; \
2979 quotednl = FALSE; \ 2964 quotednl = false; \
2980 newndx = curndx; \ 2965 newndx = curndx; \
2981} while (0) 2966} while (0)
2982 2967
@@ -2986,16 +2971,16 @@ do { \
2986 if (savetoken.valid) \ 2971 if (savetoken.valid) \
2987 { \ 2972 { \
2988 token = savetoken; \ 2973 token = savetoken; \
2989 savetoken.valid = FALSE; \ 2974 savetoken.valid = false; \
2990 } \ 2975 } \
2991 definedef = dnone; \ 2976 definedef = dnone; \
2992} while (0) 2977} while (0)
2993 2978
2994 2979
2995static void 2980static void
2996make_C_tag (int isfun) 2981make_C_tag (bool isfun)
2997{ 2982{
2998 /* This function is never called when token.valid is FALSE, but 2983 /* This function is never called when token.valid is false, but
2999 we must protect against invalid input or internal errors. */ 2984 we must protect against invalid input or internal errors. */
3000 if (token.valid) 2985 if (token.valid)
3001 make_tag (token_name.buffer, token_name.len, isfun, token.line, 2986 make_tag (token_name.buffer, token_name.len, isfun, token.line,
@@ -3008,7 +2993,7 @@ make_C_tag (int isfun)
3008 error ("INVALID TOKEN"); 2993 error ("INVALID TOKEN");
3009 } 2994 }
3010 2995
3011 token.valid = FALSE; 2996 token.valid = false;
3012} 2997}
3013 2998
3014 2999
@@ -3056,11 +3041,11 @@ C_entries (int c_ext, FILE *inf)
3056 lp = curlb.buffer; 3041 lp = curlb.buffer;
3057 *lp = 0; 3042 *lp = 0;
3058 3043
3059 fvdef = fvnone; fvextern = FALSE; typdef = tnone; 3044 fvdef = fvnone; fvextern = false; typdef = tnone;
3060 structdef = snone; definedef = dnone; objdef = onone; 3045 structdef = snone; definedef = dnone; objdef = onone;
3061 yacc_rules = FALSE; 3046 yacc_rules = false;
3062 midtoken = inquote = inchar = incomm = quotednl = FALSE; 3047 midtoken = inquote = inchar = incomm = quotednl = false;
3063 token.valid = savetoken.valid = FALSE; 3048 token.valid = savetoken.valid = false;
3064 bracelev = bracketlev = parlev = attrparlev = templatelev = 0; 3049 bracelev = bracketlev = parlev = attrparlev = templatelev = 0;
3065 if (cjava) 3050 if (cjava)
3066 { qualifier = "."; qlen = 1; } 3051 { qualifier = "."; qlen = 1; }
@@ -3078,7 +3063,7 @@ C_entries (int c_ext, FILE *inf)
3078 to read the next line. */ 3063 to read the next line. */
3079 if (*lp == '\0') 3064 if (*lp == '\0')
3080 { 3065 {
3081 quotednl = TRUE; 3066 quotednl = true;
3082 continue; 3067 continue;
3083 } 3068 }
3084 lp++; 3069 lp++;
@@ -3092,7 +3077,7 @@ C_entries (int c_ext, FILE *inf)
3092 if (*lp == '/') 3077 if (*lp == '/')
3093 { 3078 {
3094 c = *lp++; 3079 c = *lp++;
3095 incomm = FALSE; 3080 incomm = false;
3096 } 3081 }
3097 break; 3082 break;
3098 case '\0': 3083 case '\0':
@@ -3108,7 +3093,7 @@ C_entries (int c_ext, FILE *inf)
3108 switch (c) 3093 switch (c)
3109 { 3094 {
3110 case '"': 3095 case '"':
3111 inquote = FALSE; 3096 inquote = false;
3112 break; 3097 break;
3113 case '\0': 3098 case '\0':
3114 /* Newlines inside strings do not end macro definitions 3099 /* Newlines inside strings do not end macro definitions
@@ -3128,7 +3113,7 @@ C_entries (int c_ext, FILE *inf)
3128 CNL (); 3113 CNL ();
3129 /* FALLTHRU */ 3114 /* FALLTHRU */
3130 case '\'': 3115 case '\'':
3131 inchar = FALSE; 3116 inchar = false;
3132 break; 3117 break;
3133 } 3118 }
3134 continue; 3119 continue;
@@ -3136,7 +3121,7 @@ C_entries (int c_ext, FILE *inf)
3136 else switch (c) 3121 else switch (c)
3137 { 3122 {
3138 case '"': 3123 case '"':
3139 inquote = TRUE; 3124 inquote = true;
3140 if (bracketlev > 0) 3125 if (bracketlev > 0)
3141 continue; 3126 continue;
3142 if (inattribute) 3127 if (inattribute)
@@ -3150,26 +3135,26 @@ C_entries (int c_ext, FILE *inf)
3150 case vignore: 3135 case vignore:
3151 break; 3136 break;
3152 default: 3137 default:
3153 fvextern = FALSE; 3138 fvextern = false;
3154 fvdef = fvnone; 3139 fvdef = fvnone;
3155 } 3140 }
3156 continue; 3141 continue;
3157 case '\'': 3142 case '\'':
3158 inchar = TRUE; 3143 inchar = true;
3159 if (bracketlev > 0) 3144 if (bracketlev > 0)
3160 continue; 3145 continue;
3161 if (inattribute) 3146 if (inattribute)
3162 break; 3147 break;
3163 if (fvdef != finlist && fvdef != fignore && fvdef != vignore) 3148 if (fvdef != finlist && fvdef != fignore && fvdef != vignore)
3164 { 3149 {
3165 fvextern = FALSE; 3150 fvextern = false;
3166 fvdef = fvnone; 3151 fvdef = fvnone;
3167 } 3152 }
3168 continue; 3153 continue;
3169 case '/': 3154 case '/':
3170 if (*lp == '*') 3155 if (*lp == '*')
3171 { 3156 {
3172 incomm = TRUE; 3157 incomm = true;
3173 lp++; 3158 lp++;
3174 c = ' '; 3159 c = ' ';
3175 if (bracketlev > 0) 3160 if (bracketlev > 0)
@@ -3185,9 +3170,9 @@ C_entries (int c_ext, FILE *inf)
3185 { 3170 {
3186 /* Entering or exiting rules section in yacc file. */ 3171 /* Entering or exiting rules section in yacc file. */
3187 lp++; 3172 lp++;
3188 definedef = dnone; fvdef = fvnone; fvextern = FALSE; 3173 definedef = dnone; fvdef = fvnone; fvextern = false;
3189 typdef = tnone; structdef = snone; 3174 typdef = tnone; structdef = snone;
3190 midtoken = inquote = inchar = incomm = quotednl = FALSE; 3175 midtoken = inquote = inchar = incomm = quotednl = false;
3191 bracelev = 0; 3176 bracelev = 0;
3192 yacc_rules = !yacc_rules; 3177 yacc_rules = !yacc_rules;
3193 continue; 3178 continue;
@@ -3198,7 +3183,7 @@ C_entries (int c_ext, FILE *inf)
3198 if (definedef == dnone) 3183 if (definedef == dnone)
3199 { 3184 {
3200 char *cp; 3185 char *cp;
3201 bool cpptoken = TRUE; 3186 bool cpptoken = true;
3202 3187
3203 /* Look back on this line. If all blanks, or nonblanks 3188 /* Look back on this line. If all blanks, or nonblanks
3204 followed by an end of comment, this is a preprocessor 3189 followed by an end of comment, this is a preprocessor
@@ -3209,10 +3194,10 @@ C_entries (int c_ext, FILE *inf)
3209 if (*cp == '*' && cp[1] == '/') 3194 if (*cp == '*' && cp[1] == '/')
3210 { 3195 {
3211 cp++; 3196 cp++;
3212 cpptoken = TRUE; 3197 cpptoken = true;
3213 } 3198 }
3214 else 3199 else
3215 cpptoken = FALSE; 3200 cpptoken = false;
3216 } 3201 }
3217 if (cpptoken) 3202 if (cpptoken)
3218 definedef = dsharpseen; 3203 definedef = dsharpseen;
@@ -3261,7 +3246,7 @@ C_entries (int c_ext, FILE *inf)
3261 } 3246 }
3262 else 3247 else
3263 { 3248 {
3264 bool funorvar = FALSE; 3249 bool funorvar = false;
3265 3250
3266 if (yacc_rules 3251 if (yacc_rules
3267 || consider_token (newlb.buffer + tokoff, toklen, c, 3252 || consider_token (newlb.buffer + tokoff, toklen, c,
@@ -3280,7 +3265,7 @@ C_entries (int c_ext, FILE *inf)
3280 c = *lp++; 3265 c = *lp++;
3281 toklen += lp - oldlp; 3266 toklen += lp - oldlp;
3282 } 3267 }
3283 token.named = FALSE; 3268 token.named = false;
3284 if (!plainc 3269 if (!plainc
3285 && nestlev > 0 && definedef == dnone) 3270 && nestlev > 0 && definedef == dnone)
3286 /* in struct body */ 3271 /* in struct body */
@@ -3291,7 +3276,7 @@ C_entries (int c_ext, FILE *inf)
3291 linebuffer_setlen (&token_name, len+qlen+toklen); 3276 linebuffer_setlen (&token_name, len+qlen+toklen);
3292 sprintf (token_name.buffer + len, "%s%.*s", 3277 sprintf (token_name.buffer + len, "%s%.*s",
3293 qualifier, toklen, newlb.buffer + tokoff); 3278 qualifier, toklen, newlb.buffer + tokoff);
3294 token.named = TRUE; 3279 token.named = true;
3295 } 3280 }
3296 else if (objdef == ocatseen) 3281 else if (objdef == ocatseen)
3297 /* Objective C category */ 3282 /* Objective C category */
@@ -3300,13 +3285,13 @@ C_entries (int c_ext, FILE *inf)
3300 linebuffer_setlen (&token_name, len); 3285 linebuffer_setlen (&token_name, len);
3301 sprintf (token_name.buffer, "%s(%.*s)", 3286 sprintf (token_name.buffer, "%s(%.*s)",
3302 objtag, toklen, newlb.buffer + tokoff); 3287 objtag, toklen, newlb.buffer + tokoff);
3303 token.named = TRUE; 3288 token.named = true;
3304 } 3289 }
3305 else if (objdef == omethodtag 3290 else if (objdef == omethodtag
3306 || objdef == omethodparm) 3291 || objdef == omethodparm)
3307 /* Objective C method */ 3292 /* Objective C method */
3308 { 3293 {
3309 token.named = TRUE; 3294 token.named = true;
3310 } 3295 }
3311 else if (fvdef == fdefunname) 3296 else if (fvdef == fdefunname)
3312 /* GNU DEFUN and similar macros */ 3297 /* GNU DEFUN and similar macros */
@@ -3354,7 +3339,7 @@ C_entries (int c_ext, FILE *inf)
3354 token.length = toklen; 3339 token.length = toklen;
3355 token.line = newlb.buffer; 3340 token.line = newlb.buffer;
3356 token.linepos = newlinepos; 3341 token.linepos = newlinepos;
3357 token.valid = TRUE; 3342 token.valid = true;
3358 3343
3359 if (definedef == dnone 3344 if (definedef == dnone
3360 && (fvdef == fvnameseen 3345 && (fvdef == fvnameseen
@@ -3382,7 +3367,7 @@ C_entries (int c_ext, FILE *inf)
3382 fvdef = fvnone; 3367 fvdef = fvnone;
3383 } 3368 }
3384 } 3369 }
3385 midtoken = FALSE; 3370 midtoken = false;
3386 } 3371 }
3387 } /* if (endtoken (c)) */ 3372 } /* if (endtoken (c)) */
3388 else if (intoken (c)) 3373 else if (intoken (c))
@@ -3408,7 +3393,7 @@ C_entries (int c_ext, FILE *inf)
3408 case flistseen: 3393 case flistseen:
3409 if (plainc || declarations) 3394 if (plainc || declarations)
3410 { 3395 {
3411 make_C_tag (TRUE); /* a function */ 3396 make_C_tag (true); /* a function */
3412 fvdef = fignore; 3397 fvdef = fignore;
3413 } 3398 }
3414 break; 3399 break;
@@ -3427,7 +3412,7 @@ C_entries (int c_ext, FILE *inf)
3427 { 3412 {
3428 tokoff = lp - 1 - newlb.buffer; 3413 tokoff = lp - 1 - newlb.buffer;
3429 toklen = 1; 3414 toklen = 1;
3430 midtoken = TRUE; 3415 midtoken = true;
3431 } 3416 }
3432 continue; 3417 continue;
3433 } /* if (begtoken) */ 3418 } /* if (begtoken) */
@@ -3443,7 +3428,7 @@ C_entries (int c_ext, FILE *inf)
3443 break; 3428 break;
3444 if (yacc_rules && token.offset == 0 && token.valid) 3429 if (yacc_rules && token.offset == 0 && token.valid)
3445 { 3430 {
3446 make_C_tag (FALSE); /* a yacc function */ 3431 make_C_tag (false); /* a yacc function */
3447 break; 3432 break;
3448 } 3433 }
3449 if (definedef != dnone) 3434 if (definedef != dnone)
@@ -3452,7 +3437,7 @@ C_entries (int c_ext, FILE *inf)
3452 { 3437 {
3453 case otagseen: 3438 case otagseen:
3454 objdef = oignore; 3439 objdef = oignore;
3455 make_C_tag (TRUE); /* an Objective C class */ 3440 make_C_tag (true); /* an Objective C class */
3456 break; 3441 break;
3457 case omethodtag: 3442 case omethodtag:
3458 case omethodparm: 3443 case omethodparm:
@@ -3469,7 +3454,7 @@ C_entries (int c_ext, FILE *inf)
3469 /* Should be useless, but may be work as a safety net. */ 3454 /* Should be useless, but may be work as a safety net. */
3470 if (cplpl && fvdef == flistseen) 3455 if (cplpl && fvdef == flistseen)
3471 { 3456 {
3472 make_C_tag (TRUE); /* a function */ 3457 make_C_tag (true); /* a function */
3473 fvdef = fignore; 3458 fvdef = fignore;
3474 break; 3459 break;
3475 } 3460 }
@@ -3481,7 +3466,7 @@ C_entries (int c_ext, FILE *inf)
3481 { 3466 {
3482 case tend: 3467 case tend:
3483 case ttypeseen: 3468 case ttypeseen:
3484 make_C_tag (FALSE); /* a typedef */ 3469 make_C_tag (false); /* a typedef */
3485 typdef = tnone; 3470 typdef = tnone;
3486 fvdef = fvnone; 3471 fvdef = fvnone;
3487 break; 3472 break;
@@ -3497,10 +3482,10 @@ C_entries (int c_ext, FILE *inf)
3497 case fvnameseen: 3482 case fvnameseen:
3498 if ((globals && bracelev == 0 && (!fvextern || declarations)) 3483 if ((globals && bracelev == 0 && (!fvextern || declarations))
3499 || (members && instruct)) 3484 || (members && instruct))
3500 make_C_tag (FALSE); /* a variable */ 3485 make_C_tag (false); /* a variable */
3501 fvextern = FALSE; 3486 fvextern = false;
3502 fvdef = fvnone; 3487 fvdef = fvnone;
3503 token.valid = FALSE; 3488 token.valid = false;
3504 break; 3489 break;
3505 case flistseen: 3490 case flistseen:
3506 if ((declarations 3491 if ((declarations
@@ -3508,16 +3493,16 @@ C_entries (int c_ext, FILE *inf)
3508 && (typdef == tnone || (typdef != tignore && instruct))) 3493 && (typdef == tnone || (typdef != tignore && instruct)))
3509 || (members 3494 || (members
3510 && plainc && instruct)) 3495 && plainc && instruct))
3511 make_C_tag (TRUE); /* a function */ 3496 make_C_tag (true); /* a function */
3512 /* FALLTHRU */ 3497 /* FALLTHRU */
3513 default: 3498 default:
3514 fvextern = FALSE; 3499 fvextern = false;
3515 fvdef = fvnone; 3500 fvdef = fvnone;
3516 if (declarations 3501 if (declarations
3517 && cplpl && structdef == stagseen) 3502 && cplpl && structdef == stagseen)
3518 make_C_tag (FALSE); /* forward declaration */ 3503 make_C_tag (false); /* forward declaration */
3519 else 3504 else
3520 token.valid = FALSE; 3505 token.valid = false;
3521 } /* switch (fvdef) */ 3506 } /* switch (fvdef) */
3522 /* FALLTHRU */ 3507 /* FALLTHRU */
3523 default: 3508 default:
@@ -3534,7 +3519,7 @@ C_entries (int c_ext, FILE *inf)
3534 { 3519 {
3535 case omethodtag: 3520 case omethodtag:
3536 case omethodparm: 3521 case omethodparm:
3537 make_C_tag (TRUE); /* an Objective C method */ 3522 make_C_tag (true); /* an Objective C method */
3538 objdef = oinbody; 3523 objdef = oinbody;
3539 break; 3524 break;
3540 } 3525 }
@@ -3557,18 +3542,18 @@ C_entries (int c_ext, FILE *inf)
3557 && templatelev == 0 3542 && templatelev == 0
3558 && (!fvextern || declarations)) 3543 && (!fvextern || declarations))
3559 || (members && instruct))) 3544 || (members && instruct)))
3560 make_C_tag (FALSE); /* a variable */ 3545 make_C_tag (false); /* a variable */
3561 break; 3546 break;
3562 case flistseen: 3547 case flistseen:
3563 if ((declarations && typdef == tnone && !instruct) 3548 if ((declarations && typdef == tnone && !instruct)
3564 || (members && typdef != tignore && instruct)) 3549 || (members && typdef != tignore && instruct))
3565 { 3550 {
3566 make_C_tag (TRUE); /* a function */ 3551 make_C_tag (true); /* a function */
3567 fvdef = fvnameseen; 3552 fvdef = fvnameseen;
3568 } 3553 }
3569 else if (!declarations) 3554 else if (!declarations)
3570 fvdef = fvnone; 3555 fvdef = fvnone;
3571 token.valid = FALSE; 3556 token.valid = false;
3572 break; 3557 break;
3573 default: 3558 default:
3574 fvdef = fvnone; 3559 fvdef = fvnone;
@@ -3586,7 +3571,7 @@ C_entries (int c_ext, FILE *inf)
3586 case ttypeseen: 3571 case ttypeseen:
3587 case tend: 3572 case tend:
3588 typdef = tignore; 3573 typdef = tignore;
3589 make_C_tag (FALSE); /* a typedef */ 3574 make_C_tag (false); /* a typedef */
3590 break; 3575 break;
3591 case tnone: 3576 case tnone:
3592 case tinbody: 3577 case tinbody:
@@ -3601,7 +3586,7 @@ C_entries (int c_ext, FILE *inf)
3601 if ((members && bracelev == 1) 3586 if ((members && bracelev == 1)
3602 || (globals && bracelev == 0 3587 || (globals && bracelev == 0
3603 && (!fvextern || declarations))) 3588 && (!fvextern || declarations)))
3604 make_C_tag (FALSE); /* a variable */ 3589 make_C_tag (false); /* a variable */
3605 /* FALLTHRU */ 3590 /* FALLTHRU */
3606 default: 3591 default:
3607 fvdef = fvnone; 3592 fvdef = fvnone;
@@ -3628,7 +3613,7 @@ C_entries (int c_ext, FILE *inf)
3628 { 3613 {
3629 /* This handles constructs like: 3614 /* This handles constructs like:
3630 typedef void OperatorFun (int fun); */ 3615 typedef void OperatorFun (int fun); */
3631 make_C_tag (FALSE); 3616 make_C_tag (false);
3632 typdef = tignore; 3617 typdef = tignore;
3633 fvdef = fignore; 3618 fvdef = fignore;
3634 break; 3619 break;
@@ -3647,14 +3632,14 @@ C_entries (int c_ext, FILE *inf)
3647 if (inattribute) 3632 if (inattribute)
3648 { 3633 {
3649 if (--attrparlev == 0) 3634 if (--attrparlev == 0)
3650 inattribute = FALSE; 3635 inattribute = false;
3651 break; 3636 break;
3652 } 3637 }
3653 if (definedef != dnone) 3638 if (definedef != dnone)
3654 break; 3639 break;
3655 if (objdef == ocatseen && parlev == 1) 3640 if (objdef == ocatseen && parlev == 1)
3656 { 3641 {
3657 make_C_tag (TRUE); /* an Objective C category */ 3642 make_C_tag (true); /* an Objective C category */
3658 objdef = oignore; 3643 objdef = oignore;
3659 } 3644 }
3660 if (--parlev == 0) 3645 if (--parlev == 0)
@@ -3671,7 +3656,7 @@ C_entries (int c_ext, FILE *inf)
3671 || typdef == ttypeseen)) 3656 || typdef == ttypeseen))
3672 { 3657 {
3673 typdef = tignore; 3658 typdef = tignore;
3674 make_C_tag (FALSE); /* a typedef */ 3659 make_C_tag (false); /* a typedef */
3675 } 3660 }
3676 } 3661 }
3677 else if (parlev < 0) /* can happen due to ill-conceived #if's. */ 3662 else if (parlev < 0) /* can happen due to ill-conceived #if's. */
@@ -3690,7 +3675,7 @@ C_entries (int c_ext, FILE *inf)
3690 switch (fvdef) 3675 switch (fvdef)
3691 { 3676 {
3692 case flistseen: 3677 case flistseen:
3693 make_C_tag (TRUE); /* a function */ 3678 make_C_tag (true); /* a function */
3694 /* FALLTHRU */ 3679 /* FALLTHRU */
3695 case fignore: 3680 case fignore:
3696 fvdef = fvnone; 3681 fvdef = fvnone;
@@ -3699,12 +3684,12 @@ C_entries (int c_ext, FILE *inf)
3699 switch (objdef) 3684 switch (objdef)
3700 { 3685 {
3701 case otagseen: 3686 case otagseen:
3702 make_C_tag (TRUE); /* an Objective C class */ 3687 make_C_tag (true); /* an Objective C class */
3703 objdef = oignore; 3688 objdef = oignore;
3704 break; 3689 break;
3705 case omethodtag: 3690 case omethodtag:
3706 case omethodparm: 3691 case omethodparm:
3707 make_C_tag (TRUE); /* an Objective C method */ 3692 make_C_tag (true); /* an Objective C method */
3708 objdef = oinbody; 3693 objdef = oinbody;
3709 break; 3694 break;
3710 default: 3695 default:
@@ -3725,7 +3710,7 @@ C_entries (int c_ext, FILE *inf)
3725 case scolonseen: /* a class */ 3710 case scolonseen: /* a class */
3726 pushclass_above (bracelev,token.line+token.offset, token.length); 3711 pushclass_above (bracelev,token.line+token.offset, token.length);
3727 structdef = snone; 3712 structdef = snone;
3728 make_C_tag (FALSE); /* a struct or enum */ 3713 make_C_tag (false); /* a struct or enum */
3729 break; 3714 break;
3730 } 3715 }
3731 bracelev += 1; 3716 bracelev += 1;
@@ -3736,7 +3721,7 @@ C_entries (int c_ext, FILE *inf)
3736 if (fvdef == fstartlist) 3721 if (fvdef == fstartlist)
3737 { 3722 {
3738 fvdef = fvnone; /* avoid tagging `foo' in `foo (*bar()) ()' */ 3723 fvdef = fvnone; /* avoid tagging `foo' in `foo (*bar()) ()' */
3739 token.valid = FALSE; 3724 token.valid = false;
3740 } 3725 }
3741 break; 3726 break;
3742 case '}': 3727 case '}':
@@ -3746,13 +3731,13 @@ C_entries (int c_ext, FILE *inf)
3746 if (!ignoreindent && lp == newlb.buffer + 1) 3731 if (!ignoreindent && lp == newlb.buffer + 1)
3747 { 3732 {
3748 if (bracelev != 0) 3733 if (bracelev != 0)
3749 token.valid = FALSE; /* unexpected value, token unreliable */ 3734 token.valid = false; /* unexpected value, token unreliable */
3750 bracelev = 0; /* reset brace level if first column */ 3735 bracelev = 0; /* reset brace level if first column */
3751 parlev = 0; /* also reset paren level, just in case... */ 3736 parlev = 0; /* also reset paren level, just in case... */
3752 } 3737 }
3753 else if (bracelev < 0) 3738 else if (bracelev < 0)
3754 { 3739 {
3755 token.valid = FALSE; /* something gone amiss, token unreliable */ 3740 token.valid = false; /* something gone amiss, token unreliable */
3756 bracelev = 0; 3741 bracelev = 0;
3757 } 3742 }
3758 if (bracelev == 0 && fvdef == vignore) 3743 if (bracelev == 0 && fvdef == vignore)
@@ -3779,7 +3764,7 @@ C_entries (int c_ext, FILE *inf)
3779 case fvnameseen: 3764 case fvnameseen:
3780 if ((members && bracelev == 1) 3765 if ((members && bracelev == 1)
3781 || (globals && bracelev == 0 && (!fvextern || declarations))) 3766 || (globals && bracelev == 0 && (!fvextern || declarations)))
3782 make_C_tag (FALSE); /* a variable */ 3767 make_C_tag (false); /* a variable */
3783 /* FALLTHRU */ 3768 /* FALLTHRU */
3784 default: 3769 default:
3785 fvdef = vignore; 3770 fvdef = vignore;
@@ -3828,7 +3813,7 @@ C_entries (int c_ext, FILE *inf)
3828 case '\0': 3813 case '\0':
3829 if (objdef == otagseen) 3814 if (objdef == otagseen)
3830 { 3815 {
3831 make_C_tag (TRUE); /* an Objective C class */ 3816 make_C_tag (true); /* an Objective C class */
3832 objdef = oignore; 3817 objdef = oignore;
3833 } 3818 }
3834 /* If a macro spans multiple lines don't reset its state. */ 3819 /* If a macro spans multiple lines don't reset its state. */
@@ -3898,18 +3883,18 @@ Yacc_entries (FILE *inf)
3898 && /* instructions at start of loop */ \ 3883 && /* instructions at start of loop */ \
3899 (readline (&line_buffer, file_pointer), \ 3884 (readline (&line_buffer, file_pointer), \
3900 char_pointer = line_buffer.buffer, \ 3885 char_pointer = line_buffer.buffer, \
3901 TRUE); \ 3886 true); \
3902 ) 3887 )
3903 3888
3904#define LOOKING_AT(cp, kw) /* kw is the keyword, a literal string */ \ 3889#define LOOKING_AT(cp, kw) /* kw is the keyword, a literal string */ \
3905 ((assert ("" kw), TRUE) /* syntax error if not a literal string */ \ 3890 ((assert ("" kw), true) /* syntax error if not a literal string */ \
3906 && strneq ((cp), kw, sizeof (kw)-1) /* cp points at kw */ \ 3891 && strneq ((cp), kw, sizeof (kw)-1) /* cp points at kw */ \
3907 && notinname ((cp)[sizeof (kw)-1]) /* end of kw */ \ 3892 && notinname ((cp)[sizeof (kw)-1]) /* end of kw */ \
3908 && ((cp) = skip_spaces ((cp)+sizeof (kw)-1))) /* skip spaces */ 3893 && ((cp) = skip_spaces ((cp)+sizeof (kw)-1))) /* skip spaces */
3909 3894
3910/* Similar to LOOKING_AT but does not use notinname, does not skip */ 3895/* Similar to LOOKING_AT but does not use notinname, does not skip */
3911#define LOOKING_AT_NOCASE(cp, kw) /* the keyword is a literal string */ \ 3896#define LOOKING_AT_NOCASE(cp, kw) /* the keyword is a literal string */ \
3912 ((assert ("" kw), TRUE) /* syntax error if not a literal string */ \ 3897 ((assert ("" kw), true) /* syntax error if not a literal string */ \
3913 && strncaseeq ((cp), kw, sizeof (kw)-1) /* cp points at kw */ \ 3898 && strncaseeq ((cp), kw, sizeof (kw)-1) /* cp points at kw */ \
3914 && ((cp) += sizeof (kw)-1)) /* skip spaces */ 3899 && ((cp) += sizeof (kw)-1)) /* skip spaces */
3915 3900
@@ -3972,7 +3957,7 @@ F_getit (FILE *inf)
3972 return; 3957 return;
3973 for (cp = dbp + 1; *cp != '\0' && intoken (*cp); cp++) 3958 for (cp = dbp + 1; *cp != '\0' && intoken (*cp); cp++)
3974 continue; 3959 continue;
3975 make_tag (dbp, cp-dbp, TRUE, 3960 make_tag (dbp, cp-dbp, true,
3976 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); 3961 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
3977} 3962}
3978 3963
@@ -4049,7 +4034,7 @@ Fortran_functions (FILE *inf)
4049 { 4034 {
4050 dbp = skip_spaces (dbp); 4035 dbp = skip_spaces (dbp);
4051 if (*dbp == '\0') /* assume un-named */ 4036 if (*dbp == '\0') /* assume un-named */
4052 make_tag ("blockdata", 9, TRUE, 4037 make_tag ("blockdata", 9, true,
4053 lb.buffer, dbp - lb.buffer, lineno, linecharno); 4038 lb.buffer, dbp - lb.buffer, lineno, linecharno);
4054 else 4039 else
4055 F_getit (inf); /* look for name */ 4040 F_getit (inf); /* look for name */
@@ -4122,7 +4107,7 @@ Ada_getit (FILE *inf, const char *name_qualifier)
4122 *cp = '\0'; 4107 *cp = '\0';
4123 name = concat (dbp, name_qualifier, ""); 4108 name = concat (dbp, name_qualifier, "");
4124 *cp = c; 4109 *cp = c;
4125 make_tag (name, strlen (name), TRUE, 4110 make_tag (name, strlen (name), true,
4126 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); 4111 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
4127 free (name); 4112 free (name);
4128 if (c == '"') 4113 if (c == '"')
@@ -4134,8 +4119,8 @@ Ada_getit (FILE *inf, const char *name_qualifier)
4134static void 4119static void
4135Ada_funcs (FILE *inf) 4120Ada_funcs (FILE *inf)
4136{ 4121{
4137 bool inquote = FALSE; 4122 bool inquote = false;
4138 bool skip_till_semicolumn = FALSE; 4123 bool skip_till_semicolumn = false;
4139 4124
4140 LOOP_ON_INPUT_LINES (inf, lb, dbp) 4125 LOOP_ON_INPUT_LINES (inf, lb, dbp)
4141 { 4126 {
@@ -4147,13 +4132,13 @@ Ada_funcs (FILE *inf)
4147 dbp = etags_strchr (dbp + !inquote, '"'); 4132 dbp = etags_strchr (dbp + !inquote, '"');
4148 if (dbp != NULL) 4133 if (dbp != NULL)
4149 { 4134 {
4150 inquote = FALSE; 4135 inquote = false;
4151 dbp += 1; 4136 dbp += 1;
4152 continue; /* advance char */ 4137 continue; /* advance char */
4153 } 4138 }
4154 else 4139 else
4155 { 4140 {
4156 inquote = TRUE; 4141 inquote = true;
4157 break; /* advance line */ 4142 break; /* advance line */
4158 } 4143 }
4159 } 4144 }
@@ -4175,7 +4160,7 @@ Ada_funcs (FILE *inf)
4175 if (skip_till_semicolumn) 4160 if (skip_till_semicolumn)
4176 { 4161 {
4177 if (*dbp == ';') 4162 if (*dbp == ';')
4178 skip_till_semicolumn = FALSE; 4163 skip_till_semicolumn = false;
4179 dbp++; 4164 dbp++;
4180 continue; /* advance char */ 4165 continue; /* advance char */
4181 } 4166 }
@@ -4212,7 +4197,7 @@ Ada_funcs (FILE *inf)
4212 { 4197 {
4213 /* when tagging types, avoid tagging use type Pack.Typename; 4198 /* when tagging types, avoid tagging use type Pack.Typename;
4214 for this, we will skip everything till a ; */ 4199 for this, we will skip everything till a ; */
4215 skip_till_semicolumn = TRUE; 4200 skip_till_semicolumn = true;
4216 continue; /* advance char */ 4201 continue; /* advance char */
4217 } 4202 }
4218 4203
@@ -4261,7 +4246,7 @@ Asm_labels (FILE *inf)
4261 cp++; 4246 cp++;
4262 if (*cp == ':' || iswhite (*cp)) 4247 if (*cp == ':' || iswhite (*cp))
4263 /* Found end of label, so copy it and add it to the table. */ 4248 /* Found end of label, so copy it and add it to the table. */
4264 make_tag (lb.buffer, cp - lb.buffer, TRUE, 4249 make_tag (lb.buffer, cp - lb.buffer, true,
4265 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); 4250 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
4266 } 4251 }
4267 } 4252 }
@@ -4275,7 +4260,7 @@ Asm_labels (FILE *inf)
4275 * Perl variable names: /^(my|local).../ 4260 * Perl variable names: /^(my|local).../
4276 * Original code by Bart Robinson <lomew@cs.utah.edu> (1995) 4261 * Original code by Bart Robinson <lomew@cs.utah.edu> (1995)
4277 * Additions by Michael Ernst <mernst@alum.mit.edu> (1997) 4262 * Additions by Michael Ernst <mernst@alum.mit.edu> (1997)
4278 * Ideas by Kai Großjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> (2001) 4263 * Ideas by Kai Großjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> (2001)
4279 */ 4264 */
4280static void 4265static void
4281Perl_functions (FILE *inf) 4266Perl_functions (FILE *inf)
@@ -4305,7 +4290,7 @@ Perl_functions (FILE *inf)
4305 if ((pos = etags_strchr (sp, ':')) != NULL 4290 if ((pos = etags_strchr (sp, ':')) != NULL
4306 && pos < cp && pos[1] == ':') 4291 && pos < cp && pos[1] == ':')
4307 /* The name is already qualified. */ 4292 /* The name is already qualified. */
4308 make_tag (sp, cp - sp, TRUE, 4293 make_tag (sp, cp - sp, true,
4309 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); 4294 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
4310 else 4295 else
4311 /* Qualify it. */ 4296 /* Qualify it. */
@@ -4316,7 +4301,7 @@ Perl_functions (FILE *inf)
4316 *cp = '\0'; 4301 *cp = '\0';
4317 name = concat (package, "::", sp); 4302 name = concat (package, "::", sp);
4318 *cp = savechar; 4303 *cp = savechar;
4319 make_tag (name, strlen (name), TRUE, 4304 make_tag (name, strlen (name), true,
4320 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); 4305 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
4321 free (name); 4306 free (name);
4322 } 4307 }
@@ -4359,7 +4344,7 @@ Perl_functions (FILE *inf)
4359 else 4344 else
4360 continue; 4345 continue;
4361 4346
4362 make_tag (varstart, cp - varstart, FALSE, 4347 make_tag (varstart, cp - varstart, false,
4363 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); 4348 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
4364 } 4349 }
4365 } 4350 }
@@ -4386,7 +4371,7 @@ Python_functions (FILE *inf)
4386 char *name = cp; 4371 char *name = cp;
4387 while (!notinname (*cp) && *cp != ':') 4372 while (!notinname (*cp) && *cp != ':')
4388 cp++; 4373 cp++;
4389 make_tag (name, cp - name, TRUE, 4374 make_tag (name, cp - name, true,
4390 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); 4375 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
4391 } 4376 }
4392 } 4377 }
@@ -4406,8 +4391,8 @@ Python_functions (FILE *inf)
4406static void 4391static void
4407PHP_functions (FILE *inf) 4392PHP_functions (FILE *inf)
4408{ 4393{
4409 register char *cp, *name; 4394 char *cp, *name;
4410 bool search_identifier = FALSE; 4395 bool search_identifier = false;
4411 4396
4412 LOOP_ON_INPUT_LINES (inf, lb, cp) 4397 LOOP_ON_INPUT_LINES (inf, lb, cp)
4413 { 4398 {
@@ -4418,9 +4403,9 @@ PHP_functions (FILE *inf)
4418 { 4403 {
4419 while (!notinname (*cp)) 4404 while (!notinname (*cp))
4420 cp++; 4405 cp++;
4421 make_tag (name, cp - name, TRUE, 4406 make_tag (name, cp - name, true,
4422 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); 4407 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
4423 search_identifier = FALSE; 4408 search_identifier = false;
4424 } 4409 }
4425 else if (LOOKING_AT (cp, "function")) 4410 else if (LOOKING_AT (cp, "function"))
4426 { 4411 {
@@ -4431,11 +4416,11 @@ PHP_functions (FILE *inf)
4431 name = cp; 4416 name = cp;
4432 while (!notinname (*cp)) 4417 while (!notinname (*cp))
4433 cp++; 4418 cp++;
4434 make_tag (name, cp - name, TRUE, 4419 make_tag (name, cp - name, true,
4435 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); 4420 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
4436 } 4421 }
4437 else 4422 else
4438 search_identifier = TRUE; 4423 search_identifier = true;
4439 } 4424 }
4440 else if (LOOKING_AT (cp, "class")) 4425 else if (LOOKING_AT (cp, "class"))
4441 { 4426 {
@@ -4444,11 +4429,11 @@ PHP_functions (FILE *inf)
4444 name = cp; 4429 name = cp;
4445 while (*cp != '\0' && !iswhite (*cp)) 4430 while (*cp != '\0' && !iswhite (*cp))
4446 cp++; 4431 cp++;
4447 make_tag (name, cp - name, FALSE, 4432 make_tag (name, cp - name, false,
4448 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); 4433 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
4449 } 4434 }
4450 else 4435 else
4451 search_identifier = TRUE; 4436 search_identifier = true;
4452 } 4437 }
4453 else if (strneq (cp, "define", 6) 4438 else if (strneq (cp, "define", 6)
4454 && (cp = skip_spaces (cp+6)) 4439 && (cp = skip_spaces (cp+6))
@@ -4459,7 +4444,7 @@ PHP_functions (FILE *inf)
4459 name = cp; 4444 name = cp;
4460 while (*cp != quote && *cp != '\0') 4445 while (*cp != quote && *cp != '\0')
4461 cp++; 4446 cp++;
4462 make_tag (name, cp - name, FALSE, 4447 make_tag (name, cp - name, false,
4463 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); 4448 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
4464 } 4449 }
4465 else if (members 4450 else if (members
@@ -4469,7 +4454,7 @@ PHP_functions (FILE *inf)
4469 name = cp; 4454 name = cp;
4470 while (!notinname (*cp)) 4455 while (!notinname (*cp))
4471 cp++; 4456 cp++;
4472 make_tag (name, cp - name, FALSE, 4457 make_tag (name, cp - name, false,
4473 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); 4458 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
4474 } 4459 }
4475 } 4460 }
@@ -4500,7 +4485,7 @@ Cobol_paragraphs (FILE *inf)
4500 for (ep = bp; ISALNUM (*ep) || *ep == '-'; ep++) 4485 for (ep = bp; ISALNUM (*ep) || *ep == '-'; ep++)
4501 continue; 4486 continue;
4502 if (*ep++ == '.') 4487 if (*ep++ == '.')
4503 make_tag (bp, ep - bp, TRUE, 4488 make_tag (bp, ep - bp, true,
4504 lb.buffer, ep - lb.buffer + 1, lineno, linecharno); 4489 lb.buffer, ep - lb.buffer + 1, lineno, linecharno);
4505 } 4490 }
4506} 4491}
@@ -4529,7 +4514,7 @@ Makefile_targets (FILE *inf)
4529 while (--bp > namestart) 4514 while (--bp > namestart)
4530 if (!notinname (*bp)) 4515 if (!notinname (*bp))
4531 break; 4516 break;
4532 make_tag (namestart, bp - namestart + 1, TRUE, 4517 make_tag (namestart, bp - namestart + 1, true,
4533 lb.buffer, bp - lb.buffer + 2, lineno, linecharno); 4518 lb.buffer, bp - lb.buffer + 2, lineno, linecharno);
4534 } 4519 }
4535 } 4520 }
@@ -4553,7 +4538,7 @@ Pascal_functions (FILE *inf)
4553 int save_lineno, namelen, taglen; 4538 int save_lineno, namelen, taglen;
4554 char c, *name; 4539 char c, *name;
4555 4540
4556 bool /* each of these flags is TRUE if: */ 4541 bool /* each of these flags is true if: */
4557 incomment, /* point is inside a comment */ 4542 incomment, /* point is inside a comment */
4558 inquote, /* point is inside '..' string */ 4543 inquote, /* point is inside '..' string */
4559 get_tagname, /* point is after PROCEDURE/FUNCTION 4544 get_tagname, /* point is after PROCEDURE/FUNCTION
@@ -4571,11 +4556,11 @@ Pascal_functions (FILE *inf)
4571 *dbp = '\0'; 4556 *dbp = '\0';
4572 linebuffer_init (&tline); 4557 linebuffer_init (&tline);
4573 4558
4574 incomment = inquote = FALSE; 4559 incomment = inquote = false;
4575 found_tag = FALSE; /* have a proc name; check if extern */ 4560 found_tag = false; /* have a proc name; check if extern */
4576 get_tagname = FALSE; /* found "procedure" keyword */ 4561 get_tagname = false; /* found "procedure" keyword */
4577 inparms = FALSE; /* found '(' after "proc" */ 4562 inparms = false; /* found '(' after "proc" */
4578 verify_tag = FALSE; /* check if "extern" is ahead */ 4563 verify_tag = false; /* check if "extern" is ahead */
4579 4564
4580 4565
4581 while (!feof (inf)) /* long main loop to get next char */ 4566 while (!feof (inf)) /* long main loop to get next char */
@@ -4596,46 +4581,46 @@ Pascal_functions (FILE *inf)
4596 if (incomment) 4581 if (incomment)
4597 { 4582 {
4598 if (c == '}') /* within { } comments */ 4583 if (c == '}') /* within { } comments */
4599 incomment = FALSE; 4584 incomment = false;
4600 else if (c == '*' && *dbp == ')') /* within (* *) comments */ 4585 else if (c == '*' && *dbp == ')') /* within (* *) comments */
4601 { 4586 {
4602 dbp++; 4587 dbp++;
4603 incomment = FALSE; 4588 incomment = false;
4604 } 4589 }
4605 continue; 4590 continue;
4606 } 4591 }
4607 else if (inquote) 4592 else if (inquote)
4608 { 4593 {
4609 if (c == '\'') 4594 if (c == '\'')
4610 inquote = FALSE; 4595 inquote = false;
4611 continue; 4596 continue;
4612 } 4597 }
4613 else 4598 else
4614 switch (c) 4599 switch (c)
4615 { 4600 {
4616 case '\'': 4601 case '\'':
4617 inquote = TRUE; /* found first quote */ 4602 inquote = true; /* found first quote */
4618 continue; 4603 continue;
4619 case '{': /* found open { comment */ 4604 case '{': /* found open { comment */
4620 incomment = TRUE; 4605 incomment = true;
4621 continue; 4606 continue;
4622 case '(': 4607 case '(':
4623 if (*dbp == '*') /* found open (* comment */ 4608 if (*dbp == '*') /* found open (* comment */
4624 { 4609 {
4625 incomment = TRUE; 4610 incomment = true;
4626 dbp++; 4611 dbp++;
4627 } 4612 }
4628 else if (found_tag) /* found '(' after tag, i.e., parm-list */ 4613 else if (found_tag) /* found '(' after tag, i.e., parm-list */
4629 inparms = TRUE; 4614 inparms = true;
4630 continue; 4615 continue;
4631 case ')': /* end of parms list */ 4616 case ')': /* end of parms list */
4632 if (inparms) 4617 if (inparms)
4633 inparms = FALSE; 4618 inparms = false;
4634 continue; 4619 continue;
4635 case ';': 4620 case ';':
4636 if (found_tag && !inparms) /* end of proc or fn stmt */ 4621 if (found_tag && !inparms) /* end of proc or fn stmt */
4637 { 4622 {
4638 verify_tag = TRUE; 4623 verify_tag = true;
4639 break; 4624 break;
4640 } 4625 }
4641 continue; 4626 continue;
@@ -4649,23 +4634,23 @@ Pascal_functions (FILE *inf)
4649 { 4634 {
4650 if (nocase_tail ("extern")) /* superfluous, really! */ 4635 if (nocase_tail ("extern")) /* superfluous, really! */
4651 { 4636 {
4652 found_tag = FALSE; 4637 found_tag = false;
4653 verify_tag = FALSE; 4638 verify_tag = false;
4654 } 4639 }
4655 } 4640 }
4656 else if (lowcase (*dbp) == 'f') 4641 else if (lowcase (*dbp) == 'f')
4657 { 4642 {
4658 if (nocase_tail ("forward")) /* check for forward reference */ 4643 if (nocase_tail ("forward")) /* check for forward reference */
4659 { 4644 {
4660 found_tag = FALSE; 4645 found_tag = false;
4661 verify_tag = FALSE; 4646 verify_tag = false;
4662 } 4647 }
4663 } 4648 }
4664 if (found_tag && verify_tag) /* not external proc, so make tag */ 4649 if (found_tag && verify_tag) /* not external proc, so make tag */
4665 { 4650 {
4666 found_tag = FALSE; 4651 found_tag = false;
4667 verify_tag = FALSE; 4652 verify_tag = false;
4668 make_tag (name, namelen, TRUE, 4653 make_tag (name, namelen, true,
4669 tline.buffer, taglen, save_lineno, save_lcno); 4654 tline.buffer, taglen, save_lineno, save_lcno);
4670 continue; 4655 continue;
4671 } 4656 }
@@ -4691,8 +4676,8 @@ Pascal_functions (FILE *inf)
4691 taglen = cp - lb.buffer + 1; 4676 taglen = cp - lb.buffer + 1;
4692 4677
4693 dbp = cp; /* set dbp to e-o-token */ 4678 dbp = cp; /* set dbp to e-o-token */
4694 get_tagname = FALSE; 4679 get_tagname = false;
4695 found_tag = TRUE; 4680 found_tag = true;
4696 continue; 4681 continue;
4697 4682
4698 /* And proceed to check for "extern". */ 4683 /* And proceed to check for "extern". */
@@ -4704,11 +4689,11 @@ Pascal_functions (FILE *inf)
4704 { 4689 {
4705 case 'p': 4690 case 'p':
4706 if (nocase_tail ("rocedure")) /* c = 'p', dbp has advanced */ 4691 if (nocase_tail ("rocedure")) /* c = 'p', dbp has advanced */
4707 get_tagname = TRUE; 4692 get_tagname = true;
4708 continue; 4693 continue;
4709 case 'f': 4694 case 'f':
4710 if (nocase_tail ("unction")) 4695 if (nocase_tail ("unction"))
4711 get_tagname = TRUE; 4696 get_tagname = true;
4712 continue; 4697 continue;
4713 } 4698 }
4714 } 4699 }
@@ -4837,7 +4822,7 @@ PS_functions (FILE *inf)
4837 *ep != '\0' && *ep != ' ' && *ep != '{'; 4822 *ep != '\0' && *ep != ' ' && *ep != '{';
4838 ep++) 4823 ep++)
4839 continue; 4824 continue;
4840 make_tag (bp, ep - bp, TRUE, 4825 make_tag (bp, ep - bp, true,
4841 lb.buffer, ep - lb.buffer + 1, lineno, linecharno); 4826 lb.buffer, ep - lb.buffer + 1, lineno, linecharno);
4842 } 4827 }
4843 else if (LOOKING_AT (bp, "defineps")) 4828 else if (LOOKING_AT (bp, "defineps"))
@@ -4967,14 +4952,14 @@ TeX_commands (FILE *inf)
4967 for (key = TEX_toktab; key->buffer != NULL; key++) 4952 for (key = TEX_toktab; key->buffer != NULL; key++)
4968 if (strneq (cp, key->buffer, key->len)) 4953 if (strneq (cp, key->buffer, key->len))
4969 { 4954 {
4970 register char *p; 4955 char *p;
4971 int namelen, linelen; 4956 int namelen, linelen;
4972 bool opgrp = FALSE; 4957 bool opgrp = false;
4973 4958
4974 cp = skip_spaces (cp + key->len); 4959 cp = skip_spaces (cp + key->len);
4975 if (*cp == TEX_opgrp) 4960 if (*cp == TEX_opgrp)
4976 { 4961 {
4977 opgrp = TRUE; 4962 opgrp = true;
4978 cp++; 4963 cp++;
4979 } 4964 }
4980 for (p = cp; 4965 for (p = cp;
@@ -4990,7 +4975,7 @@ TeX_commands (FILE *inf)
4990 p++; 4975 p++;
4991 linelen = p - lb.buffer + 1; 4976 linelen = p - lb.buffer + 1;
4992 } 4977 }
4993 make_tag (cp, namelen, TRUE, 4978 make_tag (cp, namelen, true,
4994 lb.buffer, linelen, lineno, linecharno); 4979 lb.buffer, linelen, lineno, linecharno);
4995 goto tex_next_line; /* We only tag a line once */ 4980 goto tex_next_line; /* We only tag a line once */
4996 } 4981 }
@@ -5094,7 +5079,7 @@ Texinfo_nodes (FILE *inf)
5094 start = cp; 5079 start = cp;
5095 while (*cp != '\0' && *cp != ',') 5080 while (*cp != '\0' && *cp != ',')
5096 cp++; 5081 cp++;
5097 make_tag (start, cp - start, TRUE, 5082 make_tag (start, cp - start, true,
5098 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); 5083 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
5099 } 5084 }
5100} 5085}
@@ -5105,15 +5090,15 @@ Texinfo_nodes (FILE *inf)
5105 * Contents of <title>, <h1>, <h2>, <h3> are tags. 5090 * Contents of <title>, <h1>, <h2>, <h3> are tags.
5106 * Contents of <a name=xxx> are tags with name xxx. 5091 * Contents of <a name=xxx> are tags with name xxx.
5107 * 5092 *
5108 * Francesco Potortì, 2002. 5093 * Francesco Potortì, 2002.
5109 */ 5094 */
5110static void 5095static void
5111HTML_labels (FILE *inf) 5096HTML_labels (FILE *inf)
5112{ 5097{
5113 bool getnext = FALSE; /* next text outside of HTML tags is a tag */ 5098 bool getnext = false; /* next text outside of HTML tags is a tag */
5114 bool skiptag = FALSE; /* skip to the end of the current HTML tag */ 5099 bool skiptag = false; /* skip to the end of the current HTML tag */
5115 bool intag = FALSE; /* inside an html tag, looking for ID= */ 5100 bool intag = false; /* inside an html tag, looking for ID= */
5116 bool inanchor = FALSE; /* when INTAG, is an anchor, look for NAME= */ 5101 bool inanchor = false; /* when INTAG, is an anchor, look for NAME= */
5117 char *end; 5102 char *end;
5118 5103
5119 5104
@@ -5129,7 +5114,7 @@ HTML_labels (FILE *inf)
5129 if (*dbp == '>') 5114 if (*dbp == '>')
5130 { 5115 {
5131 dbp += 1; 5116 dbp += 1;
5132 skiptag = FALSE; 5117 skiptag = false;
5133 continue; /* look on the same line */ 5118 continue; /* look on the same line */
5134 } 5119 }
5135 break; /* go to next line */ 5120 break; /* go to next line */
@@ -5145,7 +5130,7 @@ HTML_labels (FILE *inf)
5145 if (*dbp == '>') 5130 if (*dbp == '>')
5146 { 5131 {
5147 dbp += 1; 5132 dbp += 1;
5148 intag = FALSE; 5133 intag = false;
5149 continue; /* look on the same line */ 5134 continue; /* look on the same line */
5150 } 5135 }
5151 if ((inanchor && LOOKING_AT_NOCASE (dbp, "name=")) 5136 if ((inanchor && LOOKING_AT_NOCASE (dbp, "name="))
@@ -5164,9 +5149,9 @@ HTML_labels (FILE *inf)
5164 token_name.buffer[end - dbp] = '\0'; 5149 token_name.buffer[end - dbp] = '\0';
5165 5150
5166 dbp = end; 5151 dbp = end;
5167 intag = FALSE; /* we found what we looked for */ 5152 intag = false; /* we found what we looked for */
5168 skiptag = TRUE; /* skip to the end of the tag */ 5153 skiptag = true; /* skip to the end of the tag */
5169 getnext = TRUE; /* then grab the text */ 5154 getnext = true; /* then grab the text */
5170 continue; /* look on the same line */ 5155 continue; /* look on the same line */
5171 } 5156 }
5172 dbp += 1; 5157 dbp += 1;
@@ -5179,17 +5164,17 @@ HTML_labels (FILE *inf)
5179 break; /* go to next line */ 5164 break; /* go to next line */
5180 if (*dbp == '<') 5165 if (*dbp == '<')
5181 { 5166 {
5182 intag = TRUE; 5167 intag = true;
5183 inanchor = (lowcase (dbp[1]) == 'a' && !intoken (dbp[2])); 5168 inanchor = (lowcase (dbp[1]) == 'a' && !intoken (dbp[2]));
5184 continue; /* look on the same line */ 5169 continue; /* look on the same line */
5185 } 5170 }
5186 5171
5187 for (end = dbp + 1; *end != '\0' && *end != '<'; end++) 5172 for (end = dbp + 1; *end != '\0' && *end != '<'; end++)
5188 continue; 5173 continue;
5189 make_tag (token_name.buffer, token_name.len, TRUE, 5174 make_tag (token_name.buffer, token_name.len, true,
5190 dbp, end - dbp, lineno, linecharno); 5175 dbp, end - dbp, lineno, linecharno);
5191 linebuffer_setlen (&token_name, 0); /* no name in buffer */ 5176 linebuffer_setlen (&token_name, 0); /* no name in buffer */
5192 getnext = FALSE; 5177 getnext = false;
5193 break; /* go to next line */ 5178 break; /* go to next line */
5194 } 5179 }
5195 5180
@@ -5199,10 +5184,10 @@ HTML_labels (FILE *inf)
5199 dbp++; 5184 dbp++;
5200 if (*dbp == '\0') 5185 if (*dbp == '\0')
5201 break; /* go to next line */ 5186 break; /* go to next line */
5202 intag = TRUE; 5187 intag = true;
5203 if (lowcase (dbp[1]) == 'a' && !intoken (dbp[2])) 5188 if (lowcase (dbp[1]) == 'a' && !intoken (dbp[2]))
5204 { 5189 {
5205 inanchor = TRUE; 5190 inanchor = true;
5206 continue; /* look on the same line */ 5191 continue; /* look on the same line */
5207 } 5192 }
5208 else if (LOOKING_AT_NOCASE (dbp, "<title>") 5193 else if (LOOKING_AT_NOCASE (dbp, "<title>")
@@ -5210,8 +5195,8 @@ HTML_labels (FILE *inf)
5210 || LOOKING_AT_NOCASE (dbp, "<h2>") 5195 || LOOKING_AT_NOCASE (dbp, "<h2>")
5211 || LOOKING_AT_NOCASE (dbp, "<h3>")) 5196 || LOOKING_AT_NOCASE (dbp, "<h3>"))
5212 { 5197 {
5213 intag = FALSE; 5198 intag = false;
5214 getnext = TRUE; 5199 getnext = true;
5215 continue; /* look on the same line */ 5200 continue; /* look on the same line */
5216 } 5201 }
5217 dbp += 1; 5202 dbp += 1;
@@ -5316,7 +5301,7 @@ prolog_pr (char *s, char *last)
5316 || len != strlen (last) 5301 || len != strlen (last)
5317 || !strneq (s, last, len))) 5302 || !strneq (s, last, len)))
5318 { 5303 {
5319 make_tag (s, len, TRUE, s, pos, lineno, linecharno); 5304 make_tag (s, len, true, s, pos, lineno, linecharno);
5320 return len; 5305 return len;
5321 } 5306 }
5322 else 5307 else
@@ -5472,7 +5457,7 @@ erlang_func (char *s, char *last)
5472 || len != (int)strlen (last) 5457 || len != (int)strlen (last)
5473 || !strneq (s, last, len))) 5458 || !strneq (s, last, len)))
5474 { 5459 {
5475 make_tag (s, len, TRUE, s, pos, lineno, linecharno); 5460 make_tag (s, len, true, s, pos, lineno, linecharno);
5476 return len; 5461 return len;
5477 } 5462 }
5478 5463
@@ -5499,7 +5484,7 @@ erlang_attribute (char *s)
5499 { 5484 {
5500 int len = erlang_atom (skip_spaces (cp)); 5485 int len = erlang_atom (skip_spaces (cp));
5501 if (len > 0) 5486 if (len > 0)
5502 make_tag (cp, len, TRUE, s, cp + len - s, lineno, linecharno); 5487 make_tag (cp, len, true, s, cp + len - s, lineno, linecharno);
5503 } 5488 }
5504 return; 5489 return;
5505} 5490}
@@ -5552,7 +5537,7 @@ scan_separators (char *name)
5552{ 5537{
5553 char sep = name[0]; 5538 char sep = name[0];
5554 char *copyto = name; 5539 char *copyto = name;
5555 bool quoted = FALSE; 5540 bool quoted = false;
5556 5541
5557 for (++name; *name != '\0'; ++name) 5542 for (++name; *name != '\0'; ++name)
5558 { 5543 {
@@ -5580,10 +5565,10 @@ scan_separators (char *name)
5580 } 5565 }
5581 break; 5566 break;
5582 } 5567 }
5583 quoted = FALSE; 5568 quoted = false;
5584 } 5569 }
5585 else if (*name == '\\') 5570 else if (*name == '\\')
5586 quoted = TRUE; 5571 quoted = true;
5587 else if (*name == sep) 5572 else if (*name == sep)
5588 break; 5573 break;
5589 else 5574 else
@@ -5628,10 +5613,7 @@ analyse_regex (char *regex_arg)
5628 /* regexfile is a file containing regexps, one per line. */ 5613 /* regexfile is a file containing regexps, one per line. */
5629 regexfp = fopen (regexfile, "r"); 5614 regexfp = fopen (regexfile, "r");
5630 if (regexfp == NULL) 5615 if (regexfp == NULL)
5631 { 5616 pfatal (regexfile);
5632 pfatal (regexfile);
5633 return;
5634 }
5635 linebuffer_init (&regexbuf); 5617 linebuffer_init (&regexbuf);
5636 while (readline_internal (&regexbuf, regexfp) > 0) 5618 while (readline_internal (&regexbuf, regexfp) > 0)
5637 analyse_regex (regexbuf.buffer); 5619 analyse_regex (regexbuf.buffer);
@@ -5680,10 +5662,10 @@ add_regex (char *regexp_pattern, language *lang)
5680 struct re_pattern_buffer *patbuf; 5662 struct re_pattern_buffer *patbuf;
5681 regexp *rp; 5663 regexp *rp;
5682 bool 5664 bool
5683 force_explicit_name = TRUE, /* do not use implicit tag names */ 5665 force_explicit_name = true, /* do not use implicit tag names */
5684 ignore_case = FALSE, /* case is significant */ 5666 ignore_case = false, /* case is significant */
5685 multi_line = FALSE, /* matches are done one line at a time */ 5667 multi_line = false, /* matches are done one line at a time */
5686 single_line = FALSE; /* dot does not match newline */ 5668 single_line = false; /* dot does not match newline */
5687 5669
5688 5670
5689 if (strlen (regexp_pattern) < 3) 5671 if (strlen (regexp_pattern) < 3)
@@ -5719,17 +5701,17 @@ add_regex (char *regexp_pattern, language *lang)
5719 case 'N': 5701 case 'N':
5720 if (modifiers == name) 5702 if (modifiers == name)
5721 error ("forcing explicit tag name but no name, ignoring"); 5703 error ("forcing explicit tag name but no name, ignoring");
5722 force_explicit_name = TRUE; 5704 force_explicit_name = true;
5723 break; 5705 break;
5724 case 'i': 5706 case 'i':
5725 ignore_case = TRUE; 5707 ignore_case = true;
5726 break; 5708 break;
5727 case 's': 5709 case 's':
5728 single_line = TRUE; 5710 single_line = true;
5729 /* FALLTHRU */ 5711 /* FALLTHRU */
5730 case 'm': 5712 case 'm':
5731 multi_line = TRUE; 5713 multi_line = true;
5732 need_filebuf = TRUE; 5714 need_filebuf = true;
5733 break; 5715 break;
5734 default: 5716 default:
5735 error ("invalid regexp modifier `%c', ignoring", modifiers[0]); 5717 error ("invalid regexp modifier `%c', ignoring", modifiers[0]);
@@ -5773,7 +5755,7 @@ add_regex (char *regexp_pattern, language *lang)
5773 p_head->lang = lang; 5755 p_head->lang = lang;
5774 p_head->pat = patbuf; 5756 p_head->pat = patbuf;
5775 p_head->name = savestr (name); 5757 p_head->name = savestr (name);
5776 p_head->error_signaled = FALSE; 5758 p_head->error_signaled = false;
5777 p_head->force_explicit_name = force_explicit_name; 5759 p_head->force_explicit_name = force_explicit_name;
5778 p_head->ignore_case = ignore_case; 5760 p_head->ignore_case = ignore_case;
5779 p_head->multi_line = multi_line; 5761 p_head->multi_line = multi_line;
@@ -5887,7 +5869,7 @@ regex_tag_multiline (void)
5887 { 5869 {
5888 error ("regexp stack overflow while matching \"%s\"", 5870 error ("regexp stack overflow while matching \"%s\"",
5889 rp->pattern); 5871 rp->pattern);
5890 rp->error_signaled = TRUE; 5872 rp->error_signaled = true;
5891 } 5873 }
5892 break; 5874 break;
5893 case -1: 5875 case -1:
@@ -5900,7 +5882,7 @@ regex_tag_multiline (void)
5900 { 5882 {
5901 error ("regexp matches the empty string: \"%s\"", 5883 error ("regexp matches the empty string: \"%s\"",
5902 rp->pattern); 5884 rp->pattern);
5903 rp->error_signaled = TRUE; 5885 rp->error_signaled = true;
5904 } 5886 }
5905 match = -3; /* exit from while loop */ 5887 match = -3; /* exit from while loop */
5906 break; 5888 break;
@@ -5917,10 +5899,10 @@ regex_tag_multiline (void)
5917 name = substitute (buffer, rp->name, &rp->regs); 5899 name = substitute (buffer, rp->name, &rp->regs);
5918 if (rp->force_explicit_name) 5900 if (rp->force_explicit_name)
5919 /* Force explicit tag name, if a name is there. */ 5901 /* Force explicit tag name, if a name is there. */
5920 pfnote (name, TRUE, buffer + linecharno, 5902 pfnote (name, true, buffer + linecharno,
5921 charno - linecharno + 1, lineno, linecharno); 5903 charno - linecharno + 1, lineno, linecharno);
5922 else 5904 else
5923 make_tag (name, strlen (name), TRUE, buffer + linecharno, 5905 make_tag (name, strlen (name), true, buffer + linecharno,
5924 charno - linecharno + 1, lineno, linecharno); 5906 charno - linecharno + 1, lineno, linecharno);
5925 break; 5907 break;
5926 } 5908 }
@@ -5939,9 +5921,9 @@ nocase_tail (const char *cp)
5939 if (*cp == '\0' && !intoken (dbp[len])) 5921 if (*cp == '\0' && !intoken (dbp[len]))
5940 { 5922 {
5941 dbp += len; 5923 dbp += len;
5942 return TRUE; 5924 return true;
5943 } 5925 }
5944 return FALSE; 5926 return false;
5945} 5927}
5946 5928
5947static void 5929static void
@@ -5954,7 +5936,7 @@ get_tag (register char *bp, char **namepp)
5954 /* Go till you get to white space or a syntactic break */ 5936 /* Go till you get to white space or a syntactic break */
5955 for (cp = bp + 1; !notinname (*cp); cp++) 5937 for (cp = bp + 1; !notinname (*cp); cp++)
5956 continue; 5938 continue;
5957 make_tag (bp, cp - bp, TRUE, 5939 make_tag (bp, cp - bp, true,
5958 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); 5940 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
5959 } 5941 }
5960 5942
@@ -6089,7 +6071,7 @@ readline (linebuffer *lbp, FILE *stream)
6089 char *taggedfname; /* name of original file as given */ 6071 char *taggedfname; /* name of original file as given */
6090 char *name; /* temp var */ 6072 char *name; /* temp var */
6091 6073
6092 discard_until_line_directive = FALSE; /* found it */ 6074 discard_until_line_directive = false; /* found it */
6093 name = lbp->buffer + start; 6075 name = lbp->buffer + start;
6094 *endp = '\0'; 6076 *endp = '\0';
6095 canonicalize_filename (name); 6077 canonicalize_filename (name);
@@ -6137,7 +6119,7 @@ readline (linebuffer *lbp, FILE *stream)
6137 for (fdp = fdhead; fdp != NULL; fdp = fdp->next) 6119 for (fdp = fdhead; fdp != NULL; fdp = fdp->next)
6138 if (streq (fdp->infabsname, taggedabsname)) 6120 if (streq (fdp->infabsname, taggedabsname))
6139 { 6121 {
6140 discard_until_line_directive = TRUE; 6122 discard_until_line_directive = true;
6141 free (taggedfname); 6123 free (taggedfname);
6142 break; 6124 break;
6143 } 6125 }
@@ -6153,9 +6135,9 @@ readline (linebuffer *lbp, FILE *stream)
6153 fdhead->infabsname = savestr (curfdp->infabsname); 6135 fdhead->infabsname = savestr (curfdp->infabsname);
6154 fdhead->infabsdir = savestr (curfdp->infabsdir); 6136 fdhead->infabsdir = savestr (curfdp->infabsdir);
6155 fdhead->taggedfname = taggedfname; 6137 fdhead->taggedfname = taggedfname;
6156 fdhead->usecharno = FALSE; 6138 fdhead->usecharno = false;
6157 fdhead->prop = NULL; 6139 fdhead->prop = NULL;
6158 fdhead->written = FALSE; 6140 fdhead->written = false;
6159 curfdp = fdhead; 6141 curfdp = fdhead;
6160 } 6142 }
6161 } 6143 }
@@ -6178,7 +6160,7 @@ readline (linebuffer *lbp, FILE *stream)
6178 return; 6160 return;
6179 } 6161 }
6180 /* End of file. */ 6162 /* End of file. */
6181 discard_until_line_directive = FALSE; 6163 discard_until_line_directive = false;
6182 return; 6164 return;
6183 } 6165 }
6184 } /* if #line directives should be considered */ 6166 } /* if #line directives should be considered */
@@ -6208,7 +6190,7 @@ readline (linebuffer *lbp, FILE *stream)
6208 { 6190 {
6209 error ("regexp stack overflow while matching \"%s\"", 6191 error ("regexp stack overflow while matching \"%s\"",
6210 rp->pattern); 6192 rp->pattern);
6211 rp->error_signaled = TRUE; 6193 rp->error_signaled = true;
6212 } 6194 }
6213 break; 6195 break;
6214 case -1: 6196 case -1:
@@ -6219,7 +6201,7 @@ readline (linebuffer *lbp, FILE *stream)
6219 if (!rp->error_signaled) 6201 if (!rp->error_signaled)
6220 { 6202 {
6221 error ("regexp matches the empty string: \"%s\"", rp->pattern); 6203 error ("regexp matches the empty string: \"%s\"", rp->pattern);
6222 rp->error_signaled = TRUE; 6204 rp->error_signaled = true;
6223 } 6205 }
6224 break; 6206 break;
6225 default: 6207 default:
@@ -6231,9 +6213,9 @@ readline (linebuffer *lbp, FILE *stream)
6231 name = substitute (lbp->buffer, rp->name, &rp->regs); 6213 name = substitute (lbp->buffer, rp->name, &rp->regs);
6232 if (rp->force_explicit_name) 6214 if (rp->force_explicit_name)
6233 /* Force explicit tag name, if a name is there. */ 6215 /* Force explicit tag name, if a name is there. */
6234 pfnote (name, TRUE, lbp->buffer, match, lineno, linecharno); 6216 pfnote (name, true, lbp->buffer, match, lineno, linecharno);
6235 else 6217 else
6236 make_tag (name, strlen (name), TRUE, 6218 make_tag (name, strlen (name), true,
6237 lbp->buffer, match, lineno, linecharno); 6219 lbp->buffer, match, lineno, linecharno);
6238 break; 6220 break;
6239 } 6221 }
@@ -6259,12 +6241,9 @@ savestr (const char *cp)
6259static char * 6241static char *
6260savenstr (const char *cp, int len) 6242savenstr (const char *cp, int len)
6261{ 6243{
6262 register char *dp; 6244 char *dp = xnew (len + 1, char);
6263
6264 dp = xnew (len + 1, char);
6265 memcpy (dp, cp, len);
6266 dp[len] = '\0'; 6245 dp[len] = '\0';
6267 return dp; 6246 return memcpy (dp, cp, len);
6268} 6247}
6269 6248
6270/* 6249/*
@@ -6378,7 +6357,6 @@ concat (const char *s1, const char *s2, const char *s3)
6378 strcpy (result, s1); 6357 strcpy (result, s1);
6379 strcpy (result + len1, s2); 6358 strcpy (result + len1, s2);
6380 strcpy (result + len1 + len2, s3); 6359 strcpy (result + len1 + len2, s3);
6381 result[len1 + len2 + len3] = '\0';
6382 6360
6383 return result; 6361 return result;
6384} 6362}
diff --git a/lib-src/grep-changelog b/lib-src/grep-changelog
index ace4d48df3e..ab8c5e38618 100755
--- a/lib-src/grep-changelog
+++ b/lib-src/grep-changelog
@@ -1,6 +1,6 @@
1#! /usr/bin/perl 1#! /usr/bin/perl
2 2
3# Copyright (C) 1999-2013 Free Software Foundation, Inc. 3# Copyright (C) 1999-2014 Free Software Foundation, Inc.
4# 4#
5# This file is part of GNU Emacs. 5# This file is part of GNU Emacs.
6 6
diff --git a/lib-src/hexl.c b/lib-src/hexl.c
index 3208a895aa2..9e21ddf9de6 100644
--- a/lib-src/hexl.c
+++ b/lib-src/hexl.c
@@ -1,5 +1,5 @@
1/* Convert files for Emacs Hexl mode. 1/* Convert files for Emacs Hexl mode.
2 Copyright (C) 1989, 2001-2013 Free Software Foundation, Inc. 2 Copyright (C) 1989, 2001-2014 Free Software Foundation, Inc.
3 3
4Author: Keith Gabryelski 4Author: Keith Gabryelski
5(according to authors.el) 5(according to authors.el)
@@ -37,12 +37,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
37#define DEFAULT_GROUPING 0x01 37#define DEFAULT_GROUPING 0x01
38#define DEFAULT_BASE 16 38#define DEFAULT_BASE 16
39 39
40#undef TRUE 40int base = DEFAULT_BASE;
41#undef FALSE 41bool un_flag = false, iso_flag = false, endian = true;
42#define TRUE (1)
43#define FALSE (0)
44
45int base = DEFAULT_BASE, un_flag = FALSE, iso_flag = FALSE, endian = 1;
46int group_by = DEFAULT_GROUPING; 42int group_by = DEFAULT_GROUPING;
47char *progname; 43char *progname;
48 44
@@ -83,7 +79,7 @@ main (int argc, char **argv)
83 } 79 }
84 else if (!strcmp (*argv, "-un") || !strcmp (*argv, "-de")) 80 else if (!strcmp (*argv, "-un") || !strcmp (*argv, "-de"))
85 { 81 {
86 un_flag = TRUE; 82 un_flag = true;
87 --argc; argv++; 83 --argc; argv++;
88 } 84 }
89 else if (!strcmp (*argv, "-hex")) 85 else if (!strcmp (*argv, "-hex"))
@@ -93,7 +89,7 @@ main (int argc, char **argv)
93 } 89 }
94 else if (!strcmp (*argv, "-iso")) 90 else if (!strcmp (*argv, "-iso"))
95 { 91 {
96 iso_flag = TRUE; 92 iso_flag = true;
97 --argc; argv++; 93 --argc; argv++;
98 } 94 }
99 else if (!strcmp (*argv, "-oct")) 95 else if (!strcmp (*argv, "-oct"))
@@ -103,12 +99,12 @@ main (int argc, char **argv)
103 } 99 }
104 else if (!strcmp (*argv, "-big-endian")) 100 else if (!strcmp (*argv, "-big-endian"))
105 { 101 {
106 endian = 1; 102 endian = true;
107 --argc; argv++; 103 --argc; argv++;
108 } 104 }
109 else if (!strcmp (*argv, "-little-endian")) 105 else if (!strcmp (*argv, "-little-endian"))
110 { 106 {
111 endian = 0; 107 endian = false;
112 --argc; argv++; 108 --argc; argv++;
113 } 109 }
114 else if (!strcmp (*argv, "-group-by-8-bits")) 110 else if (!strcmp (*argv, "-group-by-8-bits"))
@@ -129,7 +125,7 @@ main (int argc, char **argv)
129 else if (!strcmp (*argv, "-group-by-64-bits")) 125 else if (!strcmp (*argv, "-group-by-64-bits"))
130 { 126 {
131 group_by = 0x07; 127 group_by = 0x07;
132 endian = 0; 128 endian = false;
133 --argc; argv++; 129 --argc; argv++;
134 } 130 }
135 else 131 else
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c
index 68e5279fd15..2eb2413815e 100644
--- a/lib-src/make-docfile.c
+++ b/lib-src/make-docfile.c
@@ -1,6 +1,6 @@
1/* Generate doc-string file for GNU Emacs from source files. 1/* Generate doc-string file for GNU Emacs from source files.
2 2
3Copyright (C) 1985-1986, 1992-1994, 1997, 1999-2013 Free Software 3Copyright (C) 1985-1986, 1992-1994, 1997, 1999-2014 Free Software
4Foundation, Inc. 4Foundation, Inc.
5 5
6This file is part of GNU Emacs. 6This file is part of GNU Emacs.
@@ -276,7 +276,7 @@ struct rcsoc_state
276/* Output CH to the file or buffer in STATE. Any pending newlines or 276/* Output CH to the file or buffer in STATE. Any pending newlines or
277 spaces are output first. */ 277 spaces are output first. */
278 278
279static inline void 279static void
280put_char (int ch, struct rcsoc_state *state) 280put_char (int ch, struct rcsoc_state *state)
281{ 281{
282 int out_ch; 282 int out_ch;
@@ -555,7 +555,7 @@ enum global_type
555 LISP_OBJECT, 555 LISP_OBJECT,
556 EMACS_INTEGER, 556 EMACS_INTEGER,
557 BOOLEAN, 557 BOOLEAN,
558 FUNCTION, 558 FUNCTION
559}; 559};
560 560
561/* A single global. */ 561/* A single global. */
@@ -1075,7 +1075,7 @@ read_lisp_symbol (FILE *infile, char *buffer)
1075static int 1075static int
1076search_lisp_doc_at_eol (FILE *infile) 1076search_lisp_doc_at_eol (FILE *infile)
1077{ 1077{
1078 char c = 0, c1 = 0, c2 = 0; 1078 int c = 0, c1 = 0, c2 = 0;
1079 1079
1080 /* Skip until the end of line; remember two previous chars. */ 1080 /* Skip until the end of line; remember two previous chars. */
1081 while (c != '\n' && c != '\r' && c != EOF) 1081 while (c != '\n' && c != '\r' && c != EOF)
@@ -1090,8 +1090,7 @@ search_lisp_doc_at_eol (FILE *infile)
1090 if (c2 != '"' || c1 != '\\') 1090 if (c2 != '"' || c1 != '\\')
1091 { 1091 {
1092#ifdef DEBUG 1092#ifdef DEBUG
1093 fprintf (stderr, "## non-docstring in %s (%s)\n", 1093 fprintf (stderr, "## non-docstring found\n");
1094 buffer, filename);
1095#endif 1094#endif
1096 if (c != EOF) 1095 if (c != EOF)
1097 ungetc (c, infile); 1096 ungetc (c, infile);
diff --git a/lib-src/makefile.w32-in b/lib-src/makefile.w32-in
index 8d016bc16be..773c89745e5 100644
--- a/lib-src/makefile.w32-in
+++ b/lib-src/makefile.w32-in
@@ -1,5 +1,5 @@
1# -*- Makefile -*- for GNU Emacs on the Microsoft Windows API. 1# -*- Makefile -*- for GNU Emacs on the Microsoft Windows API.
2# Copyright (C) 2000-2013 Free Software Foundation, Inc. 2# Copyright (C) 2000-2014 Free Software Foundation, Inc.
3 3
4# This file is part of GNU Emacs. 4# This file is part of GNU Emacs.
5 5
@@ -27,6 +27,7 @@ LOCAL_FLAGS = -DNO_LDAV=1 -DNO_ARCHIVES=1 -I../lib \
27 -I../nt/inc -I../src $(EMACS_EXTRA_C_FLAGS) 27 -I../nt/inc -I../src $(EMACS_EXTRA_C_FLAGS)
28 28
29LIBS = $(BASE_LIBS) $(ADVAPI32) 29LIBS = $(BASE_LIBS) $(ADVAPI32)
30LIB_SRC = .
30 31
31# The following target is used by makefile.w32-in files in other directories. 32# The following target is used by makefile.w32-in files in other directories.
32make-docfile: $(BLD)/make-docfile.exe 33make-docfile: $(BLD)/make-docfile.exe
@@ -250,6 +251,7 @@ lisp2 = \
250 $(lispsource)register.elc \ 251 $(lispsource)register.elc \
251 $(lispsource)replace.elc \ 252 $(lispsource)replace.elc \
252 $(lispsource)simple.elc \ 253 $(lispsource)simple.elc \
254 $(lispsource)emacs-lisp/nadvice.elc \
253 $(lispsource)minibuffer.elc \ 255 $(lispsource)minibuffer.elc \
254 $(lispsource)startup.elc \ 256 $(lispsource)startup.elc \
255 $(lispsource)subr.elc \ 257 $(lispsource)subr.elc \
@@ -291,10 +293,10 @@ $(DOC): stamp_BLD $(BLD)/make-docfile.exe ../src/$(BLD)/temacs.exe $(lisp1) $(l
291 "$(THISDIR)/$(BLD)/make-docfile" -a $(DOC) -d ../src $(lisp1) 293 "$(THISDIR)/$(BLD)/make-docfile" -a $(DOC) -d ../src $(lisp1)
292 "$(THISDIR)/$(BLD)/make-docfile" -a $(DOC) -d ../src $(lisp2) 294 "$(THISDIR)/$(BLD)/make-docfile" -a $(DOC) -d ../src $(lisp2)
293 "$(THISDIR)/$(BLD)/make-docfile" -a $(DOC) -d ../src $(OTHER_PLATFORM_SUPPORT) 295 "$(THISDIR)/$(BLD)/make-docfile" -a $(DOC) -d ../src $(OTHER_PLATFORM_SUPPORT)
294 $(CP) $(DOC) ../etc/DOC-X 296 $(CP) $(DOC) ../etc/DOC
295 - mkdir "../src/$(OBJDIR)" 297 - mkdir "../src/$(OBJDIR)"
296 - mkdir "../src/$(OBJDIR)/etc" 298 - mkdir "../src/$(OBJDIR)/etc"
297 $(CP) $(DOC) ../src/$(OBJDIR)/etc/DOC-X 299 $(CP) $(DOC) ../src/$(OBJDIR)/etc/DOC
298 300
299{$(BLD)}.$(O){$(BLD)}.exe: 301{$(BLD)}.$(O){$(BLD)}.exe:
300 $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $*.$(O) $(LIBS) 302 $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $*.$(O) $(LIBS)
@@ -360,7 +362,6 @@ TAGS: $(BLD)/etags.exe *.c *.h
360### DEPENDENCIES ### 362### DEPENDENCIES ###
361 363
362EMACS_ROOT = .. 364EMACS_ROOT = ..
363LIB_SRC = .
364SRC = $(EMACS_ROOT)/src 365SRC = $(EMACS_ROOT)/src
365NT_INC = $(EMACS_ROOT)/nt/inc 366NT_INC = $(EMACS_ROOT)/nt/inc
366GNU_LIB = $(EMACS_ROOT)/lib 367GNU_LIB = $(EMACS_ROOT)/lib
diff --git a/lib-src/movemail.c b/lib-src/movemail.c
index cf93fb78d98..d0d00fcf4cc 100644
--- a/lib-src/movemail.c
+++ b/lib-src/movemail.c
@@ -1,7 +1,7 @@
1/* movemail foo bar -- move file foo to file bar, 1/* movemail foo bar -- move file foo to file bar,
2 locking file foo the way /bin/mail respects. 2 locking file foo the way /bin/mail respects.
3 3
4Copyright (C) 1986, 1992-1994, 1996, 1999, 2001-2013 Free Software 4Copyright (C) 1986, 1992-1994, 1996, 1999, 2001-2014 Free Software
5Foundation, Inc. 5Foundation, Inc.
6 6
7This file is part of GNU Emacs. 7This file is part of GNU Emacs.
@@ -304,24 +304,13 @@ main (int argc, char **argv)
304 304
305 memcpy (tempname, inname, inname_dirlen); 305 memcpy (tempname, inname, inname_dirlen);
306 strcpy (tempname + inname_dirlen, "EXXXXXX"); 306 strcpy (tempname + inname_dirlen, "EXXXXXX");
307#ifdef HAVE_MKSTEMP 307 desc = mkostemp (tempname, 0);
308 desc = mkstemp (tempname);
309#else
310 mktemp (tempname);
311 if (!*tempname)
312 desc = -1;
313 else
314 {
315 unlink (tempname);
316 desc = open (tempname, O_WRONLY | O_CREAT | O_EXCL, 0600);
317 }
318#endif
319 if (desc < 0) 308 if (desc < 0)
320 { 309 {
321 int mkstemp_errno = errno; 310 int mkostemp_errno = errno;
322 error ("error while creating what would become the lock file", 311 error ("error while creating what would become the lock file",
323 0, 0); 312 0, 0);
324 errno = mkstemp_errno; 313 errno = mkostemp_errno;
325 pfatal_with_name (tempname); 314 pfatal_with_name (tempname);
326 } 315 }
327 close (desc); 316 close (desc);
@@ -380,13 +369,9 @@ main (int argc, char **argv)
380 if (indesc < 0) 369 if (indesc < 0)
381 pfatal_with_name (inname); 370 pfatal_with_name (inname);
382 371
383#ifdef BSD_SYSTEM 372 /* Make sure the user can read the output file. */
384 /* In case movemail is setuid to root, make sure the user can 373 umask (umask (0) & 0377);
385 read the output file. */ 374
386 /* This is desirable for all systems
387 but I don't want to assume all have the umask system call */
388 umask (umask (0) & 0333);
389#endif /* BSD_SYSTEM */
390 outdesc = open (outname, O_WRONLY | O_CREAT | O_EXCL, 0666); 375 outdesc = open (outname, O_WRONLY | O_CREAT | O_EXCL, 0666);
391 if (outdesc < 0) 376 if (outdesc < 0)
392 pfatal_with_name (outname); 377 pfatal_with_name (outname);
@@ -470,10 +455,8 @@ main (int argc, char **argv)
470 } 455 }
471 } 456 }
472 457
473#ifdef BSD_SYSTEM 458 if (fsync (outdesc) != 0 && errno != EINVAL)
474 if (fsync (outdesc) < 0)
475 pfatal_and_delete (outname); 459 pfatal_and_delete (outname);
476#endif
477 460
478 /* Prevent symlink attacks truncating other users' mailboxes */ 461 /* Prevent symlink attacks truncating other users' mailboxes */
479 if (setregid (-1, real_gid) < 0) 462 if (setregid (-1, real_gid) < 0)
@@ -754,21 +737,14 @@ popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse
754 } 737 }
755 } 738 }
756 739
757 /* On AFS, a call to write only modifies the file in the local 740 if (fsync (mbfi) != 0 && errno != EINVAL)
758 * workstation's AFS cache. The changes are not written to the server
759 * until a call to fsync or close is made. Users with AFS home
760 * directories have lost mail when over quota because these checks were
761 * not made in previous versions of movemail. */
762
763#ifdef BSD_SYSTEM
764 if (fsync (mbfi) < 0)
765 { 741 {
766 error ("Error in fsync: %s", strerror (errno), 0); 742 error ("Error in fsync: %s", strerror (errno), 0);
743 close (mbfi);
767 return EXIT_FAILURE; 744 return EXIT_FAILURE;
768 } 745 }
769#endif
770 746
771 if (close (mbfi) == -1) 747 if (close (mbfi) != 0)
772 { 748 {
773 error ("Error in close: %s", strerror (errno), 0); 749 error ("Error in close: %s", strerror (errno), 0);
774 return EXIT_FAILURE; 750 return EXIT_FAILURE;
diff --git a/lib-src/ntlib.c b/lib-src/ntlib.c
index f43117457cb..23d7ba77b8e 100644
--- a/lib-src/ntlib.c
+++ b/lib-src/ntlib.c
@@ -1,6 +1,6 @@
1/* Utility and Unix shadow routines for GNU Emacs support programs on NT. 1/* Utility and Unix shadow routines for GNU Emacs support programs on NT.
2 2
3Copyright (C) 1994, 2001-2013 Free Software Foundation, Inc. 3Copyright (C) 1994, 2001-2014 Free Software Foundation, Inc.
4 4
5Author: Geoff Voelker (voelker@cs.washington.edu) 5Author: Geoff Voelker (voelker@cs.washington.edu)
6Created: 10-8-94 6Created: 10-8-94
@@ -34,21 +34,26 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
34 34
35#include "ntlib.h" 35#include "ntlib.h"
36 36
37/* MinGW64 defines _TIMEZONE_DEFINED and defines 'struct timespec' in
38 its system headers. */
39#ifndef _TIMEZONE_DEFINED
37struct timezone 40struct timezone
38{ 41{
39 int tz_minuteswest; /* minutes west of Greenwich */ 42 int tz_minuteswest; /* minutes west of Greenwich */
40 int tz_dsttime; /* type of dst correction */ 43 int tz_dsttime; /* type of dst correction */
41}; 44};
45#endif
42 46
43#define MAXPATHLEN _MAX_PATH 47#define MAXPATHLEN _MAX_PATH
44 48
45/* Emulate sleep...we could have done this with a define, but that 49/* Emulate sleep...we could have done this with a define, but that
46 would necessitate including windows.h in the files that used it. 50 would necessitate including windows.h in the files that used it.
47 This is much easier. */ 51 This is much easier. */
48void 52unsigned
49sleep (unsigned long seconds) 53sleep (unsigned seconds)
50{ 54{
51 Sleep (seconds * 1000); 55 Sleep (seconds * 1000);
56 return 0;
52} 57}
53 58
54/* Get the current working directory. */ 59/* Get the current working directory. */
@@ -134,6 +139,12 @@ getuid (void)
134} 139}
135 140
136unsigned 141unsigned
142geteuid (void)
143{
144 return getuid ();
145}
146
147unsigned
137getgid (void) 148getgid (void)
138{ 149{
139 return 0; 150 return 0;
@@ -412,3 +423,71 @@ lstat (const char * path, struct stat * buf)
412 return stat (path, buf); 423 return stat (path, buf);
413} 424}
414 425
426/* Implementation of mkostemp for MS-Windows, to avoid race conditions
427 when using mktemp. Copied from w32.c.
428
429 This is used only in update-game-score.c. It is overkill for that
430 use case, since update-game-score renames the temporary file into
431 the game score file, which isn't atomic on MS-Windows anyway, when
432 the game score already existed before running the program, which it
433 almost always does. But using a simpler implementation just to
434 make a point is uneconomical... */
435
436int
437mkostemp (char * template, int flags)
438{
439 char * p;
440 int i, fd = -1;
441 unsigned uid = GetCurrentThreadId ();
442 int save_errno = errno;
443 static char first_char[] = "abcdefghijklmnopqrstuvwyz0123456789!%-_@#";
444
445 errno = EINVAL;
446 if (template == NULL)
447 return -1;
448
449 p = template + strlen (template);
450 i = 5;
451 /* replace up to the last 5 X's with uid in decimal */
452 while (--p >= template && p[0] == 'X' && --i >= 0)
453 {
454 p[0] = '0' + uid % 10;
455 uid /= 10;
456 }
457
458 if (i < 0 && p[0] == 'X')
459 {
460 i = 0;
461 do
462 {
463 p[0] = first_char[i];
464 if ((fd = open (template,
465 flags | _O_CREAT | _O_EXCL | _O_RDWR,
466 S_IRUSR | S_IWUSR)) >= 0
467 || errno != EEXIST)
468 {
469 if (fd >= 0)
470 errno = save_errno;
471 return fd;
472 }
473 }
474 while (++i < sizeof (first_char));
475 }
476
477 /* Template is badly formed or else we can't generate a unique name. */
478 return -1;
479}
480
481/* On Windows, you cannot rename into an existing file. */
482int
483sys_rename (const char *from, const char *to)
484{
485 int retval = rename (from, to);
486
487 if (retval < 0 && errno == EEXIST)
488 {
489 if (unlink (to) == 0)
490 retval = rename (from, to);
491 }
492 return retval;
493}
diff --git a/lib-src/ntlib.h b/lib-src/ntlib.h
index 1b2f57f35e5..dbb0195a30b 100644
--- a/lib-src/ntlib.h
+++ b/lib-src/ntlib.h
@@ -1,5 +1,5 @@
1/* Utility and Unix shadow routines for GNU Emacs support programs on NT. 1/* Utility and Unix shadow routines for GNU Emacs support programs on NT.
2 Copyright (C) 1994, 2002-2013 Free Software Foundation, Inc. 2 Copyright (C) 1994, 2002-2014 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
@@ -16,31 +16,33 @@ GNU General Public License for more details.
16You should have received a copy of the GNU General Public License 16You should have received a copy of the GNU General Public License
17along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 17along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
18 18
19
20#include <pwd.h> 19#include <pwd.h>
21#include <malloc.h> 20#include <malloc.h>
22 21
23/* Include these headers now so we don't have to worry about include 22/* Include these headers now so we don't have to worry about include
24 order dependencies in common source files. */ 23 order dependencies in common source files. */
25#include <direct.h> 24#include <direct.h>
25#include <fcntl.h>
26#include <io.h> 26#include <io.h>
27#include <stdio.h> 27#include <stdio.h>
28 28
29#ifdef sleep 29#ifdef sleep
30#undef sleep 30#undef sleep
31#endif 31#endif
32void sleep (unsigned long seconds); 32unsigned sleep (unsigned seconds);
33char *getwd (char *dir); 33char *getwd (char *dir);
34int getppid (void); 34int getppid (void);
35char * getlogin (void); 35char * getlogin (void);
36char * cuserid (char * s); 36char * cuserid (char * s);
37unsigned getuid (void); 37unsigned getuid (void);
38unsigned geteuid (void);
38unsigned getegid (void); 39unsigned getegid (void);
39unsigned getgid (void); 40unsigned getgid (void);
40int setuid (unsigned uid); 41int setuid (unsigned uid);
41int setregid (unsigned rgid, unsigned gid); 42int setregid (unsigned rgid, unsigned gid);
42char * getpass (const char * prompt); 43char * getpass (const char * prompt);
43int fchown (int fd, unsigned uid, unsigned gid); 44int fchown (int fd, unsigned uid, unsigned gid);
45int mkostemp (char * template, int flags);
44 46
45/* redirect or undo interceptions created by config.h */ 47/* redirect or undo interceptions created by config.h */
46#undef access 48#undef access
@@ -61,15 +63,12 @@ int fchown (int fd, unsigned uid, unsigned gid);
61#undef fopen 63#undef fopen
62#undef mkdir 64#undef mkdir
63#define mkdir _mkdir 65#define mkdir _mkdir
64#undef mktemp
65#define mktemp _mktemp
66#undef open 66#undef open
67#define open _open 67#define open _open
68#undef pipe 68#undef pipe
69#define pipe _pipe 69#define pipe _pipe
70#undef read 70#undef read
71#define read _read 71#define read _read
72#undef rename
73#undef rmdir 72#undef rmdir
74#define rmdir _rmdir 73#define rmdir _rmdir
75#undef unlink 74#undef unlink
diff --git a/lib-src/pop.c b/lib-src/pop.c
index ba384db3d19..ffe16c5f911 100644
--- a/lib-src/pop.c
+++ b/lib-src/pop.c
@@ -1,6 +1,6 @@
1/* pop.c: client routines for talking to a POP3-protocol post-office server 1/* pop.c: client routines for talking to a POP3-protocol post-office server
2 2
3Copyright (C) 1991, 1993, 1996-1997, 1999, 2001-2013 Free Software 3Copyright (C) 1991, 1993, 1996-1997, 1999, 2001-2014 Free Software
4Foundation, Inc. 4Foundation, Inc.
5 5
6Author: Jonathan Kamens <jik@security.ov.com> 6Author: Jonathan Kamens <jik@security.ov.com>
@@ -124,7 +124,7 @@ static char *find_crlf (char *, int);
124#endif 124#endif
125 125
126char pop_error[ERROR_MAX]; 126char pop_error[ERROR_MAX];
127int pop_debug = 0; 127bool pop_debug = false;
128 128
129/* 129/*
130 * Function: pop_open (char *host, char *username, char *password, 130 * Function: pop_open (char *host, char *username, char *password,
@@ -269,8 +269,8 @@ pop_open (char *host, char *username, char *password, int flags)
269 server->data = 0; 269 server->data = 0;
270 server->buffer_index = 0; 270 server->buffer_index = 0;
271 server->buffer_size = GETLINE_MIN; 271 server->buffer_size = GETLINE_MIN;
272 server->in_multi = 0; 272 server->in_multi = false;
273 server->trash_started = 0; 273 server->trash_started = false;
274 274
275 if (getok (server)) 275 if (getok (server))
276 return (0); 276 return (0);
@@ -686,7 +686,7 @@ pop_multi_first (popserver server, const char *command, char **response)
686 else if (0 == strncmp (*response, "+OK", 3)) 686 else if (0 == strncmp (*response, "+OK", 3))
687 { 687 {
688 for (*response += 3; **response == ' '; (*response)++) /* empty */; 688 for (*response += 3; **response == ' '; (*response)++) /* empty */;
689 server->in_multi = 1; 689 server->in_multi = true;
690 return (0); 690 return (0);
691 } 691 }
692 else 692 else
@@ -728,7 +728,7 @@ pop_multi_next (popserver server, char **line)
728 if (! fromserver[1]) 728 if (! fromserver[1])
729 { 729 {
730 *line = 0; 730 *line = 0;
731 server->in_multi = 0; 731 server->in_multi = false;
732 return (0); 732 return (0);
733 } 733 }
734 else 734 else
@@ -1075,28 +1075,22 @@ socket_connection (char *host, int flags)
1075 } 1075 }
1076 } while (ret != 0); 1076 } while (ret != 0);
1077 1077
1078 if (ret == 0) 1078 for (it = res; it; it = it->ai_next)
1079 { 1079 if (it->ai_addrlen == sizeof addr)
1080 it = res; 1080 {
1081 while (it) 1081 struct sockaddr_in *in_a = (struct sockaddr_in *) it->ai_addr;
1082 { 1082 addr.sin_addr = in_a->sin_addr;
1083 if (it->ai_addrlen == sizeof (addr)) 1083 if (! connect (sock, (struct sockaddr *) &addr, sizeof addr))
1084 { 1084 break;
1085 struct sockaddr_in *in_a = (struct sockaddr_in *) it->ai_addr; 1085 }
1086 addr.sin_addr = in_a->sin_addr; 1086 connect_ok = it != NULL;
1087 if (! connect (sock, (struct sockaddr *) &addr, sizeof (addr))) 1087 if (connect_ok)
1088 break; 1088 {
1089 } 1089 realhost = alloca (strlen (it->ai_canonname) + 1);
1090 it = it->ai_next; 1090 strcpy (realhost, it->ai_canonname);
1091 }
1092 connect_ok = it != NULL;
1093 if (connect_ok)
1094 {
1095 realhost = alloca (strlen (it->ai_canonname) + 1);
1096 strcpy (realhost, it->ai_canonname);
1097 }
1098 freeaddrinfo (res);
1099 } 1091 }
1092 freeaddrinfo (res);
1093
1100#else /* !HAVE_GETADDRINFO */ 1094#else /* !HAVE_GETADDRINFO */
1101 do 1095 do
1102 { 1096 {
@@ -1198,7 +1192,7 @@ socket_connection (char *host, int flags)
1198 } 1192 }
1199#elif defined HAVE_KRB5_ERROR_E_TEXT 1193#elif defined HAVE_KRB5_ERROR_E_TEXT
1200 if (err_ret && err_ret->e_text && **err_ret->e_text) 1194 if (err_ret && err_ret->e_text && **err_ret->e_text)
1201 snprintf (pop_error + pop_error_len, ERRMAX - pop_error_len, 1195 snprintf (pop_error + pop_error_len, ERROR_MAX - pop_error_len,
1202 " [server says '%s']", *err_ret->e_text); 1196 " [server says '%s']", *err_ret->e_text);
1203#endif 1197#endif
1204 if (err_ret) 1198 if (err_ret)
@@ -1552,7 +1546,7 @@ pop_trash (popserver server)
1552 /* avoid recursion; sendline can call pop_trash */ 1546 /* avoid recursion; sendline can call pop_trash */
1553 if (server->trash_started) 1547 if (server->trash_started)
1554 return; 1548 return;
1555 server->trash_started = 1; 1549 server->trash_started = true;
1556 1550
1557 sendline (server, "RSET"); 1551 sendline (server, "RSET");
1558 sendline (server, "QUIT"); 1552 sendline (server, "QUIT");
diff --git a/lib-src/pop.h b/lib-src/pop.h
index dbc7c8dbe64..51eaa8158af 100644
--- a/lib-src/pop.h
+++ b/lib-src/pop.h
@@ -1,5 +1,5 @@
1/* pop.h: Header file for the "pop.c" client POP3 protocol. 1/* pop.h: Header file for the "pop.c" client POP3 protocol.
2 Copyright (C) 1991, 1993, 2001-2013 Free Software Foundation, Inc. 2 Copyright (C) 1991, 1993, 2001-2014 Free Software Foundation, Inc.
3 3
4Author: Jonathan Kamens <jik@security.ov.com> 4Author: Jonathan Kamens <jik@security.ov.com>
5 5
@@ -27,15 +27,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
27 /* size when it needs to grow */ 27 /* size when it needs to grow */
28 28
29extern char pop_error[]; 29extern char pop_error[];
30extern int pop_debug; 30extern bool pop_debug;
31 31
32struct _popserver 32struct _popserver
33{ 33{
34 int file, data; 34 int file, data;
35 char *buffer; 35 char *buffer;
36 int buffer_size, buffer_index; 36 int buffer_size, buffer_index;
37 int in_multi; 37 bool_bf in_multi : 1;
38 int trash_started; 38 bool_bf trash_started : 1;
39}; 39};
40 40
41typedef struct _popserver *popserver; 41typedef struct _popserver *popserver;
@@ -73,4 +73,3 @@ extern int pop_last (popserver server);
73extern int pop_reset (popserver server); 73extern int pop_reset (popserver server);
74extern int pop_quit (popserver server); 74extern int pop_quit (popserver server);
75extern void pop_close (popserver); 75extern void pop_close (popserver);
76
diff --git a/lib-src/profile.c b/lib-src/profile.c
index ab17b52ca28..e159a92e86d 100644
--- a/lib-src/profile.c
+++ b/lib-src/profile.c
@@ -1,5 +1,5 @@
1/* profile.c --- generate periodic events for profiling of Emacs Lisp code. 1/* profile.c --- generate periodic events for profiling of Emacs Lisp code.
2 Copyright (C) 1992, 1994, 1999, 2001-2013 Free Software Foundation, 2 Copyright (C) 1992, 1994, 1999, 2001-2014 Free Software Foundation,
3 Inc. 3 Inc.
4 4
5Author: Boaz Ben-Zvi <boaz@lcs.mit.edu> 5Author: Boaz Ben-Zvi <boaz@lcs.mit.edu>
@@ -29,9 +29,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
29 ** abstraction : a stopwatch 29 ** abstraction : a stopwatch
30 ** operations: reset_watch, get_time 30 ** operations: reset_watch, get_time
31 */ 31 */
32#include <config.h>
33 32
34#define SYSTIME_INLINE EXTERN_INLINE 33#define INLINE EXTERN_INLINE
34#include <config.h>
35 35
36#include <inttypes.h> 36#include <inttypes.h>
37#include <stdio.h> 37#include <stdio.h>
@@ -39,17 +39,17 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
39#include <intprops.h> 39#include <intprops.h>
40#include <systime.h> 40#include <systime.h>
41 41
42static EMACS_TIME TV1; 42static struct timespec TV1;
43static int watch_not_started = 1; /* flag */ 43static int watch_not_started = 1; /* flag */
44static char time_string[INT_STRLEN_BOUND (uintmax_t) + sizeof "." 44static char time_string[INT_STRLEN_BOUND (uintmax_t) + sizeof "."
45 + LOG10_EMACS_TIME_RESOLUTION]; 45 + LOG10_TIMESPEC_RESOLUTION];
46 46
47/* Reset the stopwatch to zero. */ 47/* Reset the stopwatch to zero. */
48 48
49static void 49static void
50reset_watch (void) 50reset_watch (void)
51{ 51{
52 TV1 = current_emacs_time (); 52 TV1 = current_timespec ();
53 watch_not_started = 0; 53 watch_not_started = 0;
54} 54}
55 55
@@ -60,12 +60,12 @@ reset_watch (void)
60static char * 60static char *
61get_time (void) 61get_time (void)
62{ 62{
63 EMACS_TIME TV2 = sub_emacs_time (current_emacs_time (), TV1); 63 struct timespec TV2 = timespec_sub (current_timespec (), TV1);
64 uintmax_t s = EMACS_SECS (TV2); 64 uintmax_t s = TV2.tv_sec;
65 int ns = EMACS_NSECS (TV2); 65 int ns = TV2.tv_nsec;
66 if (watch_not_started) 66 if (watch_not_started)
67 exit (EXIT_FAILURE); /* call reset_watch first ! */ 67 exit (EXIT_FAILURE); /* call reset_watch first ! */
68 sprintf (time_string, "%"PRIuMAX".%0*d", s, LOG10_EMACS_TIME_RESOLUTION, ns); 68 sprintf (time_string, "%"PRIuMAX".%0*d", s, LOG10_TIMESPEC_RESOLUTION, ns);
69 return time_string; 69 return time_string;
70} 70}
71 71
diff --git a/lib-src/rcs2log b/lib-src/rcs2log
index 4f2bb3308fc..a0a75e390fb 100755
--- a/lib-src/rcs2log
+++ b/lib-src/rcs2log
@@ -2,7 +2,7 @@
2 2
3# RCS to ChangeLog generator 3# RCS to ChangeLog generator
4 4
5# Copyright (C) 1992-1998, 2001-2013 Free Software Foundation, Inc. 5# Copyright (C) 1992-1998, 2001-2014 Free Software Foundation, Inc.
6 6
7# Author: Paul Eggert <eggert@twinsun.com> 7# Author: Paul Eggert <eggert@twinsun.com>
8 8
@@ -20,7 +20,7 @@
20# along with this program. If not, see <http://www.gnu.org/licenses/>. 20# along with this program. If not, see <http://www.gnu.org/licenses/>.
21 21
22 22
23Copyright='Copyright (C) 2013 Free Software Foundation, Inc. 23Copyright='Copyright (C) 2014 Free Software Foundation, Inc.
24This program comes with NO WARRANTY, to the extent permitted by law. 24This program comes with NO WARRANTY, to the extent permitted by law.
25You may redistribute copies of this program 25You may redistribute copies of this program
26under the terms of the GNU General Public License. 26under the terms of the GNU General Public License.
@@ -774,4 +774,3 @@ exec rm -fr $logdir
774# Local Variables: 774# Local Variables:
775# tab-width:4 775# tab-width:4
776# End: 776# End:
777
diff --git a/lib-src/test-distrib.c b/lib-src/test-distrib.c
index 42aef07870f..88b95db9060 100644
--- a/lib-src/test-distrib.c
+++ b/lib-src/test-distrib.c
@@ -1,6 +1,6 @@
1/* test-distrib.c --- testing distribution of nonprinting chars 1/* test-distrib.c --- testing distribution of nonprinting chars
2 2
3Copyright (C) 1987, 1993-1995, 1999, 2001-2013 Free Software Foundation, 3Copyright (C) 1987, 1993-1995, 1999, 2001-2014 Free Software Foundation,
4Inc. 4Inc.
5 5
6This file is part of GNU Emacs. 6This file is part of GNU Emacs.
diff --git a/lib-src/update-game-score.c b/lib-src/update-game-score.c
index 29c81a8936c..ad591cca87a 100644
--- a/lib-src/update-game-score.c
+++ b/lib-src/update-game-score.c
@@ -1,6 +1,6 @@
1/* update-game-score.c --- Update a score file 1/* update-game-score.c --- Update a score file
2 2
3Copyright (C) 2002-2013 Free Software Foundation, Inc. 3Copyright (C) 2002-2014 Free Software Foundation, Inc.
4 4
5Author: Colin Walters <walters@debian.org> 5Author: Colin Walters <walters@debian.org>
6 6
@@ -35,7 +35,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
35 35
36#include <unistd.h> 36#include <unistd.h>
37#include <errno.h> 37#include <errno.h>
38#include <inttypes.h>
38#include <limits.h> 39#include <limits.h>
40#include <stdbool.h>
39#include <string.h> 41#include <string.h>
40#include <stdlib.h> 42#include <stdlib.h>
41#include <stdio.h> 43#include <stdio.h>
@@ -46,15 +48,17 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
46#include <sys/stat.h> 48#include <sys/stat.h>
47#include <getopt.h> 49#include <getopt.h>
48 50
49#define MAX_ATTEMPTS 5 51#ifdef WINDOWSNT
50#define MAX_SCORES 200 52#include "ntlib.h"
51#define MAX_DATA_LEN 1024 53#endif
52 54
53#ifndef HAVE_DIFFTIME 55#ifndef min
54/* OK on POSIX (time_t is arithmetic type) modulo overflow in subtraction. */ 56# define min(a,b) ((a) < (b) ? (a) : (b))
55#define difftime(t1, t0) (double)((t1) - (t0))
56#endif 57#endif
57 58
59#define MAX_ATTEMPTS 5
60#define MAX_DATA_LEN 1024
61
58static _Noreturn void 62static _Noreturn void
59usage (int err) 63usage (int err)
60{ 64{
@@ -72,18 +76,21 @@ static int unlock_file (const char *filename, void *state);
72 76
73struct score_entry 77struct score_entry
74{ 78{
75 long score; 79 intmax_t score;
76 char *username; 80 char *username;
77 char *data; 81 char *data;
78}; 82};
79 83
84#define MAX_SCORES min (PTRDIFF_MAX, SIZE_MAX / sizeof (struct score_entry))
85
80static int read_scores (const char *filename, struct score_entry **scores, 86static int read_scores (const char *filename, struct score_entry **scores,
81 int *count); 87 ptrdiff_t *count, ptrdiff_t *alloc);
82static int push_score (struct score_entry **scores, int *count, 88static int push_score (struct score_entry **scores, ptrdiff_t *count,
83 int newscore, char *username, char *newdata); 89 ptrdiff_t *size, struct score_entry const *newscore);
84static void sort_scores (struct score_entry *scores, int count, int reverse); 90static void sort_scores (struct score_entry *scores, ptrdiff_t count,
91 bool reverse);
85static int write_scores (const char *filename, 92static int write_scores (const char *filename,
86 const struct score_entry *scores, int count); 93 const struct score_entry *scores, ptrdiff_t count);
87 94
88static _Noreturn void 95static _Noreturn void
89lose (const char *msg) 96lose (const char *msg)
@@ -103,19 +110,19 @@ static char *
103get_user_id (void) 110get_user_id (void)
104{ 111{
105 struct passwd *buf = getpwuid (getuid ()); 112 struct passwd *buf = getpwuid (getuid ());
106 if (!buf) 113 if (!buf || strchr (buf->pw_name, ' ') || strchr (buf->pw_name, '\n'))
107 { 114 {
108 long uid = getuid (); 115 intmax_t uid = getuid ();
109 char *name = malloc (sizeof uid * CHAR_BIT / 3 + 1); 116 char *name = malloc (sizeof uid * CHAR_BIT / 3 + 4);
110 if (name) 117 if (name)
111 sprintf (name, "%ld", uid); 118 sprintf (name, "%"PRIdMAX, uid);
112 return name; 119 return name;
113 } 120 }
114 return buf->pw_name; 121 return buf->pw_name;
115} 122}
116 123
117static const char * 124static const char *
118get_prefix (int running_suid, const char *user_prefix) 125get_prefix (bool running_suid, const char *user_prefix)
119{ 126{
120 if (!running_suid && user_prefix == NULL) 127 if (!running_suid && user_prefix == NULL)
121 lose ("Not using a shared game directory, and no prefix given."); 128 lose ("Not using a shared game directory, and no prefix given.");
@@ -133,14 +140,18 @@ get_prefix (int running_suid, const char *user_prefix)
133int 140int
134main (int argc, char **argv) 141main (int argc, char **argv)
135{ 142{
136 int c, running_suid; 143 int c;
144 bool running_suid;
137 void *lockstate; 145 void *lockstate;
138 char *user_id, *scorefile; 146 char *scorefile;
147 char *nl;
139 const char *prefix, *user_prefix = NULL; 148 const char *prefix, *user_prefix = NULL;
140 struct stat buf; 149 struct stat buf;
141 struct score_entry *scores; 150 struct score_entry *scores;
142 int newscore, scorecount, reverse = 0, max = MAX_SCORES; 151 struct score_entry newscore;
143 char *newdata; 152 bool reverse = false;
153 ptrdiff_t scorecount, scorealloc;
154 ptrdiff_t max_scores = MAX_SCORES;
144 155
145 srand (time (0)); 156 srand (time (0));
146 157
@@ -157,15 +168,18 @@ main (int argc, char **argv)
157 reverse = 1; 168 reverse = 1;
158 break; 169 break;
159 case 'm': 170 case 'm':
160 max = atoi (optarg); 171 {
161 if (max > MAX_SCORES) 172 intmax_t m = strtoimax (optarg, 0, 10);
162 max = MAX_SCORES; 173 if (m < 0)
174 usage (EXIT_FAILURE);
175 max_scores = min (m, MAX_SCORES);
176 }
163 break; 177 break;
164 default: 178 default:
165 usage (EXIT_FAILURE); 179 usage (EXIT_FAILURE);
166 } 180 }
167 181
168 if (optind+3 != argc) 182 if (argc - optind != 3)
169 usage (EXIT_FAILURE); 183 usage (EXIT_FAILURE);
170 184
171 running_suid = (getuid () != geteuid ()); 185 running_suid = (getuid () != geteuid ());
@@ -179,13 +193,18 @@ main (int argc, char **argv)
179 strcpy (scorefile, prefix); 193 strcpy (scorefile, prefix);
180 strcat (scorefile, "/"); 194 strcat (scorefile, "/");
181 strcat (scorefile, argv[optind]); 195 strcat (scorefile, argv[optind]);
182 newscore = atoi (argv[optind+1]);
183 newdata = argv[optind+2];
184 if (strlen (newdata) > MAX_DATA_LEN)
185 newdata[MAX_DATA_LEN] = '\0';
186 196
187 user_id = get_user_id (); 197 newscore.score = strtoimax (argv[optind + 1], 0, 10);
188 if (user_id == NULL) 198
199 newscore.data = argv[optind + 2];
200 if (strlen (newscore.data) > MAX_DATA_LEN)
201 newscore.data[MAX_DATA_LEN] = '\0';
202 nl = strchr (newscore.data, '\n');
203 if (nl)
204 *nl = '\0';
205
206 newscore.username = get_user_id ();
207 if (! newscore.username)
189 lose_syserr ("Couldn't determine user id"); 208 lose_syserr ("Couldn't determine user id");
190 209
191 if (stat (scorefile, &buf) < 0) 210 if (stat (scorefile, &buf) < 0)
@@ -194,29 +213,34 @@ main (int argc, char **argv)
194 if (lock_file (scorefile, &lockstate) < 0) 213 if (lock_file (scorefile, &lockstate) < 0)
195 lose_syserr ("Failed to lock scores file"); 214 lose_syserr ("Failed to lock scores file");
196 215
197 if (read_scores (scorefile, &scores, &scorecount) < 0) 216 if (read_scores (scorefile, &scores, &scorecount, &scorealloc) < 0)
198 { 217 {
199 unlock_file (scorefile, lockstate); 218 unlock_file (scorefile, lockstate);
200 lose_syserr ("Failed to read scores file"); 219 lose_syserr ("Failed to read scores file");
201 } 220 }
202 push_score (&scores, &scorecount, newscore, user_id, newdata); 221 if (push_score (&scores, &scorecount, &scorealloc, &newscore) < 0)
222 {
223 unlock_file (scorefile, lockstate);
224 lose_syserr ("Failed to add score");
225 }
203 sort_scores (scores, scorecount, reverse); 226 sort_scores (scores, scorecount, reverse);
204 /* Limit the number of scores. If we're using reverse sorting, then 227 /* Limit the number of scores. If we're using reverse sorting, then
205 also increment the beginning of the array, to skip over the 228 also increment the beginning of the array, to skip over the
206 *smallest* scores. Otherwise, just decrementing the number of 229 *smallest* scores. Otherwise, just decrementing the number of
207 scores suffices, since the smallest is at the end. */ 230 scores suffices, since the smallest is at the end. */
208 if (scorecount > MAX_SCORES) 231 if (scorecount > max_scores)
209 { 232 {
210 if (reverse) 233 if (reverse)
211 scores += (scorecount - MAX_SCORES); 234 scores += scorecount - max_scores;
212 scorecount = MAX_SCORES; 235 scorecount = max_scores;
213 } 236 }
214 if (write_scores (scorefile, scores, scorecount) < 0) 237 if (write_scores (scorefile, scores, scorecount) < 0)
215 { 238 {
216 unlock_file (scorefile, lockstate); 239 unlock_file (scorefile, lockstate);
217 lose_syserr ("Failed to write scores file"); 240 lose_syserr ("Failed to write scores file");
218 } 241 }
219 unlock_file (scorefile, lockstate); 242 if (unlock_file (scorefile, lockstate) < 0)
243 lose_syserr ("Failed to unlock scores file");
220 exit (EXIT_SUCCESS); 244 exit (EXIT_SUCCESS);
221} 245}
222 246
@@ -224,13 +248,18 @@ static int
224read_score (FILE *f, struct score_entry *score) 248read_score (FILE *f, struct score_entry *score)
225{ 249{
226 int c; 250 int c;
251 if ((c = getc (f)) != EOF)
252 ungetc (c, f);
227 if (feof (f)) 253 if (feof (f))
228 return 1; 254 return 1;
229 while ((c = getc (f)) != EOF 255 for (score->score = 0; (c = getc (f)) != EOF && isdigit (c); )
230 && isdigit (c))
231 { 256 {
257 if (INTMAX_MAX / 10 < score->score)
258 return -1;
232 score->score *= 10; 259 score->score *= 10;
233 score->score += (c-48); 260 if (INTMAX_MAX - (c - '0') < score->score)
261 return -1;
262 score->score += c - '0';
234 } 263 }
235 while ((c = getc (f)) != EOF 264 while ((c = getc (f)) != EOF
236 && isspace (c)) 265 && isspace (c))
@@ -241,6 +270,7 @@ read_score (FILE *f, struct score_entry *score)
241#ifdef HAVE_GETDELIM 270#ifdef HAVE_GETDELIM
242 { 271 {
243 size_t count = 0; 272 size_t count = 0;
273 score->username = 0;
244 if (getdelim (&score->username, &count, ' ', f) < 1 274 if (getdelim (&score->username, &count, ' ', f) < 1
245 || score->username == NULL) 275 || score->username == NULL)
246 return -1; 276 return -1;
@@ -249,18 +279,30 @@ read_score (FILE *f, struct score_entry *score)
249 } 279 }
250#else 280#else
251 { 281 {
252 int unameread = 0; 282 ptrdiff_t unameread = 0;
253 int unamelen = 30; 283 ptrdiff_t unamelen = 30;
254 char *username = malloc (unamelen); 284 char *username = malloc (unamelen);
255 if (!username) 285 if (!username)
256 return -1; 286 return -1;
257 287
258 while ((c = getc (f)) != EOF 288 while ((c = getc (f)) != EOF && c != ' ')
259 && !isspace (c))
260 { 289 {
261 if (unameread >= unamelen-1) 290 if (unameread >= unamelen - 1)
262 if (!(username = realloc (username, unamelen *= 2))) 291 {
263 return -1; 292 ptrdiff_t unamelen_max = min (PTRDIFF_MAX, SIZE_MAX);
293 if (unamelen <= unamelen_max / 2)
294 unamelen *= 2;
295 else if (unamelen < unamelen_max)
296 unamelen = unamelen_max;
297 else
298 {
299 errno = ENOMEM;
300 return -1;
301 }
302 username = realloc (username, unamelen);
303 if (!username)
304 return -1;
305 }
264 username[unameread] = c; 306 username[unameread] = c;
265 unameread++; 307 unameread++;
266 } 308 }
@@ -281,8 +323,8 @@ read_score (FILE *f, struct score_entry *score)
281 } 323 }
282#else 324#else
283 { 325 {
284 int cur = 0; 326 ptrdiff_t cur = 0;
285 int len = 16; 327 ptrdiff_t len = 16;
286 char *buf = malloc (len); 328 char *buf = malloc (len);
287 if (!buf) 329 if (!buf)
288 return -1; 330 return -1;
@@ -291,6 +333,11 @@ read_score (FILE *f, struct score_entry *score)
291 { 333 {
292 if (cur >= len-1) 334 if (cur >= len-1)
293 { 335 {
336 if (min (PTRDIFF_MAX, SIZE_MAX) / 2 < len)
337 {
338 errno = ENOMEM;
339 return -1;
340 }
294 if (!(buf = realloc (buf, len *= 2))) 341 if (!(buf = realloc (buf, len *= 2)))
295 return -1; 342 return -1;
296 } 343 }
@@ -305,36 +352,29 @@ read_score (FILE *f, struct score_entry *score)
305} 352}
306 353
307static int 354static int
308read_scores (const char *filename, struct score_entry **scores, int *count) 355read_scores (const char *filename, struct score_entry **scores,
356 ptrdiff_t *count, ptrdiff_t *alloc)
309{ 357{
310 int readval, scorecount, cursize; 358 int readval = -1;
311 struct score_entry *ret; 359 ptrdiff_t scorecount = 0;
360 ptrdiff_t cursize = 0;
361 struct score_entry *ret = 0;
362 struct score_entry entry;
312 FILE *f = fopen (filename, "r"); 363 FILE *f = fopen (filename, "r");
364 int retval = -1;
313 if (!f) 365 if (!f)
314 return -1; 366 return -1;
315 scorecount = 0; 367 while ((readval = read_score (f, &entry)) == 0)
316 cursize = 16; 368 if (push_score (&ret, &scorecount, &cursize, &entry) < 0)
317 ret = (struct score_entry *) malloc (sizeof (struct score_entry) * cursize); 369 return -1;
318 if (!ret) 370 if (readval > 0 && fclose (f) == 0)
319 return -1;
320 while ((readval = read_score (f, &ret[scorecount])) == 0)
321 { 371 {
322 /* We encountered an error. */ 372 *count = scorecount;
323 if (readval < 0) 373 *alloc = cursize;
324 return -1; 374 *scores = ret;
325 scorecount++; 375 retval = 0;
326 if (scorecount >= cursize)
327 {
328 cursize *= 2;
329 ret = (struct score_entry *)
330 realloc (ret, (sizeof (struct score_entry) * cursize));
331 if (!ret)
332 return -1;
333 }
334 } 376 }
335 *count = scorecount; 377 return retval;
336 *scores = ret;
337 return 0;
338} 378}
339 379
340static int 380static int
@@ -348,60 +388,81 @@ score_compare (const void *a, const void *b)
348static int 388static int
349score_compare_reverse (const void *a, const void *b) 389score_compare_reverse (const void *a, const void *b)
350{ 390{
351 const struct score_entry *sa = (const struct score_entry *) a; 391 return score_compare (b, a);
352 const struct score_entry *sb = (const struct score_entry *) b;
353 return (sa->score > sb->score) - (sa->score < sb->score);
354} 392}
355 393
356int 394int
357push_score (struct score_entry **scores, int *count, int newscore, char *username, char *newdata) 395push_score (struct score_entry **scores, ptrdiff_t *count, ptrdiff_t *size,
396 struct score_entry const *newscore)
358{ 397{
359 struct score_entry *newscores 398 struct score_entry *newscores = *scores;
360 = (struct score_entry *) realloc (*scores, 399 if (*count == *size)
361 sizeof (struct score_entry) * ((*count) + 1)); 400 {
362 if (!newscores) 401 ptrdiff_t newsize = *size;
363 return -1; 402 if (newsize <= 0)
364 newscores[*count].score = newscore; 403 newsize = 1;
365 newscores[*count].username = username; 404 else if (newsize <= MAX_SCORES / 2)
366 newscores[*count].data = newdata; 405 newsize *= 2;
406 else if (newsize < MAX_SCORES)
407 newsize = MAX_SCORES;
408 else
409 {
410 errno = ENOMEM;
411 return -1;
412 }
413 newscores = realloc (newscores, sizeof *newscores * newsize);
414 if (!newscores)
415 return -1;
416 *scores = newscores;
417 *size = newsize;
418 }
419 newscores[*count] = *newscore;
367 (*count) += 1; 420 (*count) += 1;
368 *scores = newscores;
369 return 0; 421 return 0;
370} 422}
371 423
372static void 424static void
373sort_scores (struct score_entry *scores, int count, int reverse) 425sort_scores (struct score_entry *scores, ptrdiff_t count, bool reverse)
374{ 426{
375 qsort (scores, count, sizeof (struct score_entry), 427 qsort (scores, count, sizeof *scores,
376 reverse ? score_compare_reverse : score_compare); 428 reverse ? score_compare_reverse : score_compare);
377} 429}
378 430
379static int 431static int
380write_scores (const char *filename, const struct score_entry *scores, int count) 432write_scores (const char *filename, const struct score_entry *scores,
433 ptrdiff_t count)
381{ 434{
435 int fd;
382 FILE *f; 436 FILE *f;
383 int i; 437 ptrdiff_t i;
384 char *tempfile = malloc (strlen (filename) + strlen (".tempXXXXXX") + 1); 438 char *tempfile = malloc (strlen (filename) + strlen (".tempXXXXXX") + 1);
385 if (!tempfile) 439 if (!tempfile)
386 return -1; 440 return -1;
387 strcpy (tempfile, filename); 441 strcpy (tempfile, filename);
388 strcat (tempfile, ".tempXXXXXX"); 442 strcat (tempfile, ".tempXXXXXX");
389#ifdef HAVE_MKSTEMP 443 fd = mkostemp (tempfile, 0);
390 if (mkstemp (tempfile) < 0 444 if (fd < 0)
391#else 445 return -1;
392 if (mktemp (tempfile) != tempfile 446#ifndef WINDOWSNT
447 if (fchmod (fd, 0644) != 0)
448 return -1;
393#endif 449#endif
394 || !(f = fopen (tempfile, "w"))) 450 f = fdopen (fd, "w");
451 if (! f)
395 return -1; 452 return -1;
396 for (i = 0; i < count; i++) 453 for (i = 0; i < count; i++)
397 if (fprintf (f, "%ld %s %s\n", scores[i].score, scores[i].username, 454 if (fprintf (f, "%"PRIdMAX" %s %s\n",
398 scores[i].data) < 0) 455 scores[i].score, scores[i].username, scores[i].data)
456 < 0)
399 return -1; 457 return -1;
400 fclose (f); 458 if (fclose (f) != 0)
401 if (rename (tempfile, filename) < 0)
402 return -1; 459 return -1;
460 if (rename (tempfile, filename) != 0)
461 return -1;
462#ifdef WINDOWSNT
403 if (chmod (filename, 0644) < 0) 463 if (chmod (filename, 0644) < 0)
404 return -1; 464 return -1;
465#endif
405 return 0; 466 return 0;
406} 467}
407 468
@@ -420,9 +481,9 @@ lock_file (const char *filename, void **state)
420 *state = lockpath; 481 *state = lockpath;
421 trylock: 482 trylock:
422 attempts++; 483 attempts++;
423 /* If the lock is over an hour old, delete it. */ 484 /* If the lock is over an hour old, delete it. */
424 if (stat (lockpath, &buf) == 0 485 if (stat (lockpath, &buf) == 0
425 && (difftime (buf.st_ctime, time (NULL) > 60*60))) 486 && 60 * 60 < time (0) - buf.st_ctime)
426 unlink (lockpath); 487 unlink (lockpath);
427 fd = open (lockpath, O_CREAT | O_EXCL, 0600); 488 fd = open (lockpath, O_CREAT | O_EXCL, 0600);
428 if (fd < 0) 489 if (fd < 0)
@@ -450,12 +511,12 @@ static int
450unlock_file (const char *filename, void *state) 511unlock_file (const char *filename, void *state)
451{ 512{
452 char *lockpath = (char *) state; 513 char *lockpath = (char *) state;
453 int ret = unlink (lockpath);
454 int saved_errno = errno; 514 int saved_errno = errno;
515 int ret = unlink (lockpath);
516 int unlink_errno = errno;
455 free (lockpath); 517 free (lockpath);
456 errno = saved_errno; 518 errno = ret < 0 ? unlink_errno : saved_errno;
457 return ret; 519 return ret;
458} 520}
459 521
460
461/* update-game-score.c ends here */ 522/* update-game-score.c ends here */
diff --git a/lib-src/update-game-score.exe.manifest b/lib-src/update-game-score.exe.manifest
new file mode 100644
index 00000000000..1db836bec6b
--- /dev/null
+++ b/lib-src/update-game-score.exe.manifest
@@ -0,0 +1,10 @@
1<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
3 <v3:trustInfo xmlns:v3="urn:schemas-microsoft-com:asm.v3">
4 <v3:security>
5 <v3:requestedPrivileges>
6 <v3:requestedExecutionLevel level="asInvoker" />
7 </v3:requestedPrivileges>
8 </v3:security>
9 </v3:trustInfo>
10</assembly>