aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog244
-rw-r--r--lib-src/Makefile.in104
-rw-r--r--lib-src/ebrowse.c5
-rw-r--r--lib-src/emacsclient.c233
-rw-r--r--lib-src/etags.c155
-rwxr-xr-xlib-src/grep-changelog2
-rw-r--r--lib-src/hexl.c2
-rw-r--r--lib-src/make-docfile.c58
-rw-r--r--lib-src/makefile.w32-in77
-rw-r--r--lib-src/movemail.c66
-rw-r--r--lib-src/ntlib.c49
-rw-r--r--lib-src/ntlib.h6
-rw-r--r--lib-src/pop.c42
-rw-r--r--lib-src/pop.h2
-rw-r--r--lib-src/profile.c3
-rwxr-xr-xlib-src/rcs2log4
-rw-r--r--lib-src/test-distrib.c3
-rw-r--r--lib-src/update-game-score.c8
18 files changed, 687 insertions, 376 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 35190fd2a8f..e1025fc5f6b 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,239 @@
12013-05-29 Eli Zaretskii <eliz@gnu.org>
2
3 * Makefile.in (mostlyclean): Remove *.res files.
4
52013-05-18 Paul Eggert <eggert@cs.ucla.edu>
6
7 Port --enable-gcc-warnings to clang.
8 * etags.c: Omit unnecessary forward decls.
9 (print_version, print_help): Declare _Noreturn.
10 * pop.c (socket_connection) [HAVE_GETADDRINFO]: Simplify.
11
122013-05-16 Eli Zaretskii <eliz@gnu.org>
13
14 * update-game-score.c [WINDOWSNT]: Include "ntlib.h".
15
16 * ntlib.h (sleep): Update prototype.
17 (geteuid): Add prototype.
18
19 * ntlib.c (sleep): Now returns an unsigned value.
20 (getgid): New function.
21
22 * Makefile.in (CLIENTW, LIB_WSOCK32, LIBS_ECLIENT, NTLIB)
23 (CLIENTRES, WINDRES, NTINC, NTDEPS): New variables.
24 (INSTALLABLES): Add $(CLIENTW).
25 (LIBS_MOVE): Use $(LIB_WSOCK32).
26 ($(DESTDIR)${archlibdir}): Use $(EXEEXT) on update-game-score.
27 (test-distrib${EXEEXT}): Use $(EXEEXT) on test-distrib.
28 (etags${EXEEXT}, ebrowse${EXEEXT}, ctags${EXEEXT})
29 (profile${EXEEXT}, make-docfile${EXEEXT}, movemail${EXEEXT})
30 (emacsclient${EXEEXT}, hexl${EXEEXT}, update-game-score${EXEEXT}):
31 Add $(NTLIB) to prerequisites. Use $(EXEEXT).
32 (pop.o): Add pop.h to prerequisites.
33 (emacsclientw${EXEEXT}, ntlib.o): New targets.
34 (emacsclient.res): New target.
35
362013-05-15 Stefan Monnier <monnier@iro.umontreal.ca>
37
38 * makefile.w32-in ($(DOC)): Use DOC rather than DOC-X.
39
402013-05-06 Paul Eggert <eggert@cs.ucla.edu>
41
42 * make-docfile.c (search_lisp_doc_at_eol) [DEBUG]: Fix typo,
43 by removing references to no-longer-existing locals.
44
452013-03-26 Eli Zaretskii <eliz@gnu.org>
46
47 Fix incompatibilities between MinGW.org and MinGW64 headers.
48 * ntlib.c (struct timespec) [!_TIMEZONE_DEFINED]: Define the
49 struct only if _TIMEZONE_DEFINED is not defined.
50
512013-03-23 cg <chengang31@gmail.com> (tiny change)
52
53 * makefile.w32-in (LIB_SRC): Move before first use.
54
552013-03-16 Paul Eggert <eggert@cs.ucla.edu>
56
57 * pop.c: Fix ERRMAX typo (Bug#13925).
58 (socket_connection) [!HAVE_KRB5_ERROR_TEXT && HAVE_KRB5_ERROR_E_TEXT]:
59 Use ERROR_MAX, not ERRMAX.
60
612013-03-13 Paul Eggert <eggert@cs.ucla.edu>
62
63 File synchronization fixes (Bug#13944).
64 * Makefile.in (LIB_FDATASYNC): New macro.
65 (emacsclient${EXEEXT}): Use it.
66 * emacsclient.c (main): Use fdatasync, not fsync, since we don't
67 care about metadata. Keep trying if interrupted.
68 * movemail.c (main, popmail): Don't worry about BSD_SYSTEM, since
69 fsync is available everywhere (or there is a substitute).
70 Don't report an error if fsync returns EINVAL.
71
72 Static checking by Sun C 5.12.
73 * etags.c (analyse_regex): Omit unreachable code.
74
75 * movemail.c (main): Call umask on all systems.
76 This is OK since Emacs already assumes umask elsewhere.
77 Don't grant more read permissions than necessary.
78 The old 0333 dates back to before we called setuid,
79 so it was needed back then to ensure user-readability,
80 but 0377 should suffice now.
81
822013-02-08 Paul Eggert <eggert@cs.ucla.edu>
83
84 * movemail.c (getenv): Remove decl (unused since 1994).
85
862013-01-15 Paul Eggert <eggert@cs.ucla.edu>
87
88 * make-docfile.c (write_globals): Make it a bit clearer (Bug#13448).
89 This pacifies GCC 4.7.2 when Emacs is configured with
90 --enable-link-time-optimization and --enable-gcc-warnings.
91
922013-01-01 Juanma Barranquero <lekktu@gmail.com>
93
94 * makefile.w32-in (lisp1): Add macroexp.elc (bug#13320).
95
962012-12-11 Juanma Barranquero <lekktu@gmail.com>
97
98 * makefile.w32-in (SYSWAIT_H): Update dependencies.
99
1002012-12-10 Eli Zaretskii <eliz@gnu.org>
101
102 * makefile.w32-in (obj): Add w32notify.o. Add missing X and Unix
103 sources.
104
1052012-12-02 Kevin Ryde <user42@zip.com.au>
106
107 * etags.c (Lisp_functions): Skip (defvar foo) declarations unless
108 the --declarations flag is enabled (Bug#5600).
109 (Lisp_help): Update.
110 (skip_name): New function.
111
1122012-12-01 Kevin Ryde <user42@zip.com.au>
113
114 * etags.c (Perl_functions): Support "use constant" (Bug#5055).
115
1162012-11-27 Paul Eggert <eggert@cs.ucla.edu>
117
118 Assume POSIX 1003.1-1988 or later for errno.h (Bug#12968).
119 * movemail.c (main): Assume EAGAIN and EBUSY.
120
1212012-11-23 Paul Eggert <eggert@cs.ucla.edu>
122
123 movemail: treat EACCES etc. failures as permanent
124 * movemail.c (main): Treat any link failure other than EEXIST as a
125 permanent failure, not just EPERM. EACCES, for example.
126
1272012-11-21 Paul Eggert <eggert@cs.ucla.edu>
128
129 Assume POSIX 1003.1-1988 or later for unistd.h (Bug#12945).
130 * emacsclient.c (getcwd): Remove decl.
131 (get_current_dir_name): Assume getcwd exists.
132 * etags.c (HAVE_GETCWD): Remove.
133 (getcwd): Remove decl.
134 (NO_LONG_OPTIONS): Remove this. All uses removed.
135 Emacs always has GNU getopt.
136 (etags_getcwd): Assume getcwd exists.
137 * movemail.c (F_OK, X_OK, W_OK, R_OK): Remove.
138
1392012-11-20 Paul Eggert <eggert@cs.ucla.edu>
140
141 * emacsclient.c (handle_sigcont, handle_sigtstp): Use raise (sig)
142 rather than kill (getpid (), sig), as it's simpler and safer.
143
1442012-11-17 Juanma Barranquero <lekktu@gmail.com>
145
146 * makefile.w32-in (SYSWAIT_H): New macro.
147 ($(BLD)/movemail.$(O)): Update dependencies.
148
1492012-11-17 Paul Eggert <eggert@cs.ucla.edu>
150
151 Assume POSIX 1003.1-1988 or later for fcntl.h (Bug#12881).
152 * movemail.c, update-game-score.c: Assume <fcntl.h> exists.
153
1542012-10-26 Glenn Morris <rgm@gnu.org>
155
156 * Makefile.in (uninstall): No INSTALLABLES live in archlibdir.
157
158 * Makefile.in (install, uninstall): Transformations should not be
159 applied to $EXEEXT.
160
1612012-10-23 Eli Zaretskii <eliz@gnu.org>
162
163 * makefile.w32-in (lisp2): Add cp51932.el and eucjp-ms.el, to
164 follow src/lisp.mk.
165
1662012-10-21 Glenn Morris <rgm@gnu.org>
167
168 * make-docfile.c (scan_lisp_file): Add cp51932.el and eucjp-ms.el.
169
1702012-10-20 Eli Zaretskii <eliz@gnu.org>
171
172 * make-docfile.c (IS_SLASH, DEF_ELISP_FILE): New macros.
173 (scan_lisp_file): Only pass a .el file if its basename matches a
174 known file in its entirety. Use IS_SLASH and DEF_ELISP_FILE.
175
1762012-10-20 Andreas Schwab <schwab@linux-m68k.org>
177
178 * make-docfile.c (scan_lisp_file): Add bounds checking.
179
1802012-10-20 Eli Zaretskii <eliz@gnu.org>
181
182 Prevent silent omission of doc strings from uncompiled Lisp files.
183 * make-docfile.c (scan_lisp_file): Barf if called with a .el file
184 other than one of a small list of supported un-compiled files.
185
186 * makefile.w32-in (lisp1, lisp2): Name .elc files wherever they
187 exist. (Bug#12395)
188
1892012-10-17 Eli Zaretskii <eliz@gnu.org>
190
191 * ntlib.c: Include <mbstring.h>, to avoid compiler warning about
192 _mbspbrk.
193
1942012-10-08 Eli Zaretskii <eliz@gnu.org>
195
196 * makefile.w32-in (obj): Add cygw32.o.
197
1982012-10-08 Daniel Colascione <dancol@dancol.org>
199
200 * emacsclient.c: Include windows.h when HAVE_NTGUI.
201 (alt_display): New variable. We send the display held by this
202 variable when the primary display is either unsupported or not
203 present.
204 (longopts): Allow display everywhere.
205 (w32_set_user_model_id): Move lower in file, inside HAVE_NTGUI
206 section.
207 (decode_options): Use alt_display. Explain why.
208 (main): Retry connection with alt_display if connection with main
209 display fails.
210
2112012-10-01 Fabrice Popineau <fabrice.popineau@gmail.com>
212
213 * make-docfile.c (write_globals): Special-case
214 Fexit_recursive_edit and Fabort_recursive_edit as well, as
215 functions that are _Noreturn, to be consistent with
216 src/keyboard.c.
217
2182012-09-30 Eli Zaretskii <eliz@gnu.org>
219
220 * ntlib.c (gettimeofday): Copy from src/w32.c. lib/gettime.c
221 needs this function.
222
2232012-09-26 Juanma Barranquero <lekktu@gmail.com>
224
225 * makefile.w32-in (obj): Add profiler.o.
226
2272012-09-17 Glenn Morris <rgm@gnu.org>
228
229 * ebrowse.c (version):
230 * etags.c (print_version): Use COPYRIGHT.
231
2322012-09-11 Paul Eggert <eggert@cs.ucla.edu>
233
234 * pop.c (socket_connection) [HAVE_GETADDRINFO]:
235 Prefer assignment to memcpy when either will do.
236
12012-08-31 Andreas Schwab <schwab@linux-m68k.org> 2372012-08-31 Andreas Schwab <schwab@linux-m68k.org>
2 238
3 * etags.c (consider_token): Always zero-terminate token buffer. 239 * etags.c (consider_token): Always zero-terminate token buffer.
@@ -1028,7 +1264,7 @@
1028 (Asm_help, default_C_suffixes, default_C_help, Cplusplus_suffixes) 1264 (Asm_help, default_C_suffixes, default_C_help, Cplusplus_suffixes)
1029 (Cplusplus_help, Cjava_suffixes, Cobol_suffixes, Cstar_suffixes) 1265 (Cplusplus_help, Cjava_suffixes, Cobol_suffixes, Cstar_suffixes)
1030 (Erlang_suffixes, Erlang_help, Forth_suffixes, Forth_help) 1266 (Erlang_suffixes, Erlang_help, Forth_suffixes, Forth_help)
1031 (Fortran_suffixes, Fortran_help, HTML_suffixes, HTML_help) 1267 (Fortran_suffixes, Fortran_help, HTML_suffixes, HTML_help)
1032 (Lisp_suffixes, Lisp_help, Lua_suffixes, Lua_help) 1268 (Lisp_suffixes, Lisp_help, Lua_suffixes, Lua_help)
1033 (Makefile_filenames, Makefile_help, Objc_suffixes, Objc_help) 1269 (Makefile_filenames, Makefile_help, Objc_suffixes, Objc_help)
1034 (Pascal_suffixes, Pascal_help, Perl_suffixes, Perl_interpreters) 1270 (Pascal_suffixes, Pascal_help, Perl_suffixes, Perl_interpreters)
@@ -3532,7 +3768,7 @@
3532 3768
35332002-03-05 Francesco Potortì <pot@gnu.org> 37692002-03-05 Francesco Potortì <pot@gnu.org>
3534 3770
3535 * etags.c: Honour #line directives. 3771 * etags.c: Honor #line directives.
3536 (no_line_directive): New global var; set it for old behavior. 3772 (no_line_directive): New global var; set it for old behavior.
3537 (main): Remove some #ifdef in the getopt switch. 3773 (main): Remove some #ifdef in the getopt switch.
3538 (add_node, put_entries): Code added to merge different chunks of 3774 (add_node, put_entries): Code added to merge different chunks of
@@ -5006,7 +5242,7 @@
5006 (longopts): New long options without short counterpart are 5242 (longopts): New long options without short counterpart are
5007 globals, members, no-globals, no-members. Regexp options are now 5243 globals, members, no-globals, no-members. Regexp options are now
5008 defined conditionally to ETAGS_REGEXPS. 5244 defined conditionally to ETAGS_REGEXPS.
5009 (print_help): Updated. 5245 (print_help): Update.
5010 5246
50111997-05-22 Francesco Potortì <F.Potorti@cnuce.cnr.it> 52471997-05-22 Francesco Potortì <F.Potorti@cnuce.cnr.it>
5012 5248
@@ -8338,7 +8574,7 @@
8338;; coding: utf-8 8574;; coding: utf-8
8339;; End: 8575;; End:
8340 8576
8341 Copyright (C) 1988-1999, 2001-2012 Free Software Foundation, Inc. 8577 Copyright (C) 1988-1999, 2001-2013 Free Software Foundation, Inc.
8342 8578
8343 This file is part of GNU Emacs. 8579 This file is part of GNU Emacs.
8344 8580
diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in
index c5acca28856..f32333fe765 100644
--- a/lib-src/Makefile.in
+++ b/lib-src/Makefile.in
@@ -1,6 +1,6 @@
1# Makefile for lib-src subdirectory in GNU Emacs. 1# Makefile for lib-src subdirectory in GNU Emacs.
2# Copyright (C) 1985, 1987-1988, 1993-1994, 2001-2012 2# Copyright (C) 1985, 1987-1988, 1993-1994, 2001-2013 Free Software
3# Free Software Foundation, Inc. 3# Foundation, Inc.
4 4
5# This file is part of GNU Emacs. 5# This file is part of GNU Emacs.
6 6
@@ -113,8 +113,11 @@ MKDIR_P = @MKDIR_P@
113 113
114# ========================== Lists of Files =========================== 114# ========================== Lists of Files ===========================
115 115
116# emacsclientw.exe for MinGW, empty otherwise
117CLIENTW = @CLIENTW@
118
116# Things that a user might actually run, which should be installed in bindir. 119# Things that a user might actually run, which should be installed in bindir.
117INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} \ 120INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} $(CLIENTW) \
118 ebrowse${EXEEXT} 121 ebrowse${EXEEXT}
119 122
120INSTALLABLE_SCRIPTS = grep-changelog 123INSTALLABLE_SCRIPTS = grep-changelog
@@ -161,10 +164,23 @@ LIBRESOLV=@LIBRESOLV@
161LIBS_MAIL=@LIBS_MAIL@ 164LIBS_MAIL=@LIBS_MAIL@
162## empty or -lrt or -lposix4 if HAVE_CLOCK_GETTIME 165## empty or -lrt or -lposix4 if HAVE_CLOCK_GETTIME
163LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ 166LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
167## empty or -lrt or -lposix4 if HAVE_FDATASYNC
168LIB_FDATASYNC = @LIB_FDATASYNC@
169## empty or -lwsock2 for MinGW
170LIB_WSOCK32=@LIB_WSOCK32@
164 171
165## Extra libraries to use when linking movemail. 172## Extra libraries to use when linking movemail.
166LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) \ 173LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) \
167 $(COM_ERRLIB) $(LIBHESIOD) $(LIBRESOLV) 174 $(COM_ERRLIB) $(LIBHESIOD) $(LIBRESOLV) $(LIB_WSOCK32)
175
176## Extra libraries when linking emacsclient
177## (empty or -lcomctl32 for MinGW)
178LIBS_ECLIENT = @LIBS_ECLIENT@
179
180## Extra object files for linking for MinGW
181NTLIB = @NTLIB@
182CLIENTRES = @CLIENTRES@
183WINDRES = @WINDRES@
168 184
169## Some systems define this to request special libraries. 185## Some systems define this to request special libraries.
170LIBS_SYSTEM = @LIBS_SYSTEM@ 186LIBS_SYSTEM = @LIBS_SYSTEM@
@@ -225,7 +241,7 @@ $(DESTDIR)${archlibdir}: all
225 umask 022; ${MKDIR_P} $(DESTDIR)${gamedir}; \ 241 umask 022; ${MKDIR_P} $(DESTDIR)${gamedir}; \
226 touch $(DESTDIR)${gamedir}/snake-scores; \ 242 touch $(DESTDIR)${gamedir}/snake-scores; \
227 touch $(DESTDIR)${gamedir}/tetris-scores 243 touch $(DESTDIR)${gamedir}/tetris-scores
228 -if chown ${gameuser} $(DESTDIR)${archlibdir}/update-game-score && chmod u+s $(DESTDIR)${archlibdir}/update-game-score; then \ 244 -if chown ${gameuser} $(DESTDIR)${archlibdir}/update-game-score${EXEEXT} && chmod u+s $(DESTDIR)${archlibdir}/update-game-score${EXEEXT}; then \
229 chown ${gameuser} $(DESTDIR)${gamedir}; \ 245 chown ${gameuser} $(DESTDIR)${gamedir}; \
230 chmod u=rwx,g=rwx,o=rx $(DESTDIR)${gamedir}; \ 246 chmod u=rwx,g=rwx,o=rx $(DESTDIR)${gamedir}; \
231 fi 247 fi
@@ -244,24 +260,25 @@ install: $(DESTDIR)${archlibdir}
244 @echo "Installing utilities for users to run." 260 @echo "Installing utilities for users to run."
245 umask 022; ${MKDIR_P} $(DESTDIR)${bindir} 261 umask 022; ${MKDIR_P} $(DESTDIR)${bindir}
246 for file in ${INSTALLABLES} ; do \ 262 for file in ${INSTALLABLES} ; do \
247 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \ 263 $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} $(DESTDIR)${bindir}/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \
248 done 264 done
249 for file in ${INSTALLABLE_SCRIPTS} ; do \ 265 for file in ${INSTALLABLE_SCRIPTS} ; do \
250 $(INSTALL_SCRIPT) ${srcdir}/$${file} $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \ 266 $(INSTALL_SCRIPT) ${srcdir}/$${file} $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
251 done 267 done
252 268
253uninstall: 269uninstall:
254 (cd $(DESTDIR)${bindir}; \ 270 for file in ${INSTALLABLES}; do \
255 for file in ${INSTALLABLES} ${INSTALLABLE_SCRIPTS}; do \ 271 rm -f $(DESTDIR)${bindir}/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \
272 done
273 for file in ${INSTALLABLE_SCRIPTS}; do \
256 rm -f $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \ 274 rm -f $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \
257 done) 275 done
258 if [ -d $(DESTDIR)${archlibdir} ]; then \ 276 if [ -d $(DESTDIR)${archlibdir} ]; then \
259 (cd $(DESTDIR)${archlibdir} && \ 277 (cd $(DESTDIR)${archlibdir} && rm -f ${UTILITIES} ${SCRIPTS}) \
260 rm -f ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}) \
261 fi 278 fi
262 279
263mostlyclean: 280mostlyclean:
264 -rm -f core *.o 281 -rm -f core *.o *.res
265 282
266clean: mostlyclean 283clean: mostlyclean
267 -rm -f ${EXE_FILES} 284 -rm -f ${EXE_FILES}
@@ -289,7 +306,7 @@ TAGS: etags${EXEEXT}
289## distribute Emacs. If they were clobbered, all the .elc files were 306## distribute Emacs. If they were clobbered, all the .elc files were
290## clobbered too. 307## clobbered too.
291test-distrib${EXEEXT}: ${srcdir}/test-distrib.c 308test-distrib${EXEEXT}: ${srcdir}/test-distrib.c
292 $(CC) ${ALL_CFLAGS} -o test-distrib ${srcdir}/test-distrib.c 309 $(CC) ${ALL_CFLAGS} -o test-distrib${EXEEXT} ${srcdir}/test-distrib.c
293 ./test-distrib ${srcdir}/testfile 310 ./test-distrib ${srcdir}/testfile
294 311
295../lib/libgnu.a: $(config_h) 312../lib/libgnu.a: $(config_h)
@@ -299,47 +316,68 @@ regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h $(config_h)
299 ${CC} -c ${CPP_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER \ 316 ${CC} -c ${CPP_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER \
300 ${srcdir}/../src/regex.c 317 ${srcdir}/../src/regex.c
301 318
302etags${EXEEXT}: ${srcdir}/etags.c regex.o $(config_h) 319etags${EXEEXT}: ${srcdir}/etags.c regex.o $(NTLIB) $(config_h)
303 $(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" \ 320 $(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" \
304 -DVERSION="\"${version}\"" ${srcdir}/etags.c \ 321 -DVERSION="\"${version}\"" ${srcdir}/etags.c \
305 regex.o $(LOADLIBES) -o etags 322 regex.o $(LOADLIBES) $(NTLIB) -o etags${EXEEXT}
306 323
307ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h $(config_h) 324ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h $(NTLIB) \
325 $(config_h)
308 $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \ 326 $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \
309 ${srcdir}/ebrowse.c $(LOADLIBES) -o ebrowse 327 ${srcdir}/ebrowse.c $(LOADLIBES) $(NTLIB) -o ebrowse${EXEEXT}
310 328
311## We depend on etags to assure that parallel makes do not write two 329## We depend on etags to assure that parallel makes do not write two
312## etags.o files on top of each other. 330## etags.o files on top of each other.
313ctags${EXEEXT}: etags${EXEEXT} 331ctags${EXEEXT}: etags${EXEEXT}
314 $(CC) ${ALL_CFLAGS} -DCTAGS -DEMACS_NAME="\"GNU Emacs\"" \ 332 $(CC) ${ALL_CFLAGS} -DCTAGS -DEMACS_NAME="\"GNU Emacs\"" \
315 -DVERSION="\"${version}\"" ${srcdir}/etags.c \ 333 -DVERSION="\"${version}\"" ${srcdir}/etags.c \
316 regex.o $(LOADLIBES) -o ctags 334 regex.o $(LOADLIBES) $(NTLIB) -o ctags${EXEEXT}
317 335
318profile${EXEEXT}: ${srcdir}/profile.c $(config_h) 336profile${EXEEXT}: ${srcdir}/profile.c $(NTLIB) $(config_h)
319 $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c \ 337 $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c \
320 $(LOADLIBES) $(LIB_CLOCK_GETTIME) -o profile 338 $(LOADLIBES) $(NTLIB) $(LIB_CLOCK_GETTIME) -o profile${EXEEXT}
321 339
322make-docfile${EXEEXT}: ${srcdir}/make-docfile.c $(config_h) 340make-docfile${EXEEXT}: ${srcdir}/make-docfile.c $(NTLIB) $(config_h)
323 $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) \ 341 $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) $(NTLIB) \
324 -o make-docfile 342 -o make-docfile${EXEEXT}
325 343
326movemail${EXEEXT}: ${srcdir}/movemail.c pop.o $(config_h) 344movemail${EXEEXT}: ${srcdir}/movemail.c pop.o $(NTLIB) $(config_h)
327 $(CC) ${ALL_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c pop.o \ 345 $(CC) ${ALL_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c pop.o \
328 $(LOADLIBES) $(LIBS_MOVE) -o movemail 346 $(LOADLIBES) $(NTLIB) $(LIBS_MOVE) -o movemail${EXEEXT}
329 347
330pop.o: ${srcdir}/pop.c ${srcdir}/../lib/min-max.h $(config_h) 348pop.o: ${srcdir}/pop.c ${srcdir}/pop.h ${srcdir}/../lib/min-max.h $(config_h)
331 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c 349 $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c
332 350
333emacsclient${EXEEXT}: ${srcdir}/emacsclient.c $(config_h) 351emacsclient${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(config_h)
334 $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c \ 352 $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c \
335 -DVERSION="\"${version}\"" \ 353 -DVERSION="\"${version}\"" $(NTLIB) $(LOADLIBES) $(LIB_FDATASYNC) \
336 $(LOADLIBES) -o emacsclient 354 $(LIB_WSOCK32) $(LIBS_ECLIENT) -o emacsclient${EXEEXT}
337 355
338hexl${EXEEXT}: ${srcdir}/hexl.c $(config_h) 356emacsclientw${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(CLIENTRES) $(config_h)
339 $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl 357 $(CC) ${ALL_CFLAGS} $(CLIENTRES) -mwindows ${srcdir}/emacsclient.c \
358 -DVERSION="\"${version}\"" $(LOADLIBES) $(LIB_FDATASYNC) \
359 $(LIB_WSOCK32) $(LIBS_ECLIENT) -o emacsclientw${EXEEXT}
340 360
341update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(config_h) 361NTINC = ${srcdir}/../nt/inc
362NTDEPS = $(NTINC)/ms-w32.h $(NTINC)/sys/stat.h $(NTINC)/inttypes.h \
363 $(NTINC)/stdint.h $(NTINC)/pwd.h $(NTINC)/sys/time.h $(NTINC)/stdbool.h \
364 $(NTINC)/sys/wait.h $(NTINC)/unistd.h $(NTINC)/sys/file.h $(NTINC)/netdb.h
365
366# The dependency on $(NTDEPS) is a trick intended to cause recompile of
367# programs on MinGW whenever some private header in nt/inc is modified.
368ntlib.o: ${srcdir}/ntlib.c ${srcdir}/ntlib.h $(NTDEPS)
369 $(CC) -c ${CPP_CFLAGS} ${srcdir}/ntlib.c
370
371hexl${EXEEXT}: ${srcdir}/hexl.c $(NTLIB) $(config_h)
372 $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl${EXEEXT}
373
374update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(NTLIB) $(config_h)
342 $(CC) ${ALL_CFLAGS} -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \ 375 $(CC) ${ALL_CFLAGS} -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \
343 ${srcdir}/update-game-score.c $(LOADLIBES) -o update-game-score 376 ${srcdir}/update-game-score.c $(LOADLIBES) $(NTLIB) \
377 -o update-game-score${EXEEXT}
378
379emacsclient.res: $(NTINC)/../emacsclient.rc
380 $(WINDRES) -O coff --include-dir=$(NTINC)/.. -o emacsclient.res \
381 $(NTINC)/../emacsclient.rc
344 382
345## Makefile ends here. 383## Makefile ends here.
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c
index f8569fe3747..3a237daf5f8 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-2012 Free Software Foundation, Inc. 3Copyright (C) 1992-2013 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
6 6
@@ -3516,8 +3516,7 @@ usage (int error)
3516static _Noreturn void 3516static _Noreturn void
3517version (void) 3517version (void)
3518{ 3518{
3519 /* Makes it easier to update automatically. */ 3519 char emacs_copyright[] = COPYRIGHT;
3520 char emacs_copyright[] = "Copyright (C) 2012 Free Software Foundation, Inc.";
3521 3520
3522 printf ("ebrowse %s\n", VERSION); 3521 printf ("ebrowse %s\n", VERSION);
3523 puts (emacs_copyright); 3522 puts (emacs_copyright);
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 07300dbf249..898e8d69b07 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-2012 Free Software Foundation, Inc. 3Copyright (C) 1986-1987, 1994, 1999-2013 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
6 6
@@ -44,6 +44,10 @@ char *w32_getenv (char *);
44 44
45#else /* !WINDOWSNT */ 45#else /* !WINDOWSNT */
46 46
47# ifdef HAVE_NTGUI
48# include <windows.h>
49# endif /* HAVE_NTGUI */
50
47# include "syswait.h" 51# include "syswait.h"
48 52
49# ifdef HAVE_INET_SOCKETS 53# ifdef HAVE_INET_SOCKETS
@@ -84,10 +88,7 @@ char *w32_getenv (char *);
84 88
85 89
86 90
87char *getenv (const char *), *getwd (char *); 91char *getenv (const char *);
88#ifdef HAVE_GETCWD
89char *(getcwd) (char *, size_t);
90#endif
91 92
92#ifndef VERSION 93#ifndef VERSION
93#define VERSION "unspecified" 94#define VERSION "unspecified"
@@ -140,6 +141,9 @@ int current_frame = 1;
140/* The display on which Emacs should work. --display. */ 141/* The display on which Emacs should work. --display. */
141const char *display = NULL; 142const char *display = NULL;
142 143
144/* The alternate display we should try if Emacs does not support display. */
145const char *alt_display = NULL;
146
143/* The parent window ID, if we are opening a frame via XEmbed. */ 147/* The parent window ID, if we are opening a frame via XEmbed. */
144char *parent_id = NULL; 148char *parent_id = NULL;
145 149
@@ -182,9 +186,7 @@ struct option longopts[] =
182 { "socket-name", required_argument, NULL, 's' }, 186 { "socket-name", required_argument, NULL, 's' },
183#endif 187#endif
184 { "server-file", required_argument, NULL, 'f' }, 188 { "server-file", required_argument, NULL, 'f' },
185#ifndef WINDOWSNT
186 { "display", required_argument, NULL, 'd' }, 189 { "display", required_argument, NULL, 'd' },
187#endif
188 { "parent-id", required_argument, NULL, 'p' }, 190 { "parent-id", required_argument, NULL, 'p' },
189 { 0, 0, 0, 0 } 191 { 0, 0, 0, 0 }
190}; 192};
@@ -218,7 +220,7 @@ get_current_dir_name (void)
218 char *buf; 220 char *buf;
219 const char *pwd; 221 const char *pwd;
220 struct stat dotstat, pwdstat; 222 struct stat dotstat, pwdstat;
221 /* If PWD is accurate, use it instead of calling getwd. PWD is 223 /* If PWD is accurate, use it instead of calling getcwd. PWD is
222 sometimes a nicer name, and using it may avoid a fatal error if a 224 sometimes a nicer name, and using it may avoid a fatal error if a
223 parent directory is searchable but not readable. */ 225 parent directory is searchable but not readable. */
224 if ((pwd = egetenv ("PWD")) != 0 226 if ((pwd = egetenv ("PWD")) != 0
@@ -235,7 +237,6 @@ get_current_dir_name (void)
235 buf = (char *) xmalloc (strlen (pwd) + 1); 237 buf = (char *) xmalloc (strlen (pwd) + 1);
236 strcpy (buf, pwd); 238 strcpy (buf, pwd);
237 } 239 }
238#ifdef HAVE_GETCWD
239 else 240 else
240 { 241 {
241 size_t buf_size = 1024; 242 size_t buf_size = 1024;
@@ -262,20 +263,6 @@ get_current_dir_name (void)
262 } 263 }
263 } 264 }
264 } 265 }
265#else
266 else
267 {
268 /* We need MAXPATHLEN here. */
269 buf = (char *) xmalloc (MAXPATHLEN + 1);
270 if (getwd (buf) == NULL)
271 {
272 int tmp_errno = errno;
273 free (buf);
274 errno = tmp_errno;
275 return NULL;
276 }
277 }
278#endif
279 return buf; 266 return buf;
280} 267}
281#endif 268#endif
@@ -385,32 +372,6 @@ w32_getenv (char *envvar)
385 return NULL; 372 return NULL;
386} 373}
387 374
388void
389w32_set_user_model_id (void)
390{
391 HMODULE shell;
392 HRESULT (WINAPI * set_user_model) (wchar_t * id);
393
394 /* On Windows 7 and later, we need to set the user model ID
395 to associate emacsclient launched files with Emacs frames
396 in the UI. */
397 shell = LoadLibrary ("shell32.dll");
398 if (shell)
399 {
400 set_user_model
401 = (void *) GetProcAddress (shell,
402 "SetCurrentProcessExplicitAppUserModelID");
403 /* If the function is defined, then we are running on Windows 7
404 or newer, and the UI uses this to group related windows
405 together. Since emacs, runemacs, emacsclient are related, we
406 want them grouped even though the executables are different,
407 so we need to set a consistent ID between them. */
408 if (set_user_model)
409 set_user_model (L"GNU.Emacs");
410
411 FreeLibrary (shell);
412 }
413}
414 375
415int 376int
416w32_window_app (void) 377w32_window_app (void)
@@ -605,16 +566,29 @@ decode_options (int argc, char **argv)
605 Without the -c option, we used to set `display' to $DISPLAY by 566 Without the -c option, we used to set `display' to $DISPLAY by
606 default, but this changed the default behavior and is sometimes 567 default, but this changed the default behavior and is sometimes
607 inconvenient. So we force users to use "--display $DISPLAY" if 568 inconvenient. So we force users to use "--display $DISPLAY" if
608 they want Emacs to connect to their current display. */ 569 they want Emacs to connect to their current display.
570
571 Some window systems have a notion of default display not
572 reflected in the DISPLAY variable. If the user didn't give us an
573 explicit display, try this platform-specific after trying the
574 display in DISPLAY (if any). */
609 if (!current_frame && !tty && !display) 575 if (!current_frame && !tty && !display)
610 { 576 {
611 display = egetenv ("DISPLAY"); 577 /* Set these here so we use a default_display only when the user
612#ifdef NS_IMPL_COCOA 578 didn't give us an explicit display. */
613 /* Under Cocoa, we don't really use displays the same way as in X, 579#if defined (NS_IMPL_COCOA)
614 so provide a dummy. */ 580 alt_display = "ns";
615 if (!display || strlen (display) == 0) 581#elif defined (HAVE_NTGUI)
616 display = "ns"; 582 alt_display = "w32";
617#endif 583#endif
584
585 display = egetenv ("DISPLAY");
586 }
587
588 if (!display)
589 {
590 display = alt_display;
591 alt_display = NULL;
618 } 592 }
619 593
620 /* A null-string display is invalid. */ 594 /* A null-string display is invalid. */
@@ -1146,7 +1120,7 @@ handle_sigcont (int signalnum)
1146 else 1120 else
1147 { 1121 {
1148 /* We are in the background; cancel the continue. */ 1122 /* We are in the background; cancel the continue. */
1149 kill (getpid (), SIGSTOP); 1123 raise (SIGSTOP);
1150 } 1124 }
1151 1125
1152 signal (signalnum, handle_sigcont); 1126 signal (signalnum, handle_sigcont);
@@ -1173,7 +1147,7 @@ handle_sigtstp (int signalnum)
1173 sigprocmask (SIG_BLOCK, NULL, &set); 1147 sigprocmask (SIG_BLOCK, NULL, &set);
1174 sigdelset (&set, signalnum); 1148 sigdelset (&set, signalnum);
1175 signal (signalnum, SIG_DFL); 1149 signal (signalnum, SIG_DFL);
1176 kill (getpid (), signalnum); 1150 raise (signalnum);
1177 sigprocmask (SIG_SETMASK, &set, NULL); /* Let's the above signal through. */ 1151 sigprocmask (SIG_SETMASK, &set, NULL); /* Let's the above signal through. */
1178 signal (signalnum, handle_sigtstp); 1152 signal (signalnum, handle_sigtstp);
1179 1153
@@ -1415,10 +1389,37 @@ set_socket (int no_exit_if_error)
1415 exit (EXIT_FAILURE); 1389 exit (EXIT_FAILURE);
1416} 1390}
1417 1391
1418#ifdef WINDOWSNT 1392#ifdef HAVE_NTGUI
1419FARPROC set_fg; /* Pointer to AllowSetForegroundWindow. */ 1393FARPROC set_fg; /* Pointer to AllowSetForegroundWindow. */
1420FARPROC get_wc; /* Pointer to RealGetWindowClassA. */ 1394FARPROC get_wc; /* Pointer to RealGetWindowClassA. */
1421 1395
1396void
1397w32_set_user_model_id (void)
1398{
1399 HMODULE shell;
1400 HRESULT (WINAPI * set_user_model) (wchar_t * id);
1401
1402 /* On Windows 7 and later, we need to set the user model ID
1403 to associate emacsclient launched files with Emacs frames
1404 in the UI. */
1405 shell = LoadLibrary ("shell32.dll");
1406 if (shell)
1407 {
1408 set_user_model
1409 = (void *) GetProcAddress (shell,
1410 "SetCurrentProcessExplicitAppUserModelID");
1411 /* If the function is defined, then we are running on Windows 7
1412 or newer, and the UI uses this to group related windows
1413 together. Since emacs, runemacs, emacsclient are related, we
1414 want them grouped even though the executables are different,
1415 so we need to set a consistent ID between them. */
1416 if (set_user_model)
1417 set_user_model (L"GNU.Emacs");
1418
1419 FreeLibrary (shell);
1420 }
1421}
1422
1422BOOL CALLBACK 1423BOOL CALLBACK
1423w32_find_emacs_process (HWND hWnd, LPARAM lParam) 1424w32_find_emacs_process (HWND hWnd, LPARAM lParam)
1424{ 1425{
@@ -1467,7 +1468,7 @@ w32_give_focus (void)
1467 && (get_wc = GetProcAddress (user32, "RealGetWindowClassA"))) 1468 && (get_wc = GetProcAddress (user32, "RealGetWindowClassA")))
1468 EnumWindows (w32_find_emacs_process, (LPARAM) 0); 1469 EnumWindows (w32_find_emacs_process, (LPARAM) 0);
1469} 1470}
1470#endif 1471#endif /* HAVE_NTGUI */
1471 1472
1472/* Start the emacs daemon and try to connect to it. */ 1473/* Start the emacs daemon and try to connect to it. */
1473 1474
@@ -1537,11 +1538,13 @@ main (int argc, char **argv)
1537 main_argv = argv; 1538 main_argv = argv;
1538 progname = argv[0]; 1539 progname = argv[0];
1539 1540
1540#ifdef WINDOWSNT 1541#ifdef HAVE_NTGUI
1541 /* On Windows 7 and later, we need to explicitly associate emacsclient 1542 /* On Windows 7 and later, we need to explicitly associate
1542 with emacs so the UI behaves sensibly. */ 1543 emacsclient with emacs so the UI behaves sensibly. This
1544 association does no harm if we're not actually connecting to an
1545 Emacs using a window display. */
1543 w32_set_user_model_id (); 1546 w32_set_user_model_id ();
1544#endif 1547#endif /* HAVE_NTGUI */
1545 1548
1546 /* Process options. */ 1549 /* Process options. */
1547 decode_options (argc, argv); 1550 decode_options (argc, argv);
@@ -1571,15 +1574,15 @@ main (int argc, char **argv)
1571 cwd = get_current_dir_name (); 1574 cwd = get_current_dir_name ();
1572 if (cwd == 0) 1575 if (cwd == 0)
1573 { 1576 {
1574 /* getwd puts message in STRING if it fails. */
1575 message (TRUE, "%s: %s\n", progname, 1577 message (TRUE, "%s: %s\n", progname,
1576 "Cannot get current working directory"); 1578 "Cannot get current working directory");
1577 fail (); 1579 fail ();
1578 } 1580 }
1579 1581
1580#ifdef WINDOWSNT 1582#ifdef HAVE_NTGUI
1583 if (display && !strcmp (display, "w32"))
1581 w32_give_focus (); 1584 w32_give_focus ();
1582#endif 1585#endif /* HAVE_NTGUI */
1583 1586
1584 /* Send over our environment and current directory. */ 1587 /* Send over our environment and current directory. */
1585 if (!current_frame) 1588 if (!current_frame)
@@ -1721,7 +1724,8 @@ main (int argc, char **argv)
1721 needlf = 2; 1724 needlf = 2;
1722 } 1725 }
1723 fflush (stdout); 1726 fflush (stdout);
1724 fsync (1); 1727 while (fdatasync (1) != 0 && errno == EINTR)
1728 continue;
1725 1729
1726 /* Now, wait for an answer and print any messages. */ 1730 /* Now, wait for an answer and print any messages. */
1727 while (exit_status == EXIT_SUCCESS) 1731 while (exit_status == EXIT_SUCCESS)
@@ -1748,46 +1752,56 @@ main (int argc, char **argv)
1748 if (end_p != NULL) 1752 if (end_p != NULL)
1749 *end_p++ = '\0'; 1753 *end_p++ = '\0';
1750 1754
1751 if (strprefix ("-emacs-pid ", p)) 1755 if (strprefix ("-emacs-pid ", p))
1752 { 1756 {
1753 /* -emacs-pid PID: The process id of the Emacs process. */ 1757 /* -emacs-pid PID: The process id of the Emacs process. */
1754 emacs_pid = strtol (p + strlen ("-emacs-pid"), NULL, 10); 1758 emacs_pid = strtol (p + strlen ("-emacs-pid"), NULL, 10);
1755 } 1759 }
1756 else if (strprefix ("-window-system-unsupported ", p)) 1760 else if (strprefix ("-window-system-unsupported ", p))
1757 { 1761 {
1758 /* -window-system-unsupported: Emacs was compiled without X 1762 /* -window-system-unsupported: Emacs was compiled without support
1759 support. Try again on the terminal. */ 1763 for whatever window system we tried. Try the alternate
1760 nowait = 0; 1764 display, or, failing that, try the terminal. */
1761 tty = 1; 1765 if (alt_display)
1762 goto retry; 1766 {
1763 } 1767 display = alt_display;
1764 else if (strprefix ("-print ", p)) 1768 alt_display = NULL;
1765 { 1769 }
1766 /* -print STRING: Print STRING on the terminal. */ 1770 else
1767 str = unquote_argument (p + strlen ("-print ")); 1771 {
1768 if (needlf) 1772 nowait = 0;
1769 printf ("\n"); 1773 tty = 1;
1770 printf ("%s", str); 1774 }
1771 needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; 1775
1772 } 1776 goto retry;
1773 else if (strprefix ("-print-nonl ", p)) 1777 }
1774 { 1778 else if (strprefix ("-print ", p))
1775 /* -print-nonl STRING: Print STRING on the terminal. 1779 {
1776 Used to continue a preceding -print command. */ 1780 /* -print STRING: Print STRING on the terminal. */
1777 str = unquote_argument (p + strlen ("-print-nonl ")); 1781 str = unquote_argument (p + strlen ("-print "));
1778 printf ("%s", str); 1782 if (needlf)
1779 needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; 1783 printf ("\n");
1780 } 1784 printf ("%s", str);
1781 else if (strprefix ("-error ", p)) 1785 needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n';
1782 { 1786 }
1783 /* -error DESCRIPTION: Signal an error on the terminal. */ 1787 else if (strprefix ("-print-nonl ", p))
1784 str = unquote_argument (p + strlen ("-error ")); 1788 {
1785 if (needlf) 1789 /* -print-nonl STRING: Print STRING on the terminal.
1786 printf ("\n"); 1790 Used to continue a preceding -print command. */
1787 fprintf (stderr, "*ERROR*: %s", str); 1791 str = unquote_argument (p + strlen ("-print-nonl "));
1788 needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; 1792 printf ("%s", str);
1789 exit_status = EXIT_FAILURE; 1793 needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n';
1790 } 1794 }
1795 else if (strprefix ("-error ", p))
1796 {
1797 /* -error DESCRIPTION: Signal an error on the terminal. */
1798 str = unquote_argument (p + strlen ("-error "));
1799 if (needlf)
1800 printf ("\n");
1801 fprintf (stderr, "*ERROR*: %s", str);
1802 needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n';
1803 exit_status = EXIT_FAILURE;
1804 }
1791#ifdef SIGSTOP 1805#ifdef SIGSTOP
1792 else if (strprefix ("-suspend ", p)) 1806 else if (strprefix ("-suspend ", p))
1793 { 1807 {
@@ -1812,7 +1826,8 @@ main (int argc, char **argv)
1812 if (needlf) 1826 if (needlf)
1813 printf ("\n"); 1827 printf ("\n");
1814 fflush (stdout); 1828 fflush (stdout);
1815 fsync (1); 1829 while (fdatasync (1) != 0 && errno == EINTR)
1830 continue;
1816 1831
1817 if (rl < 0) 1832 if (rl < 0)
1818 exit_status = EXIT_FAILURE; 1833 exit_status = EXIT_FAILURE;
diff --git a/lib-src/etags.c b/lib-src/etags.c
index e65082de534..f6b173bf465 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,8 +28,8 @@ 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-2012 31Copyright (C) 1984, 1987-1989, 1993-1995, 1998-2013 Free Software
32 Free Software Foundation, Inc. 32Foundation, Inc.
33 33
34This file is not considered part of GNU Emacs. 34This file is not considered part of GNU Emacs.
35 35
@@ -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/*
@@ -123,19 +123,9 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4";
123# undef HAVE_NTGUI 123# undef HAVE_NTGUI
124# undef DOS_NT 124# undef DOS_NT
125# define DOS_NT 125# define DOS_NT
126# ifndef HAVE_GETCWD 126#endif /* WINDOWSNT */
127# define HAVE_GETCWD
128# endif /* undef HAVE_GETCWD */
129#else /* not WINDOWSNT */
130#endif /* !WINDOWSNT */
131 127
132#include <unistd.h> 128#include <unistd.h>
133#ifndef HAVE_UNISTD_H
134# if defined (HAVE_GETCWD) && !defined (WINDOWSNT)
135 extern char *getcwd (char *buf, size_t size);
136# endif
137#endif /* HAVE_UNISTD_H */
138
139#include <stdarg.h> 129#include <stdarg.h>
140#include <stdlib.h> 130#include <stdlib.h>
141#include <string.h> 131#include <string.h>
@@ -152,16 +142,7 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4";
152# define assert(x) ((void) 0) 142# define assert(x) ((void) 0)
153#endif 143#endif
154 144
155#ifdef NO_LONG_OPTIONS /* define this if you don't have GNU getopt */ 145#include <getopt.h>
156# define NO_LONG_OPTIONS TRUE
157# define getopt_long(argc,argv,optstr,lopts,lind) getopt (argc, argv, optstr)
158 extern char *optarg;
159 extern int optind, opterr;
160#else
161# define NO_LONG_OPTIONS FALSE
162# include <getopt.h>
163#endif /* NO_LONG_OPTIONS */
164
165#include <regex.h> 146#include <regex.h>
166 147
167/* Define CTAGS to make the program "ctags" compatible with the usual one. 148/* Define CTAGS to make the program "ctags" compatible with the usual one.
@@ -335,15 +316,7 @@ static void Texinfo_nodes (FILE *);
335static void Yacc_entries (FILE *); 316static void Yacc_entries (FILE *);
336static void just_read_file (FILE *); 317static void just_read_file (FILE *);
337 318
338static void print_language_names (void);
339static void print_version (void);
340static void print_help (argument *);
341int main (int, char **);
342
343static compressor *get_compressor_from_suffix (char *, char **);
344static language *get_language_from_langname (const char *); 319static language *get_language_from_langname (const char *);
345static language *get_language_from_interpreter (char *);
346static language *get_language_from_filename (char *, bool);
347static void readline (linebuffer *, FILE *); 320static void readline (linebuffer *, FILE *);
348static long readline_internal (linebuffer *, FILE *); 321static long readline_internal (linebuffer *, FILE *);
349static bool nocase_tail (const char *); 322static bool nocase_tail (const char *);
@@ -365,13 +338,13 @@ static void find_entries (FILE *);
365static void free_tree (node *); 338static void free_tree (node *);
366static void free_fdesc (fdesc *); 339static void free_fdesc (fdesc *);
367static void pfnote (char *, bool, char *, int, int, long); 340static void pfnote (char *, bool, char *, int, int, long);
368static void make_tag (const char *, int, bool, char *, int, int, long);
369static void invalidate_nodes (fdesc *, node **); 341static void invalidate_nodes (fdesc *, node **);
370static void put_entries (node *); 342static void put_entries (node *);
371 343
372static char *concat (const char *, const char *, const char *); 344static char *concat (const char *, const char *, const char *);
373static char *skip_spaces (char *); 345static char *skip_spaces (char *);
374static char *skip_non_spaces (char *); 346static char *skip_non_spaces (char *);
347static char *skip_name (char *);
375static char *savenstr (const char *, int); 348static char *savenstr (const char *, int);
376static char *savestr (const char *); 349static char *savestr (const char *);
377static char *etags_strchr (const char *, int); 350static char *etags_strchr (const char *, int);
@@ -638,7 +611,8 @@ static const char Lisp_help [] =
638"In Lisp code, any function defined with `defun', any variable\n\ 611"In Lisp code, any function defined with `defun', any variable\n\
639defined with `defvar' or `defconst', and in general the first\n\ 612defined with `defvar' or `defconst', and in general the first\n\
640argument of any expression that starts with `(def' in column zero\n\ 613argument of any expression that starts with `(def' in column zero\n\
641is a tag."; 614is a tag.\n\
615The `--declarations' option tags \"(defvar foo)\" constructs too.";
642 616
643static const char *Lua_suffixes [] = 617static const char *Lua_suffixes [] =
644 { "lua", "LUA", NULL }; 618 { "lua", "LUA", NULL };
@@ -833,11 +807,10 @@ etags --help --lang=ada.");
833#ifndef VERSION 807#ifndef VERSION
834# define VERSION "17.38.1.4" 808# define VERSION "17.38.1.4"
835#endif 809#endif
836static void 810static _Noreturn void
837print_version (void) 811print_version (void)
838{ 812{
839 /* Makes it easier to update automatically. */ 813 char emacs_copyright[] = COPYRIGHT;
840 char emacs_copyright[] = "Copyright (C) 2012 Free Software Foundation, Inc.";
841 814
842 printf ("%s (%s %s)\n", (CTAGS) ? "ctags" : "etags", EMACS_NAME, VERSION); 815 printf ("%s (%s %s)\n", (CTAGS) ? "ctags" : "etags", EMACS_NAME, VERSION);
843 puts (emacs_copyright); 816 puts (emacs_copyright);
@@ -850,7 +823,7 @@ print_version (void)
850# define PRINT_UNDOCUMENTED_OPTIONS_HELP FALSE 823# define PRINT_UNDOCUMENTED_OPTIONS_HELP FALSE
851#endif 824#endif
852 825
853static void 826static _Noreturn void
854print_help (argument *argbuffer) 827print_help (argument *argbuffer)
855{ 828{
856 bool help_for_lang = FALSE; 829 bool help_for_lang = FALSE;
@@ -870,11 +843,7 @@ print_help (argument *argbuffer)
870 printf ("Usage: %s [options] [[regex-option ...] file-name] ...\n\ 843 printf ("Usage: %s [options] [[regex-option ...] file-name] ...\n\
871\n\ 844\n\
872These are the options accepted by %s.\n", progname, progname); 845These are the options accepted by %s.\n", progname, progname);
873 if (NO_LONG_OPTIONS) 846 puts ("You may use unambiguous abbreviations for the long option names.");
874 puts ("WARNING: long option names do not work with this executable,\n\
875as it is not linked with GNU getopt.");
876 else
877 puts ("You may use unambiguous abbreviations for the long option names.");
878 puts (" A - as file name means read names from stdin (one per line).\n\ 847 puts (" A - as file name means read names from stdin (one per line).\n\
879Absolute names are stored in the output file as they are.\n\ 848Absolute names are stored in the output file as they are.\n\
880Relative ones are stored relative to the output file's directory.\n"); 849Relative ones are stored relative to the output file's directory.\n");
@@ -1066,9 +1035,9 @@ main (int argc, char **argv)
1066 1035
1067 /* When the optstring begins with a '-' getopt_long does not rearrange the 1036 /* When the optstring begins with a '-' getopt_long does not rearrange the
1068 non-options arguments to be at the end, but leaves them alone. */ 1037 non-options arguments to be at the end, but leaves them alone. */
1069 optstring = concat (NO_LONG_OPTIONS ? "" : "-", 1038 optstring = concat ("-ac:Cf:Il:o:r:RSVhH",
1070 "ac:Cf:Il:o:r:RSVhH", 1039 (CTAGS) ? "BxdtTuvw" : "Di:",
1071 (CTAGS) ? "BxdtTuvw" : "Di:"); 1040 "");
1072 1041
1073 while ((opt = getopt_long (argc, argv, optstring, longopts, NULL)) != EOF) 1042 while ((opt = getopt_long (argc, argv, optstring, longopts, NULL)) != EOF)
1074 switch (opt) 1043 switch (opt)
@@ -4293,10 +4262,11 @@ Asm_labels (FILE *inf)
4293/* 4262/*
4294 * Perl support 4263 * Perl support
4295 * Perl sub names: /^sub[ \t\n]+[^ \t\n{]+/ 4264 * Perl sub names: /^sub[ \t\n]+[^ \t\n{]+/
4265 * /^use constant[ \t\n]+[^ \t\n{=,;]+/
4296 * Perl variable names: /^(my|local).../ 4266 * Perl variable names: /^(my|local).../
4297 * Original code by Bart Robinson <lomew@cs.utah.edu> (1995) 4267 * Original code by Bart Robinson <lomew@cs.utah.edu> (1995)
4298 * Additions by Michael Ernst <mernst@alum.mit.edu> (1997) 4268 * Additions by Michael Ernst <mernst@alum.mit.edu> (1997)
4299 * Ideas by Kai Großjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> (2001) 4269 * Ideas by Kai Großjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> (2001)
4300 */ 4270 */
4301static void 4271static void
4302Perl_functions (FILE *inf) 4272Perl_functions (FILE *inf)
@@ -4315,9 +4285,10 @@ Perl_functions (FILE *inf)
4315 } 4285 }
4316 else if (LOOKING_AT (cp, "sub")) 4286 else if (LOOKING_AT (cp, "sub"))
4317 { 4287 {
4318 char *pos; 4288 char *pos, *sp;
4319 char *sp = cp;
4320 4289
4290 subr:
4291 sp = cp;
4321 while (!notinname (*cp)) 4292 while (!notinname (*cp))
4322 cp++; 4293 cp++;
4323 if (cp == sp) 4294 if (cp == sp)
@@ -4340,8 +4311,21 @@ Perl_functions (FILE *inf)
4340 lb.buffer, cp - lb.buffer + 1, lineno, linecharno); 4311 lb.buffer, cp - lb.buffer + 1, lineno, linecharno);
4341 free (name); 4312 free (name);
4342 } 4313 }
4314 }
4315 else if (LOOKING_AT (cp, "use constant")
4316 || LOOKING_AT (cp, "use constant::defer"))
4317 {
4318 /* For hash style multi-constant like
4319 use constant { FOO => 123,
4320 BAR => 456 };
4321 only the first FOO is picked up. Parsing across the value
4322 expressions would be difficult in general, due to possible nested
4323 hashes, here-documents, etc. */
4324 if (*cp == '{')
4325 cp = skip_spaces (cp+1);
4326 goto subr;
4343 } 4327 }
4344 else if (globals) /* only if we are tagging global vars */ 4328 else if (globals) /* only if we are tagging global vars */
4345 { 4329 {
4346 /* Skip a qualifier, if any. */ 4330 /* Skip a qualifier, if any. */
4347 bool qual = LOOKING_AT (cp, "my") || LOOKING_AT (cp, "local"); 4331 bool qual = LOOKING_AT (cp, "my") || LOOKING_AT (cp, "local");
@@ -4756,6 +4740,19 @@ Lisp_functions (FILE *inf)
4756 if (dbp[0] != '(') 4740 if (dbp[0] != '(')
4757 continue; 4741 continue;
4758 4742
4743 /* "(defvar foo)" is a declaration rather than a definition. */
4744 if (! declarations)
4745 {
4746 char *p = dbp + 1;
4747 if (LOOKING_AT (p, "defvar"))
4748 {
4749 p = skip_name (p); /* past var name */
4750 p = skip_spaces (p);
4751 if (*p == ')')
4752 continue;
4753 }
4754 }
4755
4759 if (strneq (dbp+1, "def", 3) || strneq (dbp+1, "DEF", 3)) 4756 if (strneq (dbp+1, "def", 3) || strneq (dbp+1, "DEF", 3))
4760 { 4757 {
4761 dbp = skip_non_spaces (dbp); 4758 dbp = skip_non_spaces (dbp);
@@ -5099,7 +5096,7 @@ Texinfo_nodes (FILE *inf)
5099 * Contents of <title>, <h1>, <h2>, <h3> are tags. 5096 * Contents of <title>, <h1>, <h2>, <h3> are tags.
5100 * Contents of <a name=xxx> are tags with name xxx. 5097 * Contents of <a name=xxx> are tags with name xxx.
5101 * 5098 *
5102 * Francesco Potortì, 2002. 5099 * Francesco Potortì, 2002.
5103 */ 5100 */
5104static void 5101static void
5105HTML_labels (FILE *inf) 5102HTML_labels (FILE *inf)
@@ -5622,10 +5619,7 @@ analyse_regex (char *regex_arg)
5622 /* regexfile is a file containing regexps, one per line. */ 5619 /* regexfile is a file containing regexps, one per line. */
5623 regexfp = fopen (regexfile, "r"); 5620 regexfp = fopen (regexfile, "r");
5624 if (regexfp == NULL) 5621 if (regexfp == NULL)
5625 { 5622 pfatal (regexfile);
5626 pfatal (regexfile);
5627 return;
5628 }
5629 linebuffer_init (&regexbuf); 5623 linebuffer_init (&regexbuf);
5630 while (readline_internal (&regexbuf, regexfp) > 0) 5624 while (readline_internal (&regexbuf, regexfp) > 0)
5631 analyse_regex (regexbuf.buffer); 5625 analyse_regex (regexbuf.buffer);
@@ -6316,6 +6310,16 @@ skip_non_spaces (char *cp)
6316 return cp; 6310 return cp;
6317} 6311}
6318 6312
6313/* Skip any chars in the "name" class.*/
6314static char *
6315skip_name (char *cp)
6316{
6317 /* '\0' is a notinname() so loop stops there too */
6318 while (! notinname (*cp))
6319 cp++;
6320 return cp;
6321}
6322
6319/* Print error message and exit. */ 6323/* Print error message and exit. */
6320void 6324void
6321fatal (const char *s1, const char *s2) 6325fatal (const char *s1, const char *s2)
@@ -6334,8 +6338,8 @@ pfatal (const char *s1)
6334static void 6338static void
6335suggest_asking_for_help (void) 6339suggest_asking_for_help (void)
6336{ 6340{
6337 fprintf (stderr, "\tTry `%s %s' for a complete list of options.\n", 6341 fprintf (stderr, "\tTry `%s --help' for a complete list of options.\n",
6338 progname, NO_LONG_OPTIONS ? "-h" : "--help"); 6342 progname);
6339 exit (EXIT_FAILURE); 6343 exit (EXIT_FAILURE);
6340} 6344}
6341 6345
@@ -6373,7 +6377,6 @@ concat (const char *s1, const char *s2, const char *s3)
6373static char * 6377static char *
6374etags_getcwd (void) 6378etags_getcwd (void)
6375{ 6379{
6376#ifdef HAVE_GETCWD
6377 int bufsize = 200; 6380 int bufsize = 200;
6378 char *path = xnew (bufsize, char); 6381 char *path = xnew (bufsize, char);
6379 6382
@@ -6388,34 +6391,6 @@ etags_getcwd (void)
6388 6391
6389 canonicalize_filename (path); 6392 canonicalize_filename (path);
6390 return path; 6393 return path;
6391
6392#else /* not HAVE_GETCWD */
6393#if MSDOS
6394
6395 char *p, path[MAXPATHLEN + 1]; /* Fixed size is safe on MSDOS. */
6396
6397 getwd (path);
6398
6399 for (p = path; *p != '\0'; p++)
6400 if (*p == '\\')
6401 *p = '/';
6402 else
6403 *p = lowcase (*p);
6404
6405 return strdup (path);
6406#else /* not MSDOS */
6407 linebuffer path;
6408 FILE *pipe;
6409
6410 linebuffer_init (&path);
6411 pipe = (FILE *) popen ("pwd 2>/dev/null", "r");
6412 if (pipe == NULL || readline_internal (&path, pipe) == 0)
6413 pfatal ("pwd");
6414 pclose (pipe);
6415
6416 return path.buffer;
6417#endif /* not MSDOS */
6418#endif /* not HAVE_GETCWD */
6419} 6394}
6420 6395
6421/* Return a newly allocated string containing the file name of FILE 6396/* Return a newly allocated string containing the file name of FILE
diff --git a/lib-src/grep-changelog b/lib-src/grep-changelog
index 5477de7b577..ace4d48df3e 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-2012 Free Software Foundation, Inc. 3# Copyright (C) 1999-2013 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 08da0075269..3208a895aa2 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-2012 Free Software Foundation, Inc. 2 Copyright (C) 1989, 2001-2013 Free Software Foundation, Inc.
3 3
4Author: Keith Gabryelski 4Author: Keith Gabryelski
5(according to authors.el) 5(according to authors.el)
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c
index 2654387fb37..8fa70dd430e 100644
--- a/lib-src/make-docfile.c
+++ b/lib-src/make-docfile.c
@@ -1,7 +1,7 @@
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-2012 3Copyright (C) 1985-1986, 1992-1994, 1997, 1999-2013 Free Software
4 Free Software Foundation, Inc. 4Foundation, Inc.
5 5
6This file is part of GNU Emacs. 6This file is part of GNU Emacs.
7 7
@@ -58,9 +58,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
58#undef chdir 58#undef chdir
59#define READ_TEXT "rt" 59#define READ_TEXT "rt"
60#define READ_BINARY "rb" 60#define READ_BINARY "rb"
61#define IS_SLASH(c) ((c) == '/' || (c) == '\\' || (c) == ':')
61#else /* not DOS_NT */ 62#else /* not DOS_NT */
62#define READ_TEXT "r" 63#define READ_TEXT "r"
63#define READ_BINARY "r" 64#define READ_BINARY "r"
65#define IS_SLASH(c) ((c) == '/')
64#endif /* not DOS_NT */ 66#endif /* not DOS_NT */
65 67
66static int scan_file (char *filename); 68static int scan_file (char *filename);
@@ -622,7 +624,7 @@ write_globals (void)
622 qsort (globals, num_globals, sizeof (struct global), compare_globals); 624 qsort (globals, num_globals, sizeof (struct global), compare_globals);
623 for (i = 0; i < num_globals; ++i) 625 for (i = 0; i < num_globals; ++i)
624 { 626 {
625 char const *type; 627 char const *type = 0;
626 628
627 switch (globals[i].type) 629 switch (globals[i].type)
628 { 630 {
@@ -647,7 +649,7 @@ write_globals (void)
647 fatal ("not a recognized DEFVAR_", 0); 649 fatal ("not a recognized DEFVAR_", 0);
648 } 650 }
649 651
650 if (globals[i].type != FUNCTION) 652 if (type)
651 { 653 {
652 fprintf (outfile, " %s f_%s;\n", type, globals[i].name); 654 fprintf (outfile, " %s f_%s;\n", type, globals[i].name);
653 fprintf (outfile, "#define %s globals.f_%s\n", 655 fprintf (outfile, "#define %s globals.f_%s\n",
@@ -659,7 +661,9 @@ write_globals (void)
659 special hacks. */ 661 special hacks. */
660 if (strcmp (globals[i].name, "Fthrow") == 0 662 if (strcmp (globals[i].name, "Fthrow") == 0
661 || strcmp (globals[i].name, "Ftop_level") == 0 663 || strcmp (globals[i].name, "Ftop_level") == 0
662 || strcmp (globals[i].name, "Fkill_emacs") == 0) 664 || strcmp (globals[i].name, "Fkill_emacs") == 0
665 || strcmp (globals[i].name, "Fexit_recursive_edit") == 0
666 || strcmp (globals[i].name, "Fabort_recursive_edit") == 0)
663 fprintf (outfile, "_Noreturn "); 667 fprintf (outfile, "_Noreturn ");
664 fprintf (outfile, "EXFUN (%s, ", globals[i].name); 668 fprintf (outfile, "EXFUN (%s, ", globals[i].name);
665 if (globals[i].value == -1) 669 if (globals[i].value == -1)
@@ -1023,9 +1027,9 @@ scan_c_file (char *filename, const char *mode)
1023 arglist, but the doc string must still have a backslash and newline 1027 arglist, but the doc string must still have a backslash and newline
1024 immediately after the double quote. 1028 immediately after the double quote.
1025 The only source files that must follow this convention are preloaded 1029 The only source files that must follow this convention are preloaded
1026 uncompiled ones like loaddefs.el and bindings.el; aside 1030 uncompiled ones like loaddefs.el; aside from that, it is always the .elc
1027 from that, it is always the .elc file that we look at, and they are no 1031 file that we should look at, and they are no problem because byte-compiler
1028 problem because byte-compiler output follows this convention. 1032 output follows this convention.
1029 The NAME and DOCSTRING are output. 1033 The NAME and DOCSTRING are output.
1030 NAME is preceded by `F' for a function or `V' for a variable. 1034 NAME is preceded by `F' for a function or `V' for a variable.
1031 An entry is output only if DOCSTRING has \ newline just after the opening ". 1035 An entry is output only if DOCSTRING has \ newline just after the opening ".
@@ -1086,8 +1090,7 @@ search_lisp_doc_at_eol (FILE *infile)
1086 if (c2 != '"' || c1 != '\\') 1090 if (c2 != '"' || c1 != '\\')
1087 { 1091 {
1088#ifdef DEBUG 1092#ifdef DEBUG
1089 fprintf (stderr, "## non-docstring in %s (%s)\n", 1093 fprintf (stderr, "## non-docstring found\n");
1090 buffer, filename);
1091#endif 1094#endif
1092 if (c != EOF) 1095 if (c != EOF)
1093 ungetc (c, infile); 1096 ungetc (c, infile);
@@ -1096,15 +1099,50 @@ search_lisp_doc_at_eol (FILE *infile)
1096 return 1; 1099 return 1;
1097} 1100}
1098 1101
1102#define DEF_ELISP_FILE(fn) { #fn, sizeof(#fn) - 1 }
1103
1099static int 1104static int
1100scan_lisp_file (const char *filename, const char *mode) 1105scan_lisp_file (const char *filename, const char *mode)
1101{ 1106{
1102 FILE *infile; 1107 FILE *infile;
1103 register int c; 1108 register int c;
1104 char *saved_string = 0; 1109 char *saved_string = 0;
1110 /* These are the only files that are loaded uncompiled, and must
1111 follow the conventions of the doc strings expected by this
1112 function. These conventions are automatically followed by the
1113 byte compiler when it produces the .elc files. */
1114 static struct {
1115 const char *fn;
1116 size_t fl;
1117 } const uncompiled[] = {
1118 DEF_ELISP_FILE (loaddefs.el),
1119 DEF_ELISP_FILE (loadup.el),
1120 DEF_ELISP_FILE (charprop.el),
1121 DEF_ELISP_FILE (cp51932.el),
1122 DEF_ELISP_FILE (eucjp-ms.el)
1123 };
1124 int i, match;
1125 size_t flen = strlen (filename);
1105 1126
1106 if (generate_globals) 1127 if (generate_globals)
1107 fatal ("scanning lisp file when -g specified", 0); 1128 fatal ("scanning lisp file when -g specified", 0);
1129 if (flen > 3 && !strcmp (filename + flen - 3, ".el"))
1130 {
1131 for (i = 0, match = 0; i < sizeof (uncompiled) / sizeof (uncompiled[0]);
1132 i++)
1133 {
1134 if (uncompiled[i].fl <= flen
1135 && !strcmp (filename + flen - uncompiled[i].fl, uncompiled[i].fn)
1136 && (flen == uncompiled[i].fl
1137 || IS_SLASH (filename[flen - uncompiled[i].fl - 1])))
1138 {
1139 match = 1;
1140 break;
1141 }
1142 }
1143 if (!match)
1144 fatal ("uncompiled lisp file %s is not supported", filename);
1145 }
1108 1146
1109 infile = fopen (filename, mode); 1147 infile = fopen (filename, mode);
1110 if (infile == NULL) 1148 if (infile == NULL)
diff --git a/lib-src/makefile.w32-in b/lib-src/makefile.w32-in
index 64974b88b6f..9656a3badec 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-2012 Free Software Foundation, Inc. 2# Copyright (C) 2000-2013 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
@@ -123,10 +124,13 @@ $(BLD)/profile.exe: $(PROFILEOBJS)
123# 124#
124obj = dosfns.o msdos.o \ 125obj = dosfns.o msdos.o \
125 xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \ 126 xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \
126 fontset.o menu.o \ 127 fontset.o menu.o dbusbind.o cygw32.o \
127 w32.o w32console.o w32fns.o w32heap.o w32inevt.o \ 128 nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o \
129 w32.o w32console.o w32fns.o w32heap.o w32inevt.o w32notify.o \
128 w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o \ 130 w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o \
129 font.o w32font.o w32uniscribe.o \ 131 w16select.o widget.o xfont.o ftfont.o xftfont.o ftxfont.o gtkutil.o \
132 xsettings.o xgselect.o termcap.o \
133 font.o w32font.o w32uniscribe.o w32notify.o \
130 dispnew.o frame.o scroll.o xdisp.o window.o bidi.o \ 134 dispnew.o frame.o scroll.o xdisp.o window.o bidi.o \
131 charset.o coding.o category.o ccl.o character.o chartab.o \ 135 charset.o coding.o category.o ccl.o character.o chartab.o \
132 cm.o term.o terminal.o xfaces.o \ 136 cm.o term.o terminal.o xfaces.o \
@@ -140,7 +144,7 @@ obj = dosfns.o msdos.o \
140 process.o callproc.o unexw32.o \ 144 process.o callproc.o unexw32.o \
141 region-cache.o sound.o atimer.o \ 145 region-cache.o sound.o atimer.o \
142 doprnt.o intervals.o textprop.o composite.o \ 146 doprnt.o intervals.o textprop.o composite.o \
143 gnutls.o xml.o 147 gnutls.o xml.o profiler.o
144 148
145# 149#
146# These are the lisp files that are loaded up in loadup.el 150# These are the lisp files that are loaded up in loadup.el
@@ -209,38 +213,41 @@ lisp1= \
209 $(lispsource)emacs-lisp/map-ynp.elc \ 213 $(lispsource)emacs-lisp/map-ynp.elc \
210 $(lispsource)menu-bar.elc \ 214 $(lispsource)menu-bar.elc \
211 $(lispsource)international/mule.elc \ 215 $(lispsource)international/mule.elc \
212 $(lispsource)international/mule-conf.el \ 216 $(lispsource)international/mule-conf.elc \
213 $(lispsource)international/mule-cmds.elc \ 217 $(lispsource)international/mule-cmds.elc \
214 $(lispsource)international/characters.elc \ 218 $(lispsource)international/characters.elc \
215 $(lispsource)international/charprop.el \ 219 $(lispsource)international/charprop.el \
216 $(lispsource)case-table.elc 220 $(lispsource)case-table.elc \
221 $(lispsource)emacs-lisp/macroexp.elc
217 222
218lisp2 = \ 223lisp2 = \
219 $(lispsource)language/chinese.el \ 224 $(lispsource)language/chinese.elc \
220 $(lispsource)language/cyrillic.el \ 225 $(lispsource)language/cyrillic.elc \
221 $(lispsource)language/indian.el \ 226 $(lispsource)language/indian.elc \
222 $(lispsource)language/sinhala.el \ 227 $(lispsource)language/sinhala.elc \
223 $(lispsource)language/english.el \ 228 $(lispsource)language/english.elc \
224 $(lispsource)language/ethiopic.elc \ 229 $(lispsource)language/ethiopic.elc \
225 $(lispsource)language/european.elc \ 230 $(lispsource)language/european.elc \
226 $(lispsource)language/czech.el \ 231 $(lispsource)language/czech.elc \
227 $(lispsource)language/slovak.el \ 232 $(lispsource)language/slovak.elc \
228 $(lispsource)language/romanian.el \ 233 $(lispsource)language/romanian.elc \
229 $(lispsource)language/greek.el \ 234 $(lispsource)language/greek.elc \
230 $(lispsource)language/hebrew.elc \ 235 $(lispsource)language/hebrew.elc \
231 $(lispsource)language/japanese.el \ 236 $(lispsource)language/japanese.elc \
232 $(lispsource)language/korean.el \ 237 $(lispsource)international/cp51932.el \
233 $(lispsource)language/lao.el \ 238 $(lispsource)international/eucjp-ms.el \
234 $(lispsource)language/cham.el \ 239 $(lispsource)language/korean.elc \
235 $(lispsource)language/tai-viet.el \ 240 $(lispsource)language/lao.elc \
236 $(lispsource)language/thai.el \ 241 $(lispsource)language/cham.elc \
242 $(lispsource)language/tai-viet.elc \
243 $(lispsource)language/thai.elc \
237 $(lispsource)language/tibetan.elc \ 244 $(lispsource)language/tibetan.elc \
238 $(lispsource)language/vietnamese.el \ 245 $(lispsource)language/vietnamese.elc \
239 $(lispsource)language/misc-lang.el \ 246 $(lispsource)language/misc-lang.elc \
240 $(lispsource)language/utf-8-lang.el \ 247 $(lispsource)language/utf-8-lang.elc \
241 $(lispsource)language/georgian.el \ 248 $(lispsource)language/georgian.elc \
242 $(lispsource)language/khmer.el \ 249 $(lispsource)language/khmer.elc \
243 $(lispsource)language/burmese.el \ 250 $(lispsource)language/burmese.elc \
244 $(lispsource)register.elc \ 251 $(lispsource)register.elc \
245 $(lispsource)replace.elc \ 252 $(lispsource)replace.elc \
246 $(lispsource)simple.elc \ 253 $(lispsource)simple.elc \
@@ -266,7 +273,7 @@ lisp2 = \
266 $(WINDOW_SUPPORT) \ 273 $(WINDOW_SUPPORT) \
267 $(lispsource)widget.elc \ 274 $(lispsource)widget.elc \
268 $(lispsource)window.elc \ 275 $(lispsource)window.elc \
269 $(lispsource)version.el 276 $(lispsource)version.elc
270 277
271# This is needed the first time we build the tree, since temacs.exe 278# This is needed the first time we build the tree, since temacs.exe
272# does not exist yet, and the DOC rule needs it to rebuild DOC whenever 279# does not exist yet, and the DOC rule needs it to rebuild DOC whenever
@@ -285,10 +292,10 @@ $(DOC): stamp_BLD $(BLD)/make-docfile.exe ../src/$(BLD)/temacs.exe $(lisp1) $(l
285 "$(THISDIR)/$(BLD)/make-docfile" -a $(DOC) -d ../src $(lisp1) 292 "$(THISDIR)/$(BLD)/make-docfile" -a $(DOC) -d ../src $(lisp1)
286 "$(THISDIR)/$(BLD)/make-docfile" -a $(DOC) -d ../src $(lisp2) 293 "$(THISDIR)/$(BLD)/make-docfile" -a $(DOC) -d ../src $(lisp2)
287 "$(THISDIR)/$(BLD)/make-docfile" -a $(DOC) -d ../src $(OTHER_PLATFORM_SUPPORT) 294 "$(THISDIR)/$(BLD)/make-docfile" -a $(DOC) -d ../src $(OTHER_PLATFORM_SUPPORT)
288 $(CP) $(DOC) ../etc/DOC-X 295 $(CP) $(DOC) ../etc/DOC
289 - mkdir "../src/$(OBJDIR)" 296 - mkdir "../src/$(OBJDIR)"
290 - mkdir "../src/$(OBJDIR)/etc" 297 - mkdir "../src/$(OBJDIR)/etc"
291 $(CP) $(DOC) ../src/$(OBJDIR)/etc/DOC-X 298 $(CP) $(DOC) ../src/$(OBJDIR)/etc/DOC
292 299
293{$(BLD)}.$(O){$(BLD)}.exe: 300{$(BLD)}.$(O){$(BLD)}.exe:
294 $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $*.$(O) $(LIBS) 301 $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $*.$(O) $(LIBS)
@@ -354,7 +361,6 @@ TAGS: $(BLD)/etags.exe *.c *.h
354### DEPENDENCIES ### 361### DEPENDENCIES ###
355 362
356EMACS_ROOT = .. 363EMACS_ROOT = ..
357LIB_SRC = .
358SRC = $(EMACS_ROOT)/src 364SRC = $(EMACS_ROOT)/src
359NT_INC = $(EMACS_ROOT)/nt/inc 365NT_INC = $(EMACS_ROOT)/nt/inc
360GNU_LIB = $(EMACS_ROOT)/lib 366GNU_LIB = $(EMACS_ROOT)/lib
@@ -372,6 +378,9 @@ NTLIB_H = $(LIB_SRC)/ntlib.h \
372SYSTIME_H = $(SRC)/systime.h \ 378SYSTIME_H = $(SRC)/systime.h \
373 $(NT_INC)/sys/time.h \ 379 $(NT_INC)/sys/time.h \
374 $(GNU_LIB)/timespec.h 380 $(GNU_LIB)/timespec.h
381SYSWAIT_H = $(SRC)/syswait.h \
382 $(NT_INC)/stdbool.h \
383 $(NT_INC)/sys/wait.h
375 384
376$(BLD)/ctags.$(O) : \ 385$(BLD)/ctags.$(O) : \
377 $(LIB_SRC)/ctags.c \ 386 $(LIB_SRC)/ctags.c \
@@ -417,14 +426,14 @@ $(BLD)/make-docfile.$(O) : \
417$(BLD)/movemail.$(O) : \ 426$(BLD)/movemail.$(O) : \
418 $(LIB_SRC)/movemail.c \ 427 $(LIB_SRC)/movemail.c \
419 $(LIB_SRC)/pop.h \ 428 $(LIB_SRC)/pop.h \
420 $(SRC)/syswait.h \
421 $(NT_INC)/pwd.h \ 429 $(NT_INC)/pwd.h \
422 $(NT_INC)/sys/file.h \ 430 $(NT_INC)/sys/file.h \
423 $(NT_INC)/sys/stat.h \ 431 $(NT_INC)/sys/stat.h \
424 $(NT_INC)/unistd.h \ 432 $(NT_INC)/unistd.h \
425 $(GNU_LIB)/getopt.h \ 433 $(GNU_LIB)/getopt.h \
426 $(CONFIG_H) \ 434 $(CONFIG_H) \
427 $(NTLIB_H) 435 $(NTLIB_H) \
436 $(SYSWAIT_H)
428 437
429$(BLD)/ntlib.$(O) : \ 438$(BLD)/ntlib.$(O) : \
430 $(LIB_SRC)/ntlib.c \ 439 $(LIB_SRC)/ntlib.c \
diff --git a/lib-src/movemail.c b/lib-src/movemail.c
index 32d32e69abf..81ac8aa187c 100644
--- a/lib-src/movemail.c
+++ b/lib-src/movemail.c
@@ -1,8 +1,8 @@
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-2012 4Copyright (C) 1986, 1992-1994, 1996, 1999, 2001-2013 Free Software
5 Free Software Foundation, Inc. 5Foundation, Inc.
6 6
7This file is part of GNU Emacs. 7This file is part of GNU Emacs.
8 8
@@ -65,9 +65,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
65 65
66#include <getopt.h> 66#include <getopt.h>
67#include <unistd.h> 67#include <unistd.h>
68#ifdef HAVE_FCNTL_H
69#include <fcntl.h> 68#include <fcntl.h>
70#endif
71#include <string.h> 69#include <string.h>
72#include "syswait.h" 70#include "syswait.h"
73#ifdef MAIL_USE_POP 71#ifdef MAIL_USE_POP
@@ -98,13 +96,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
98#include <fcntl.h> 96#include <fcntl.h>
99#endif /* WINDOWSNT */ 97#endif /* WINDOWSNT */
100 98
101#ifndef F_OK
102#define F_OK 0
103#define X_OK 1
104#define W_OK 2
105#define R_OK 4
106#endif
107
108#ifdef WINDOWSNT 99#ifdef WINDOWSNT
109#include <sys/locking.h> 100#include <sys/locking.h>
110#endif 101#endif
@@ -337,11 +328,8 @@ main (int argc, char **argv)
337 328
338 tem = link (tempname, lockname); 329 tem = link (tempname, lockname);
339 330
340#ifdef EPERM 331 if (tem < 0 && errno != EEXIST)
341 if (tem < 0 && errno == EPERM) 332 pfatal_with_name (lockname);
342 fatal ("Unable to create hard link between %s and %s",
343 tempname, lockname);
344#endif
345 333
346 unlink (tempname); 334 unlink (tempname);
347 if (tem >= 0) 335 if (tem >= 0)
@@ -392,13 +380,9 @@ main (int argc, char **argv)
392 if (indesc < 0) 380 if (indesc < 0)
393 pfatal_with_name (inname); 381 pfatal_with_name (inname);
394 382
395#ifdef BSD_SYSTEM 383 /* Make sure the user can read the output file. */
396 /* In case movemail is setuid to root, make sure the user can 384 umask (umask (0) & 0377);
397 read the output file. */ 385
398 /* This is desirable for all systems
399 but I don't want to assume all have the umask system call */
400 umask (umask (0) & 0333);
401#endif /* BSD_SYSTEM */
402 outdesc = open (outname, O_WRONLY | O_CREAT | O_EXCL, 0666); 386 outdesc = open (outname, O_WRONLY | O_CREAT | O_EXCL, 0666);
403 if (outdesc < 0) 387 if (outdesc < 0)
404 pfatal_with_name (outname); 388 pfatal_with_name (outname);
@@ -442,22 +426,10 @@ main (int argc, char **argv)
442 for certain failure codes. */ 426 for certain failure codes. */
443 if (status < 0) 427 if (status < 0)
444 { 428 {
445 if (++lockcount <= 5) 429 if (++lockcount <= 5 && (errno == EAGAIN || errno == EBUSY))
446 { 430 {
447#ifdef EAGAIN 431 sleep (1);
448 if (errno == EAGAIN) 432 goto retry_lock;
449 {
450 sleep (1);
451 goto retry_lock;
452 }
453#endif
454#ifdef EBUSY
455 if (errno == EBUSY)
456 {
457 sleep (1);
458 goto retry_lock;
459 }
460#endif
461 } 433 }
462 434
463 pfatal_with_name (inname); 435 pfatal_with_name (inname);
@@ -494,10 +466,8 @@ main (int argc, char **argv)
494 } 466 }
495 } 467 }
496 468
497#ifdef BSD_SYSTEM 469 if (fsync (outdesc) != 0 && errno != EINVAL)
498 if (fsync (outdesc) < 0)
499 pfatal_and_delete (outname); 470 pfatal_and_delete (outname);
500#endif
501 471
502 /* Prevent symlink attacks truncating other users' mailboxes */ 472 /* Prevent symlink attacks truncating other users' mailboxes */
503 if (setregid (-1, real_gid) < 0) 473 if (setregid (-1, real_gid) < 0)
@@ -689,7 +659,6 @@ popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse
689 register int i; 659 register int i;
690 int mbfi; 660 int mbfi;
691 FILE *mbf; 661 FILE *mbf;
692 char *getenv (const char *);
693 popserver server; 662 popserver server;
694 int start, end, increment; 663 int start, end, increment;
695 char *user, *hostname; 664 char *user, *hostname;
@@ -779,21 +748,14 @@ popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse
779 } 748 }
780 } 749 }
781 750
782 /* On AFS, a call to write only modifies the file in the local 751 if (fsync (mbfi) != 0 && errno != EINVAL)
783 * workstation's AFS cache. The changes are not written to the server
784 * until a call to fsync or close is made. Users with AFS home
785 * directories have lost mail when over quota because these checks were
786 * not made in previous versions of movemail. */
787
788#ifdef BSD_SYSTEM
789 if (fsync (mbfi) < 0)
790 { 752 {
791 error ("Error in fsync: %s", strerror (errno), 0); 753 error ("Error in fsync: %s", strerror (errno), 0);
754 close (mbfi);
792 return EXIT_FAILURE; 755 return EXIT_FAILURE;
793 } 756 }
794#endif
795 757
796 if (close (mbfi) == -1) 758 if (close (mbfi) != 0)
797 { 759 {
798 error ("Error in close: %s", strerror (errno), 0); 760 error ("Error in close: %s", strerror (errno), 0);
799 return EXIT_FAILURE; 761 return EXIT_FAILURE;
diff --git a/lib-src/ntlib.c b/lib-src/ntlib.c
index 2cc791fb56a..41b4e3a0cbc 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-2012 Free Software Foundation, Inc. 3Copyright (C) 1994, 2001-2013 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
@@ -29,18 +29,31 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
29#include <sys/stat.h> 29#include <sys/stat.h>
30#include <errno.h> 30#include <errno.h>
31#include <ctype.h> 31#include <ctype.h>
32#include <sys/timeb.h>
33#include <mbstring.h>
32 34
33#include "ntlib.h" 35#include "ntlib.h"
34 36
37/* MinGW64 defines _TIMEZONE_DEFINED and defines 'struct timespec' in
38 its system headers. */
39#ifndef _TIMEZONE_DEFINED
40struct timezone
41{
42 int tz_minuteswest; /* minutes west of Greenwich */
43 int tz_dsttime; /* type of dst correction */
44};
45#endif
46
35#define MAXPATHLEN _MAX_PATH 47#define MAXPATHLEN _MAX_PATH
36 48
37/* 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
38 would necessitate including windows.h in the files that used it. 50 would necessitate including windows.h in the files that used it.
39 This is much easier. */ 51 This is much easier. */
40void 52unsigned
41sleep (unsigned long seconds) 53sleep (unsigned seconds)
42{ 54{
43 Sleep (seconds * 1000); 55 Sleep (seconds * 1000);
56 return 0;
44} 57}
45 58
46/* Get the current working directory. */ 59/* Get the current working directory. */
@@ -126,6 +139,12 @@ getuid (void)
126} 139}
127 140
128unsigned 141unsigned
142geteuid (void)
143{
144 return getuid ();
145}
146
147unsigned
129getgid (void) 148getgid (void)
130{ 149{
131 return 0; 150 return 0;
@@ -202,6 +221,29 @@ getpass (const char * prompt)
202 return NULL; 221 return NULL;
203} 222}
204 223
224/* This is needed because lib/gettime.c calls gettimeofday, which MSVC
225 doesn't have. Copied from w32.c. */
226void
227gettimeofday (struct timeval *tv, struct timezone *tz)
228{
229 struct _timeb tb;
230 _ftime (&tb);
231
232 tv->tv_sec = tb.time;
233 tv->tv_usec = tb.millitm * 1000L;
234 /* Implementation note: _ftime sometimes doesn't update the dstflag
235 according to the new timezone when the system timezone is
236 changed. We could fix that by using GetSystemTime and
237 GetTimeZoneInformation, but that doesn't seem necessary, since
238 Emacs always calls gettimeofday with the 2nd argument NULL (see
239 current_emacs_time). */
240 if (tz)
241 {
242 tz->tz_minuteswest = tb.timezone; /* minutes west of Greenwich */
243 tz->tz_dsttime = tb.dstflag; /* type of dst correction */
244 }
245}
246
205int 247int
206fchown (int fd, unsigned uid, unsigned gid) 248fchown (int fd, unsigned uid, unsigned gid)
207{ 249{
@@ -380,4 +422,3 @@ lstat (const char * path, struct stat * buf)
380{ 422{
381 return stat (path, buf); 423 return stat (path, buf);
382} 424}
383
diff --git a/lib-src/ntlib.h b/lib-src/ntlib.h
index 7502a8a8b34..3e48d2997e0 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-2012 Free Software Foundation, Inc. 2 Copyright (C) 1994, 2002-2013 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
@@ -16,7 +16,6 @@ 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
@@ -29,12 +28,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
29#ifdef sleep 28#ifdef sleep
30#undef sleep 29#undef sleep
31#endif 30#endif
32void sleep (unsigned long seconds); 31unsigned sleep (unsigned seconds);
33char *getwd (char *dir); 32char *getwd (char *dir);
34int getppid (void); 33int getppid (void);
35char * getlogin (void); 34char * getlogin (void);
36char * cuserid (char * s); 35char * cuserid (char * s);
37unsigned getuid (void); 36unsigned getuid (void);
37unsigned geteuid (void);
38unsigned getegid (void); 38unsigned getegid (void);
39unsigned getgid (void); 39unsigned getgid (void);
40int setuid (unsigned uid); 40int setuid (unsigned uid);
diff --git a/lib-src/pop.c b/lib-src/pop.c
index 74054e0e1b1..a269144c915 100644
--- a/lib-src/pop.c
+++ b/lib-src/pop.c
@@ -1,7 +1,7 @@
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-2012 3Copyright (C) 1991, 1993, 1996-1997, 1999, 2001-2013 Free Software
4 Free Software Foundation, Inc. 4Foundation, Inc.
5 5
6Author: Jonathan Kamens <jik@security.ov.com> 6Author: Jonathan Kamens <jik@security.ov.com>
7 7
@@ -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 memcpy (&addr.sin_addr, &in_a->sin_addr, sizeof (addr.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)
diff --git a/lib-src/pop.h b/lib-src/pop.h
index 682a7f93dc5..dbc7c8dbe64 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-2012 Free Software Foundation, Inc. 2 Copyright (C) 1991, 1993, 2001-2013 Free Software Foundation, Inc.
3 3
4Author: Jonathan Kamens <jik@security.ov.com> 4Author: Jonathan Kamens <jik@security.ov.com>
5 5
diff --git a/lib-src/profile.c b/lib-src/profile.c
index 3489e492543..ab17b52ca28 100644
--- a/lib-src/profile.c
+++ b/lib-src/profile.c
@@ -1,5 +1,6 @@
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-2012 Free Software Foundation, Inc. 2 Copyright (C) 1992, 1994, 1999, 2001-2013 Free Software Foundation,
3 Inc.
3 4
4Author: Boaz Ben-Zvi <boaz@lcs.mit.edu> 5Author: Boaz Ben-Zvi <boaz@lcs.mit.edu>
5 6
diff --git a/lib-src/rcs2log b/lib-src/rcs2log
index 3ed54684a7e..4f2bb3308fc 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-2012 Free Software Foundation, Inc. 5# Copyright (C) 1992-1998, 2001-2013 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) 2012 Free Software Foundation, Inc. 23Copyright='Copyright (C) 2013 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.
diff --git a/lib-src/test-distrib.c b/lib-src/test-distrib.c
index b404c8230d1..42aef07870f 100644
--- a/lib-src/test-distrib.c
+++ b/lib-src/test-distrib.c
@@ -1,6 +1,7 @@
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-2012 Free Software Foundation, Inc. 3Copyright (C) 1987, 1993-1995, 1999, 2001-2013 Free Software Foundation,
4Inc.
4 5
5This file is part of GNU Emacs. 6This file is part of GNU Emacs.
6 7
diff --git a/lib-src/update-game-score.c b/lib-src/update-game-score.c
index 40397536fad..ec8b4317770 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-2012 Free Software Foundation, Inc. 3Copyright (C) 2002-2013 Free Software Foundation, Inc.
4 4
5Author: Colin Walters <walters@debian.org> 5Author: Colin Walters <walters@debian.org>
6 6
@@ -42,12 +42,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
42#include <time.h> 42#include <time.h>
43#include <pwd.h> 43#include <pwd.h>
44#include <ctype.h> 44#include <ctype.h>
45#ifdef HAVE_FCNTL_H
46#include <fcntl.h> 45#include <fcntl.h>
47#endif
48#include <sys/stat.h> 46#include <sys/stat.h>
49#include <getopt.h> 47#include <getopt.h>
50 48
49#ifdef WINDOWSNT
50#include "ntlib.h"
51#endif
52
51#define MAX_ATTEMPTS 5 53#define MAX_ATTEMPTS 5
52#define MAX_SCORES 200 54#define MAX_SCORES 200
53#define MAX_DATA_LEN 1024 55#define MAX_DATA_LEN 1024