diff options
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/ChangeLog | 576 | ||||
| -rw-r--r-- | lib-src/Makefile.in | 110 | ||||
| -rw-r--r-- | lib-src/ebrowse.c | 24 | ||||
| -rw-r--r-- | lib-src/emacsclient.c | 575 | ||||
| -rw-r--r-- | lib-src/etags.c | 272 | ||||
| -rwxr-xr-x | lib-src/grep-changelog | 2 | ||||
| -rw-r--r-- | lib-src/hexl.c | 6 | ||||
| -rw-r--r-- | lib-src/make-docfile.c | 351 | ||||
| -rw-r--r-- | lib-src/makefile.w32-in | 267 | ||||
| -rw-r--r-- | lib-src/movemail.c | 150 | ||||
| -rw-r--r-- | lib-src/ntlib.c | 50 | ||||
| -rw-r--r-- | lib-src/ntlib.h | 2 | ||||
| -rw-r--r-- | lib-src/pop.c | 77 | ||||
| -rw-r--r-- | lib-src/pop.h | 2 | ||||
| -rw-r--r-- | lib-src/profile.c | 43 | ||||
| -rwxr-xr-x | lib-src/rcs-checkin | 116 | ||||
| -rwxr-xr-x | lib-src/rcs2log | 4 | ||||
| -rw-r--r-- | lib-src/test-distrib.c | 2 | ||||
| -rw-r--r-- | lib-src/update-game-score.c | 37 | ||||
| -rwxr-xr-x | lib-src/vcdiff | 114 |
20 files changed, 1409 insertions, 1371 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index e989473219c..b85ba12a5b2 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog | |||
| @@ -1,3 +1,527 @@ | |||
| 1 | 2012-11-23 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | movemail: treat EACCES etc. failures as permanent | ||
| 4 | * movemail.c (main): Treat any link failure other than EEXIST as a | ||
| 5 | permanent failure, not just EPERM. EACCES, for example. | ||
| 6 | |||
| 7 | 2012-11-21 Paul Eggert <eggert@cs.ucla.edu> | ||
| 8 | |||
| 9 | Assume POSIX 1003.1-1988 or later for unistd.h (Bug#12945). | ||
| 10 | * emacsclient.c (getcwd): Remove decl. | ||
| 11 | (get_current_dir_name): Assume getcwd exists. | ||
| 12 | * etags.c (HAVE_GETCWD): Remove. | ||
| 13 | (getcwd): Remove decl. | ||
| 14 | (NO_LONG_OPTIONS): Remove this. All uses removed. | ||
| 15 | Emacs always has GNU getopt. | ||
| 16 | (etags_getcwd): Assume getcwd exists. | ||
| 17 | * movemail.c (F_OK, X_OK, W_OK, R_OK): Remove. | ||
| 18 | |||
| 19 | 2012-11-20 Paul Eggert <eggert@cs.ucla.edu> | ||
| 20 | |||
| 21 | * emacsclient.c (handle_sigcont, handle_sigtstp): Use raise (sig) | ||
| 22 | rather than kill (getpid (), sig), as it's simpler and safer. | ||
| 23 | |||
| 24 | 2012-11-17 Juanma Barranquero <lekktu@gmail.com> | ||
| 25 | |||
| 26 | * makefile.w32-in (SYSWAIT_H): New macro. | ||
| 27 | ($(BLD)/movemail.$(O)): Update dependencies. | ||
| 28 | |||
| 29 | 2012-11-17 Paul Eggert <eggert@cs.ucla.edu> | ||
| 30 | |||
| 31 | Assume POSIX 1003.1-1988 or later for fcntl.h (Bug#12881). | ||
| 32 | * movemail.c, update-game-score.c: Assume <fcntl.h> exists. | ||
| 33 | |||
| 34 | 2012-10-26 Glenn Morris <rgm@gnu.org> | ||
| 35 | |||
| 36 | * Makefile.in (uninstall): No INSTALLABLES live in archlibdir. | ||
| 37 | |||
| 38 | * Makefile.in (install, uninstall): Transformations should not be | ||
| 39 | applied to $EXEEXT. | ||
| 40 | |||
| 41 | 2012-10-23 Eli Zaretskii <eliz@gnu.org> | ||
| 42 | |||
| 43 | * makefile.w32-in (lisp2): Add cp51932.el and eucjp-ms.el, to | ||
| 44 | follow src/lisp.mk. | ||
| 45 | |||
| 46 | 2012-10-21 Glenn Morris <rgm@gnu.org> | ||
| 47 | |||
| 48 | * make-docfile.c (scan_lisp_file): Add cp51932.el and eucjp-ms.el. | ||
| 49 | |||
| 50 | 2012-10-20 Eli Zaretskii <eliz@gnu.org> | ||
| 51 | |||
| 52 | * make-docfile.c (IS_SLASH, DEF_ELISP_FILE): New macros. | ||
| 53 | (scan_lisp_file): Only pass a .el file if its basename matches a | ||
| 54 | known file in its entirety. Use IS_SLASH and DEF_ELISP_FILE. | ||
| 55 | |||
| 56 | 2012-10-20 Andreas Schwab <schwab@linux-m68k.org> | ||
| 57 | |||
| 58 | * make-docfile.c (scan_lisp_file): Add bounds checking. | ||
| 59 | |||
| 60 | 2012-10-20 Eli Zaretskii <eliz@gnu.org> | ||
| 61 | |||
| 62 | Prevent silent omission of doc strings from uncompiled Lisp files. | ||
| 63 | * make-docfile.c (scan_lisp_file): Barf if called with a .el file | ||
| 64 | other than one of a small list of supported un-compiled files. | ||
| 65 | |||
| 66 | * makefile.w32-in (lisp1, lisp2): Name .elc files wherever they | ||
| 67 | exist. (Bug#12395) | ||
| 68 | |||
| 69 | 2012-10-17 Eli Zaretskii <eliz@gnu.org> | ||
| 70 | |||
| 71 | * ntlib.c: Include <mbstring.h>, to avoid compiler warning about | ||
| 72 | _mbspbrk. | ||
| 73 | |||
| 74 | 2012-10-08 Eli Zaretskii <eliz@gnu.org> | ||
| 75 | |||
| 76 | * makefile.w32-in (obj): Add cygw32.o. | ||
| 77 | |||
| 78 | 2012-10-08 Daniel Colascione <dancol@dancol.org> | ||
| 79 | |||
| 80 | * emacsclient.c: Include windows.h when HAVE_NTGUI. | ||
| 81 | (alt_display): New variable. We send the display held by this | ||
| 82 | variable when the primary display is either unsupported or not | ||
| 83 | present. | ||
| 84 | (longopts): Allow display everywhere. | ||
| 85 | (w32_set_user_model_id): Move lower in file, inside HAVE_NTGUI | ||
| 86 | section. | ||
| 87 | (decode_options): Use alt_display. Explain why. | ||
| 88 | (main): Retry connection with alt_display if connection with main | ||
| 89 | display fails. | ||
| 90 | |||
| 91 | 2012-10-01 Fabrice Popineau <fabrice.popineau@gmail.com> | ||
| 92 | |||
| 93 | * make-docfile.c (write_globals): Special-case | ||
| 94 | Fexit_recursive_edit and Fabort_recursive_edit as well, as | ||
| 95 | functions that are _Noreturn, to be consistent with | ||
| 96 | src/keyboard.c. | ||
| 97 | |||
| 98 | 2012-09-30 Eli Zaretskii <eliz@gnu.org> | ||
| 99 | |||
| 100 | * ntlib.c (gettimeofday): Copy from src/w32.c. lib/gettime.c | ||
| 101 | needs this function. | ||
| 102 | |||
| 103 | 2012-09-26 Juanma Barranquero <lekktu@gmail.com> | ||
| 104 | |||
| 105 | * makefile.w32-in (obj): Add profiler.o. | ||
| 106 | |||
| 107 | 2012-09-17 Glenn Morris <rgm@gnu.org> | ||
| 108 | |||
| 109 | * ebrowse.c (version): | ||
| 110 | * etags.c (print_version): Use COPYRIGHT. | ||
| 111 | |||
| 112 | 2012-09-11 Paul Eggert <eggert@cs.ucla.edu> | ||
| 113 | |||
| 114 | * pop.c (socket_connection) [HAVE_GETADDRINFO]: | ||
| 115 | Prefer assignment to memcpy when either will do. | ||
| 116 | |||
| 117 | 2012-08-31 Andreas Schwab <schwab@linux-m68k.org> | ||
| 118 | |||
| 119 | * etags.c (consider_token): Always zero-terminate token buffer. | ||
| 120 | (Bug#12306) | ||
| 121 | |||
| 122 | 2012-08-19 Paul Eggert <eggert@cs.ucla.edu> | ||
| 123 | |||
| 124 | Rely on <config.h> + <unistd.h> to declare 'environ'. | ||
| 125 | * emacsclient.c (environ): Remove decl. | ||
| 126 | |||
| 127 | 2012-08-17 Juanma Barranquero <lekktu@gmail.com> | ||
| 128 | |||
| 129 | * makefile.w32-in ($(BLD)/regex.$(O)): Update dependencies. | ||
| 130 | |||
| 131 | 2012-08-15 Paul Eggert <eggert@cs.ucla.edu> | ||
| 132 | |||
| 133 | * etags.c (Pascal_functions): Fix parenthesization typo. | ||
| 134 | |||
| 135 | 2012-08-14 Paul Eggert <eggert@cs.ucla.edu> | ||
| 136 | |||
| 137 | * make-docfile.c (enum global_type): Sort values roughly in | ||
| 138 | decreasing alignment, except put functions last. | ||
| 139 | (compare_globals): Use this new property of enum global_type. | ||
| 140 | (write_globals): Use bool, not int, for booleans. | ||
| 141 | |||
| 142 | 2012-08-10 Glenn Morris <rgm@gnu.org> | ||
| 143 | |||
| 144 | * make-docfile.c (IF_LINT): | ||
| 145 | * emacsclient.c (IF_LINT): Remove (in config.h now). | ||
| 146 | |||
| 147 | * make-docfile.c (main): | ||
| 148 | (fopen) [!WINDOWSNT]: | ||
| 149 | (chdir) [!DOS_NT]: No more need to undef. | ||
| 150 | |||
| 151 | * movemail.c (DIRECTORY_SEP, IS_DIRECTORY_SEP): | ||
| 152 | * make-docfile.c (DIRECTORY_SEP, IS_DIRECTORY_SEP): | ||
| 153 | * emacsclient.c (DIRECTORY_SEP, IS_DIRECTORY_SEP, IS_DEVICE_SEP): | ||
| 154 | Remove (they are in config.h now). | ||
| 155 | |||
| 156 | * ebrowse.c (PATH_LIST_SEPARATOR): | ||
| 157 | Remove, and replace with SEPCHAR from config.h. | ||
| 158 | |||
| 159 | 2012-08-03 Juanma Barranquero <lekktu@gmail.com> | ||
| 160 | |||
| 161 | * makefile.w32-in (LOCAL_FLAGS): Remove WINDOWSNT and DOS_NT, | ||
| 162 | they are always defined in config.h. | ||
| 163 | |||
| 164 | 2012-08-03 Eli Zaretskii <eliz@gnu.org> | ||
| 165 | |||
| 166 | * ntlib.c (lstat): New function, calls 'stat'. | ||
| 167 | |||
| 168 | 2012-08-02 Paul Eggert <eggert@cs.ucla.edu> | ||
| 169 | |||
| 170 | Use C99-style 'extern inline' if available. | ||
| 171 | * profile.c (SYSTIME_INLINE): Define. | ||
| 172 | |||
| 173 | 2012-08-02 Glenn Morris <rgm@gnu.org> | ||
| 174 | |||
| 175 | * makefile.w32-in (MS_W32_H): Update for new ms-w32.h location. | ||
| 176 | |||
| 177 | 2012-08-01 Glenn Morris <rgm@gnu.org> | ||
| 178 | |||
| 179 | * Makefile.in (config_h): New variable. | ||
| 180 | Use throughout in place of ../src/config.h. | ||
| 181 | |||
| 182 | 2012-08-01 Juanma Barranquero <lekktu@gmail.com> | ||
| 183 | |||
| 184 | * makefile.w32-in (CONFIG_H): Update dependencies. | ||
| 185 | (CONF_POST_H): New macro. | ||
| 186 | |||
| 187 | 2012-07-30 Paul Eggert <eggert@cs.ucla.edu> | ||
| 188 | |||
| 189 | Update .PHONY listings in makefiles. | ||
| 190 | * Makefile.in (.PHONY): Add all, need-blessmail, maybe-blessmail, | ||
| 191 | install, uninstall, mostlyclean, clean, distclean, | ||
| 192 | maintainer-clean, extraclean, check, tags. | ||
| 193 | |||
| 194 | 2012-07-29 Eli Zaretskii <eliz@gnu.org> | ||
| 195 | |||
| 196 | * makefile.w32-in ($(BLD)/profile.$(O)): Depend on stamp_BLD. | ||
| 197 | |||
| 198 | 2012-07-12 Paul Eggert <eggert@cs.ucla.edu> | ||
| 199 | |||
| 200 | * movemail.c: Add missing 'defined'. | ||
| 201 | Suggested by Sven Joachim in | ||
| 202 | <http://lists.gnu.org/archive/html/emacs-devel/2012-07/msg00218.html>. | ||
| 203 | |||
| 204 | 2012-07-11 Paul Eggert <eggert@cs.ucla.edu> | ||
| 205 | |||
| 206 | Port 'movemail' again to Solaris and similar hosts. | ||
| 207 | See Susan Cragin's report in | ||
| 208 | <http://lists.gnu.org/archive/html/emacs-devel/2012-07/msg00199.html>. | ||
| 209 | * movemail.c (xmalloc): Also define if !DISABLE_DIRECT_ACCESS && | ||
| 210 | !MAIL_USE_MMDF && !MAIL_USE_SYSTEM_LOCK. Move up, so it doesn't | ||
| 211 | need a forward declaration. | ||
| 212 | (main): Rewrite to avoid no-longer-present function 'concat', if | ||
| 213 | !DISABLE_DIRECT_ACCESS && !MAIL_USE_MMDF && !MAIL_USE_SYSTEM_LOCK. | ||
| 214 | |||
| 215 | Assume strerror. | ||
| 216 | * emacsclient.c, movemail.c, update-game-score.c (strerror) | ||
| 217 | [!HAVE_STRERROR]: Remove. | ||
| 218 | |||
| 219 | 2012-07-10 Paul Eggert <eggert@cs.ucla.edu> | ||
| 220 | |||
| 221 | EMACS_TIME simplification (Bug#11875). | ||
| 222 | * profile.c (TV2): Remove no-longer-needed static var. | ||
| 223 | |||
| 224 | Simplify by avoiding confusing use of strncpy etc. | ||
| 225 | * etags.c (write_classname, C_entries): | ||
| 226 | Use sprintf rather than strncpy or strncat. | ||
| 227 | * etags.c (consider_token, C_entries, HTML_labels, Prolog_functions) | ||
| 228 | (Erlang_functions, substitute, readline_internal, savenstr): | ||
| 229 | * movemail.c (mail_spool_name): | ||
| 230 | Use memcpy rather than strncpy or strncat when either will do. | ||
| 231 | * make-docfile.c (write_c_args): | ||
| 232 | Use memcmp rather than strncmp when either will do. | ||
| 233 | * movemail.c (pop_retr): | ||
| 234 | * pop.c (pop_stat, pop_list, pop_multi_first, pop_last) | ||
| 235 | (socket_connection, pop_getline, sendline, getok): | ||
| 236 | Use snprintf rather than strncpy or strncat. | ||
| 237 | * movemail.c (concat): Remove; no longer needed. | ||
| 238 | (xmalloc): Define only if needed, now that concat has gone away. | ||
| 239 | Return void *. All uses changed. | ||
| 240 | |||
| 241 | 2012-07-09 Paul Eggert <eggert@cs.ucla.edu> | ||
| 242 | |||
| 243 | Add GCC-style 'const' attribute to functions that can use it. | ||
| 244 | * etags.c (number_len): Add ATTRIBUTE_CONST. | ||
| 245 | |||
| 246 | 2012-07-09 Juanma Barranquero <lekktu@gmail.com> | ||
| 247 | |||
| 248 | * emacsclient.c (w32_execvp): Declare execvp to silence the compiler. | ||
| 249 | |||
| 250 | 2012-07-09 Juanma Barranquero <lekktu@gmail.com> | ||
| 251 | |||
| 252 | * makefile.w32-in ($(BLD)/test-distrib.exe): Use LIB_SRC, not SRC. | ||
| 253 | (LIB_SRC, NT_INC, GNU_LIB, MS_W32_H, CONFIG_H, INTTYPES_H, NTLIB_H) | ||
| 254 | (SYSTIME_H): New macros. | ||
| 255 | (SRC): Redefine to point to src/, not current directory. | ||
| 256 | ($(BLD)/ctags.$(O), $(BLD)/ebrowse.$(O), $(BLD)/emacsclient.$(O)) | ||
| 257 | ($(BLD)/etags.$(O), $(BLD)/hexl.$(O), $(BLD)/make-docfile.$(O)) | ||
| 258 | ($(BLD)/movemail.$(O), $(BLD)/ntlib.$(O), $(BLD)/pop.$(O)) | ||
| 259 | ($(BLD)/profile.$(O), $(BLD)/test-distrib.$(O)): Update dependencies. | ||
| 260 | ($(BLD)/regex.$(O)): New dependency. | ||
| 261 | |||
| 262 | 2012-07-09 Juanma Barranquero <lekktu@gmail.com> | ||
| 263 | |||
| 264 | * makefile.w32-in (ALL): Add profile.exe. | ||
| 265 | (PROFILEOBJS): New macro. | ||
| 266 | ($(BLD)/profile.exe): New target. | ||
| 267 | (install): Copy profile.exe. | ||
| 268 | ($(BLD)/alloca.$(O), $(BLD)/tcp.$(O)): Remove, obsolete. | ||
| 269 | |||
| 270 | 2012-07-07 Juanma Barranquero <lekktu@gmail.com> | ||
| 271 | |||
| 272 | * makefile.w32-in ($(BLD)/ctags.$(O), $(BLD)/etags.$(O)): | ||
| 273 | Update dependencies. | ||
| 274 | |||
| 275 | 2012-07-06 Paul Eggert <eggert@cs.ucla.edu> | ||
| 276 | |||
| 277 | Use c_strcasecmp for ASCII case-insensitive comparison (Bug#11786). | ||
| 278 | * etags.c: Include c-strcase.h. | ||
| 279 | (etags_strcasecmp, etags_strncasecmp): Remove. | ||
| 280 | All uses replaced with c_strcasecmp and c_strncasecmp. | ||
| 281 | |||
| 282 | 2012-07-06 Andreas Schwab <schwab@linux-m68k.org> | ||
| 283 | |||
| 284 | * make-docfile.c (write_globals): Warn about duplicate function | ||
| 285 | definitions with differing signatures. | ||
| 286 | |||
| 287 | 2012-07-03 Paul Eggert <eggert@cs.ucla.edu> | ||
| 288 | |||
| 289 | * make-docfile.c (scan_c_file): Suppress GCC warning. | ||
| 290 | |||
| 291 | 2012-06-29 Tom Tromey <tromey@redhat.com> | ||
| 292 | |||
| 293 | * make-docfile.c (enum global_type) <FUNCTION>: New constant. | ||
| 294 | (struct global) <value>: New field. | ||
| 295 | (add_global): Add 'value' argument. | ||
| 296 | (compare_globals): Sort functions at the end. | ||
| 297 | (close_emacs_globals): New function. | ||
| 298 | (write_globals): Handle functions. | ||
| 299 | (scan_c_file): Call add_global for DEFUN. | ||
| 300 | |||
| 301 | 2012-06-30 Juanma Barranquero <lekktu@gmail.com> | ||
| 302 | |||
| 303 | * makefile.w32-in (CTAGS_CFLAGS): Remove EMACS_NAME; | ||
| 304 | already defined in ETAGS_CFLAGS. | ||
| 305 | |||
| 306 | 2012-06-27 Glenn Morris <rgm@gnu.org> | ||
| 307 | |||
| 308 | * makefile.w32-in (lisp2): Remove paths.el. | ||
| 309 | |||
| 310 | 2012-06-26 Paul Eggert <eggert@cs.ucla.edu> | ||
| 311 | |||
| 312 | Clean out last vestiges of the old HAVE_CONFIG_H stuff. | ||
| 313 | * Makefile.in (BASE_CFLAGS): | ||
| 314 | * makefile.w32-in (LOCAL_FLAGS): Remove -DHAVE_CONFIG_H. | ||
| 315 | * etags.c, hexl.c, pop.c: Include <config.h> unconditionally. | ||
| 316 | * etags.c (DOS_NT): | ||
| 317 | * pop.c (MAIL_USE_POP, h_errno): | ||
| 318 | Remove code that was conditioned on !HAVE_CONFIG_H. | ||
| 319 | |||
| 320 | 2012-06-25 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 321 | |||
| 322 | * etags.c (etags_strcasecmp, etags_strncasecmp): Define to | ||
| 323 | library functions strcasecmp and strncasecmp if available. | ||
| 324 | |||
| 325 | 2012-06-24 Paul Eggert <eggert@cs.ucla.edu> | ||
| 326 | |||
| 327 | Switch from NO_RETURN to C11's _Noreturn (Bug#11750). | ||
| 328 | * ebrowse.c (usage, version): | ||
| 329 | * emacsclient.c (print_help_and_exit, fail): | ||
| 330 | * etags.c (suggest_asking_for_help, fatal, pfatal): | ||
| 331 | * hexl.c (usage): | ||
| 332 | * make-docfile.c (fatal): | ||
| 333 | * movemail.c (fatal, pfatal_with_name, pfatal_and_delete): | ||
| 334 | * update-game-score.c (usage): | ||
| 335 | * ebrowse.c (usage, version): | ||
| 336 | * emacsclient.c (print_help_and_exit, fail): | ||
| 337 | Use _Noreturn rather than NO_RETURN. | ||
| 338 | No need for separate decl merely because of _Noreturn. | ||
| 339 | |||
| 340 | 2012-06-24 Samuel Bronson <naesten@gmail.com> (tiny change) | ||
| 341 | |||
| 342 | * emacsclient.c (set_local_socket): Fix compiler warning (Bug#7838). | ||
| 343 | |||
| 344 | 2012-06-22 Paul Eggert <eggert@cs.ucla.edu> | ||
| 345 | |||
| 346 | Support higher-resolution time stamps (Bug#9000). | ||
| 347 | * Makefile.in (LIB_CLOCK_GETTIME): New macro. | ||
| 348 | (profile${EXEEXT}): Use it. | ||
| 349 | * profile.c: Include inttypes.h, intprops.h. | ||
| 350 | (time_string): Size conservatively; do not guess size. | ||
| 351 | (get_time): Now prints nanoseconds. | ||
| 352 | (gettimeofday): Remove replacement function; gnulib now does this. | ||
| 353 | |||
| 354 | 2012-06-08 Andreas Schwab <schwab@linux-m68k.org> | ||
| 355 | |||
| 356 | * make-docfile.c (search_lisp_doc_at_eol): Unget last read | ||
| 357 | character. | ||
| 358 | |||
| 359 | 2012-06-06 Glenn Morris <rgm@gnu.org> | ||
| 360 | |||
| 361 | * Makefile.in (STAMP_INST_SCRIPTS, STAMP_SCRIPTS, insrcdir) | ||
| 362 | (stamp-rcs2log, stamp-grep-changelog): Remove. | ||
| 363 | (all, clean): Remove references to stamps. | ||
| 364 | |||
| 365 | * vcdiff: Remove file. | ||
| 366 | * Makefile.in (SCRIPTS, STAMP_SCRIPTS): Remove vcdiff. | ||
| 367 | (stamp-vcdiff): Remove. | ||
| 368 | |||
| 369 | 2012-06-05 Glenn Morris <rgm@gnu.org> | ||
| 370 | |||
| 371 | * makefile.w32-in ($(BLD)/getdate.$(O), $(BLD)/leditcfns.$(O)): | ||
| 372 | ($(BLD)/make-path.$(O), $(BLD)/qsort.$(O)): | ||
| 373 | ($(BLD)/timer.$(O)): Remove cruft. | ||
| 374 | |||
| 375 | 2012-06-03 Glenn Morris <rgm@gnu.org> | ||
| 376 | |||
| 377 | * rcs-checkin: Remove file. | ||
| 378 | * Makefile.in (INSTALLABLE_SCRIPTS, STAMP_INST_SCRIPTS): | ||
| 379 | Remove rcs-checkin. | ||
| 380 | (stamp-rcs-checkin): Remove. | ||
| 381 | |||
| 382 | 2012-05-31 Eli Zaretskii <eliz@gnu.org> | ||
| 383 | |||
| 384 | * makefile.w32-in ($(BLD)/emacsclientw.exe): Use $(MWINDOWS) | ||
| 385 | instead of a literal -mwindows, which is not supported by MSVC. | ||
| 386 | (Bug#11405) | ||
| 387 | |||
| 388 | 2012-05-30 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 389 | |||
| 390 | * make-docfile.c: Improve comment style. | ||
| 391 | (search_lisp_doc_at_eol): New function. | ||
| 392 | (scan_lisp_file): Use it. | ||
| 393 | |||
| 394 | 2012-05-26 Glenn Morris <rgm@gnu.org> | ||
| 395 | |||
| 396 | * Makefile.in (INSTALL_DATA): Remove; unused. | ||
| 397 | |||
| 398 | 2012-05-22 Paul Eggert <eggert@cs.ucla.edu> | ||
| 399 | |||
| 400 | Remove src/m/*. | ||
| 401 | * makefile.w32-in: Remove dependencies on | ||
| 402 | $(EMACS_ROOT)/src/m/intel386.h. | ||
| 403 | |||
| 404 | 2012-05-22 Glenn Morris <rgm@gnu.org> | ||
| 405 | |||
| 406 | * Makefile.in (install): Remove unneeded chmods. | ||
| 407 | |||
| 408 | 2012-05-21 Paul Eggert <eggert@cs.ucla.edu> | ||
| 409 | |||
| 410 | Assume C89 or later. | ||
| 411 | * etags.c (static, const): Remove macros. | ||
| 412 | (PTR): Remove; all uses replaced with void *. Omit needless casts. | ||
| 413 | |||
| 414 | 2012-05-21 Glenn Morris <rgm@gnu.org> | ||
| 415 | |||
| 416 | * Makefile.in (insrcdir, $(DESTDIR)${archlibdir}): | ||
| 417 | Scrap superfluous subshells. | ||
| 418 | |||
| 419 | 2012-05-18 Glenn Morris <rgm@gnu.org> | ||
| 420 | |||
| 421 | * Makefile.in (install): Ensure $bindir exists. | ||
| 422 | |||
| 423 | 2012-05-17 Glenn Morris <rgm@gnu.org> | ||
| 424 | |||
| 425 | * Makefile.in (ns_appbindir): New, set by configure. | ||
| 426 | |||
| 427 | 2012-05-12 Glenn Morris <rgm@gnu.org> | ||
| 428 | |||
| 429 | * Makefile.in (MKDIR_P): New, set by configure. | ||
| 430 | ($(DESTDIR)${archlibdir}): Use $MKDIR_P. | ||
| 431 | |||
| 432 | 2012-05-10 Paul Eggert <eggert@cs.ucla.edu> | ||
| 433 | |||
| 434 | etags: pacify gcc -Wstack-protector on Ubuntu 12.04 x86 | ||
| 435 | * etags.c: Include <stdarg.h>. | ||
| 436 | (error): Declare as printf-style, as that's what it really is. | ||
| 437 | All uses changed. | ||
| 438 | (add_regex): Use single char rather than array-of-one char. | ||
| 439 | |||
| 440 | 2012-05-05 Jim Meyering <meyering@redhat.com> | ||
| 441 | |||
| 442 | * lib-src/pop.c (pop_stat, pop_list, pop_multi_first, pop_last): | ||
| 443 | NUL-terminate the error buffer (Bug#11372). | ||
| 444 | |||
| 445 | 2012-05-02 Juanma Barranquero <lekktu@gmail.com> | ||
| 446 | |||
| 447 | * emacsclient.c (min): Undef before redefining it. | ||
| 448 | |||
| 449 | 2012-05-02 Jim Meyering <jim@meyering.net> | ||
| 450 | |||
| 451 | * emacsclient.c (send_to_emacs): Avoid invalid strcpy upon partial | ||
| 452 | send (Bug#11374). | ||
| 453 | |||
| 454 | 2012-04-29 Andreas Schwab <schwab@linux-m68k.org> | ||
| 455 | |||
| 456 | * make-docfile.c (scan_lisp_file) [DEBUG]: Also skip if and | ||
| 457 | byte-code forms. (Bug#11380) | ||
| 458 | |||
| 459 | 2012-04-20 Chong Yidong <cyd@gnu.org> | ||
| 460 | |||
| 461 | * emacsclient.c (decode_options): Move -t -n corner case handling | ||
| 462 | into server.el (Bug#11102). | ||
| 463 | (main): Send -tty to Emacs under more circumstances (Bug#8314). | ||
| 464 | |||
| 465 | 2012-04-18 Paul Eggert <eggert@cs.ucla.edu> | ||
| 466 | |||
| 467 | configure: new option --enable-gcc-warnings (Bug#11207) | ||
| 468 | * Makefile.in (C_WARNINGS_SWITCH): Remove. | ||
| 469 | (WARN_CFLAGS, WERROR_CFLAGS): New macros. | ||
| 470 | (BASE_CFLAGS): Use new macros rather than old. | ||
| 471 | |||
| 472 | 2012-04-16 Paul Eggert <eggert@cs.ucla.edu> | ||
| 473 | |||
| 474 | Assume less-ancient POSIX support. | ||
| 475 | * update-game-score.c: Include <getopt.h> rather than rolling our | ||
| 476 | own decls for optarg, optind, opterr. See | ||
| 477 | <http://lists.gnu.org/archive/html/emacs-devel/2011-12/msg00720.html>. | ||
| 478 | |||
| 479 | 2012-04-14 Juanma Barranquero <lekktu@gmail.com> | ||
| 480 | |||
| 481 | * emacsclient.c (decode_options) [WINDOWSNT]: | ||
| 482 | Call ttyname instead of passing its address (typo in 2011-12-04T17:13:01Z!lekktu@gmail.com). | ||
| 483 | |||
| 484 | 2012-04-07 Eli Zaretskii <eliz@gnu.org> | ||
| 485 | |||
| 486 | * makefile.w32-in (obj): Add xml.o. | ||
| 487 | |||
| 488 | 2012-04-07 Eli Zaretskii <eliz@gnu.org> | ||
| 489 | |||
| 490 | * makefile.w32-in (ALL): Now the list of executables, not of phony | ||
| 491 | targets. | ||
| 492 | (.PHONY): Only make-docfile is its prerequisite now. | ||
| 493 | (make-docfile): Don't depend on stamp_BLD. Add a comment about | ||
| 494 | the need in this target. | ||
| 495 | (ctags, etags, ebrowse, hexl, movemail, emacsclient) | ||
| 496 | (test-distrib): Phony targets removed. | ||
| 497 | ($(BLD)/test-distrib.exe): Run test-distrib as part of the recipe. | ||
| 498 | (all): Don't depend on stamp_BLD. | ||
| 499 | (ALL): Include $(BLD)/test-distrib.exe. | ||
| 500 | |||
| 501 | 2012-03-11 Andreas Schwab <schwab@linux-m68k.org> | ||
| 502 | |||
| 503 | * emacsclient.c (main): Handle -print-nonl command. | ||
| 504 | |||
| 505 | * emacsclient.c (main): Handle multiple messages in a single | ||
| 506 | datagram. | ||
| 507 | |||
| 508 | * emacsclient.c (socket_name): Add const. | ||
| 509 | (get_server_config): Add parameter config_file, use it instead of | ||
| 510 | global server_file. | ||
| 511 | (set_tcp_socket): Add parameter local_server_file, pass it down to | ||
| 512 | get_server_config. | ||
| 513 | (set_local_socket): Add parameter local_socket_name, use it | ||
| 514 | instead of global socket_name. | ||
| 515 | (set_socket): Adjust calls to set_local_socket and set_tcp_socket. | ||
| 516 | Don't clobber global server_file or socket_name. | ||
| 517 | (main): No longer reset server_file or socket_name. | ||
| 518 | |||
| 519 | 2012-01-05 Glenn Morris <rgm@gnu.org> | ||
| 520 | |||
| 521 | * ebrowse.c (version) <emacs_copyright>: | ||
| 522 | * etags.c (print_version) <emacs_copyright>: | ||
| 523 | * rcs2log (Copyright): Update short copyright year to 2012. | ||
| 524 | |||
| 1 | 2011-12-25 Andreas Schwab <schwab@linux-m68k.org> | 525 | 2011-12-25 Andreas Schwab <schwab@linux-m68k.org> |
| 2 | 526 | ||
| 3 | * etags.c (C_entries): Properly skip over string and character | 527 | * etags.c (C_entries): Properly skip over string and character |
| @@ -21,7 +545,7 @@ | |||
| 21 | * makefile.w32-in (LOCAL_FLAGS): Add $(EMACS_EXTRA_C_FLAGS). | 545 | * makefile.w32-in (LOCAL_FLAGS): Add $(EMACS_EXTRA_C_FLAGS). |
| 22 | 546 | ||
| 23 | * emacsclient.c (main) <environ>: Remove declaration, already | 547 | * emacsclient.c (main) <environ>: Remove declaration, already |
| 24 | pulled in by unistd.h on Posix hosts and stdlib.h on MS-Windows. | 548 | pulled in by unistd.h on POSIX hosts and stdlib.h on MS-Windows. |
| 25 | 549 | ||
| 26 | 2011-11-24 Glenn Morris <rgm@gnu.org> | 550 | 2011-11-24 Glenn Morris <rgm@gnu.org> |
| 27 | 551 | ||
| @@ -310,8 +834,8 @@ | |||
| 310 | 834 | ||
| 311 | * etags.c (canonicalize_filename, ISUPPER): Fix last change. | 835 | * etags.c (canonicalize_filename, ISUPPER): Fix last change. |
| 312 | 836 | ||
| 313 | * makefile.w32-in ($(BLD)/ebrowse.$(O), $(BLD)/pop.$(O)): Depend | 837 | * makefile.w32-in ($(BLD)/ebrowse.$(O), $(BLD)/pop.$(O)): |
| 314 | on ../lib/min-max.h. | 838 | Depend on ../lib/min-max.h. |
| 315 | 839 | ||
| 316 | 2011-02-22 Paul Eggert <eggert@cs.ucla.edu> | 840 | 2011-02-22 Paul Eggert <eggert@cs.ucla.edu> |
| 317 | 841 | ||
| @@ -620,7 +1144,7 @@ | |||
| 620 | (Asm_help, default_C_suffixes, default_C_help, Cplusplus_suffixes) | 1144 | (Asm_help, default_C_suffixes, default_C_help, Cplusplus_suffixes) |
| 621 | (Cplusplus_help, Cjava_suffixes, Cobol_suffixes, Cstar_suffixes) | 1145 | (Cplusplus_help, Cjava_suffixes, Cobol_suffixes, Cstar_suffixes) |
| 622 | (Erlang_suffixes, Erlang_help, Forth_suffixes, Forth_help) | 1146 | (Erlang_suffixes, Erlang_help, Forth_suffixes, Forth_help) |
| 623 | (Fortran_suffixes, Fortran_help, HTML_suffixes, HTML_help) | 1147 | (Fortran_suffixes, Fortran_help, HTML_suffixes, HTML_help) |
| 624 | (Lisp_suffixes, Lisp_help, Lua_suffixes, Lua_help) | 1148 | (Lisp_suffixes, Lisp_help, Lua_suffixes, Lua_help) |
| 625 | (Makefile_filenames, Makefile_help, Objc_suffixes, Objc_help) | 1149 | (Makefile_filenames, Makefile_help, Objc_suffixes, Objc_help) |
| 626 | (Pascal_suffixes, Pascal_help, Perl_suffixes, Perl_interpreters) | 1150 | (Pascal_suffixes, Pascal_help, Perl_suffixes, Perl_interpreters) |
| @@ -2688,7 +3212,7 @@ | |||
| 2688 | 3212 | ||
| 2689 | * make-docfile.c (read_c_string_or_comment): Declare msgno. | 3213 | * make-docfile.c (read_c_string_or_comment): Declare msgno. |
| 2690 | 3214 | ||
| 2691 | * Makefile.in (YACC): Deleted. | 3215 | * Makefile.in (YACC): Delete. |
| 2692 | 3216 | ||
| 2693 | 2002-10-19 Andreas Schwab <schwab@suse.de> | 3217 | 2002-10-19 Andreas Schwab <schwab@suse.de> |
| 2694 | 3218 | ||
| @@ -2906,7 +3430,7 @@ | |||
| 2906 | (TeX_commands): Names now include the initial backslash. | 3430 | (TeX_commands): Names now include the initial backslash. |
| 2907 | (TeX_commands): Names do not include numeric args #n. | 3431 | (TeX_commands): Names do not include numeric args #n. |
| 2908 | (TeX_commands): Correct line char number in tags. | 3432 | (TeX_commands): Correct line char number in tags. |
| 2909 | (TEX_tabent, TEX_token): Deleted. | 3433 | (TEX_tabent, TEX_token): Delete. |
| 2910 | (TeX_commands, TEX_decode_env): Streamlined. | 3434 | (TeX_commands, TEX_decode_env): Streamlined. |
| 2911 | 3435 | ||
| 2912 | 2002-06-05 Francesco Potortì <pot@gnu.org> | 3436 | 2002-06-05 Francesco Potortì <pot@gnu.org> |
| @@ -2947,7 +3471,7 @@ | |||
| 2947 | (main): New argument -d, for specifying directory. | 3471 | (main): New argument -d, for specifying directory. |
| 2948 | (usage): Document. | 3472 | (usage): Document. |
| 2949 | (get_user_id): Compute. | 3473 | (get_user_id): Compute. |
| 2950 | (get_home_dir): Deleted. | 3474 | (get_home_dir): Delete. |
| 2951 | (get_prefix): New function, taken from main. | 3475 | (get_prefix): New function, taken from main. |
| 2952 | (main): Check whether or not we are running setuid. Move prefix | 3476 | (main): Check whether or not we are running setuid. Move prefix |
| 2953 | computation to get_prefix. Don't call getpwent; we don't need to | 3477 | computation to get_prefix. Don't call getpwent; we don't need to |
| @@ -3208,7 +3732,7 @@ | |||
| 3208 | (LOOKING_AT, get_tag, PHP_functions): Use notinname. | 3732 | (LOOKING_AT, get_tag, PHP_functions): Use notinname. |
| 3209 | (Ada_getit, Ada_funcs, Python_functions, Scheme_functions): | 3733 | (Ada_getit, Ada_funcs, Python_functions, Scheme_functions): |
| 3210 | Clarified, using strneq or notinname. | 3734 | Clarified, using strneq or notinname. |
| 3211 | (L_isdef, L_isquote): Removed. | 3735 | (L_isdef, L_isquote): Remove. |
| 3212 | (Lisp_functions, L_getit): Clarified. | 3736 | (Lisp_functions, L_getit): Clarified. |
| 3213 | 3737 | ||
| 3214 | * etags.c (P_): Rename to __P for consistency with config.h. | 3738 | * etags.c (P_): Rename to __P for consistency with config.h. |
| @@ -3645,7 +4169,7 @@ | |||
| 3645 | comma when --declarations is used. | 4169 | comma when --declarations is used. |
| 3646 | (C_entries): More accurate tagging of members and declarations. | 4170 | (C_entries): More accurate tagging of members and declarations. |
| 3647 | (yacc_rules): Was global, made local to C_entries. | 4171 | (yacc_rules): Was global, made local to C_entries. |
| 3648 | (next_token_is_func): Removed. | 4172 | (next_token_is_func): Remove. |
| 3649 | (fvdef): New constants fdefunkey, fdefunname. | 4173 | (fvdef): New constants fdefunkey, fdefunname. |
| 3650 | (consider_token, C_entries): Use them. | 4174 | (consider_token, C_entries): Use them. |
| 3651 | (C_entries): Build proper lisp names for Emacs DEFUNs. | 4175 | (C_entries): Build proper lisp names for Emacs DEFUNs. |
| @@ -4121,7 +4645,7 @@ | |||
| 4121 | (find_entries, takeprec, getit, Fortran_functions, Perl_functions) | 4645 | (find_entries, takeprec, getit, Fortran_functions, Perl_functions) |
| 4122 | (Python_functions, L_getit, Lisp_functions, Scheme_functions) | 4646 | (Python_functions, L_getit, Lisp_functions, Scheme_functions) |
| 4123 | (prolog_pred, erlanf_func, erlang_attribute): Use them. | 4647 | (prolog_pred, erlanf_func, erlang_attribute): Use them. |
| 4124 | (eat_white): Deleted. | 4648 | (eat_white): Delete. |
| 4125 | 4649 | ||
| 4126 | * etags.c (CHAR, init): Keep into account non US-ASCII | 4650 | * etags.c (CHAR, init): Keep into account non US-ASCII |
| 4127 | characters and compilers with default signed chars. | 4651 | characters and compilers with default signed chars. |
| @@ -4644,7 +5168,7 @@ | |||
| 4644 | 1997-05-13 Francesco Potortì <F.Potorti@cnuce.cnr.it> | 5168 | 1997-05-13 Francesco Potortì <F.Potorti@cnuce.cnr.it> |
| 4645 | 5169 | ||
| 4646 | * etags.c (TeX_functions): Cleaned up. | 5170 | * etags.c (TeX_functions): Cleaned up. |
| 4647 | (tex_getit): Removed. | 5171 | (tex_getit): Remove. |
| 4648 | 5172 | ||
| 4649 | 1997-05-13 Paul Eggert <eggert@twinsun.com> | 5173 | 1997-05-13 Paul Eggert <eggert@twinsun.com> |
| 4650 | 5174 | ||
| @@ -5165,7 +5689,7 @@ | |||
| 5165 | 5689 | ||
| 5166 | * etags.c: Prolog language totally rewritten. | 5690 | * etags.c: Prolog language totally rewritten. |
| 5167 | (Prolog_functions): Rewritten from scratch. | 5691 | (Prolog_functions): Rewritten from scratch. |
| 5168 | (skip_comment, prolog_getit): Removed. | 5692 | (skip_comment, prolog_getit): Remove. |
| 5169 | (prolog_skip_comment): New function, like old skip_comment. | 5693 | (prolog_skip_comment): New function, like old skip_comment. |
| 5170 | (prolog_pred, prolog_atom, prolog_white): New functions. | 5694 | (prolog_pred, prolog_atom, prolog_white): New functions. |
| 5171 | (erlang_func, erlang_attributes): Forward declarations added. | 5695 | (erlang_func, erlang_attributes): Forward declarations added. |
| @@ -5666,7 +6190,7 @@ | |||
| 5666 | 6190 | ||
| 5667 | 1995-01-12 Francesco Potortì (pot@cnuce.cnr.it) | 6191 | 1995-01-12 Francesco Potortì (pot@cnuce.cnr.it) |
| 5668 | 6192 | ||
| 5669 | * etags.c (FILEPOS, GET_CHARNO, GET_FILEPOS, max, LINENO): Deleted. | 6193 | * etags.c (FILEPOS, GET_CHARNO, GET_FILEPOS, max, LINENO): Delete. |
| 5670 | (append_to_tagfile, typedefs, typedefs_and_cplusplus) | 6194 | (append_to_tagfile, typedefs, typedefs_and_cplusplus) |
| 5671 | (constantypedefs, update, vgrind_style, no_warnings) | 6195 | (constantypedefs, update, vgrind_style, no_warnings) |
| 5672 | (cxref_style, cplusplus, noindentypedefs): Were int, now logical. | 6196 | (cxref_style, cplusplus, noindentypedefs): Were int, now logical. |
| @@ -5685,9 +6209,9 @@ | |||
| 5685 | (consider_token): Don't take a token as argument. Use savenstr | 6209 | (consider_token): Don't take a token as argument. Use savenstr |
| 5686 | when saving a tag in structtag. Callers changed. | 6210 | when saving a tag in structtag. Callers changed. |
| 5687 | (TOKEN): Structure changed. Now used only in C_entries. | 6211 | (TOKEN): Structure changed. Now used only in C_entries. |
| 5688 | (TOKEN_SAVED_P, SAVE_TOKEN, RESTORE_TOKEN): Deleted. | 6212 | (TOKEN_SAVED_P, SAVE_TOKEN, RESTORE_TOKEN): Delete. |
| 5689 | (C_entries): nameb and savenameb deleted. Use dinamic allocation. | 6213 | (C_entries): nameb and savenameb deleted. Use dinamic allocation. |
| 5690 | (pfcnt): Deleted. Users updated. | 6214 | (pfcnt): Delete. Users updated. |
| 5691 | (getit, Asm_labels, Pascal_functions, L_getit, get_scheme) | 6215 | (getit, Asm_labels, Pascal_functions, L_getit, get_scheme) |
| 5692 | (TEX_getit, prolog_getit): Use dinamic allocation for storing | 6216 | (TEX_getit, prolog_getit): Use dinamic allocation for storing |
| 5693 | the tag instead of a fixed size buffer. | 6217 | the tag instead of a fixed size buffer. |
| @@ -6263,7 +6787,7 @@ | |||
| 6263 | 6787 | ||
| 6264 | 1994-03-25 Francesco Potortì (pot@cnuce.cnr.it) | 6788 | 1994-03-25 Francesco Potortì (pot@cnuce.cnr.it) |
| 6265 | 6789 | ||
| 6266 | * etags.c (emacs_tags_format, ETAGS): Removed. Use CTAGS instead. | 6790 | * etags.c (emacs_tags_format, ETAGS): Remove. Use CTAGS instead. |
| 6267 | (main): Don't allow the use of -t and -T in etags mode. | 6791 | (main): Don't allow the use of -t and -T in etags mode. |
| 6268 | (print_help): Don't show options enabled by default. | 6792 | (print_help): Don't show options enabled by default. |
| 6269 | (print_version): Show the emacs version number if VERSION is #defined. | 6793 | (print_version): Show the emacs version number if VERSION is #defined. |
| @@ -6380,9 +6904,9 @@ | |||
| 6380 | 1994-01-14 Francesco Potortì (pot@cnuce.cnr.it) | 6904 | 1994-01-14 Francesco Potortì (pot@cnuce.cnr.it) |
| 6381 | 6905 | ||
| 6382 | * etags.c (stab_entry, stab_create, stab_find, stab_search, | 6906 | * etags.c (stab_entry, stab_create, stab_find, stab_search, |
| 6383 | stab_type, add_keyword, C_reate_stab, C_create_stabs): Deleted. | 6907 | stab_type, add_keyword, C_reate_stab, C_create_stabs): Delete. |
| 6384 | Use gperf generated hash table instead of linked list. | 6908 | Use gperf generated hash table instead of linked list. |
| 6385 | (C_stab_entry, hash, in_word_set, get_C_stab, C_symtype): Added. | 6909 | (C_stab_entry, hash, in_word_set, get_C_stab, C_symtype): Add. |
| 6386 | Mostly code generated by gperf. | 6910 | Mostly code generated by gperf. |
| 6387 | (consider_token): Remove unused parameter `lp'. | 6911 | (consider_token): Remove unused parameter `lp'. |
| 6388 | (PF_funcs, getit): Allow subroutine and similar declarations | 6912 | (PF_funcs, getit): Allow subroutine and similar declarations |
| @@ -6605,7 +7129,7 @@ | |||
| 6605 | 7129 | ||
| 6606 | 1993-08-25 Paul Eggert (eggert@twinsun.com) | 7130 | 1993-08-25 Paul Eggert (eggert@twinsun.com) |
| 6607 | 7131 | ||
| 6608 | * rcs2log: Change /{/ to /\{/ for Posix ERE compatibility; | 7132 | * rcs2log: Change /{/ to /\{/ for POSIX ERE compatibility; |
| 6609 | otherwise, HP awk complains. | 7133 | otherwise, HP awk complains. |
| 6610 | 7134 | ||
| 6611 | * vcdiff: Append /usr/ccs/bin and /usr/sccs to PATH, since these | 7135 | * vcdiff: Append /usr/ccs/bin and /usr/sccs to PATH, since these |
| @@ -6701,7 +7225,7 @@ | |||
| 6701 | * etags.c (consider_token): Was `==', now is `='. | 7225 | * etags.c (consider_token): Was `==', now is `='. |
| 6702 | (consider_token): DEFUNs now treated like funcs in ctags mode. | 7226 | (consider_token): DEFUNs now treated like funcs in ctags mode. |
| 6703 | 7227 | ||
| 6704 | * etags.c (LEVEL_OK_FOR_FUNCDEF): Removed. | 7228 | * etags.c (LEVEL_OK_FOR_FUNCDEF): Remove. |
| 6705 | (C_entries): Optimized the test that used LEVEL_OK_FOR_FUNCDEF. | 7229 | (C_entries): Optimized the test that used LEVEL_OK_FOR_FUNCDEF. |
| 6706 | (C_entries): Remove a piece of useless code. | 7230 | (C_entries): Remove a piece of useless code. |
| 6707 | (C_entries): Making typedef tags is delayed until a semicolon | 7231 | (C_entries): Making typedef tags is delayed until a semicolon |
| @@ -6952,7 +7476,7 @@ | |||
| 6952 | 7476 | ||
| 6953 | * rcs2log: mawk, SunOS 4.1.3 nawk, and Ultrix/MKS nawk all barf on | 7477 | * rcs2log: mawk, SunOS 4.1.3 nawk, and Ultrix/MKS nawk all barf on |
| 6954 | /[/]/, so change it to /[\/]/. This should work on all | 7478 | /[/]/, so change it to /[\/]/. This should work on all |
| 6955 | Posix-compliant awks. It's slightly wrong with traditional awk, | 7479 | POSIX-compliant awks. It's slightly wrong with traditional awk, |
| 6956 | since it matches \ too, but that's a minor problem compared to awk | 7480 | since it matches \ too, but that's a minor problem compared to awk |
| 6957 | syntax errors. | 7481 | syntax errors. |
| 6958 | 7482 | ||
| @@ -7000,10 +7524,10 @@ | |||
| 7000 | * etags.c (GET_COOKIE): And related macros removed. | 7524 | * etags.c (GET_COOKIE): And related macros removed. |
| 7001 | (logical): Is now int, no more a char. | 7525 | (logical): Is now int, no more a char. |
| 7002 | (reg): Define deleted. | 7526 | (reg): Define deleted. |
| 7003 | (isgood, _gd, notgd): Deleted. | 7527 | (isgood, _gd, notgd): Delete. |
| 7004 | (gotone): Deleted. | 7528 | (gotone): Delete. |
| 7005 | (TOKEN): Member linestart removed. | 7529 | (TOKEN): Member linestart removed. |
| 7006 | (linepos, prev_linepos, lb1): Deleted. | 7530 | (linepos, prev_linepos, lb1): Delete. |
| 7007 | (main): Call initbuffer on lbs array instead of lb1. | 7531 | (main): Call initbuffer on lbs array instead of lb1. |
| 7008 | (init): Remove the initialization of the logical _gd array. | 7532 | (init): Remove the initialization of the logical _gd array. |
| 7009 | (find_entries): A .sa suffix means assembler file. | 7533 | (find_entries): A .sa suffix means assembler file. |
| @@ -7011,7 +7535,7 @@ | |||
| 7011 | All C state machines rewritten. | 7535 | All C state machines rewritten. |
| 7012 | (C_entries): Complete rewrite. | 7536 | (C_entries): Complete rewrite. |
| 7013 | (condider_token): Complete rewrite. | 7537 | (condider_token): Complete rewrite. |
| 7014 | (getline): Deleted. | 7538 | (getline): Delete. |
| 7015 | 7539 | ||
| 7016 | 1993-03-01 Francesco Potortì (pot@fly.CNUCE.CNR.IT) | 7540 | 1993-03-01 Francesco Potortì (pot@fly.CNUCE.CNR.IT) |
| 7017 | 7541 | ||
| @@ -7930,7 +8454,7 @@ | |||
| 7930 | ;; coding: utf-8 | 8454 | ;; coding: utf-8 |
| 7931 | ;; End: | 8455 | ;; End: |
| 7932 | 8456 | ||
| 7933 | Copyright (C) 1988-1999, 2001-2011 Free Software Foundation, Inc. | 8457 | Copyright (C) 1988-1999, 2001-2012 Free Software Foundation, Inc. |
| 7934 | 8458 | ||
| 7935 | This file is part of GNU Emacs. | 8459 | This file is part of GNU Emacs. |
| 7936 | 8460 | ||
diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in index c5e117f66f9..d271bb3a4fa 100644 --- a/lib-src/Makefile.in +++ b/lib-src/Makefile.in | |||
| @@ -1,5 +1,5 @@ | |||
| 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-2011 | 2 | # Copyright (C) 1985, 1987-1988, 1993-1994, 2001-2012 |
| 3 | # Free Software Foundation, Inc. | 3 | # Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | # This file is part of GNU Emacs. | 5 | # This file is part of GNU Emacs. |
| @@ -36,14 +36,19 @@ configuration=@configuration@ | |||
| 36 | EXEEXT=@EXEEXT@ | 36 | EXEEXT=@EXEEXT@ |
| 37 | C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@ | 37 | C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@ |
| 38 | C_SWITCH_MACHINE=@C_SWITCH_MACHINE@ | 38 | C_SWITCH_MACHINE=@C_SWITCH_MACHINE@ |
| 39 | C_WARNINGS_SWITCH = @C_WARNINGS_SWITCH@ | ||
| 40 | PROFILING_CFLAGS = @PROFILING_CFLAGS@ | 39 | PROFILING_CFLAGS = @PROFILING_CFLAGS@ |
| 40 | WARN_CFLAGS = @WARN_CFLAGS@ | ||
| 41 | WERROR_CFLAGS = @WERROR_CFLAGS@ | ||
| 41 | 42 | ||
| 42 | # Program name transformation. | 43 | # Program name transformation. |
| 43 | TRANSFORM = @program_transform_name@ | 44 | TRANSFORM = @program_transform_name@ |
| 44 | 45 | ||
| 45 | # ==================== Where To Install Things ==================== | 46 | # ==================== Where To Install Things ==================== |
| 46 | 47 | ||
| 48 | # Location to install Emacs.app under GNUstep / Mac OS X. | ||
| 49 | # Later values may use this. | ||
| 50 | ns_appbindir=@ns_appbindir@ | ||
| 51 | |||
| 47 | # The default location for installation. Everything is placed in | 52 | # The default location for installation. Everything is placed in |
| 48 | # subdirectories of this directory. The default values for many of | 53 | # subdirectories of this directory. The default values for many of |
| 49 | # the variables below are expressed in terms of this one, so you may | 54 | # the variables below are expressed in terms of this one, so you may |
| @@ -101,10 +106,10 @@ gameuser=@gameuser@ | |||
| 101 | # ../configure figures out the correct values for these. | 106 | # ../configure figures out the correct values for these. |
| 102 | INSTALL = @INSTALL@ | 107 | INSTALL = @INSTALL@ |
| 103 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ | 108 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ |
| 104 | INSTALL_DATA = @INSTALL_DATA@ | ||
| 105 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ | 109 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ |
| 106 | # By default, we uphold the dignity of our programs. | 110 | # By default, we uphold the dignity of our programs. |
| 107 | INSTALL_STRIP = | 111 | INSTALL_STRIP = |
| 112 | MKDIR_P = @MKDIR_P@ | ||
| 108 | 113 | ||
| 109 | # ========================== Lists of Files =========================== | 114 | # ========================== Lists of Files =========================== |
| 110 | 115 | ||
| @@ -112,8 +117,7 @@ INSTALL_STRIP = | |||
| 112 | INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} \ | 117 | INSTALLABLES = etags${EXEEXT} ctags${EXEEXT} emacsclient${EXEEXT} \ |
| 113 | ebrowse${EXEEXT} | 118 | ebrowse${EXEEXT} |
| 114 | 119 | ||
| 115 | INSTALLABLE_SCRIPTS = rcs-checkin grep-changelog | 120 | INSTALLABLE_SCRIPTS = grep-changelog |
| 116 | STAMP_INST_SCRIPTS = stamp-rcs-checkin stamp-grep-changelog | ||
| 117 | 121 | ||
| 118 | # Things that Emacs runs internally, or during the build process, | 122 | # Things that Emacs runs internally, or during the build process, |
| 119 | # which should not be installed in bindir. | 123 | # which should not be installed in bindir. |
| @@ -124,8 +128,7 @@ DONT_INSTALL= test-distrib${EXEEXT} make-docfile${EXEEXT} | |||
| 124 | 128 | ||
| 125 | # Like UTILITIES, but they're not system-dependent, and should not be | 129 | # Like UTILITIES, but they're not system-dependent, and should not be |
| 126 | # deleted by the distclean target. | 130 | # deleted by the distclean target. |
| 127 | SCRIPTS= rcs2log vcdiff | 131 | SCRIPTS= rcs2log |
| 128 | STAMP_SCRIPTS= stamp-rcs2log stamp-vcdiff | ||
| 129 | 132 | ||
| 130 | # All files that are created by the linker, i.e., whose names end in ${EXEEXT}. | 133 | # All files that are created by the linker, i.e., whose names end in ${EXEEXT}. |
| 131 | EXE_FILES = ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL} | 134 | EXE_FILES = ${INSTALLABLES} ${UTILITIES} ${DONT_INSTALL} |
| @@ -156,6 +159,8 @@ LIBHESIOD=@LIBHESIOD@ | |||
| 156 | LIBRESOLV=@LIBRESOLV@ | 159 | LIBRESOLV=@LIBRESOLV@ |
| 157 | ## -llockfile if HAVE_LIBLOCKFILE or -lmail if HAVE_LIBMAIL | 160 | ## -llockfile if HAVE_LIBLOCKFILE or -lmail if HAVE_LIBMAIL |
| 158 | LIBS_MAIL=@LIBS_MAIL@ | 161 | LIBS_MAIL=@LIBS_MAIL@ |
| 162 | ## empty or -lrt or -lposix4 if HAVE_CLOCK_GETTIME | ||
| 163 | LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@ | ||
| 159 | 164 | ||
| 160 | ## Extra libraries to use when linking movemail. | 165 | ## Extra libraries to use when linking movemail. |
| 161 | LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) \ | 166 | LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) \ |
| @@ -164,42 +169,24 @@ LIBS_MOVE = $(LIBS_MAIL) $(KRB4LIB) $(DESLIB) $(KRB5LIB) $(CRYPTOLIB) \ | |||
| 164 | ## Some systems define this to request special libraries. | 169 | ## Some systems define this to request special libraries. |
| 165 | LIBS_SYSTEM = @LIBS_SYSTEM@ | 170 | LIBS_SYSTEM = @LIBS_SYSTEM@ |
| 166 | 171 | ||
| 167 | # Those files shared with other GNU utilities need HAVE_CONFIG_H | 172 | BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \ |
| 168 | # defined before they know they can take advantage of the information | 173 | $(WARN_CFLAGS) $(WERROR_CFLAGS) \ |
| 169 | # in ../src/config.h. | 174 | -I. -I../src -I../lib \ |
| 170 | BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) ${C_WARNINGS_SWITCH} \ | ||
| 171 | -DHAVE_CONFIG_H -I. -I../src -I../lib \ | ||
| 172 | -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib | 175 | -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib |
| 173 | 176 | ||
| 174 | ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS} | 177 | ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS} |
| 175 | LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS} | 178 | LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS} |
| 176 | CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS} | 179 | CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS} |
| 177 | 180 | ||
| 178 | all: ${EXE_FILES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS} ${STAMP_INST_SCRIPTS} ${STAMP_SCRIPTS} | 181 | # Configuration files for .o files to depend on. |
| 179 | 182 | config_h = ../src/config.h $(srcdir)/../src/conf_post.h | |
| 180 | LOADLIBES = ../lib/libgnu.a $(LIBS_SYSTEM) | ||
| 181 | $(EXE_FILES): ../lib/libgnu.a | ||
| 182 | |||
| 183 | ## These targets copy the scripts into the build directory so that | ||
| 184 | ## they can be run from there in an uninstalled Emacs. | ||
| 185 | ## Nothing to do if pwd = srcdir. | ||
| 186 | insrcdir=[ "`/bin/pwd`" = "`(cd $(srcdir) && /bin/pwd)`" ] | ||
| 187 | |||
| 188 | stamp-rcs2log: $(srcdir)/rcs2log | ||
| 189 | $(insrcdir) || cp -p $(srcdir)/rcs2log rcs2log | ||
| 190 | touch $@ | ||
| 191 | 183 | ||
| 192 | stamp-rcs-checkin: $(srcdir)/rcs-checkin | 184 | all: ${EXE_FILES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS} |
| 193 | $(insrcdir) || cp -p $(srcdir)/rcs-checkin rcs-checkin | ||
| 194 | touch $@ | ||
| 195 | 185 | ||
| 196 | stamp-grep-changelog: $(srcdir)/grep-changelog | 186 | .PHONY: all need-blessmail maybe-blessmail |
| 197 | $(insrcdir) || cp -p $(srcdir)/grep-changelog grep-changelog | ||
| 198 | touch $@ | ||
| 199 | 187 | ||
| 200 | stamp-vcdiff: $(srcdir)/vcdiff | 188 | LOADLIBES = ../lib/libgnu.a $(LIBS_SYSTEM) |
| 201 | $(insrcdir) || cp -p $(srcdir)/vcdiff vcdiff | 189 | $(EXE_FILES): ../lib/libgnu.a |
| 202 | touch $@ | ||
| 203 | 190 | ||
| 204 | ## Only used if we need blessmail, but no harm in always defining. | 191 | ## Only used if we need blessmail, but no harm in always defining. |
| 205 | ## This makes the actual blessmail executable. | 192 | ## This makes the actual blessmail executable. |
| @@ -229,46 +216,49 @@ maybe-blessmail: $(BLESSMAIL_TARGET) | |||
| 229 | $(DESTDIR)${archlibdir}: all | 216 | $(DESTDIR)${archlibdir}: all |
| 230 | @echo | 217 | @echo |
| 231 | @echo "Installing utilities run internally by Emacs." | 218 | @echo "Installing utilities run internally by Emacs." |
| 232 | umask 022; $(top_srcdir)/build-aux/install-sh -d $(DESTDIR)${archlibdir} | 219 | umask 022; ${MKDIR_P} $(DESTDIR)${archlibdir} |
| 233 | if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` != `/bin/pwd` ]; then \ | 220 | if [ `cd $(DESTDIR)${archlibdir} && /bin/pwd` != `/bin/pwd` ]; then \ |
| 234 | for file in ${UTILITIES}; do \ | 221 | for file in ${UTILITIES}; do \ |
| 235 | $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file $(DESTDIR)${archlibdir}/$$file ; \ | 222 | $(INSTALL_PROGRAM) $(INSTALL_STRIP) $$file $(DESTDIR)${archlibdir}/$$file ; \ |
| 236 | done ; \ | 223 | done ; \ |
| 237 | fi | 224 | fi |
| 238 | umask 022; $(top_srcdir)/build-aux/install-sh -d $(DESTDIR)${gamedir}; \ | 225 | umask 022; ${MKDIR_P} $(DESTDIR)${gamedir}; \ |
| 239 | touch $(DESTDIR)${gamedir}/snake-scores; \ | 226 | touch $(DESTDIR)${gamedir}/snake-scores; \ |
| 240 | touch $(DESTDIR)${gamedir}/tetris-scores | 227 | touch $(DESTDIR)${gamedir}/tetris-scores |
| 241 | -if chown ${gameuser} $(DESTDIR)${archlibdir}/update-game-score && chmod u+s $(DESTDIR)${archlibdir}/update-game-score; then \ | 228 | -if chown ${gameuser} $(DESTDIR)${archlibdir}/update-game-score && chmod u+s $(DESTDIR)${archlibdir}/update-game-score; then \ |
| 242 | chown ${gameuser} $(DESTDIR)${gamedir}; \ | 229 | chown ${gameuser} $(DESTDIR)${gamedir}; \ |
| 243 | chmod u=rwx,g=rwx,o=rx $(DESTDIR)${gamedir}; \ | 230 | chmod u=rwx,g=rwx,o=rx $(DESTDIR)${gamedir}; \ |
| 244 | fi | 231 | fi |
| 245 | if [ `(cd $(DESTDIR)${archlibdir} && /bin/pwd)` \ | 232 | if [ `cd $(DESTDIR)${archlibdir} && /bin/pwd` \ |
| 246 | != `(cd ${srcdir} && /bin/pwd)` ]; then \ | 233 | != `cd ${srcdir} && /bin/pwd` ]; then \ |
| 247 | for file in ${SCRIPTS}; do \ | 234 | for file in ${SCRIPTS}; do \ |
| 248 | $(INSTALL_SCRIPT) ${srcdir}/$$file $(DESTDIR)${archlibdir}/$$file; \ | 235 | $(INSTALL_SCRIPT) ${srcdir}/$$file $(DESTDIR)${archlibdir}/$$file; \ |
| 249 | done ; \ | 236 | done ; \ |
| 250 | fi | 237 | fi |
| 251 | 238 | ||
| 239 | .PHONY: install uninstall mostlyclean clean distclean maintainer-clean | ||
| 240 | .PHONY: extraclean check tags | ||
| 241 | |||
| 252 | install: $(DESTDIR)${archlibdir} | 242 | install: $(DESTDIR)${archlibdir} |
| 253 | @echo | 243 | @echo |
| 254 | @echo "Installing utilities for users to run." | 244 | @echo "Installing utilities for users to run." |
| 245 | umask 022; ${MKDIR_P} $(DESTDIR)${bindir} | ||
| 255 | for file in ${INSTALLABLES} ; do \ | 246 | for file in ${INSTALLABLES} ; do \ |
| 256 | $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \ | 247 | $(INSTALL_PROGRAM) $(INSTALL_STRIP) $${file} $(DESTDIR)${bindir}/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \ |
| 257 | chmod a+rx $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \ | ||
| 258 | done | 248 | done |
| 259 | for file in ${INSTALLABLE_SCRIPTS} ; do \ | 249 | for file in ${INSTALLABLE_SCRIPTS} ; do \ |
| 260 | $(INSTALL_SCRIPT) ${srcdir}/$${file} $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \ | 250 | $(INSTALL_SCRIPT) ${srcdir}/$${file} $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \ |
| 261 | chmod a+rx $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'`; \ | ||
| 262 | done | 251 | done |
| 263 | 252 | ||
| 264 | uninstall: | 253 | uninstall: |
| 265 | (cd $(DESTDIR)${bindir}; \ | 254 | for file in ${INSTALLABLES}; do \ |
| 266 | for file in ${INSTALLABLES} ${INSTALLABLE_SCRIPTS}; do \ | 255 | rm -f $(DESTDIR)${bindir}/`echo $${file} | sed -e 's/${EXEEXT}$$//' -e '$(TRANSFORM)'`${EXEEXT} ; \ |
| 256 | done | ||
| 257 | for file in ${INSTALLABLE_SCRIPTS}; do \ | ||
| 267 | rm -f $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \ | 258 | rm -f $(DESTDIR)${bindir}/`echo $${file} | sed '$(TRANSFORM)'` ; \ |
| 268 | done) | 259 | done |
| 269 | if [ -d $(DESTDIR)${archlibdir} ]; then \ | 260 | if [ -d $(DESTDIR)${archlibdir} ]; then \ |
| 270 | (cd $(DESTDIR)${archlibdir} && \ | 261 | (cd $(DESTDIR)${archlibdir} && rm -f ${UTILITIES} ${SCRIPTS}) \ |
| 271 | rm -f ${UTILITIES} ${INSTALLABLES} ${SCRIPTS} ${INSTALLABLE_SCRIPTS}) \ | ||
| 272 | fi | 262 | fi |
| 273 | 263 | ||
| 274 | mostlyclean: | 264 | mostlyclean: |
| @@ -276,7 +266,6 @@ mostlyclean: | |||
| 276 | 266 | ||
| 277 | clean: mostlyclean | 267 | clean: mostlyclean |
| 278 | -rm -f ${EXE_FILES} | 268 | -rm -f ${EXE_FILES} |
| 279 | -rm -f ${STAMP_INST_SCRIPTS} ${STAMP_SCRIPTS} | ||
| 280 | 269 | ||
| 281 | distclean: clean | 270 | distclean: clean |
| 282 | -rm -f TAGS | 271 | -rm -f TAGS |
| @@ -304,19 +293,19 @@ test-distrib${EXEEXT}: ${srcdir}/test-distrib.c | |||
| 304 | $(CC) ${ALL_CFLAGS} -o test-distrib ${srcdir}/test-distrib.c | 293 | $(CC) ${ALL_CFLAGS} -o test-distrib ${srcdir}/test-distrib.c |
| 305 | ./test-distrib ${srcdir}/testfile | 294 | ./test-distrib ${srcdir}/testfile |
| 306 | 295 | ||
| 307 | ../lib/libgnu.a: ../src/config.h | 296 | ../lib/libgnu.a: $(config_h) |
| 308 | cd ../lib && $(MAKE) libgnu.a | 297 | cd ../lib && $(MAKE) libgnu.a |
| 309 | 298 | ||
| 310 | regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h ../src/config.h | 299 | regex.o: $(srcdir)/../src/regex.c $(srcdir)/../src/regex.h $(config_h) |
| 311 | ${CC} -c ${CPP_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER \ | 300 | ${CC} -c ${CPP_CFLAGS} -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER \ |
| 312 | ${srcdir}/../src/regex.c | 301 | ${srcdir}/../src/regex.c |
| 313 | 302 | ||
| 314 | etags${EXEEXT}: ${srcdir}/etags.c regex.o ../src/config.h | 303 | etags${EXEEXT}: ${srcdir}/etags.c regex.o $(config_h) |
| 315 | $(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" \ | 304 | $(CC) ${ALL_CFLAGS} -DEMACS_NAME="\"GNU Emacs\"" \ |
| 316 | -DVERSION="\"${version}\"" ${srcdir}/etags.c \ | 305 | -DVERSION="\"${version}\"" ${srcdir}/etags.c \ |
| 317 | regex.o $(LOADLIBES) -o etags | 306 | regex.o $(LOADLIBES) -o etags |
| 318 | 307 | ||
| 319 | ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h ../src/config.h | 308 | ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h $(config_h) |
| 320 | $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \ | 309 | $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \ |
| 321 | ${srcdir}/ebrowse.c $(LOADLIBES) -o ebrowse | 310 | ${srcdir}/ebrowse.c $(LOADLIBES) -o ebrowse |
| 322 | 311 | ||
| @@ -327,29 +316,30 @@ ctags${EXEEXT}: etags${EXEEXT} | |||
| 327 | -DVERSION="\"${version}\"" ${srcdir}/etags.c \ | 316 | -DVERSION="\"${version}\"" ${srcdir}/etags.c \ |
| 328 | regex.o $(LOADLIBES) -o ctags | 317 | regex.o $(LOADLIBES) -o ctags |
| 329 | 318 | ||
| 330 | profile${EXEEXT}: ${srcdir}/profile.c ../src/config.h | 319 | profile${EXEEXT}: ${srcdir}/profile.c $(config_h) |
| 331 | $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c $(LOADLIBES) -o profile | 320 | $(CC) ${ALL_CFLAGS} ${srcdir}/profile.c \ |
| 321 | $(LOADLIBES) $(LIB_CLOCK_GETTIME) -o profile | ||
| 332 | 322 | ||
| 333 | make-docfile${EXEEXT}: ${srcdir}/make-docfile.c ../src/config.h | 323 | make-docfile${EXEEXT}: ${srcdir}/make-docfile.c $(config_h) |
| 334 | $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) \ | 324 | $(CC) ${ALL_CFLAGS} ${srcdir}/make-docfile.c $(LOADLIBES) \ |
| 335 | -o make-docfile | 325 | -o make-docfile |
| 336 | 326 | ||
| 337 | movemail${EXEEXT}: ${srcdir}/movemail.c pop.o ../src/config.h | 327 | movemail${EXEEXT}: ${srcdir}/movemail.c pop.o $(config_h) |
| 338 | $(CC) ${ALL_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c pop.o \ | 328 | $(CC) ${ALL_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c pop.o \ |
| 339 | $(LOADLIBES) $(LIBS_MOVE) -o movemail | 329 | $(LOADLIBES) $(LIBS_MOVE) -o movemail |
| 340 | 330 | ||
| 341 | pop.o: ${srcdir}/pop.c ${srcdir}/../lib/min-max.h ../src/config.h | 331 | pop.o: ${srcdir}/pop.c ${srcdir}/../lib/min-max.h $(config_h) |
| 342 | $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c | 332 | $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c |
| 343 | 333 | ||
| 344 | emacsclient${EXEEXT}: ${srcdir}/emacsclient.c ../src/config.h | 334 | emacsclient${EXEEXT}: ${srcdir}/emacsclient.c $(config_h) |
| 345 | $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c \ | 335 | $(CC) ${ALL_CFLAGS} ${srcdir}/emacsclient.c \ |
| 346 | -DVERSION="\"${version}\"" \ | 336 | -DVERSION="\"${version}\"" \ |
| 347 | $(LOADLIBES) -o emacsclient | 337 | $(LOADLIBES) -o emacsclient |
| 348 | 338 | ||
| 349 | hexl${EXEEXT}: ${srcdir}/hexl.c ../src/config.h | 339 | hexl${EXEEXT}: ${srcdir}/hexl.c $(config_h) |
| 350 | $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl | 340 | $(CC) ${ALL_CFLAGS} ${srcdir}/hexl.c $(LOADLIBES) -o hexl |
| 351 | 341 | ||
| 352 | update-game-score${EXEEXT}: ${srcdir}/update-game-score.c ../src/config.h | 342 | update-game-score${EXEEXT}: ${srcdir}/update-game-score.c $(config_h) |
| 353 | $(CC) ${ALL_CFLAGS} -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \ | 343 | $(CC) ${ALL_CFLAGS} -DHAVE_SHARED_GAME_DIR="\"$(gamedir)\"" \ |
| 354 | ${srcdir}/update-game-score.c $(LOADLIBES) -o update-game-score | 344 | ${srcdir}/update-game-score.c $(LOADLIBES) -o update-game-score |
| 355 | 345 | ||
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c index 7395f2c8fdd..056ed471fde 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 | ||
| 3 | Copyright (C) 1992-2011 Free Software Foundation, Inc. | 3 | Copyright (C) 1992-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This file is part of GNU Emacs. | 5 | This file is part of GNU Emacs. |
| 6 | 6 | ||
| @@ -43,17 +43,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 43 | 43 | ||
| 44 | #define READ_CHUNK_SIZE (100 * 1024) | 44 | #define READ_CHUNK_SIZE (100 * 1024) |
| 45 | 45 | ||
| 46 | /* The character used as a separator in path lists (like $PATH). */ | ||
| 47 | |||
| 48 | #if defined (__MSDOS__) | 46 | #if defined (__MSDOS__) |
| 49 | #define PATH_LIST_SEPARATOR ';' | ||
| 50 | #define FILENAME_EQ(X,Y) (strcasecmp (X,Y) == 0) | 47 | #define FILENAME_EQ(X,Y) (strcasecmp (X,Y) == 0) |
| 51 | #else | 48 | #else |
| 52 | #if defined (WINDOWSNT) | 49 | #if defined (WINDOWSNT) |
| 53 | #define PATH_LIST_SEPARATOR ';' | ||
| 54 | #define FILENAME_EQ(X,Y) (stricmp (X,Y) == 0) | 50 | #define FILENAME_EQ(X,Y) (stricmp (X,Y) == 0) |
| 55 | #else | 51 | #else |
| 56 | #define PATH_LIST_SEPARATOR ':' | ||
| 57 | #define FILENAME_EQ(X,Y) (streq (X,Y)) | 52 | #define FILENAME_EQ(X,Y) (streq (X,Y)) |
| 58 | #endif | 53 | #endif |
| 59 | #endif | 54 | #endif |
| @@ -463,10 +458,6 @@ static struct member *add_member (struct sym *, char *, int, int, unsigned); | |||
| 463 | static void class_definition (struct sym *, int, int, int); | 458 | static void class_definition (struct sym *, int, int, int); |
| 464 | static char *operator_name (int *); | 459 | static char *operator_name (int *); |
| 465 | static void parse_qualified_param_ident_or_type (char **); | 460 | static void parse_qualified_param_ident_or_type (char **); |
| 466 | static void usage (int) NO_RETURN; | ||
| 467 | static void version (void) NO_RETURN; | ||
| 468 | |||
| 469 | |||
| 470 | 461 | ||
| 471 | /*********************************************************************** | 462 | /*********************************************************************** |
| 472 | Utilities | 463 | Utilities |
| @@ -981,7 +972,7 @@ make_namespace (char *name, struct sym *context) | |||
| 981 | } | 972 | } |
| 982 | 973 | ||
| 983 | 974 | ||
| 984 | /* Find the symbol for namespace NAME. If not found, retrun NULL */ | 975 | /* Find the symbol for namespace NAME. If not found, return NULL */ |
| 985 | 976 | ||
| 986 | static struct sym * | 977 | static struct sym * |
| 987 | check_namespace (char *name, struct sym *context) | 978 | check_namespace (char *name, struct sym *context) |
| @@ -3421,7 +3412,7 @@ add_search_path (char *path_list) | |||
| 3421 | char *start = path_list; | 3412 | char *start = path_list; |
| 3422 | struct search_path *p; | 3413 | struct search_path *p; |
| 3423 | 3414 | ||
| 3424 | while (*path_list && *path_list != PATH_LIST_SEPARATOR) | 3415 | while (*path_list && *path_list != SEPCHAR) |
| 3425 | ++path_list; | 3416 | ++path_list; |
| 3426 | 3417 | ||
| 3427 | p = (struct search_path *) xmalloc (sizeof *p); | 3418 | p = (struct search_path *) xmalloc (sizeof *p); |
| @@ -3438,7 +3429,7 @@ add_search_path (char *path_list) | |||
| 3438 | else | 3429 | else |
| 3439 | search_path = search_path_tail = p; | 3430 | search_path = search_path_tail = p; |
| 3440 | 3431 | ||
| 3441 | while (*path_list == PATH_LIST_SEPARATOR) | 3432 | while (*path_list == SEPCHAR) |
| 3442 | ++path_list; | 3433 | ++path_list; |
| 3443 | } | 3434 | } |
| 3444 | } | 3435 | } |
| @@ -3507,7 +3498,7 @@ Usage: ebrowse [options] {files}\n\ | |||
| 3507 | --version display version info\n\ | 3498 | --version display version info\n\ |
| 3508 | " | 3499 | " |
| 3509 | 3500 | ||
| 3510 | static void | 3501 | static _Noreturn void |
| 3511 | usage (int error) | 3502 | usage (int error) |
| 3512 | { | 3503 | { |
| 3513 | puts (USAGE); | 3504 | puts (USAGE); |
| @@ -3522,11 +3513,10 @@ usage (int error) | |||
| 3522 | # define VERSION "21" | 3513 | # define VERSION "21" |
| 3523 | #endif | 3514 | #endif |
| 3524 | 3515 | ||
| 3525 | static void | 3516 | static _Noreturn void |
| 3526 | version (void) | 3517 | version (void) |
| 3527 | { | 3518 | { |
| 3528 | /* Makes it easier to update automatically. */ | 3519 | char emacs_copyright[] = COPYRIGHT; |
| 3529 | char emacs_copyright[] = "Copyright (C) 2011 Free Software Foundation, Inc."; | ||
| 3530 | 3520 | ||
| 3531 | printf ("ebrowse %s\n", VERSION); | 3521 | printf ("ebrowse %s\n", VERSION); |
| 3532 | puts (emacs_copyright); | 3522 | puts (emacs_copyright); |
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 5e1c2d61b89..021ac6eb247 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c | |||
| @@ -1,5 +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 | Copyright (C) 1986-1987, 1994, 1999-2011 Free Software Foundation, Inc. | 2 | |
| 3 | Copyright (C) 1986-1987, 1994, 1999-2012 Free Software Foundation, Inc. | ||
| 3 | 4 | ||
| 4 | This file is part of GNU Emacs. | 5 | This file is part of GNU Emacs. |
| 5 | 6 | ||
| @@ -21,7 +22,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 21 | 22 | ||
| 22 | #ifdef WINDOWSNT | 23 | #ifdef WINDOWSNT |
| 23 | 24 | ||
| 24 | /* config.h defines these, which disables sockets altogether! */ | 25 | /* ms-w32.h defines these, which disables sockets altogether! */ |
| 25 | # undef _WINSOCKAPI_ | 26 | # undef _WINSOCKAPI_ |
| 26 | # undef _WINSOCK_H | 27 | # undef _WINSOCK_H |
| 27 | 28 | ||
| @@ -43,6 +44,10 @@ char *w32_getenv (char *); | |||
| 43 | 44 | ||
| 44 | #else /* !WINDOWSNT */ | 45 | #else /* !WINDOWSNT */ |
| 45 | 46 | ||
| 47 | # ifdef HAVE_NTGUI | ||
| 48 | # include <windows.h> | ||
| 49 | # endif /* HAVE_NTGUI */ | ||
| 50 | |||
| 46 | # include "syswait.h" | 51 | # include "syswait.h" |
| 47 | 52 | ||
| 48 | # ifdef HAVE_INET_SOCKETS | 53 | # ifdef HAVE_INET_SOCKETS |
| @@ -83,10 +88,7 @@ char *w32_getenv (char *); | |||
| 83 | 88 | ||
| 84 | 89 | ||
| 85 | 90 | ||
| 86 | char *getenv (const char *), *getwd (char *); | 91 | char *getenv (const char *); |
| 87 | #ifdef HAVE_GETCWD | ||
| 88 | char *(getcwd) (char *, size_t); | ||
| 89 | #endif | ||
| 90 | 92 | ||
| 91 | #ifndef VERSION | 93 | #ifndef VERSION |
| 92 | #define VERSION "unspecified" | 94 | #define VERSION "unspecified" |
| @@ -112,12 +114,10 @@ char *(getcwd) (char *, size_t); | |||
| 112 | /* Additional space when allocating buffers for filenames, etc. */ | 114 | /* Additional space when allocating buffers for filenames, etc. */ |
| 113 | #define EXTRA_SPACE 100 | 115 | #define EXTRA_SPACE 100 |
| 114 | 116 | ||
| 115 | /* Use this to suppress gcc's `...may be used before initialized' warnings. */ | 117 | #ifdef min |
| 116 | #ifdef lint | 118 | #undef min |
| 117 | # define IF_LINT(Code) Code | ||
| 118 | #else | ||
| 119 | # define IF_LINT(Code) /* empty */ | ||
| 120 | #endif | 119 | #endif |
| 120 | #define min(x, y) (((x) < (y)) ? (x) : (y)) | ||
| 121 | 121 | ||
| 122 | 122 | ||
| 123 | /* Name used to invoke this program. */ | 123 | /* Name used to invoke this program. */ |
| @@ -141,6 +141,9 @@ int current_frame = 1; | |||
| 141 | /* The display on which Emacs should work. --display. */ | 141 | /* The display on which Emacs should work. --display. */ |
| 142 | const char *display = NULL; | 142 | const char *display = NULL; |
| 143 | 143 | ||
| 144 | /* The alternate display we should try if Emacs does not support display. */ | ||
| 145 | const char *alt_display = NULL; | ||
| 146 | |||
| 144 | /* 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. */ |
| 145 | char *parent_id = NULL; | 148 | char *parent_id = NULL; |
| 146 | 149 | ||
| @@ -152,7 +155,7 @@ int tty = 0; | |||
| 152 | const char *alternate_editor = NULL; | 155 | const char *alternate_editor = NULL; |
| 153 | 156 | ||
| 154 | /* If non-NULL, the filename of the UNIX socket. */ | 157 | /* If non-NULL, the filename of the UNIX socket. */ |
| 155 | char *socket_name = NULL; | 158 | const char *socket_name = NULL; |
| 156 | 159 | ||
| 157 | /* If non-NULL, the filename of the authentication file. */ | 160 | /* If non-NULL, the filename of the authentication file. */ |
| 158 | const char *server_file = NULL; | 161 | const char *server_file = NULL; |
| @@ -164,8 +167,7 @@ int emacs_pid = 0; | |||
| 164 | be used for the new frame */ | 167 | be used for the new frame */ |
| 165 | const char *frame_parameters = NULL; | 168 | const char *frame_parameters = NULL; |
| 166 | 169 | ||
| 167 | static void print_help_and_exit (void) NO_RETURN; | 170 | static _Noreturn void print_help_and_exit (void); |
| 168 | static void fail (void) NO_RETURN; | ||
| 169 | 171 | ||
| 170 | 172 | ||
| 171 | struct option longopts[] = | 173 | struct option longopts[] = |
| @@ -184,9 +186,7 @@ struct option longopts[] = | |||
| 184 | { "socket-name", required_argument, NULL, 's' }, | 186 | { "socket-name", required_argument, NULL, 's' }, |
| 185 | #endif | 187 | #endif |
| 186 | { "server-file", required_argument, NULL, 'f' }, | 188 | { "server-file", required_argument, NULL, 'f' }, |
| 187 | #ifndef WINDOWSNT | ||
| 188 | { "display", required_argument, NULL, 'd' }, | 189 | { "display", required_argument, NULL, 'd' }, |
| 189 | #endif | ||
| 190 | { "parent-id", required_argument, NULL, 'p' }, | 190 | { "parent-id", required_argument, NULL, 'p' }, |
| 191 | { 0, 0, 0, 0 } | 191 | { 0, 0, 0, 0 } |
| 192 | }; | 192 | }; |
| @@ -209,21 +209,6 @@ xmalloc (size_t size) | |||
| 209 | /* From sysdep.c */ | 209 | /* From sysdep.c */ |
| 210 | #if !defined (HAVE_GET_CURRENT_DIR_NAME) || defined (BROKEN_GET_CURRENT_DIR_NAME) | 210 | #if !defined (HAVE_GET_CURRENT_DIR_NAME) || defined (BROKEN_GET_CURRENT_DIR_NAME) |
| 211 | 211 | ||
| 212 | /* From lisp.h */ | ||
| 213 | #ifndef DIRECTORY_SEP | ||
| 214 | #define DIRECTORY_SEP '/' | ||
| 215 | #endif | ||
| 216 | #ifndef IS_DIRECTORY_SEP | ||
| 217 | #define IS_DIRECTORY_SEP(_c_) ((_c_) == DIRECTORY_SEP) | ||
| 218 | #endif | ||
| 219 | #ifndef IS_DEVICE_SEP | ||
| 220 | #ifndef DEVICE_SEP | ||
| 221 | #define IS_DEVICE_SEP(_c_) 0 | ||
| 222 | #else | ||
| 223 | #define IS_DEVICE_SEP(_c_) ((_c_) == DEVICE_SEP) | ||
| 224 | #endif | ||
| 225 | #endif | ||
| 226 | |||
| 227 | char *get_current_dir_name (void); | 212 | char *get_current_dir_name (void); |
| 228 | 213 | ||
| 229 | /* Return the current working directory. Returns NULL on errors. | 214 | /* Return the current working directory. Returns NULL on errors. |
| @@ -235,7 +220,7 @@ get_current_dir_name (void) | |||
| 235 | char *buf; | 220 | char *buf; |
| 236 | const char *pwd; | 221 | const char *pwd; |
| 237 | struct stat dotstat, pwdstat; | 222 | struct stat dotstat, pwdstat; |
| 238 | /* 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 |
| 239 | 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 |
| 240 | parent directory is searchable but not readable. */ | 225 | parent directory is searchable but not readable. */ |
| 241 | if ((pwd = egetenv ("PWD")) != 0 | 226 | if ((pwd = egetenv ("PWD")) != 0 |
| @@ -252,7 +237,6 @@ get_current_dir_name (void) | |||
| 252 | buf = (char *) xmalloc (strlen (pwd) + 1); | 237 | buf = (char *) xmalloc (strlen (pwd) + 1); |
| 253 | strcpy (buf, pwd); | 238 | strcpy (buf, pwd); |
| 254 | } | 239 | } |
| 255 | #ifdef HAVE_GETCWD | ||
| 256 | else | 240 | else |
| 257 | { | 241 | { |
| 258 | size_t buf_size = 1024; | 242 | size_t buf_size = 1024; |
| @@ -279,20 +263,6 @@ get_current_dir_name (void) | |||
| 279 | } | 263 | } |
| 280 | } | 264 | } |
| 281 | } | 265 | } |
| 282 | #else | ||
| 283 | else | ||
| 284 | { | ||
| 285 | /* We need MAXPATHLEN here. */ | ||
| 286 | buf = (char *) xmalloc (MAXPATHLEN + 1); | ||
| 287 | if (getwd (buf) == NULL) | ||
| 288 | { | ||
| 289 | int tmp_errno = errno; | ||
| 290 | free (buf); | ||
| 291 | errno = tmp_errno; | ||
| 292 | return NULL; | ||
| 293 | } | ||
| 294 | } | ||
| 295 | #endif | ||
| 296 | return buf; | 266 | return buf; |
| 297 | } | 267 | } |
| 298 | #endif | 268 | #endif |
| @@ -402,32 +372,6 @@ w32_getenv (char *envvar) | |||
| 402 | return NULL; | 372 | return NULL; |
| 403 | } | 373 | } |
| 404 | 374 | ||
| 405 | void | ||
| 406 | w32_set_user_model_id (void) | ||
| 407 | { | ||
| 408 | HMODULE shell; | ||
| 409 | HRESULT (WINAPI * set_user_model) (wchar_t * id); | ||
| 410 | |||
| 411 | /* On Windows 7 and later, we need to set the user model ID | ||
| 412 | to associate emacsclient launched files with Emacs frames | ||
| 413 | in the UI. */ | ||
| 414 | shell = LoadLibrary ("shell32.dll"); | ||
| 415 | if (shell) | ||
| 416 | { | ||
| 417 | set_user_model | ||
| 418 | = (void *) GetProcAddress (shell, | ||
| 419 | "SetCurrentProcessExplicitAppUserModelID"); | ||
| 420 | /* If the function is defined, then we are running on Windows 7 | ||
| 421 | or newer, and the UI uses this to group related windows | ||
| 422 | together. Since emacs, runemacs, emacsclient are related, we | ||
| 423 | want them grouped even though the executables are different, | ||
| 424 | so we need to set a consistent ID between them. */ | ||
| 425 | if (set_user_model) | ||
| 426 | set_user_model (L"GNU.Emacs"); | ||
| 427 | |||
| 428 | FreeLibrary (shell); | ||
| 429 | } | ||
| 430 | } | ||
| 431 | 375 | ||
| 432 | int | 376 | int |
| 433 | w32_window_app (void) | 377 | w32_window_app (void) |
| @@ -447,19 +391,19 @@ w32_window_app (void) | |||
| 447 | return window_app; | 391 | return window_app; |
| 448 | } | 392 | } |
| 449 | 393 | ||
| 450 | /* | 394 | /* execvp wrapper for Windows. Quotes arguments with embedded spaces. |
| 451 | execvp wrapper for Windows. Quotes arguments with embedded spaces. | ||
| 452 | 395 | ||
| 453 | This is necessary due to the broken implementation of exec* routines in | 396 | This is necessary due to the broken implementation of exec* routines in |
| 454 | the Microsoft libraries: they concatenate the arguments together without | 397 | the Microsoft libraries: they concatenate the arguments together without |
| 455 | quoting special characters, and pass the result to CreateProcess, with | 398 | quoting special characters, and pass the result to CreateProcess, with |
| 456 | predictably bad results. By contrast, POSIX execvp passes the arguments | 399 | predictably bad results. By contrast, POSIX execvp passes the arguments |
| 457 | directly into the argv array of the child process. | 400 | directly into the argv array of the child process. */ |
| 458 | */ | 401 | |
| 459 | int | 402 | int |
| 460 | w32_execvp (const char *path, char **argv) | 403 | w32_execvp (const char *path, char **argv) |
| 461 | { | 404 | { |
| 462 | int i; | 405 | int i; |
| 406 | extern int execvp (const char*, char **); | ||
| 463 | 407 | ||
| 464 | /* Required to allow a .BAT script as alternate editor. */ | 408 | /* Required to allow a .BAT script as alternate editor. */ |
| 465 | argv[0] = (char *) alternate_editor; | 409 | argv[0] = (char *) alternate_editor; |
| @@ -622,48 +566,52 @@ decode_options (int argc, char **argv) | |||
| 622 | 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 |
| 623 | default, but this changed the default behavior and is sometimes | 567 | default, but this changed the default behavior and is sometimes |
| 624 | inconvenient. So we force users to use "--display $DISPLAY" if | 568 | inconvenient. So we force users to use "--display $DISPLAY" if |
| 625 | 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). */ | ||
| 626 | if (!current_frame && !tty && !display) | 575 | if (!current_frame && !tty && !display) |
| 627 | { | 576 | { |
| 628 | display = egetenv ("DISPLAY"); | 577 | /* Set these here so we use a default_display only when the user |
| 629 | #ifdef NS_IMPL_COCOA | 578 | didn't give us an explicit display. */ |
| 630 | /* Under Cocoa, we don't really use displays the same way as in X, | 579 | #if defined (NS_IMPL_COCOA) |
| 631 | so provide a dummy. */ | 580 | alt_display = "ns"; |
| 632 | if (!display || strlen (display) == 0) | 581 | #elif defined (HAVE_NTGUI) |
| 633 | display = "ns"; | 582 | alt_display = "w32"; |
| 634 | #endif | 583 | #endif |
| 584 | |||
| 585 | display = egetenv ("DISPLAY"); | ||
| 586 | } | ||
| 587 | |||
| 588 | if (!display) | ||
| 589 | { | ||
| 590 | display = alt_display; | ||
| 591 | alt_display = NULL; | ||
| 635 | } | 592 | } |
| 636 | 593 | ||
| 637 | /* A null-string display is invalid. */ | 594 | /* A null-string display is invalid. */ |
| 638 | if (display && strlen (display) == 0) | 595 | if (display && strlen (display) == 0) |
| 639 | display = NULL; | 596 | display = NULL; |
| 640 | 597 | ||
| 641 | #ifdef WINDOWSNT | ||
| 642 | /* Emacs on Windows does not support GUI and console frames in the same | ||
| 643 | instance. So, it makes sense to treat the -t and -c options as | ||
| 644 | equivalent, and open a new frame regardless of whether the running | ||
| 645 | instance is GUI or console. Ideally, we would only set tty = 1 when | ||
| 646 | the instance is running in a console, but alas we don't know that. | ||
| 647 | The simplest workaround is to always ask for a tty frame, and let | ||
| 648 | server.el check whether it makes sense. */ | ||
| 649 | if (tty || !current_frame) | ||
| 650 | { | ||
| 651 | display = (const char *) ttyname; | ||
| 652 | current_frame = 0; | ||
| 653 | tty = 1; | ||
| 654 | } | ||
| 655 | #endif | ||
| 656 | |||
| 657 | /* If no display is available, new frames are tty frames. */ | 598 | /* If no display is available, new frames are tty frames. */ |
| 658 | if (!current_frame && !display) | 599 | if (!current_frame && !display) |
| 659 | tty = 1; | 600 | tty = 1; |
| 660 | 601 | ||
| 661 | /* --no-wait implies --current-frame on ttys when there are file | ||
| 662 | arguments or expressions given. */ | ||
| 663 | if (nowait && tty && argc - optind > 0) | ||
| 664 | current_frame = 1; | ||
| 665 | |||
| 666 | #ifdef WINDOWSNT | 602 | #ifdef WINDOWSNT |
| 603 | /* Emacs on Windows does not support graphical and text terminal | ||
| 604 | frames in the same instance. So, treat the -t and -c options as | ||
| 605 | equivalent, and open a new frame on the server's terminal. | ||
| 606 | Ideally, we would only set tty = 1 when the serve is running in a | ||
| 607 | console, but alas we don't know that. As a workaround, always | ||
| 608 | ask for a tty frame, and let server.el figure it out. */ | ||
| 609 | if (!current_frame) | ||
| 610 | { | ||
| 611 | display = NULL; | ||
| 612 | tty = 1; | ||
| 613 | } | ||
| 614 | |||
| 667 | if (alternate_editor && alternate_editor[0] == '\0') | 615 | if (alternate_editor && alternate_editor[0] == '\0') |
| 668 | { | 616 | { |
| 669 | message (TRUE, "--alternate-editor argument or ALTERNATE_EDITOR variable cannot be\n\ | 617 | message (TRUE, "--alternate-editor argument or ALTERNATE_EDITOR variable cannot be\n\ |
| @@ -674,7 +622,7 @@ an empty string"); | |||
| 674 | } | 622 | } |
| 675 | 623 | ||
| 676 | 624 | ||
| 677 | static void | 625 | static _Noreturn void |
| 678 | print_help_and_exit (void) | 626 | print_help_and_exit (void) |
| 679 | { | 627 | { |
| 680 | /* Spaces and tabs are significant in this message; they're chosen so the | 628 | /* Spaces and tabs are significant in this message; they're chosen so the |
| @@ -717,12 +665,11 @@ Report bugs with M-x report-emacs-bug.\n", progname); | |||
| 717 | exit (EXIT_SUCCESS); | 665 | exit (EXIT_SUCCESS); |
| 718 | } | 666 | } |
| 719 | 667 | ||
| 720 | /* | 668 | /* Try to run a different command, or --if no alternate editor is |
| 721 | Try to run a different command, or --if no alternate editor is | 669 | defined-- exit with an errorcode. |
| 722 | defined-- exit with an errorcode. | 670 | Uses argv, but gets it from the global variable main_argv. */ |
| 723 | Uses argv, but gets it from the global variable main_argv. | 671 | |
| 724 | */ | 672 | static _Noreturn void |
| 725 | static void | ||
| 726 | fail (void) | 673 | fail (void) |
| 727 | { | 674 | { |
| 728 | if (alternate_editor) | 675 | if (alternate_editor) |
| @@ -755,16 +702,15 @@ main (int argc, char **argv) | |||
| 755 | #define AUTH_KEY_LENGTH 64 | 702 | #define AUTH_KEY_LENGTH 64 |
| 756 | #define SEND_BUFFER_SIZE 4096 | 703 | #define SEND_BUFFER_SIZE 4096 |
| 757 | 704 | ||
| 758 | extern char *strerror (int); | ||
| 759 | |||
| 760 | /* Buffer to accumulate data to send in TCP connections. */ | 705 | /* Buffer to accumulate data to send in TCP connections. */ |
| 761 | char send_buffer[SEND_BUFFER_SIZE + 1]; | 706 | char send_buffer[SEND_BUFFER_SIZE + 1]; |
| 762 | int sblen = 0; /* Fill pointer for the send buffer. */ | 707 | int sblen = 0; /* Fill pointer for the send buffer. */ |
| 763 | /* Socket used to communicate with the Emacs server process. */ | 708 | /* Socket used to communicate with the Emacs server process. */ |
| 764 | HSOCKET emacs_socket = 0; | 709 | HSOCKET emacs_socket = 0; |
| 765 | 710 | ||
| 766 | /* On Windows, the socket library was historically separate from the standard | 711 | /* On Windows, the socket library was historically separate from the |
| 767 | C library, so errors are handled differently. */ | 712 | standard C library, so errors are handled differently. */ |
| 713 | |||
| 768 | static void | 714 | static void |
| 769 | sock_err_message (const char *function_name) | 715 | sock_err_message (const char *function_name) |
| 770 | { | 716 | { |
| @@ -792,33 +738,35 @@ sock_err_message (const char *function_name) | |||
| 792 | static void | 738 | static void |
| 793 | send_to_emacs (HSOCKET s, const char *data) | 739 | send_to_emacs (HSOCKET s, const char *data) |
| 794 | { | 740 | { |
| 795 | while (data) | 741 | size_t dlen; |
| 742 | |||
| 743 | if (!data) | ||
| 744 | return; | ||
| 745 | |||
| 746 | dlen = strlen (data); | ||
| 747 | while (*data) | ||
| 796 | { | 748 | { |
| 797 | size_t dlen = strlen (data); | 749 | size_t part = min (dlen, SEND_BUFFER_SIZE - sblen); |
| 798 | if (dlen + sblen >= SEND_BUFFER_SIZE) | 750 | memcpy (&send_buffer[sblen], data, part); |
| 799 | { | 751 | data += part; |
| 800 | int part = SEND_BUFFER_SIZE - sblen; | 752 | sblen += part; |
| 801 | strncpy (&send_buffer[sblen], data, part); | ||
| 802 | data += part; | ||
| 803 | sblen = SEND_BUFFER_SIZE; | ||
| 804 | } | ||
| 805 | else if (dlen) | ||
| 806 | { | ||
| 807 | strcpy (&send_buffer[sblen], data); | ||
| 808 | data = NULL; | ||
| 809 | sblen += dlen; | ||
| 810 | } | ||
| 811 | else | ||
| 812 | break; | ||
| 813 | 753 | ||
| 814 | if (sblen == SEND_BUFFER_SIZE | 754 | if (sblen == SEND_BUFFER_SIZE |
| 815 | || (sblen > 0 && send_buffer[sblen-1] == '\n')) | 755 | || (sblen > 0 && send_buffer[sblen-1] == '\n')) |
| 816 | { | 756 | { |
| 817 | int sent = send (s, send_buffer, sblen, 0); | 757 | int sent = send (s, send_buffer, sblen, 0); |
| 758 | if (sent < 0) | ||
| 759 | { | ||
| 760 | message (TRUE, "%s: failed to send %d bytes to socket: %s\n", | ||
| 761 | progname, sblen, strerror (errno)); | ||
| 762 | fail (); | ||
| 763 | } | ||
| 818 | if (sent != sblen) | 764 | if (sent != sblen) |
| 819 | strcpy (send_buffer, &send_buffer[sent]); | 765 | memmove (send_buffer, &send_buffer[sent], sblen - sent); |
| 820 | sblen -= sent; | 766 | sblen -= sent; |
| 821 | } | 767 | } |
| 768 | |||
| 769 | dlen -= part; | ||
| 822 | } | 770 | } |
| 823 | } | 771 | } |
| 824 | 772 | ||
| @@ -867,7 +815,7 @@ quote_argument (HSOCKET s, const char *str) | |||
| 867 | 815 | ||
| 868 | 816 | ||
| 869 | /* The inverse of quote_argument. Removes quoting in string STR by | 817 | /* The inverse of quote_argument. Removes quoting in string STR by |
| 870 | modifying the string in place. Returns STR. */ | 818 | modifying the string in place. Returns STR. */ |
| 871 | 819 | ||
| 872 | static char * | 820 | static char * |
| 873 | unquote_argument (char *str) | 821 | unquote_argument (char *str) |
| @@ -950,41 +898,41 @@ initialize_sockets (void) | |||
| 950 | #endif /* WINDOWSNT */ | 898 | #endif /* WINDOWSNT */ |
| 951 | 899 | ||
| 952 | 900 | ||
| 953 | /* | 901 | /* Read the information needed to set up a TCP comm channel with |
| 954 | * Read the information needed to set up a TCP comm channel with | 902 | the Emacs server: host, port, and authentication string. */ |
| 955 | * the Emacs server: host, port, and authentication string. | 903 | |
| 956 | */ | ||
| 957 | static int | 904 | static int |
| 958 | get_server_config (struct sockaddr_in *server, char *authentication) | 905 | get_server_config (const char *config_file, struct sockaddr_in *server, |
| 906 | char *authentication) | ||
| 959 | { | 907 | { |
| 960 | char dotted[32]; | 908 | char dotted[32]; |
| 961 | char *port; | 909 | char *port; |
| 962 | FILE *config = NULL; | 910 | FILE *config = NULL; |
| 963 | 911 | ||
| 964 | if (file_name_absolute_p (server_file)) | 912 | if (file_name_absolute_p (config_file)) |
| 965 | config = fopen (server_file, "rb"); | 913 | config = fopen (config_file, "rb"); |
| 966 | else | 914 | else |
| 967 | { | 915 | { |
| 968 | const char *home = egetenv ("HOME"); | 916 | const char *home = egetenv ("HOME"); |
| 969 | 917 | ||
| 970 | if (home) | 918 | if (home) |
| 971 | { | 919 | { |
| 972 | char *path = xmalloc (strlen (home) + strlen (server_file) | 920 | char *path = xmalloc (strlen (home) + strlen (config_file) |
| 973 | + EXTRA_SPACE); | 921 | + EXTRA_SPACE); |
| 974 | strcpy (path, home); | 922 | strcpy (path, home); |
| 975 | strcat (path, "/.emacs.d/server/"); | 923 | strcat (path, "/.emacs.d/server/"); |
| 976 | strcat (path, server_file); | 924 | strcat (path, config_file); |
| 977 | config = fopen (path, "rb"); | 925 | config = fopen (path, "rb"); |
| 978 | free (path); | 926 | free (path); |
| 979 | } | 927 | } |
| 980 | #ifdef WINDOWSNT | 928 | #ifdef WINDOWSNT |
| 981 | if (!config && (home = egetenv ("APPDATA"))) | 929 | if (!config && (home = egetenv ("APPDATA"))) |
| 982 | { | 930 | { |
| 983 | char *path = xmalloc (strlen (home) + strlen (server_file) | 931 | char *path = xmalloc (strlen (home) + strlen (config_file) |
| 984 | + EXTRA_SPACE); | 932 | + EXTRA_SPACE); |
| 985 | strcpy (path, home); | 933 | strcpy (path, home); |
| 986 | strcat (path, "/.emacs.d/server/"); | 934 | strcat (path, "/.emacs.d/server/"); |
| 987 | strcat (path, server_file); | 935 | strcat (path, config_file); |
| 988 | config = fopen (path, "rb"); | 936 | config = fopen (path, "rb"); |
| 989 | free (path); | 937 | free (path); |
| 990 | } | 938 | } |
| @@ -1019,32 +967,28 @@ get_server_config (struct sockaddr_in *server, char *authentication) | |||
| 1019 | } | 967 | } |
| 1020 | 968 | ||
| 1021 | static HSOCKET | 969 | static HSOCKET |
| 1022 | set_tcp_socket (void) | 970 | set_tcp_socket (const char *local_server_file) |
| 1023 | { | 971 | { |
| 1024 | HSOCKET s; | 972 | HSOCKET s; |
| 1025 | struct sockaddr_in server; | 973 | struct sockaddr_in server; |
| 1026 | struct linger l_arg = {1, 1}; | 974 | struct linger l_arg = {1, 1}; |
| 1027 | char auth_string[AUTH_KEY_LENGTH + 1]; | 975 | char auth_string[AUTH_KEY_LENGTH + 1]; |
| 1028 | 976 | ||
| 1029 | if (! get_server_config (&server, auth_string)) | 977 | if (! get_server_config (local_server_file, &server, auth_string)) |
| 1030 | return INVALID_SOCKET; | 978 | return INVALID_SOCKET; |
| 1031 | 979 | ||
| 1032 | if (server.sin_addr.s_addr != inet_addr ("127.0.0.1") && !quiet) | 980 | if (server.sin_addr.s_addr != inet_addr ("127.0.0.1") && !quiet) |
| 1033 | message (FALSE, "%s: connected to remote socket at %s\n", | 981 | message (FALSE, "%s: connected to remote socket at %s\n", |
| 1034 | progname, inet_ntoa (server.sin_addr)); | 982 | progname, inet_ntoa (server.sin_addr)); |
| 1035 | 983 | ||
| 1036 | /* | 984 | /* Open up an AF_INET socket. */ |
| 1037 | * Open up an AF_INET socket | ||
| 1038 | */ | ||
| 1039 | if ((s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) | 985 | if ((s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) |
| 1040 | { | 986 | { |
| 1041 | sock_err_message ("socket"); | 987 | sock_err_message ("socket"); |
| 1042 | return INVALID_SOCKET; | 988 | return INVALID_SOCKET; |
| 1043 | } | 989 | } |
| 1044 | 990 | ||
| 1045 | /* | 991 | /* Set up the socket. */ |
| 1046 | * Set up the socket | ||
| 1047 | */ | ||
| 1048 | if (connect (s, (struct sockaddr *) &server, sizeof server) < 0) | 992 | if (connect (s, (struct sockaddr *) &server, sizeof server) < 0) |
| 1049 | { | 993 | { |
| 1050 | sock_err_message ("connect"); | 994 | sock_err_message ("connect"); |
| @@ -1053,9 +997,7 @@ set_tcp_socket (void) | |||
| 1053 | 997 | ||
| 1054 | setsockopt (s, SOL_SOCKET, SO_LINGER, (char *) &l_arg, sizeof l_arg); | 998 | setsockopt (s, SOL_SOCKET, SO_LINGER, (char *) &l_arg, sizeof l_arg); |
| 1055 | 999 | ||
| 1056 | /* | 1000 | /* Send the authentication. */ |
| 1057 | * Send the authentication | ||
| 1058 | */ | ||
| 1059 | auth_string[AUTH_KEY_LENGTH] = '\0'; | 1001 | auth_string[AUTH_KEY_LENGTH] = '\0'; |
| 1060 | 1002 | ||
| 1061 | send_to_emacs (s, "-auth "); | 1003 | send_to_emacs (s, "-auth "); |
| @@ -1178,7 +1120,7 @@ handle_sigcont (int signalnum) | |||
| 1178 | else | 1120 | else |
| 1179 | { | 1121 | { |
| 1180 | /* We are in the background; cancel the continue. */ | 1122 | /* We are in the background; cancel the continue. */ |
| 1181 | kill (getpid (), SIGSTOP); | 1123 | raise (SIGSTOP); |
| 1182 | } | 1124 | } |
| 1183 | 1125 | ||
| 1184 | signal (signalnum, handle_sigcont); | 1126 | signal (signalnum, handle_sigcont); |
| @@ -1189,7 +1131,7 @@ handle_sigcont (int signalnum) | |||
| 1189 | going to sleep. Normally the suspend is initiated by Emacs via | 1131 | going to sleep. Normally the suspend is initiated by Emacs via |
| 1190 | server-handle-suspend-tty, but if the server gets out of sync with | 1132 | server-handle-suspend-tty, but if the server gets out of sync with |
| 1191 | reality, we may get a SIGTSTP on C-z. Handling this signal and | 1133 | reality, we may get a SIGTSTP on C-z. Handling this signal and |
| 1192 | notifying Emacs about it should get things under control again. */ | 1134 | notifying Emacs about it should get things under control again. */ |
| 1193 | 1135 | ||
| 1194 | static void | 1136 | static void |
| 1195 | handle_sigtstp (int signalnum) | 1137 | handle_sigtstp (int signalnum) |
| @@ -1205,7 +1147,7 @@ handle_sigtstp (int signalnum) | |||
| 1205 | sigprocmask (SIG_BLOCK, NULL, &set); | 1147 | sigprocmask (SIG_BLOCK, NULL, &set); |
| 1206 | sigdelset (&set, signalnum); | 1148 | sigdelset (&set, signalnum); |
| 1207 | signal (signalnum, SIG_DFL); | 1149 | signal (signalnum, SIG_DFL); |
| 1208 | kill (getpid (), signalnum); | 1150 | raise (signalnum); |
| 1209 | sigprocmask (SIG_SETMASK, &set, NULL); /* Let's the above signal through. */ | 1151 | sigprocmask (SIG_SETMASK, &set, NULL); /* Let's the above signal through. */ |
| 1210 | signal (signalnum, handle_sigtstp); | 1152 | signal (signalnum, handle_sigtstp); |
| 1211 | 1153 | ||
| @@ -1236,15 +1178,12 @@ init_signals (void) | |||
| 1236 | 1178 | ||
| 1237 | 1179 | ||
| 1238 | static HSOCKET | 1180 | static HSOCKET |
| 1239 | set_local_socket (void) | 1181 | set_local_socket (const char *local_socket_name) |
| 1240 | { | 1182 | { |
| 1241 | HSOCKET s; | 1183 | HSOCKET s; |
| 1242 | struct sockaddr_un server; | 1184 | struct sockaddr_un server; |
| 1243 | 1185 | ||
| 1244 | /* | 1186 | /* Open up an AF_UNIX socket in this person's home directory. */ |
| 1245 | * Open up an AF_UNIX socket in this person's home directory | ||
| 1246 | */ | ||
| 1247 | |||
| 1248 | if ((s = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) | 1187 | if ((s = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) |
| 1249 | { | 1188 | { |
| 1250 | message (TRUE, "%s: socket: %s\n", progname, strerror (errno)); | 1189 | message (TRUE, "%s: socket: %s\n", progname, strerror (errno)); |
| @@ -1254,27 +1193,20 @@ set_local_socket (void) | |||
| 1254 | server.sun_family = AF_UNIX; | 1193 | server.sun_family = AF_UNIX; |
| 1255 | 1194 | ||
| 1256 | { | 1195 | { |
| 1257 | int sock_status = 0; | 1196 | int sock_status; |
| 1258 | int default_sock = !socket_name; | 1197 | int use_tmpdir = 0; |
| 1259 | int saved_errno = 0; | 1198 | int saved_errno; |
| 1260 | const char *server_name = "server"; | 1199 | const char *server_name = local_socket_name; |
| 1261 | const char *tmpdir IF_LINT ( = NULL); | 1200 | const char *tmpdir IF_LINT ( = NULL); |
| 1262 | char *tmpdir_storage = NULL; | 1201 | char *tmpdir_storage = NULL; |
| 1263 | char *socket_name_storage = NULL; | 1202 | char *socket_name_storage = NULL; |
| 1264 | 1203 | ||
| 1265 | if (socket_name && !strchr (socket_name, '/') | 1204 | if (!strchr (local_socket_name, '/') && !strchr (local_socket_name, '\\')) |
| 1266 | && !strchr (socket_name, '\\')) | ||
| 1267 | { | 1205 | { |
| 1268 | /* socket_name is a file name component. */ | 1206 | /* socket_name is a file name component. */ |
| 1269 | server_name = socket_name; | ||
| 1270 | socket_name = NULL; | ||
| 1271 | default_sock = 1; /* Try both UIDs. */ | ||
| 1272 | } | ||
| 1273 | |||
| 1274 | if (default_sock) | ||
| 1275 | { | ||
| 1276 | long uid = geteuid (); | 1207 | long uid = geteuid (); |
| 1277 | ptrdiff_t tmpdirlen; | 1208 | ptrdiff_t tmpdirlen; |
| 1209 | use_tmpdir = 1; | ||
| 1278 | tmpdir = egetenv ("TMPDIR"); | 1210 | tmpdir = egetenv ("TMPDIR"); |
| 1279 | if (!tmpdir) | 1211 | if (!tmpdir) |
| 1280 | { | 1212 | { |
| @@ -1286,33 +1218,34 @@ set_local_socket (void) | |||
| 1286 | if (n > 0) | 1218 | if (n > 0) |
| 1287 | { | 1219 | { |
| 1288 | tmpdir = tmpdir_storage = xmalloc (n); | 1220 | tmpdir = tmpdir_storage = xmalloc (n); |
| 1289 | confstr (_CS_DARWIN_USER_TEMP_DIR, tmpdir, n); | 1221 | confstr (_CS_DARWIN_USER_TEMP_DIR, tmpdir_storage, n); |
| 1290 | } | 1222 | } |
| 1291 | else | 1223 | else |
| 1292 | #endif | 1224 | #endif |
| 1293 | tmpdir = "/tmp"; | 1225 | tmpdir = "/tmp"; |
| 1294 | } | 1226 | } |
| 1295 | tmpdirlen = strlen (tmpdir); | 1227 | tmpdirlen = strlen (tmpdir); |
| 1296 | socket_name = socket_name_storage = | 1228 | socket_name_storage = |
| 1297 | xmalloc (tmpdirlen + strlen (server_name) + EXTRA_SPACE); | 1229 | xmalloc (tmpdirlen + strlen (server_name) + EXTRA_SPACE); |
| 1298 | strcpy (socket_name, tmpdir); | 1230 | strcpy (socket_name_storage, tmpdir); |
| 1299 | sprintf (socket_name + tmpdirlen, "/emacs%ld/", uid); | 1231 | sprintf (socket_name_storage + tmpdirlen, "/emacs%ld/", uid); |
| 1300 | strcat (socket_name + tmpdirlen, server_name); | 1232 | strcat (socket_name_storage + tmpdirlen, server_name); |
| 1233 | local_socket_name = socket_name_storage; | ||
| 1301 | } | 1234 | } |
| 1302 | 1235 | ||
| 1303 | if (strlen (socket_name) < sizeof (server.sun_path)) | 1236 | if (strlen (local_socket_name) < sizeof (server.sun_path)) |
| 1304 | strcpy (server.sun_path, socket_name); | 1237 | strcpy (server.sun_path, local_socket_name); |
| 1305 | else | 1238 | else |
| 1306 | { | 1239 | { |
| 1307 | message (TRUE, "%s: socket-name %s too long\n", | 1240 | message (TRUE, "%s: socket-name %s too long\n", |
| 1308 | progname, socket_name); | 1241 | progname, local_socket_name); |
| 1309 | fail (); | 1242 | fail (); |
| 1310 | } | 1243 | } |
| 1311 | 1244 | ||
| 1312 | /* See if the socket exists, and if it's owned by us. */ | 1245 | /* See if the socket exists, and if it's owned by us. */ |
| 1313 | sock_status = socket_status (server.sun_path); | 1246 | sock_status = socket_status (server.sun_path); |
| 1314 | saved_errno = errno; | 1247 | saved_errno = errno; |
| 1315 | if (sock_status && default_sock) | 1248 | if (sock_status && use_tmpdir) |
| 1316 | { | 1249 | { |
| 1317 | /* Failing that, see if LOGNAME or USER exist and differ from | 1250 | /* Failing that, see if LOGNAME or USER exist and differ from |
| 1318 | our euid. If so, look for a socket based on the UID | 1251 | our euid. If so, look for a socket based on the UID |
| @@ -1333,21 +1266,21 @@ set_local_socket (void) | |||
| 1333 | /* We're running under su, apparently. */ | 1266 | /* We're running under su, apparently. */ |
| 1334 | long uid = pw->pw_uid; | 1267 | long uid = pw->pw_uid; |
| 1335 | ptrdiff_t tmpdirlen = strlen (tmpdir); | 1268 | ptrdiff_t tmpdirlen = strlen (tmpdir); |
| 1336 | socket_name = xmalloc (tmpdirlen + strlen (server_name) | 1269 | char *user_socket_name |
| 1337 | + EXTRA_SPACE); | 1270 | = xmalloc (tmpdirlen + strlen (server_name) + EXTRA_SPACE); |
| 1338 | strcpy (socket_name, tmpdir); | 1271 | strcpy (user_socket_name, tmpdir); |
| 1339 | sprintf (socket_name + tmpdirlen, "/emacs%ld/", uid); | 1272 | sprintf (user_socket_name + tmpdirlen, "/emacs%ld/", uid); |
| 1340 | strcat (socket_name + tmpdirlen, server_name); | 1273 | strcat (user_socket_name + tmpdirlen, server_name); |
| 1341 | 1274 | ||
| 1342 | if (strlen (socket_name) < sizeof (server.sun_path)) | 1275 | if (strlen (user_socket_name) < sizeof (server.sun_path)) |
| 1343 | strcpy (server.sun_path, socket_name); | 1276 | strcpy (server.sun_path, user_socket_name); |
| 1344 | else | 1277 | else |
| 1345 | { | 1278 | { |
| 1346 | message (TRUE, "%s: socket-name %s too long\n", | 1279 | message (TRUE, "%s: socket-name %s too long\n", |
| 1347 | progname, socket_name); | 1280 | progname, user_socket_name); |
| 1348 | exit (EXIT_FAILURE); | 1281 | exit (EXIT_FAILURE); |
| 1349 | } | 1282 | } |
| 1350 | free (socket_name); | 1283 | free (user_socket_name); |
| 1351 | 1284 | ||
| 1352 | sock_status = socket_status (server.sun_path); | 1285 | sock_status = socket_status (server.sun_path); |
| 1353 | saved_errno = errno; | 1286 | saved_errno = errno; |
| @@ -1401,6 +1334,7 @@ static HSOCKET | |||
| 1401 | set_socket (int no_exit_if_error) | 1334 | set_socket (int no_exit_if_error) |
| 1402 | { | 1335 | { |
| 1403 | HSOCKET s; | 1336 | HSOCKET s; |
| 1337 | const char *local_server_file = server_file; | ||
| 1404 | 1338 | ||
| 1405 | INITIALIZE (); | 1339 | INITIALIZE (); |
| 1406 | 1340 | ||
| @@ -1408,7 +1342,7 @@ set_socket (int no_exit_if_error) | |||
| 1408 | /* Explicit --socket-name argument. */ | 1342 | /* Explicit --socket-name argument. */ |
| 1409 | if (socket_name) | 1343 | if (socket_name) |
| 1410 | { | 1344 | { |
| 1411 | s = set_local_socket (); | 1345 | s = set_local_socket (socket_name); |
| 1412 | if ((s != INVALID_SOCKET) || no_exit_if_error) | 1346 | if ((s != INVALID_SOCKET) || no_exit_if_error) |
| 1413 | return s; | 1347 | return s; |
| 1414 | message (TRUE, "%s: error accessing socket \"%s\"\n", | 1348 | message (TRUE, "%s: error accessing socket \"%s\"\n", |
| @@ -1418,30 +1352,29 @@ set_socket (int no_exit_if_error) | |||
| 1418 | #endif | 1352 | #endif |
| 1419 | 1353 | ||
| 1420 | /* Explicit --server-file arg or EMACS_SERVER_FILE variable. */ | 1354 | /* Explicit --server-file arg or EMACS_SERVER_FILE variable. */ |
| 1421 | if (!server_file) | 1355 | if (!local_server_file) |
| 1422 | server_file = egetenv ("EMACS_SERVER_FILE"); | 1356 | local_server_file = egetenv ("EMACS_SERVER_FILE"); |
| 1423 | 1357 | ||
| 1424 | if (server_file) | 1358 | if (local_server_file) |
| 1425 | { | 1359 | { |
| 1426 | s = set_tcp_socket (); | 1360 | s = set_tcp_socket (local_server_file); |
| 1427 | if ((s != INVALID_SOCKET) || no_exit_if_error) | 1361 | if ((s != INVALID_SOCKET) || no_exit_if_error) |
| 1428 | return s; | 1362 | return s; |
| 1429 | 1363 | ||
| 1430 | message (TRUE, "%s: error accessing server file \"%s\"\n", | 1364 | message (TRUE, "%s: error accessing server file \"%s\"\n", |
| 1431 | progname, server_file); | 1365 | progname, local_server_file); |
| 1432 | exit (EXIT_FAILURE); | 1366 | exit (EXIT_FAILURE); |
| 1433 | } | 1367 | } |
| 1434 | 1368 | ||
| 1435 | #ifndef NO_SOCKETS_IN_FILE_SYSTEM | 1369 | #ifndef NO_SOCKETS_IN_FILE_SYSTEM |
| 1436 | /* Implicit local socket. */ | 1370 | /* Implicit local socket. */ |
| 1437 | s = set_local_socket (); | 1371 | s = set_local_socket ("server"); |
| 1438 | if (s != INVALID_SOCKET) | 1372 | if (s != INVALID_SOCKET) |
| 1439 | return s; | 1373 | return s; |
| 1440 | #endif | 1374 | #endif |
| 1441 | 1375 | ||
| 1442 | /* Implicit server file. */ | 1376 | /* Implicit server file. */ |
| 1443 | server_file = "server"; | 1377 | s = set_tcp_socket ("server"); |
| 1444 | s = set_tcp_socket (); | ||
| 1445 | if ((s != INVALID_SOCKET) || no_exit_if_error) | 1378 | if ((s != INVALID_SOCKET) || no_exit_if_error) |
| 1446 | return s; | 1379 | return s; |
| 1447 | 1380 | ||
| @@ -1456,10 +1389,37 @@ set_socket (int no_exit_if_error) | |||
| 1456 | exit (EXIT_FAILURE); | 1389 | exit (EXIT_FAILURE); |
| 1457 | } | 1390 | } |
| 1458 | 1391 | ||
| 1459 | #ifdef WINDOWSNT | 1392 | #ifdef HAVE_NTGUI |
| 1460 | FARPROC set_fg; /* Pointer to AllowSetForegroundWindow. */ | 1393 | FARPROC set_fg; /* Pointer to AllowSetForegroundWindow. */ |
| 1461 | FARPROC get_wc; /* Pointer to RealGetWindowClassA. */ | 1394 | FARPROC get_wc; /* Pointer to RealGetWindowClassA. */ |
| 1462 | 1395 | ||
| 1396 | void | ||
| 1397 | w32_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 | |||
| 1463 | BOOL CALLBACK | 1423 | BOOL CALLBACK |
| 1464 | w32_find_emacs_process (HWND hWnd, LPARAM lParam) | 1424 | w32_find_emacs_process (HWND hWnd, LPARAM lParam) |
| 1465 | { | 1425 | { |
| @@ -1484,10 +1444,9 @@ w32_find_emacs_process (HWND hWnd, LPARAM lParam) | |||
| 1484 | return FALSE; | 1444 | return FALSE; |
| 1485 | } | 1445 | } |
| 1486 | 1446 | ||
| 1487 | /* | 1447 | /* Search for a window of class "Emacs" and owned by a process with |
| 1488 | * Search for a window of class "Emacs" and owned by a process with | 1448 | process id = emacs_pid. If found, allow it to grab the focus. */ |
| 1489 | * process id = emacs_pid. If found, allow it to grab the focus. | 1449 | |
| 1490 | */ | ||
| 1491 | void | 1450 | void |
| 1492 | w32_give_focus (void) | 1451 | w32_give_focus (void) |
| 1493 | { | 1452 | { |
| @@ -1509,7 +1468,7 @@ w32_give_focus (void) | |||
| 1509 | && (get_wc = GetProcAddress (user32, "RealGetWindowClassA"))) | 1468 | && (get_wc = GetProcAddress (user32, "RealGetWindowClassA"))) |
| 1510 | EnumWindows (w32_find_emacs_process, (LPARAM) 0); | 1469 | EnumWindows (w32_find_emacs_process, (LPARAM) 0); |
| 1511 | } | 1470 | } |
| 1512 | #endif | 1471 | #endif /* HAVE_NTGUI */ |
| 1513 | 1472 | ||
| 1514 | /* Start the emacs daemon and try to connect to it. */ | 1473 | /* Start the emacs daemon and try to connect to it. */ |
| 1515 | 1474 | ||
| @@ -1573,19 +1532,19 @@ main (int argc, char **argv) | |||
| 1573 | int rl = 0, needlf = 0; | 1532 | int rl = 0, needlf = 0; |
| 1574 | char *cwd, *str; | 1533 | char *cwd, *str; |
| 1575 | char string[BUFSIZ+1]; | 1534 | char string[BUFSIZ+1]; |
| 1576 | int null_socket_name IF_LINT ( = 0); | ||
| 1577 | int null_server_file IF_LINT ( = 0); | ||
| 1578 | int start_daemon_if_needed; | 1535 | int start_daemon_if_needed; |
| 1579 | int exit_status = EXIT_SUCCESS; | 1536 | int exit_status = EXIT_SUCCESS; |
| 1580 | 1537 | ||
| 1581 | main_argv = argv; | 1538 | main_argv = argv; |
| 1582 | progname = argv[0]; | 1539 | progname = argv[0]; |
| 1583 | 1540 | ||
| 1584 | #ifdef WINDOWSNT | 1541 | #ifdef HAVE_NTGUI |
| 1585 | /* On Windows 7 and later, we need to explicitly associate emacsclient | 1542 | /* On Windows 7 and later, we need to explicitly associate |
| 1586 | 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. */ | ||
| 1587 | w32_set_user_model_id (); | 1546 | w32_set_user_model_id (); |
| 1588 | #endif | 1547 | #endif /* HAVE_NTGUI */ |
| 1589 | 1548 | ||
| 1590 | /* Process options. */ | 1549 | /* Process options. */ |
| 1591 | decode_options (argc, argv); | 1550 | decode_options (argc, argv); |
| @@ -1602,14 +1561,6 @@ main (int argc, char **argv) | |||
| 1602 | in case of failure to connect. */ | 1561 | in case of failure to connect. */ |
| 1603 | start_daemon_if_needed = (alternate_editor | 1562 | start_daemon_if_needed = (alternate_editor |
| 1604 | && (alternate_editor[0] == '\0')); | 1563 | && (alternate_editor[0] == '\0')); |
| 1605 | if (start_daemon_if_needed) | ||
| 1606 | { | ||
| 1607 | /* set_socket changes the values for socket_name and | ||
| 1608 | server_file, we need to reset them, if they were NULL before | ||
| 1609 | for the second call to set_socket. */ | ||
| 1610 | null_socket_name = (socket_name == NULL); | ||
| 1611 | null_server_file = (server_file == NULL); | ||
| 1612 | } | ||
| 1613 | 1564 | ||
| 1614 | emacs_socket = set_socket (alternate_editor || start_daemon_if_needed); | 1565 | emacs_socket = set_socket (alternate_editor || start_daemon_if_needed); |
| 1615 | if (emacs_socket == INVALID_SOCKET) | 1566 | if (emacs_socket == INVALID_SOCKET) |
| @@ -1617,37 +1568,25 @@ main (int argc, char **argv) | |||
| 1617 | if (! start_daemon_if_needed) | 1568 | if (! start_daemon_if_needed) |
| 1618 | fail (); | 1569 | fail (); |
| 1619 | 1570 | ||
| 1620 | /* Reset socket_name and server_file if they were NULL | ||
| 1621 | before the set_socket call. */ | ||
| 1622 | if (null_socket_name) | ||
| 1623 | socket_name = NULL; | ||
| 1624 | if (null_server_file) | ||
| 1625 | server_file = NULL; | ||
| 1626 | |||
| 1627 | start_daemon_and_retry_set_socket (); | 1571 | start_daemon_and_retry_set_socket (); |
| 1628 | } | 1572 | } |
| 1629 | 1573 | ||
| 1630 | cwd = get_current_dir_name (); | 1574 | cwd = get_current_dir_name (); |
| 1631 | if (cwd == 0) | 1575 | if (cwd == 0) |
| 1632 | { | 1576 | { |
| 1633 | /* getwd puts message in STRING if it fails. */ | ||
| 1634 | message (TRUE, "%s: %s\n", progname, | 1577 | message (TRUE, "%s: %s\n", progname, |
| 1635 | "Cannot get current working directory"); | 1578 | "Cannot get current working directory"); |
| 1636 | fail (); | 1579 | fail (); |
| 1637 | } | 1580 | } |
| 1638 | 1581 | ||
| 1639 | #ifdef WINDOWSNT | 1582 | #ifdef HAVE_NTGUI |
| 1583 | if (display && !strcmp (display, "w32")) | ||
| 1640 | w32_give_focus (); | 1584 | w32_give_focus (); |
| 1641 | #endif | 1585 | #endif /* HAVE_NTGUI */ |
| 1642 | 1586 | ||
| 1643 | /* Send over our environment and current directory. */ | 1587 | /* Send over our environment and current directory. */ |
| 1644 | if (!current_frame) | 1588 | if (!current_frame) |
| 1645 | { | 1589 | { |
| 1646 | #ifndef WINDOWSNT | ||
| 1647 | /* This is defined in stdlib.h on MS-Windows. It's defined in | ||
| 1648 | unistd.h on some POSIX hosts, but not all (Bug#10155). */ | ||
| 1649 | extern char **environ; | ||
| 1650 | #endif | ||
| 1651 | int i; | 1590 | int i; |
| 1652 | for (i = 0; environ[i]; i++) | 1591 | for (i = 0; environ[i]; i++) |
| 1653 | { | 1592 | { |
| @@ -1689,10 +1628,10 @@ main (int argc, char **argv) | |||
| 1689 | send_to_emacs (emacs_socket, " "); | 1628 | send_to_emacs (emacs_socket, " "); |
| 1690 | } | 1629 | } |
| 1691 | 1630 | ||
| 1692 | /* If using the current frame, send tty information to Emacs anyway. | 1631 | /* Unless we are certain we don't want to occupy the tty, send our |
| 1693 | In daemon mode, Emacs may need to occupy this tty if no other | 1632 | tty information to Emacs. For example, in daemon mode Emacs may |
| 1694 | frame is available. */ | 1633 | need to occupy this tty if no other frame is available. */ |
| 1695 | if (tty || (current_frame && !eval)) | 1634 | if (!current_frame || !eval) |
| 1696 | { | 1635 | { |
| 1697 | const char *tty_type, *tty_name; | 1636 | const char *tty_type, *tty_name; |
| 1698 | 1637 | ||
| @@ -1790,7 +1729,7 @@ main (int argc, char **argv) | |||
| 1790 | /* Now, wait for an answer and print any messages. */ | 1729 | /* Now, wait for an answer and print any messages. */ |
| 1791 | while (exit_status == EXIT_SUCCESS) | 1730 | while (exit_status == EXIT_SUCCESS) |
| 1792 | { | 1731 | { |
| 1793 | char *p; | 1732 | char *p, *end_p; |
| 1794 | do | 1733 | do |
| 1795 | { | 1734 | { |
| 1796 | errno = 0; | 1735 | errno = 0; |
| @@ -1805,61 +1744,82 @@ main (int argc, char **argv) | |||
| 1805 | 1744 | ||
| 1806 | string[rl] = '\0'; | 1745 | string[rl] = '\0'; |
| 1807 | 1746 | ||
| 1808 | p = string + strlen (string) - 1; | 1747 | /* Loop over all NL-terminated messages. */ |
| 1809 | while (p > string && *p == '\n') | 1748 | for (end_p = p = string; end_p != NULL && *end_p != '\0'; p = end_p) |
| 1810 | *p-- = 0; | 1749 | { |
| 1750 | end_p = strchr (p, '\n'); | ||
| 1751 | if (end_p != NULL) | ||
| 1752 | *end_p++ = '\0'; | ||
| 1811 | 1753 | ||
| 1812 | if (strprefix ("-emacs-pid ", string)) | 1754 | if (strprefix ("-emacs-pid ", p)) |
| 1813 | { | 1755 | { |
| 1814 | /* -emacs-pid PID: The process id of the Emacs process. */ | 1756 | /* -emacs-pid PID: The process id of the Emacs process. */ |
| 1815 | emacs_pid = strtol (string + strlen ("-emacs-pid"), NULL, 10); | 1757 | emacs_pid = strtol (p + strlen ("-emacs-pid"), NULL, 10); |
| 1816 | } | 1758 | } |
| 1817 | else if (strprefix ("-window-system-unsupported ", string)) | 1759 | else if (strprefix ("-window-system-unsupported ", p)) |
| 1818 | { | 1760 | { |
| 1819 | /* -window-system-unsupported: Emacs was compiled without X | 1761 | /* -window-system-unsupported: Emacs was compiled without support |
| 1820 | support. Try again on the terminal. */ | 1762 | for whatever window system we tried. Try the alternate |
| 1821 | nowait = 0; | 1763 | display, or, failing that, try the terminal. */ |
| 1822 | tty = 1; | 1764 | if (alt_display) |
| 1823 | goto retry; | 1765 | { |
| 1824 | } | 1766 | display = alt_display; |
| 1825 | else if (strprefix ("-print ", string)) | 1767 | alt_display = NULL; |
| 1826 | { | 1768 | } |
| 1827 | /* -print STRING: Print STRING on the terminal. */ | 1769 | else |
| 1828 | str = unquote_argument (string + strlen ("-print ")); | 1770 | { |
| 1829 | if (needlf) | 1771 | nowait = 0; |
| 1830 | printf ("\n"); | 1772 | tty = 1; |
| 1831 | printf ("%s", str); | 1773 | } |
| 1832 | needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; | 1774 | |
| 1833 | } | 1775 | goto retry; |
| 1834 | else if (strprefix ("-error ", string)) | 1776 | } |
| 1835 | { | 1777 | else if (strprefix ("-print ", p)) |
| 1836 | /* -error DESCRIPTION: Signal an error on the terminal. */ | 1778 | { |
| 1837 | str = unquote_argument (string + strlen ("-error ")); | 1779 | /* -print STRING: Print STRING on the terminal. */ |
| 1838 | if (needlf) | 1780 | str = unquote_argument (p + strlen ("-print ")); |
| 1839 | printf ("\n"); | 1781 | if (needlf) |
| 1840 | fprintf (stderr, "*ERROR*: %s", str); | 1782 | printf ("\n"); |
| 1841 | needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; | 1783 | printf ("%s", str); |
| 1842 | exit_status = EXIT_FAILURE; | 1784 | needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; |
| 1843 | } | 1785 | } |
| 1786 | else if (strprefix ("-print-nonl ", p)) | ||
| 1787 | { | ||
| 1788 | /* -print-nonl STRING: Print STRING on the terminal. | ||
| 1789 | Used to continue a preceding -print command. */ | ||
| 1790 | str = unquote_argument (p + strlen ("-print-nonl ")); | ||
| 1791 | printf ("%s", str); | ||
| 1792 | needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; | ||
| 1793 | } | ||
| 1794 | else if (strprefix ("-error ", p)) | ||
| 1795 | { | ||
| 1796 | /* -error DESCRIPTION: Signal an error on the terminal. */ | ||
| 1797 | str = unquote_argument (p + strlen ("-error ")); | ||
| 1798 | if (needlf) | ||
| 1799 | printf ("\n"); | ||
| 1800 | fprintf (stderr, "*ERROR*: %s", str); | ||
| 1801 | needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n'; | ||
| 1802 | exit_status = EXIT_FAILURE; | ||
| 1803 | } | ||
| 1844 | #ifdef SIGSTOP | 1804 | #ifdef SIGSTOP |
| 1845 | else if (strprefix ("-suspend ", string)) | 1805 | else if (strprefix ("-suspend ", p)) |
| 1846 | { | 1806 | { |
| 1847 | /* -suspend: Suspend this terminal, i.e., stop the process. */ | 1807 | /* -suspend: Suspend this terminal, i.e., stop the process. */ |
| 1848 | if (needlf) | 1808 | if (needlf) |
| 1849 | printf ("\n"); | 1809 | printf ("\n"); |
| 1850 | needlf = 0; | 1810 | needlf = 0; |
| 1851 | kill (0, SIGSTOP); | 1811 | kill (0, SIGSTOP); |
| 1852 | } | 1812 | } |
| 1853 | #endif | 1813 | #endif |
| 1854 | else | 1814 | else |
| 1855 | { | 1815 | { |
| 1856 | /* Unknown command. */ | 1816 | /* Unknown command. */ |
| 1857 | if (needlf) | 1817 | if (needlf) |
| 1858 | printf ("\n"); | 1818 | printf ("\n"); |
| 1859 | printf ("*ERROR*: Unknown message: %s", string); | 1819 | needlf = 0; |
| 1860 | needlf = string[0] | 1820 | printf ("*ERROR*: Unknown message: %s\n", p); |
| 1861 | == '\0' ? needlf : string[strlen (string) - 1] != '\n'; | 1821 | } |
| 1862 | } | 1822 | } |
| 1863 | } | 1823 | } |
| 1864 | 1824 | ||
| 1865 | if (needlf) | 1825 | if (needlf) |
| @@ -1875,22 +1835,3 @@ main (int argc, char **argv) | |||
| 1875 | } | 1835 | } |
| 1876 | 1836 | ||
| 1877 | #endif /* HAVE_SOCKETS && HAVE_INET_SOCKETS */ | 1837 | #endif /* HAVE_SOCKETS && HAVE_INET_SOCKETS */ |
| 1878 | |||
| 1879 | |||
| 1880 | #ifndef HAVE_STRERROR | ||
| 1881 | char * | ||
| 1882 | strerror (errnum) | ||
| 1883 | int errnum; | ||
| 1884 | { | ||
| 1885 | extern char *sys_errlist[]; | ||
| 1886 | extern int sys_nerr; | ||
| 1887 | |||
| 1888 | if (errnum >= 0 && errnum < sys_nerr) | ||
| 1889 | return sys_errlist[errnum]; | ||
| 1890 | return (char *) "Unknown error"; | ||
| 1891 | } | ||
| 1892 | |||
| 1893 | #endif /* ! HAVE_STRERROR */ | ||
| 1894 | |||
| 1895 | |||
| 1896 | /* emacsclient.c ends here */ | ||
diff --git a/lib-src/etags.c b/lib-src/etags.c index 8852c9faea4..b6af17b8edf 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c | |||
| @@ -28,7 +28,7 @@ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | |||
| 28 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 | IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 | 29 | ||
| 30 | 30 | ||
| 31 | Copyright (C) 1984, 1987-1989, 1993-1995, 1998-2011 | 31 | Copyright (C) 1984, 1987-1989, 1993-1995, 1998-2012 |
| 32 | Free Software Foundation, Inc. | 32 | Free Software Foundation, Inc. |
| 33 | 33 | ||
| 34 | This file is not considered part of GNU Emacs. | 34 | This file is not considered part of GNU Emacs. |
| @@ -91,25 +91,7 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; | |||
| 91 | # define NDEBUG /* disable assert */ | 91 | # define NDEBUG /* disable assert */ |
| 92 | #endif | 92 | #endif |
| 93 | 93 | ||
| 94 | #ifdef HAVE_CONFIG_H | 94 | #include <config.h> |
| 95 | # include <config.h> | ||
| 96 | /* This is probably not necessary any more. On some systems, config.h | ||
| 97 | used to define static as nothing for the sake of unexec. We don't | ||
| 98 | want that here since we don't use unexec. None of these systems | ||
| 99 | are supported any more, but the idea is still mentioned in | ||
| 100 | etc/PROBLEMS. */ | ||
| 101 | # undef static | ||
| 102 | # ifndef PTR /* for XEmacs */ | ||
| 103 | # define PTR void * | ||
| 104 | # endif | ||
| 105 | #else /* no config.h */ | ||
| 106 | # if defined (__STDC__) && (__STDC__ || defined (__SUNPRO_C)) | ||
| 107 | # define PTR void * /* for generic pointers */ | ||
| 108 | # else /* not standard C */ | ||
| 109 | # define const /* remove const for old compilers' sake */ | ||
| 110 | # define PTR long * /* don't use void* */ | ||
| 111 | # endif | ||
| 112 | #endif /* !HAVE_CONFIG_H */ | ||
| 113 | 95 | ||
| 114 | #ifndef _GNU_SOURCE | 96 | #ifndef _GNU_SOURCE |
| 115 | # define _GNU_SOURCE 1 /* enables some compiler checks on GNU */ | 97 | # define _GNU_SOURCE 1 /* enables some compiler checks on GNU */ |
| @@ -129,10 +111,6 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; | |||
| 129 | # include <fcntl.h> | 111 | # include <fcntl.h> |
| 130 | # include <sys/param.h> | 112 | # include <sys/param.h> |
| 131 | # include <io.h> | 113 | # include <io.h> |
| 132 | # ifndef HAVE_CONFIG_H | ||
| 133 | # define DOS_NT | ||
| 134 | # include <sys/config.h> | ||
| 135 | # endif | ||
| 136 | #else | 114 | #else |
| 137 | # define MSDOS FALSE | 115 | # define MSDOS FALSE |
| 138 | #endif /* MSDOS */ | 116 | #endif /* MSDOS */ |
| @@ -145,19 +123,10 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; | |||
| 145 | # undef HAVE_NTGUI | 123 | # undef HAVE_NTGUI |
| 146 | # undef DOS_NT | 124 | # undef DOS_NT |
| 147 | # define DOS_NT | 125 | # define DOS_NT |
| 148 | # ifndef HAVE_GETCWD | 126 | #endif /* WINDOWSNT */ |
| 149 | # define HAVE_GETCWD | ||
| 150 | # endif /* undef HAVE_GETCWD */ | ||
| 151 | #else /* not WINDOWSNT */ | ||
| 152 | #endif /* !WINDOWSNT */ | ||
| 153 | 127 | ||
| 154 | #include <unistd.h> | 128 | #include <unistd.h> |
| 155 | #ifndef HAVE_UNISTD_H | 129 | #include <stdarg.h> |
| 156 | # if defined (HAVE_GETCWD) && !defined (WINDOWSNT) | ||
| 157 | extern char *getcwd (char *buf, size_t size); | ||
| 158 | # endif | ||
| 159 | #endif /* HAVE_UNISTD_H */ | ||
| 160 | |||
| 161 | #include <stdlib.h> | 130 | #include <stdlib.h> |
| 162 | #include <string.h> | 131 | #include <string.h> |
| 163 | #include <stdio.h> | 132 | #include <stdio.h> |
| @@ -165,6 +134,7 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; | |||
| 165 | #include <errno.h> | 134 | #include <errno.h> |
| 166 | #include <sys/types.h> | 135 | #include <sys/types.h> |
| 167 | #include <sys/stat.h> | 136 | #include <sys/stat.h> |
| 137 | #include <c-strcase.h> | ||
| 168 | 138 | ||
| 169 | #include <assert.h> | 139 | #include <assert.h> |
| 170 | #ifdef NDEBUG | 140 | #ifdef NDEBUG |
| @@ -172,24 +142,7 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; | |||
| 172 | # define assert(x) ((void) 0) | 142 | # define assert(x) ((void) 0) |
| 173 | #endif | 143 | #endif |
| 174 | 144 | ||
| 175 | #ifdef NO_LONG_OPTIONS /* define this if you don't have GNU getopt */ | 145 | #include <getopt.h> |
| 176 | # define NO_LONG_OPTIONS TRUE | ||
| 177 | # define getopt_long(argc,argv,optstr,lopts,lind) getopt (argc, argv, optstr) | ||
| 178 | extern char *optarg; | ||
| 179 | extern int optind, opterr; | ||
| 180 | #else | ||
| 181 | # define NO_LONG_OPTIONS FALSE | ||
| 182 | # include <getopt.h> | ||
| 183 | #endif /* NO_LONG_OPTIONS */ | ||
| 184 | |||
| 185 | #ifndef HAVE_CONFIG_H /* this is a standalone compilation */ | ||
| 186 | # ifdef __CYGWIN__ /* compiling on Cygwin */ | ||
| 187 | !!! NOTICE !!! | ||
| 188 | the regex.h distributed with Cygwin is not compatible with etags, alas! | ||
| 189 | If you want regular expression support, you should delete this notice and | ||
| 190 | arrange to use the GNU regex.h and regex.c. | ||
| 191 | # endif | ||
| 192 | #endif | ||
| 193 | #include <regex.h> | 146 | #include <regex.h> |
| 194 | 147 | ||
| 195 | /* 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. |
| @@ -203,9 +156,9 @@ If you want regular expression support, you should delete this notice and | |||
| 203 | #endif | 156 | #endif |
| 204 | 157 | ||
| 205 | #define streq(s,t) (assert ((s)!=NULL || (t)!=NULL), !strcmp (s, t)) | 158 | #define streq(s,t) (assert ((s)!=NULL || (t)!=NULL), !strcmp (s, t)) |
| 206 | #define strcaseeq(s,t) (assert ((s)!=NULL && (t)!=NULL), !etags_strcasecmp (s, t)) | 159 | #define strcaseeq(s,t) (assert ((s)!=NULL && (t)!=NULL), !c_strcasecmp (s, t)) |
| 207 | #define strneq(s,t,n) (assert ((s)!=NULL || (t)!=NULL), !strncmp (s, t, n)) | 160 | #define strneq(s,t,n) (assert ((s)!=NULL || (t)!=NULL), !strncmp (s, t, n)) |
| 208 | #define strncaseeq(s,t,n) (assert ((s)!=NULL && (t)!=NULL), !etags_strncasecmp (s, t, n)) | 161 | #define strncaseeq(s,t,n) (assert ((s)!=NULL && (t)!=NULL), !c_strncasecmp (s, t, n)) |
| 209 | 162 | ||
| 210 | #define CHARS 256 /* 2^sizeof(char) */ | 163 | #define CHARS 256 /* 2^sizeof(char) */ |
| 211 | #define CHAR(x) ((unsigned int)(x) & (CHARS - 1)) | 164 | #define CHAR(x) ((unsigned int)(x) & (CHARS - 1)) |
| @@ -380,10 +333,10 @@ static void get_tag (char *, char **); | |||
| 380 | static void analyse_regex (char *); | 333 | static void analyse_regex (char *); |
| 381 | static void free_regexps (void); | 334 | static void free_regexps (void); |
| 382 | static void regex_tag_multiline (void); | 335 | static void regex_tag_multiline (void); |
| 383 | static void error (const char *, const char *); | 336 | static void error (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2); |
| 384 | static void suggest_asking_for_help (void) NO_RETURN; | 337 | static _Noreturn void suggest_asking_for_help (void); |
| 385 | void fatal (const char *, const char *) NO_RETURN; | 338 | _Noreturn void fatal (const char *, const char *); |
| 386 | static void pfatal (const char *) NO_RETURN; | 339 | static _Noreturn void pfatal (const char *); |
| 387 | static void add_node (node *, node **); | 340 | static void add_node (node *, node **); |
| 388 | 341 | ||
| 389 | static void init (void); | 342 | static void init (void); |
| @@ -404,8 +357,6 @@ static char *savenstr (const char *, int); | |||
| 404 | static char *savestr (const char *); | 357 | static char *savestr (const char *); |
| 405 | static char *etags_strchr (const char *, int); | 358 | static char *etags_strchr (const char *, int); |
| 406 | static char *etags_strrchr (const char *, int); | 359 | static char *etags_strrchr (const char *, int); |
| 407 | static int etags_strcasecmp (const char *, const char *); | ||
| 408 | static int etags_strncasecmp (const char *, const char *, int); | ||
| 409 | static char *etags_getcwd (void); | 360 | static char *etags_getcwd (void); |
| 410 | static char *relative_filename (char *, char *); | 361 | static char *relative_filename (char *, char *); |
| 411 | static char *absolute_filename (char *, char *); | 362 | static char *absolute_filename (char *, char *); |
| @@ -414,8 +365,8 @@ static bool filename_is_absolute (char *f); | |||
| 414 | static void canonicalize_filename (char *); | 365 | static void canonicalize_filename (char *); |
| 415 | static void linebuffer_init (linebuffer *); | 366 | static void linebuffer_init (linebuffer *); |
| 416 | static void linebuffer_setlen (linebuffer *, int); | 367 | static void linebuffer_setlen (linebuffer *, int); |
| 417 | static PTR xmalloc (size_t); | 368 | static void *xmalloc (size_t); |
| 418 | static PTR xrealloc (char *, size_t); | 369 | static void *xrealloc (char *, size_t); |
| 419 | 370 | ||
| 420 | 371 | ||
| 421 | static char searchar = '/'; /* use /.../ searches */ | 372 | static char searchar = '/'; /* use /.../ searches */ |
| @@ -866,8 +817,7 @@ etags --help --lang=ada."); | |||
| 866 | static void | 817 | static void |
| 867 | print_version (void) | 818 | print_version (void) |
| 868 | { | 819 | { |
| 869 | /* Makes it easier to update automatically. */ | 820 | char emacs_copyright[] = COPYRIGHT; |
| 870 | char emacs_copyright[] = "Copyright (C) 2011 Free Software Foundation, Inc."; | ||
| 871 | 821 | ||
| 872 | printf ("%s (%s %s)\n", (CTAGS) ? "ctags" : "etags", EMACS_NAME, VERSION); | 822 | printf ("%s (%s %s)\n", (CTAGS) ? "ctags" : "etags", EMACS_NAME, VERSION); |
| 873 | puts (emacs_copyright); | 823 | puts (emacs_copyright); |
| @@ -900,11 +850,7 @@ print_help (argument *argbuffer) | |||
| 900 | printf ("Usage: %s [options] [[regex-option ...] file-name] ...\n\ | 850 | printf ("Usage: %s [options] [[regex-option ...] file-name] ...\n\ |
| 901 | \n\ | 851 | \n\ |
| 902 | These are the options accepted by %s.\n", progname, progname); | 852 | These are the options accepted by %s.\n", progname, progname); |
| 903 | if (NO_LONG_OPTIONS) | 853 | puts ("You may use unambiguous abbreviations for the long option names."); |
| 904 | puts ("WARNING: long option names do not work with this executable,\n\ | ||
| 905 | as it is not linked with GNU getopt."); | ||
| 906 | else | ||
| 907 | puts ("You may use unambiguous abbreviations for the long option names."); | ||
| 908 | puts (" A - as file name means read names from stdin (one per line).\n\ | 854 | puts (" A - as file name means read names from stdin (one per line).\n\ |
| 909 | Absolute names are stored in the output file as they are.\n\ | 855 | Absolute names are stored in the output file as they are.\n\ |
| 910 | Relative ones are stored relative to the output file's directory.\n"); | 856 | Relative ones are stored relative to the output file's directory.\n"); |
| @@ -1096,9 +1042,9 @@ main (int argc, char **argv) | |||
| 1096 | 1042 | ||
| 1097 | /* When the optstring begins with a '-' getopt_long does not rearrange the | 1043 | /* When the optstring begins with a '-' getopt_long does not rearrange the |
| 1098 | non-options arguments to be at the end, but leaves them alone. */ | 1044 | non-options arguments to be at the end, but leaves them alone. */ |
| 1099 | optstring = concat (NO_LONG_OPTIONS ? "" : "-", | 1045 | optstring = concat ("-ac:Cf:Il:o:r:RSVhH", |
| 1100 | "ac:Cf:Il:o:r:RSVhH", | 1046 | (CTAGS) ? "BxdtTuvw" : "Di:", |
| 1101 | (CTAGS) ? "BxdtTuvw" : "Di:"); | 1047 | ""); |
| 1102 | 1048 | ||
| 1103 | while ((opt = getopt_long (argc, argv, optstring, longopts, NULL)) != EOF) | 1049 | while ((opt = getopt_long (argc, argv, optstring, longopts, NULL)) != EOF) |
| 1104 | switch (opt) | 1050 | switch (opt) |
| @@ -1140,7 +1086,7 @@ main (int argc, char **argv) | |||
| 1140 | case 'o': | 1086 | case 'o': |
| 1141 | if (tagfile) | 1087 | if (tagfile) |
| 1142 | { | 1088 | { |
| 1143 | error ("-o option may only be given once.", (char *)NULL); | 1089 | error ("-o option may only be given once."); |
| 1144 | suggest_asking_for_help (); | 1090 | suggest_asking_for_help (); |
| 1145 | /* NOTREACHED */ | 1091 | /* NOTREACHED */ |
| 1146 | } | 1092 | } |
| @@ -1224,7 +1170,7 @@ main (int argc, char **argv) | |||
| 1224 | 1170 | ||
| 1225 | if (nincluded_files == 0 && file_count == 0) | 1171 | if (nincluded_files == 0 && file_count == 0) |
| 1226 | { | 1172 | { |
| 1227 | error ("no input files specified.", (char *)NULL); | 1173 | error ("no input files specified."); |
| 1228 | suggest_asking_for_help (); | 1174 | suggest_asking_for_help (); |
| 1229 | /* NOTREACHED */ | 1175 | /* NOTREACHED */ |
| 1230 | } | 1176 | } |
| @@ -1447,7 +1393,7 @@ get_language_from_langname (const char *name) | |||
| 1447 | language *lang; | 1393 | language *lang; |
| 1448 | 1394 | ||
| 1449 | if (name == NULL) | 1395 | if (name == NULL) |
| 1450 | error ("empty language name", (char *)NULL); | 1396 | error ("empty language name"); |
| 1451 | else | 1397 | else |
| 1452 | { | 1398 | { |
| 1453 | for (lang = lang_names; lang->name != NULL; lang++) | 1399 | for (lang = lang_names; lang->name != NULL; lang++) |
| @@ -2153,7 +2099,7 @@ invalidate_nodes (fdesc *badfdp, node **npp) | |||
| 2153 | 2099 | ||
| 2154 | 2100 | ||
| 2155 | static int total_size_of_entries (node *); | 2101 | static int total_size_of_entries (node *); |
| 2156 | static int number_len (long); | 2102 | static int number_len (long) ATTRIBUTE_CONST; |
| 2157 | 2103 | ||
| 2158 | /* Length of a non-negative number's decimal representation. */ | 2104 | /* Length of a non-negative number's decimal representation. */ |
| 2159 | static int | 2105 | static int |
| @@ -2233,7 +2179,7 @@ put_entries (register node *np) | |||
| 2233 | { | 2179 | { |
| 2234 | /* Ctags mode */ | 2180 | /* Ctags mode */ |
| 2235 | if (np->name == NULL) | 2181 | if (np->name == NULL) |
| 2236 | error ("internal error: NULL name in ctags mode.", (char *)NULL); | 2182 | error ("internal error: NULL name in ctags mode."); |
| 2237 | 2183 | ||
| 2238 | if (cxref_style) | 2184 | if (cxref_style) |
| 2239 | { | 2185 | { |
| @@ -2672,17 +2618,11 @@ write_classname (linebuffer *cn, const char *qualifier) | |||
| 2672 | } | 2618 | } |
| 2673 | for (i = 1; i < cstack.nl; i++) | 2619 | for (i = 1; i < cstack.nl; i++) |
| 2674 | { | 2620 | { |
| 2675 | char *s; | 2621 | char *s = cstack.cname[i]; |
| 2676 | int slen; | ||
| 2677 | |||
| 2678 | s = cstack.cname[i]; | ||
| 2679 | if (s == NULL) | 2622 | if (s == NULL) |
| 2680 | continue; | 2623 | continue; |
| 2681 | slen = strlen (s); | 2624 | linebuffer_setlen (cn, len + qlen + strlen (s)); |
| 2682 | len += slen + qlen; | 2625 | len += sprintf (cn->buffer + len, "%s%s", qualifier, s); |
| 2683 | linebuffer_setlen (cn, len); | ||
| 2684 | strncat (cn->buffer, qualifier, qlen); | ||
| 2685 | strncat (cn->buffer, s, slen); | ||
| 2686 | } | 2626 | } |
| 2687 | } | 2627 | } |
| 2688 | 2628 | ||
| @@ -2773,7 +2713,7 @@ consider_token (register char *str, register int len, register int c, int *c_ext | |||
| 2773 | case dignorerest: | 2713 | case dignorerest: |
| 2774 | return FALSE; | 2714 | return FALSE; |
| 2775 | default: | 2715 | default: |
| 2776 | error ("internal error: definedef value.", (char *)NULL); | 2716 | error ("internal error: definedef value."); |
| 2777 | } | 2717 | } |
| 2778 | 2718 | ||
| 2779 | /* | 2719 | /* |
| @@ -2897,7 +2837,7 @@ consider_token (register char *str, register int len, register int c, int *c_ext | |||
| 2897 | fvdef = fvnone; | 2837 | fvdef = fvnone; |
| 2898 | objdef = omethodtag; | 2838 | objdef = omethodtag; |
| 2899 | linebuffer_setlen (&token_name, len); | 2839 | linebuffer_setlen (&token_name, len); |
| 2900 | strncpy (token_name.buffer, str, len); | 2840 | memcpy (token_name.buffer, str, len); |
| 2901 | token_name.buffer[len] = '\0'; | 2841 | token_name.buffer[len] = '\0'; |
| 2902 | return TRUE; | 2842 | return TRUE; |
| 2903 | } | 2843 | } |
| @@ -2909,10 +2849,12 @@ consider_token (register char *str, register int len, register int c, int *c_ext | |||
| 2909 | case omethodparm: | 2849 | case omethodparm: |
| 2910 | if (parlev == 0) | 2850 | if (parlev == 0) |
| 2911 | { | 2851 | { |
| 2852 | int oldlen = token_name.len; | ||
| 2912 | fvdef = fvnone; | 2853 | fvdef = fvnone; |
| 2913 | objdef = omethodtag; | 2854 | objdef = omethodtag; |
| 2914 | linebuffer_setlen (&token_name, token_name.len + len); | 2855 | linebuffer_setlen (&token_name, oldlen + len); |
| 2915 | strncat (token_name.buffer, str, len); | 2856 | memcpy (token_name.buffer + oldlen, str, len); |
| 2857 | token_name.buffer[oldlen + len] = '\0'; | ||
| 2916 | return TRUE; | 2858 | return TRUE; |
| 2917 | } | 2859 | } |
| 2918 | return FALSE; | 2860 | return FALSE; |
| @@ -3061,7 +3003,7 @@ make_C_tag (int isfun) | |||
| 3061 | make_tag (concat ("INVALID TOKEN:-->", token_name.buffer, ""), | 3003 | make_tag (concat ("INVALID TOKEN:-->", token_name.buffer, ""), |
| 3062 | token_name.len + 17, isfun, token.line, | 3004 | token_name.len + 17, isfun, token.line, |
| 3063 | token.offset+token.length+1, token.lineno, token.linepos); | 3005 | token.offset+token.length+1, token.lineno, token.linepos); |
| 3064 | error ("INVALID TOKEN", NULL); | 3006 | error ("INVALID TOKEN"); |
| 3065 | } | 3007 | } |
| 3066 | 3008 | ||
| 3067 | token.valid = FALSE; | 3009 | token.valid = FALSE; |
| @@ -3341,12 +3283,12 @@ C_entries (int c_ext, FILE *inf) | |||
| 3341 | && nestlev > 0 && definedef == dnone) | 3283 | && nestlev > 0 && definedef == dnone) |
| 3342 | /* in struct body */ | 3284 | /* in struct body */ |
| 3343 | { | 3285 | { |
| 3286 | int len; | ||
| 3344 | write_classname (&token_name, qualifier); | 3287 | write_classname (&token_name, qualifier); |
| 3345 | linebuffer_setlen (&token_name, | 3288 | len = token_name.len; |
| 3346 | token_name.len+qlen+toklen); | 3289 | linebuffer_setlen (&token_name, len+qlen+toklen); |
| 3347 | strcat (token_name.buffer, qualifier); | 3290 | sprintf (token_name.buffer + len, "%s%.*s", |
| 3348 | strncat (token_name.buffer, | 3291 | qualifier, toklen, newlb.buffer + tokoff); |
| 3349 | newlb.buffer + tokoff, toklen); | ||
| 3350 | token.named = TRUE; | 3292 | token.named = TRUE; |
| 3351 | } | 3293 | } |
| 3352 | else if (objdef == ocatseen) | 3294 | else if (objdef == ocatseen) |
| @@ -3354,11 +3296,8 @@ C_entries (int c_ext, FILE *inf) | |||
| 3354 | { | 3296 | { |
| 3355 | int len = strlen (objtag) + 2 + toklen; | 3297 | int len = strlen (objtag) + 2 + toklen; |
| 3356 | linebuffer_setlen (&token_name, len); | 3298 | linebuffer_setlen (&token_name, len); |
| 3357 | strcpy (token_name.buffer, objtag); | 3299 | sprintf (token_name.buffer, "%s(%.*s)", |
| 3358 | strcat (token_name.buffer, "("); | 3300 | objtag, toklen, newlb.buffer + tokoff); |
| 3359 | strncat (token_name.buffer, | ||
| 3360 | newlb.buffer + tokoff, toklen); | ||
| 3361 | strcat (token_name.buffer, ")"); | ||
| 3362 | token.named = TRUE; | 3301 | token.named = TRUE; |
| 3363 | } | 3302 | } |
| 3364 | else if (objdef == omethodtag | 3303 | else if (objdef == omethodtag |
| @@ -3382,8 +3321,8 @@ C_entries (int c_ext, FILE *inf) | |||
| 3382 | len -= 1; | 3321 | len -= 1; |
| 3383 | } | 3322 | } |
| 3384 | linebuffer_setlen (&token_name, len); | 3323 | linebuffer_setlen (&token_name, len); |
| 3385 | strncpy (token_name.buffer, | 3324 | memcpy (token_name.buffer, |
| 3386 | newlb.buffer + off, len); | 3325 | newlb.buffer + off, len); |
| 3387 | token_name.buffer[len] = '\0'; | 3326 | token_name.buffer[len] = '\0'; |
| 3388 | if (defun) | 3327 | if (defun) |
| 3389 | while (--len >= 0) | 3328 | while (--len >= 0) |
| @@ -3394,8 +3333,8 @@ C_entries (int c_ext, FILE *inf) | |||
| 3394 | else | 3333 | else |
| 3395 | { | 3334 | { |
| 3396 | linebuffer_setlen (&token_name, toklen); | 3335 | linebuffer_setlen (&token_name, toklen); |
| 3397 | strncpy (token_name.buffer, | 3336 | memcpy (token_name.buffer, |
| 3398 | newlb.buffer + tokoff, toklen); | 3337 | newlb.buffer + tokoff, toklen); |
| 3399 | token_name.buffer[toklen] = '\0'; | 3338 | token_name.buffer[toklen] = '\0'; |
| 3400 | /* Name macros and members. */ | 3339 | /* Name macros and members. */ |
| 3401 | token.named = (structdef == stagseen | 3340 | token.named = (structdef == stagseen |
| @@ -4689,7 +4628,7 @@ Pascal_functions (FILE *inf) | |||
| 4689 | /* Check if this is an "extern" declaration. */ | 4628 | /* Check if this is an "extern" declaration. */ |
| 4690 | if (*dbp == '\0') | 4629 | if (*dbp == '\0') |
| 4691 | continue; | 4630 | continue; |
| 4692 | if (lowcase (*dbp == 'e')) | 4631 | if (lowcase (*dbp) == 'e') |
| 4693 | { | 4632 | { |
| 4694 | if (nocase_tail ("extern")) /* superfluous, really! */ | 4633 | if (nocase_tail ("extern")) /* superfluous, really! */ |
| 4695 | { | 4634 | { |
| @@ -5191,7 +5130,7 @@ HTML_labels (FILE *inf) | |||
| 5191 | for (end = dbp; *end != '\0' && intoken (*end); end++) | 5130 | for (end = dbp; *end != '\0' && intoken (*end); end++) |
| 5192 | continue; | 5131 | continue; |
| 5193 | linebuffer_setlen (&token_name, end - dbp); | 5132 | linebuffer_setlen (&token_name, end - dbp); |
| 5194 | strncpy (token_name.buffer, dbp, end - dbp); | 5133 | memcpy (token_name.buffer, dbp, end - dbp); |
| 5195 | token_name.buffer[end - dbp] = '\0'; | 5134 | token_name.buffer[end - dbp] = '\0'; |
| 5196 | 5135 | ||
| 5197 | dbp = end; | 5136 | dbp = end; |
| @@ -5291,7 +5230,7 @@ Prolog_functions (FILE *inf) | |||
| 5291 | else if (len + 1 > allocated) | 5230 | else if (len + 1 > allocated) |
| 5292 | xrnew (last, len + 1, char); | 5231 | xrnew (last, len + 1, char); |
| 5293 | allocated = len + 1; | 5232 | allocated = len + 1; |
| 5294 | strncpy (last, cp, len); | 5233 | memcpy (last, cp, len); |
| 5295 | last[len] = '\0'; | 5234 | last[len] = '\0'; |
| 5296 | } | 5235 | } |
| 5297 | } | 5236 | } |
| @@ -5464,7 +5403,7 @@ Erlang_functions (FILE *inf) | |||
| 5464 | else if (len + 1 > allocated) | 5403 | else if (len + 1 > allocated) |
| 5465 | xrnew (last, len + 1, char); | 5404 | xrnew (last, len + 1, char); |
| 5466 | allocated = len + 1; | 5405 | allocated = len + 1; |
| 5467 | strncpy (last, cp, len); | 5406 | memcpy (last, cp, len); |
| 5468 | last[len] = '\0'; | 5407 | last[len] = '\0'; |
| 5469 | } | 5408 | } |
| 5470 | } | 5409 | } |
| @@ -5706,7 +5645,7 @@ add_regex (char *regexp_pattern, language *lang) | |||
| 5706 | { | 5645 | { |
| 5707 | static struct re_pattern_buffer zeropattern; | 5646 | static struct re_pattern_buffer zeropattern; |
| 5708 | char sep, *pat, *name, *modifiers; | 5647 | char sep, *pat, *name, *modifiers; |
| 5709 | char empty[] = ""; | 5648 | char empty = '\0'; |
| 5710 | const char *err; | 5649 | const char *err; |
| 5711 | struct re_pattern_buffer *patbuf; | 5650 | struct re_pattern_buffer *patbuf; |
| 5712 | regexp *rp; | 5651 | regexp *rp; |
| @@ -5719,7 +5658,7 @@ add_regex (char *regexp_pattern, language *lang) | |||
| 5719 | 5658 | ||
| 5720 | if (strlen (regexp_pattern) < 3) | 5659 | if (strlen (regexp_pattern) < 3) |
| 5721 | { | 5660 | { |
| 5722 | error ("null regexp", (char *)NULL); | 5661 | error ("null regexp"); |
| 5723 | return; | 5662 | return; |
| 5724 | } | 5663 | } |
| 5725 | sep = regexp_pattern[0]; | 5664 | sep = regexp_pattern[0]; |
| @@ -5738,7 +5677,7 @@ add_regex (char *regexp_pattern, language *lang) | |||
| 5738 | if (modifiers == NULL) /* no terminating separator --> no name */ | 5677 | if (modifiers == NULL) /* no terminating separator --> no name */ |
| 5739 | { | 5678 | { |
| 5740 | modifiers = name; | 5679 | modifiers = name; |
| 5741 | name = empty; | 5680 | name = ∅ |
| 5742 | } | 5681 | } |
| 5743 | else | 5682 | else |
| 5744 | modifiers += 1; /* skip separator */ | 5683 | modifiers += 1; /* skip separator */ |
| @@ -5749,7 +5688,7 @@ add_regex (char *regexp_pattern, language *lang) | |||
| 5749 | { | 5688 | { |
| 5750 | case 'N': | 5689 | case 'N': |
| 5751 | if (modifiers == name) | 5690 | if (modifiers == name) |
| 5752 | error ("forcing explicit tag name but no name, ignoring", NULL); | 5691 | error ("forcing explicit tag name but no name, ignoring"); |
| 5753 | force_explicit_name = TRUE; | 5692 | force_explicit_name = TRUE; |
| 5754 | break; | 5693 | break; |
| 5755 | case 'i': | 5694 | case 'i': |
| @@ -5763,12 +5702,7 @@ add_regex (char *regexp_pattern, language *lang) | |||
| 5763 | need_filebuf = TRUE; | 5702 | need_filebuf = TRUE; |
| 5764 | break; | 5703 | break; |
| 5765 | default: | 5704 | default: |
| 5766 | { | 5705 | error ("invalid regexp modifier `%c', ignoring", modifiers[0]); |
| 5767 | char wrongmod [2]; | ||
| 5768 | wrongmod[0] = modifiers[0]; | ||
| 5769 | wrongmod[1] = '\0'; | ||
| 5770 | error ("invalid regexp modifier `%s', ignoring", wrongmod); | ||
| 5771 | } | ||
| 5772 | break; | 5706 | break; |
| 5773 | } | 5707 | } |
| 5774 | 5708 | ||
| @@ -5852,7 +5786,7 @@ substitute (char *in, char *out, struct re_registers *regs) | |||
| 5852 | { | 5786 | { |
| 5853 | dig = *out - '0'; | 5787 | dig = *out - '0'; |
| 5854 | diglen = regs->end[dig] - regs->start[dig]; | 5788 | diglen = regs->end[dig] - regs->start[dig]; |
| 5855 | strncpy (t, in + regs->start[dig], diglen); | 5789 | memcpy (t, in + regs->start[dig], diglen); |
| 5856 | t += diglen; | 5790 | t += diglen; |
| 5857 | } | 5791 | } |
| 5858 | else | 5792 | else |
| @@ -6075,7 +6009,7 @@ readline_internal (linebuffer *lbp, register FILE *stream) | |||
| 6075 | filebuf.size *= 2; | 6009 | filebuf.size *= 2; |
| 6076 | xrnew (filebuf.buffer, filebuf.size, char); | 6010 | xrnew (filebuf.buffer, filebuf.size, char); |
| 6077 | } | 6011 | } |
| 6078 | strncpy (filebuf.buffer + filebuf.len, lbp->buffer, lbp->len); | 6012 | memcpy (filebuf.buffer + filebuf.len, lbp->buffer, lbp->len); |
| 6079 | filebuf.len += lbp->len; | 6013 | filebuf.len += lbp->len; |
| 6080 | filebuf.buffer[filebuf.len++] = '\n'; | 6014 | filebuf.buffer[filebuf.len++] = '\n'; |
| 6081 | filebuf.buffer[filebuf.len] = '\0'; | 6015 | filebuf.buffer[filebuf.len] = '\0'; |
| @@ -6298,7 +6232,7 @@ savenstr (const char *cp, int len) | |||
| 6298 | register char *dp; | 6232 | register char *dp; |
| 6299 | 6233 | ||
| 6300 | dp = xnew (len + 1, char); | 6234 | dp = xnew (len + 1, char); |
| 6301 | strncpy (dp, cp, len); | 6235 | memcpy (dp, cp, len); |
| 6302 | dp[len] = '\0'; | 6236 | dp[len] = '\0'; |
| 6303 | return dp; | 6237 | return dp; |
| 6304 | } | 6238 | } |
| @@ -6340,48 +6274,6 @@ etags_strchr (register const char *sp, register int c) | |||
| 6340 | return NULL; | 6274 | return NULL; |
| 6341 | } | 6275 | } |
| 6342 | 6276 | ||
| 6343 | /* | ||
| 6344 | * Compare two strings, ignoring case for alphabetic characters. | ||
| 6345 | * | ||
| 6346 | * Same as BSD's strcasecmp, included for portability. | ||
| 6347 | */ | ||
| 6348 | static int | ||
| 6349 | etags_strcasecmp (register const char *s1, register const char *s2) | ||
| 6350 | { | ||
| 6351 | while (*s1 != '\0' | ||
| 6352 | && (ISALPHA (*s1) && ISALPHA (*s2) | ||
| 6353 | ? lowcase (*s1) == lowcase (*s2) | ||
| 6354 | : *s1 == *s2)) | ||
| 6355 | s1++, s2++; | ||
| 6356 | |||
| 6357 | return (ISALPHA (*s1) && ISALPHA (*s2) | ||
| 6358 | ? lowcase (*s1) - lowcase (*s2) | ||
| 6359 | : *s1 - *s2); | ||
| 6360 | } | ||
| 6361 | |||
| 6362 | /* | ||
| 6363 | * Compare two strings, ignoring case for alphabetic characters. | ||
| 6364 | * Stop after a given number of characters | ||
| 6365 | * | ||
| 6366 | * Same as BSD's strncasecmp, included for portability. | ||
| 6367 | */ | ||
| 6368 | static int | ||
| 6369 | etags_strncasecmp (register const char *s1, register const char *s2, register int n) | ||
| 6370 | { | ||
| 6371 | while (*s1 != '\0' && n-- > 0 | ||
| 6372 | && (ISALPHA (*s1) && ISALPHA (*s2) | ||
| 6373 | ? lowcase (*s1) == lowcase (*s2) | ||
| 6374 | : *s1 == *s2)) | ||
| 6375 | s1++, s2++; | ||
| 6376 | |||
| 6377 | if (n < 0) | ||
| 6378 | return 0; | ||
| 6379 | else | ||
| 6380 | return (ISALPHA (*s1) && ISALPHA (*s2) | ||
| 6381 | ? lowcase (*s1) - lowcase (*s2) | ||
| 6382 | : *s1 - *s2); | ||
| 6383 | } | ||
| 6384 | |||
| 6385 | /* Skip spaces (end of string is not space), return new pointer. */ | 6277 | /* Skip spaces (end of string is not space), return new pointer. */ |
| 6386 | static char * | 6278 | static char * |
| 6387 | skip_spaces (char *cp) | 6279 | skip_spaces (char *cp) |
| @@ -6418,18 +6310,21 @@ pfatal (const char *s1) | |||
| 6418 | static void | 6310 | static void |
| 6419 | suggest_asking_for_help (void) | 6311 | suggest_asking_for_help (void) |
| 6420 | { | 6312 | { |
| 6421 | fprintf (stderr, "\tTry `%s %s' for a complete list of options.\n", | 6313 | fprintf (stderr, "\tTry `%s --help' for a complete list of options.\n", |
| 6422 | progname, NO_LONG_OPTIONS ? "-h" : "--help"); | 6314 | progname); |
| 6423 | exit (EXIT_FAILURE); | 6315 | exit (EXIT_FAILURE); |
| 6424 | } | 6316 | } |
| 6425 | 6317 | ||
| 6426 | /* Print error message. `s1' is printf control string, `s2' is arg for it. */ | 6318 | /* Output a diagnostic with printf-style FORMAT and args. */ |
| 6427 | static void | 6319 | static void |
| 6428 | error (const char *s1, const char *s2) | 6320 | error (const char *format, ...) |
| 6429 | { | 6321 | { |
| 6322 | va_list ap; | ||
| 6323 | va_start (ap, format); | ||
| 6430 | fprintf (stderr, "%s: ", progname); | 6324 | fprintf (stderr, "%s: ", progname); |
| 6431 | fprintf (stderr, s1, s2); | 6325 | vfprintf (stderr, format, ap); |
| 6432 | fprintf (stderr, "\n"); | 6326 | fprintf (stderr, "\n"); |
| 6327 | va_end (ap); | ||
| 6433 | } | 6328 | } |
| 6434 | 6329 | ||
| 6435 | /* Return a newly-allocated string whose contents | 6330 | /* Return a newly-allocated string whose contents |
| @@ -6454,7 +6349,6 @@ concat (const char *s1, const char *s2, const char *s3) | |||
| 6454 | static char * | 6349 | static char * |
| 6455 | etags_getcwd (void) | 6350 | etags_getcwd (void) |
| 6456 | { | 6351 | { |
| 6457 | #ifdef HAVE_GETCWD | ||
| 6458 | int bufsize = 200; | 6352 | int bufsize = 200; |
| 6459 | char *path = xnew (bufsize, char); | 6353 | char *path = xnew (bufsize, char); |
| 6460 | 6354 | ||
| @@ -6469,34 +6363,6 @@ etags_getcwd (void) | |||
| 6469 | 6363 | ||
| 6470 | canonicalize_filename (path); | 6364 | canonicalize_filename (path); |
| 6471 | return path; | 6365 | return path; |
| 6472 | |||
| 6473 | #else /* not HAVE_GETCWD */ | ||
| 6474 | #if MSDOS | ||
| 6475 | |||
| 6476 | char *p, path[MAXPATHLEN + 1]; /* Fixed size is safe on MSDOS. */ | ||
| 6477 | |||
| 6478 | getwd (path); | ||
| 6479 | |||
| 6480 | for (p = path; *p != '\0'; p++) | ||
| 6481 | if (*p == '\\') | ||
| 6482 | *p = '/'; | ||
| 6483 | else | ||
| 6484 | *p = lowcase (*p); | ||
| 6485 | |||
| 6486 | return strdup (path); | ||
| 6487 | #else /* not MSDOS */ | ||
| 6488 | linebuffer path; | ||
| 6489 | FILE *pipe; | ||
| 6490 | |||
| 6491 | linebuffer_init (&path); | ||
| 6492 | pipe = (FILE *) popen ("pwd 2>/dev/null", "r"); | ||
| 6493 | if (pipe == NULL || readline_internal (&path, pipe) == 0) | ||
| 6494 | pfatal ("pwd"); | ||
| 6495 | pclose (pipe); | ||
| 6496 | |||
| 6497 | return path.buffer; | ||
| 6498 | #endif /* not MSDOS */ | ||
| 6499 | #endif /* not HAVE_GETCWD */ | ||
| 6500 | } | 6366 | } |
| 6501 | 6367 | ||
| 6502 | /* Return a newly allocated string containing the file name of FILE | 6368 | /* Return a newly allocated string containing the file name of FILE |
| @@ -6687,19 +6553,19 @@ linebuffer_setlen (linebuffer *lbp, int toksize) | |||
| 6687 | } | 6553 | } |
| 6688 | 6554 | ||
| 6689 | /* Like malloc but get fatal error if memory is exhausted. */ | 6555 | /* Like malloc but get fatal error if memory is exhausted. */ |
| 6690 | static PTR | 6556 | static void * |
| 6691 | xmalloc (size_t size) | 6557 | xmalloc (size_t size) |
| 6692 | { | 6558 | { |
| 6693 | PTR result = (PTR) malloc (size); | 6559 | void *result = malloc (size); |
| 6694 | if (result == NULL) | 6560 | if (result == NULL) |
| 6695 | fatal ("virtual memory exhausted", (char *)NULL); | 6561 | fatal ("virtual memory exhausted", (char *)NULL); |
| 6696 | return result; | 6562 | return result; |
| 6697 | } | 6563 | } |
| 6698 | 6564 | ||
| 6699 | static PTR | 6565 | static void * |
| 6700 | xrealloc (char *ptr, size_t size) | 6566 | xrealloc (char *ptr, size_t size) |
| 6701 | { | 6567 | { |
| 6702 | PTR result = (PTR) realloc (ptr, size); | 6568 | void *result = realloc (ptr, size); |
| 6703 | if (result == NULL) | 6569 | if (result == NULL) |
| 6704 | fatal ("virtual memory exhausted", (char *)NULL); | 6570 | fatal ("virtual memory exhausted", (char *)NULL); |
| 6705 | return result; | 6571 | return result; |
diff --git a/lib-src/grep-changelog b/lib-src/grep-changelog index 0c7c42dc7ce..5477de7b577 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-2011 Free Software Foundation, Inc. | 3 | # Copyright (C) 1999-2012 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 f03663ef5be..08da0075269 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-2011 Free Software Foundation, Inc. | 2 | Copyright (C) 1989, 2001-2012 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | Author: Keith Gabryelski | 4 | Author: Keith Gabryelski |
| 5 | (according to authors.el) | 5 | (according to authors.el) |
| @@ -20,9 +20,7 @@ You should have received a copy of the GNU General Public License | |||
| 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 | ||
| 23 | #ifdef HAVE_CONFIG_H | ||
| 24 | #include <config.h> | 23 | #include <config.h> |
| 25 | #endif | ||
| 26 | 24 | ||
| 27 | #include <stdio.h> | 25 | #include <stdio.h> |
| 28 | #include <ctype.h> | 26 | #include <ctype.h> |
| @@ -48,7 +46,7 @@ int base = DEFAULT_BASE, un_flag = FALSE, iso_flag = FALSE, endian = 1; | |||
| 48 | int group_by = DEFAULT_GROUPING; | 46 | int group_by = DEFAULT_GROUPING; |
| 49 | char *progname; | 47 | char *progname; |
| 50 | 48 | ||
| 51 | void usage (void) NO_RETURN; | 49 | _Noreturn void usage (void); |
| 52 | 50 | ||
| 53 | int | 51 | int |
| 54 | main (int argc, char **argv) | 52 | main (int argc, char **argv) |
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index 1ec365f3446..68e7029ee85 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c | |||
| @@ -1,6 +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 | Copyright (C) 1985-1986, 1992-1994, 1997, 1999-2011 | 2 | |
| 3 | Free Software Foundation, Inc. | 3 | Copyright (C) 1985-1986, 1992-1994, 1997, 1999-2012 |
| 4 | Free Software Foundation, Inc. | ||
| 4 | 5 | ||
| 5 | This file is part of GNU Emacs. | 6 | This file is part of GNU Emacs. |
| 6 | 7 | ||
| @@ -35,57 +36,41 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 35 | 36 | ||
| 36 | #include <config.h> | 37 | #include <config.h> |
| 37 | 38 | ||
| 38 | /* defined to be emacs_main, sys_fopen, etc. in config.h */ | ||
| 39 | #undef main | ||
| 40 | #undef fopen | ||
| 41 | #undef chdir | ||
| 42 | |||
| 43 | #include <stdio.h> | 39 | #include <stdio.h> |
| 44 | #include <stdlib.h> | 40 | #include <stdlib.h> /* config.h unconditionally includes this anyway */ |
| 45 | #ifdef MSDOS | 41 | #ifdef MSDOS |
| 46 | #include <fcntl.h> | 42 | #include <fcntl.h> |
| 47 | #endif /* MSDOS */ | 43 | #endif /* MSDOS */ |
| 48 | #ifdef WINDOWSNT | 44 | #ifdef WINDOWSNT |
| 45 | /* Defined to be sys_fopen in ms-w32.h, but only #ifdef emacs, so this | ||
| 46 | is really just insurance. */ | ||
| 47 | #undef fopen | ||
| 49 | #include <fcntl.h> | 48 | #include <fcntl.h> |
| 50 | #include <direct.h> | 49 | #include <direct.h> |
| 51 | #endif /* WINDOWSNT */ | 50 | #endif /* WINDOWSNT */ |
| 52 | 51 | ||
| 53 | #ifdef DOS_NT | 52 | #ifdef DOS_NT |
| 53 | /* Defined to be sys_chdir in ms-w32.h, but only #ifdef emacs, so this | ||
| 54 | is really just insurance. | ||
| 55 | |||
| 56 | Similarly, msdos defines this as sys_chdir, but we're not linking with the | ||
| 57 | file where that function is defined. */ | ||
| 58 | #undef chdir | ||
| 54 | #define READ_TEXT "rt" | 59 | #define READ_TEXT "rt" |
| 55 | #define READ_BINARY "rb" | 60 | #define READ_BINARY "rb" |
| 61 | #define IS_SLASH(c) ((c) == '/' || (c) == '\\' || (c) == ':') | ||
| 56 | #else /* not DOS_NT */ | 62 | #else /* not DOS_NT */ |
| 57 | #define READ_TEXT "r" | 63 | #define READ_TEXT "r" |
| 58 | #define READ_BINARY "r" | 64 | #define READ_BINARY "r" |
| 65 | #define IS_SLASH(c) ((c) == '/') | ||
| 59 | #endif /* not DOS_NT */ | 66 | #endif /* not DOS_NT */ |
| 60 | 67 | ||
| 61 | #ifndef DIRECTORY_SEP | ||
| 62 | #define DIRECTORY_SEP '/' | ||
| 63 | #endif | ||
| 64 | |||
| 65 | #ifndef IS_DIRECTORY_SEP | ||
| 66 | #define IS_DIRECTORY_SEP(_c_) ((_c_) == DIRECTORY_SEP) | ||
| 67 | #endif | ||
| 68 | |||
| 69 | /* Use this to suppress gcc's `...may be used before initialized' warnings. */ | ||
| 70 | #ifdef lint | ||
| 71 | # define IF_LINT(Code) Code | ||
| 72 | #else | ||
| 73 | # define IF_LINT(Code) /* empty */ | ||
| 74 | #endif | ||
| 75 | |||
| 76 | static int scan_file (char *filename); | 68 | static int scan_file (char *filename); |
| 77 | static int scan_lisp_file (const char *filename, const char *mode); | 69 | static int scan_lisp_file (const char *filename, const char *mode); |
| 78 | static int scan_c_file (char *filename, const char *mode); | 70 | static int scan_c_file (char *filename, const char *mode); |
| 79 | static void fatal (const char *s1, const char *s2) NO_RETURN; | ||
| 80 | static void start_globals (void); | 71 | static void start_globals (void); |
| 81 | static void write_globals (void); | 72 | static void write_globals (void); |
| 82 | 73 | ||
| 83 | #ifdef MSDOS | ||
| 84 | /* s/msdos.h defines this as sys_chdir, but we're not linking with the | ||
| 85 | file where that function is defined. */ | ||
| 86 | #undef chdir | ||
| 87 | #endif | ||
| 88 | |||
| 89 | #include <unistd.h> | 74 | #include <unistd.h> |
| 90 | 75 | ||
| 91 | /* Stdio stream for output to the DOC file. */ | 76 | /* Stdio stream for output to the DOC file. */ |
| @@ -111,7 +96,7 @@ error (const char *s1, const char *s2) | |||
| 111 | /* Print error message and exit. */ | 96 | /* Print error message and exit. */ |
| 112 | 97 | ||
| 113 | /* VARARGS1 */ | 98 | /* VARARGS1 */ |
| 114 | static void | 99 | static _Noreturn void |
| 115 | fatal (const char *s1, const char *s2) | 100 | fatal (const char *s1, const char *s2) |
| 116 | { | 101 | { |
| 117 | error (s1, s2); | 102 | error (s1, s2); |
| @@ -226,7 +211,7 @@ put_filename (char *filename) | |||
| 226 | 211 | ||
| 227 | for (tmp = filename; *tmp; tmp++) | 212 | for (tmp = filename; *tmp; tmp++) |
| 228 | { | 213 | { |
| 229 | if (IS_DIRECTORY_SEP(*tmp)) | 214 | if (IS_DIRECTORY_SEP (*tmp)) |
| 230 | filename = tmp + 1; | 215 | filename = tmp + 1; |
| 231 | } | 216 | } |
| 232 | 217 | ||
| @@ -541,8 +526,8 @@ write_c_args (FILE *out, char *func, char *buf, int minargs, int maxargs) | |||
| 541 | maxargs--; | 526 | maxargs--; |
| 542 | 527 | ||
| 543 | /* In C code, `default' is a reserved word, so we spell it | 528 | /* In C code, `default' is a reserved word, so we spell it |
| 544 | `defalt'; unmangle that here. */ | 529 | `defalt'; demangle that here. */ |
| 545 | if (ident_length == 6 && strncmp (ident_start, "defalt", 6) == 0) | 530 | if (ident_length == 6 && memcmp (ident_start, "defalt", 6) == 0) |
| 546 | fprintf (out, "DEFAULT"); | 531 | fprintf (out, "DEFAULT"); |
| 547 | else | 532 | else |
| 548 | while (ident_length-- > 0) | 533 | while (ident_length-- > 0) |
| @@ -562,13 +547,15 @@ write_c_args (FILE *out, char *func, char *buf, int minargs, int maxargs) | |||
| 562 | putc (')', out); | 547 | putc (')', out); |
| 563 | } | 548 | } |
| 564 | 549 | ||
| 565 | /* The types of globals. */ | 550 | /* The types of globals. These are sorted roughly in decreasing alignment |
| 551 | order to avoid allocation gaps, except that functions are last. */ | ||
| 566 | enum global_type | 552 | enum global_type |
| 567 | { | 553 | { |
| 554 | INVALID, | ||
| 555 | LISP_OBJECT, | ||
| 568 | EMACS_INTEGER, | 556 | EMACS_INTEGER, |
| 569 | BOOLEAN, | 557 | BOOLEAN, |
| 570 | LISP_OBJECT, | 558 | FUNCTION, |
| 571 | INVALID | ||
| 572 | }; | 559 | }; |
| 573 | 560 | ||
| 574 | /* A single global. */ | 561 | /* A single global. */ |
| @@ -576,6 +563,7 @@ struct global | |||
| 576 | { | 563 | { |
| 577 | enum global_type type; | 564 | enum global_type type; |
| 578 | char *name; | 565 | char *name; |
| 566 | int value; | ||
| 579 | }; | 567 | }; |
| 580 | 568 | ||
| 581 | /* All the variable names we saw while scanning C sources in `-g' | 569 | /* All the variable names we saw while scanning C sources in `-g' |
| @@ -585,7 +573,7 @@ int num_globals_allocated; | |||
| 585 | struct global *globals; | 573 | struct global *globals; |
| 586 | 574 | ||
| 587 | static void | 575 | static void |
| 588 | add_global (enum global_type type, char *name) | 576 | add_global (enum global_type type, char *name, int value) |
| 589 | { | 577 | { |
| 590 | /* Ignore the one non-symbol that can occur. */ | 578 | /* Ignore the one non-symbol that can occur. */ |
| 591 | if (strcmp (name, "...")) | 579 | if (strcmp (name, "...")) |
| @@ -606,6 +594,7 @@ add_global (enum global_type type, char *name) | |||
| 606 | 594 | ||
| 607 | globals[num_globals - 1].type = type; | 595 | globals[num_globals - 1].type = type; |
| 608 | globals[num_globals - 1].name = name; | 596 | globals[num_globals - 1].name = name; |
| 597 | globals[num_globals - 1].value = value; | ||
| 609 | } | 598 | } |
| 610 | } | 599 | } |
| 611 | 600 | ||
| @@ -614,13 +603,24 @@ compare_globals (const void *a, const void *b) | |||
| 614 | { | 603 | { |
| 615 | const struct global *ga = a; | 604 | const struct global *ga = a; |
| 616 | const struct global *gb = b; | 605 | const struct global *gb = b; |
| 606 | |||
| 607 | if (ga->type != gb->type) | ||
| 608 | return ga->type - gb->type; | ||
| 609 | |||
| 617 | return strcmp (ga->name, gb->name); | 610 | return strcmp (ga->name, gb->name); |
| 618 | } | 611 | } |
| 619 | 612 | ||
| 620 | static void | 613 | static void |
| 614 | close_emacs_globals (void) | ||
| 615 | { | ||
| 616 | fprintf (outfile, "};\n"); | ||
| 617 | fprintf (outfile, "extern struct emacs_globals globals;\n"); | ||
| 618 | } | ||
| 619 | |||
| 620 | static void | ||
| 621 | write_globals (void) | 621 | write_globals (void) |
| 622 | { | 622 | { |
| 623 | int i; | 623 | int i, seen_defun = 0; |
| 624 | qsort (globals, num_globals, sizeof (struct global), compare_globals); | 624 | qsort (globals, num_globals, sizeof (struct global), compare_globals); |
| 625 | for (i = 0; i < num_globals; ++i) | 625 | for (i = 0; i < num_globals; ++i) |
| 626 | { | 626 | { |
| @@ -632,25 +632,62 @@ write_globals (void) | |||
| 632 | type = "EMACS_INT"; | 632 | type = "EMACS_INT"; |
| 633 | break; | 633 | break; |
| 634 | case BOOLEAN: | 634 | case BOOLEAN: |
| 635 | type = "int"; | 635 | type = "bool"; |
| 636 | break; | 636 | break; |
| 637 | case LISP_OBJECT: | 637 | case LISP_OBJECT: |
| 638 | type = "Lisp_Object"; | 638 | type = "Lisp_Object"; |
| 639 | break; | 639 | break; |
| 640 | case FUNCTION: | ||
| 641 | if (!seen_defun) | ||
| 642 | { | ||
| 643 | close_emacs_globals (); | ||
| 644 | fprintf (outfile, "\n"); | ||
| 645 | seen_defun = 1; | ||
| 646 | } | ||
| 647 | break; | ||
| 640 | default: | 648 | default: |
| 641 | fatal ("not a recognized DEFVAR_", 0); | 649 | fatal ("not a recognized DEFVAR_", 0); |
| 642 | } | 650 | } |
| 643 | 651 | ||
| 644 | fprintf (outfile, " %s f_%s;\n", type, globals[i].name); | 652 | if (globals[i].type != FUNCTION) |
| 645 | fprintf (outfile, "#define %s globals.f_%s\n", | 653 | { |
| 646 | globals[i].name, globals[i].name); | 654 | fprintf (outfile, " %s f_%s;\n", type, globals[i].name); |
| 655 | fprintf (outfile, "#define %s globals.f_%s\n", | ||
| 656 | globals[i].name, globals[i].name); | ||
| 657 | } | ||
| 658 | else | ||
| 659 | { | ||
| 660 | /* It would be nice to have a cleaner way to deal with these | ||
| 661 | special hacks. */ | ||
| 662 | if (strcmp (globals[i].name, "Fthrow") == 0 | ||
| 663 | || strcmp (globals[i].name, "Ftop_level") == 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) | ||
| 667 | fprintf (outfile, "_Noreturn "); | ||
| 668 | fprintf (outfile, "EXFUN (%s, ", globals[i].name); | ||
| 669 | if (globals[i].value == -1) | ||
| 670 | fprintf (outfile, "MANY"); | ||
| 671 | else if (globals[i].value == -2) | ||
| 672 | fprintf (outfile, "UNEVALLED"); | ||
| 673 | else | ||
| 674 | fprintf (outfile, "%d", globals[i].value); | ||
| 675 | fprintf (outfile, ");\n"); | ||
| 676 | } | ||
| 677 | |||
| 647 | while (i + 1 < num_globals | 678 | while (i + 1 < num_globals |
| 648 | && !strcmp (globals[i].name, globals[i + 1].name)) | 679 | && !strcmp (globals[i].name, globals[i + 1].name)) |
| 649 | ++i; | 680 | { |
| 681 | if (globals[i].type == FUNCTION | ||
| 682 | && globals[i].value != globals[i + 1].value) | ||
| 683 | error ("function '%s' defined twice with differing signatures", | ||
| 684 | globals[i].name); | ||
| 685 | ++i; | ||
| 686 | } | ||
| 650 | } | 687 | } |
| 651 | 688 | ||
| 652 | fprintf (outfile, "};\n"); | 689 | if (!seen_defun) |
| 653 | fprintf (outfile, "extern struct emacs_globals globals;\n"); | 690 | close_emacs_globals (); |
| 654 | } | 691 | } |
| 655 | 692 | ||
| 656 | 693 | ||
| @@ -675,14 +712,14 @@ scan_c_file (char *filename, const char *mode) | |||
| 675 | 712 | ||
| 676 | if (infile == NULL && extension == 'o') | 713 | if (infile == NULL && extension == 'o') |
| 677 | { | 714 | { |
| 678 | /* try .m */ | 715 | /* Try .m. */ |
| 679 | filename[strlen (filename) - 1] = 'm'; | 716 | filename[strlen (filename) - 1] = 'm'; |
| 680 | infile = fopen (filename, mode); | 717 | infile = fopen (filename, mode); |
| 681 | if (infile == NULL) | 718 | if (infile == NULL) |
| 682 | filename[strlen (filename) - 1] = 'c'; /* don't confuse people */ | 719 | filename[strlen (filename) - 1] = 'c'; /* Don't confuse people. */ |
| 683 | } | 720 | } |
| 684 | 721 | ||
| 685 | /* No error if non-ex input file */ | 722 | /* No error if non-ex input file. */ |
| 686 | if (infile == NULL) | 723 | if (infile == NULL) |
| 687 | { | 724 | { |
| 688 | perror (filename); | 725 | perror (filename); |
| @@ -700,6 +737,7 @@ scan_c_file (char *filename, const char *mode) | |||
| 700 | int defvarperbufferflag = 0; | 737 | int defvarperbufferflag = 0; |
| 701 | int defvarflag = 0; | 738 | int defvarflag = 0; |
| 702 | enum global_type type = INVALID; | 739 | enum global_type type = INVALID; |
| 740 | char *name IF_LINT (= 0); | ||
| 703 | 741 | ||
| 704 | if (c != '\n' && c != '\r') | 742 | if (c != '\n' && c != '\r') |
| 705 | { | 743 | { |
| @@ -765,8 +803,9 @@ scan_c_file (char *filename, const char *mode) | |||
| 765 | } | 803 | } |
| 766 | else continue; | 804 | else continue; |
| 767 | 805 | ||
| 768 | if (generate_globals && (!defvarflag || defvarperbufferflag | 806 | if (generate_globals |
| 769 | || type == INVALID)) | 807 | && (!defvarflag || defvarperbufferflag || type == INVALID) |
| 808 | && !defunflag) | ||
| 770 | continue; | 809 | continue; |
| 771 | 810 | ||
| 772 | while (c != '(') | 811 | while (c != '(') |
| @@ -785,7 +824,6 @@ scan_c_file (char *filename, const char *mode) | |||
| 785 | if (generate_globals) | 824 | if (generate_globals) |
| 786 | { | 825 | { |
| 787 | int i = 0; | 826 | int i = 0; |
| 788 | char *name; | ||
| 789 | 827 | ||
| 790 | /* Skip "," and whitespace. */ | 828 | /* Skip "," and whitespace. */ |
| 791 | do | 829 | do |
| @@ -800,14 +838,18 @@ scan_c_file (char *filename, const char *mode) | |||
| 800 | input_buffer[i++] = c; | 838 | input_buffer[i++] = c; |
| 801 | c = getc (infile); | 839 | c = getc (infile); |
| 802 | } | 840 | } |
| 803 | while (! (c == ',' || c == ' ' || c == '\t' || | 841 | while (! (c == ',' || c == ' ' || c == '\t' |
| 804 | c == '\n' || c == '\r')); | 842 | || c == '\n' || c == '\r')); |
| 805 | input_buffer[i] = '\0'; | 843 | input_buffer[i] = '\0'; |
| 806 | 844 | ||
| 807 | name = xmalloc (i + 1); | 845 | name = xmalloc (i + 1); |
| 808 | memcpy (name, input_buffer, i + 1); | 846 | memcpy (name, input_buffer, i + 1); |
| 809 | add_global (type, name); | 847 | |
| 810 | continue; | 848 | if (!defunflag) |
| 849 | { | ||
| 850 | add_global (type, name, 0); | ||
| 851 | continue; | ||
| 852 | } | ||
| 811 | } | 853 | } |
| 812 | 854 | ||
| 813 | /* DEFVAR_LISP ("name", addr, "doc") | 855 | /* DEFVAR_LISP ("name", addr, "doc") |
| @@ -815,12 +857,12 @@ scan_c_file (char *filename, const char *mode) | |||
| 815 | DEFVAR_LISP ("name", addr, doc: /\* doc *\/) */ | 857 | DEFVAR_LISP ("name", addr, doc: /\* doc *\/) */ |
| 816 | 858 | ||
| 817 | if (defunflag) | 859 | if (defunflag) |
| 818 | commas = 5; | 860 | commas = generate_globals ? 4 : 5; |
| 819 | else if (defvarperbufferflag) | 861 | else if (defvarperbufferflag) |
| 820 | commas = 3; | 862 | commas = 3; |
| 821 | else if (defvarflag) | 863 | else if (defvarflag) |
| 822 | commas = 1; | 864 | commas = 1; |
| 823 | else /* For DEFSIMPLE and DEFPRED */ | 865 | else /* For DEFSIMPLE and DEFPRED. */ |
| 824 | commas = 2; | 866 | commas = 2; |
| 825 | 867 | ||
| 826 | while (commas) | 868 | while (commas) |
| @@ -838,11 +880,16 @@ scan_c_file (char *filename, const char *mode) | |||
| 838 | if (c < 0) | 880 | if (c < 0) |
| 839 | goto eof; | 881 | goto eof; |
| 840 | ungetc (c, infile); | 882 | ungetc (c, infile); |
| 841 | if (commas == 2) /* pick up minargs */ | 883 | if (commas == 2) /* Pick up minargs. */ |
| 842 | scanned = fscanf (infile, "%d", &minargs); | 884 | scanned = fscanf (infile, "%d", &minargs); |
| 843 | else /* pick up maxargs */ | 885 | else /* Pick up maxargs. */ |
| 844 | if (c == 'M' || c == 'U') /* MANY || UNEVALLED */ | 886 | if (c == 'M' || c == 'U') /* MANY || UNEVALLED */ |
| 845 | maxargs = -1; | 887 | { |
| 888 | if (generate_globals) | ||
| 889 | maxargs = (c == 'M') ? -1 : -2; | ||
| 890 | else | ||
| 891 | maxargs = -1; | ||
| 892 | } | ||
| 846 | else | 893 | else |
| 847 | scanned = fscanf (infile, "%d", &maxargs); | 894 | scanned = fscanf (infile, "%d", &maxargs); |
| 848 | if (scanned < 0) | 895 | if (scanned < 0) |
| @@ -855,6 +902,12 @@ scan_c_file (char *filename, const char *mode) | |||
| 855 | c = getc (infile); | 902 | c = getc (infile); |
| 856 | } | 903 | } |
| 857 | 904 | ||
| 905 | if (generate_globals) | ||
| 906 | { | ||
| 907 | add_global (FUNCTION, name, maxargs); | ||
| 908 | continue; | ||
| 909 | } | ||
| 910 | |||
| 858 | while (c == ' ' || c == '\n' || c == '\r' || c == '\t') | 911 | while (c == ' ' || c == '\n' || c == '\r' || c == '\t') |
| 859 | c = getc (infile); | 912 | c = getc (infile); |
| 860 | 913 | ||
| @@ -893,7 +946,7 @@ scan_c_file (char *filename, const char *mode) | |||
| 893 | fprintf (outfile, "%s\n", input_buffer); | 946 | fprintf (outfile, "%s\n", input_buffer); |
| 894 | 947 | ||
| 895 | if (comment) | 948 | if (comment) |
| 896 | getc (infile); /* Skip past `*' */ | 949 | getc (infile); /* Skip past `*'. */ |
| 897 | c = read_c_string_or_comment (infile, 1, comment, &saw_usage); | 950 | c = read_c_string_or_comment (infile, 1, comment, &saw_usage); |
| 898 | 951 | ||
| 899 | /* If this is a defun, find the arguments and print them. If | 952 | /* If this is a defun, find the arguments and print them. If |
| @@ -974,12 +1027,12 @@ scan_c_file (char *filename, const char *mode) | |||
| 974 | 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 |
| 975 | immediately after the double quote. | 1028 | immediately after the double quote. |
| 976 | The only source files that must follow this convention are preloaded | 1029 | The only source files that must follow this convention are preloaded |
| 977 | uncompiled ones like loaddefs.el and bindings.el; aside | 1030 | uncompiled ones like loaddefs.el; aside from that, it is always the .elc |
| 978 | 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 |
| 979 | problem because byte-compiler output follows this convention. | 1032 | output follows this convention. |
| 980 | The NAME and DOCSTRING are output. | 1033 | The NAME and DOCSTRING are output. |
| 981 | 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. |
| 982 | 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 ". |
| 983 | */ | 1036 | */ |
| 984 | 1037 | ||
| 985 | static void | 1038 | static void |
| @@ -1020,20 +1073,83 @@ read_lisp_symbol (FILE *infile, char *buffer) | |||
| 1020 | } | 1073 | } |
| 1021 | 1074 | ||
| 1022 | static int | 1075 | static int |
| 1076 | search_lisp_doc_at_eol (FILE *infile) | ||
| 1077 | { | ||
| 1078 | char c = 0, c1 = 0, c2 = 0; | ||
| 1079 | |||
| 1080 | /* Skip until the end of line; remember two previous chars. */ | ||
| 1081 | while (c != '\n' && c != '\r' && c != EOF) | ||
| 1082 | { | ||
| 1083 | c2 = c1; | ||
| 1084 | c1 = c; | ||
| 1085 | c = getc (infile); | ||
| 1086 | } | ||
| 1087 | |||
| 1088 | /* If two previous characters were " and \, | ||
| 1089 | this is a doc string. Otherwise, there is none. */ | ||
| 1090 | if (c2 != '"' || c1 != '\\') | ||
| 1091 | { | ||
| 1092 | #ifdef DEBUG | ||
| 1093 | fprintf (stderr, "## non-docstring in %s (%s)\n", | ||
| 1094 | buffer, filename); | ||
| 1095 | #endif | ||
| 1096 | if (c != EOF) | ||
| 1097 | ungetc (c, infile); | ||
| 1098 | return 0; | ||
| 1099 | } | ||
| 1100 | return 1; | ||
| 1101 | } | ||
| 1102 | |||
| 1103 | #define DEF_ELISP_FILE(fn) { #fn, sizeof(#fn) - 1 } | ||
| 1104 | |||
| 1105 | static int | ||
| 1023 | scan_lisp_file (const char *filename, const char *mode) | 1106 | scan_lisp_file (const char *filename, const char *mode) |
| 1024 | { | 1107 | { |
| 1025 | FILE *infile; | 1108 | FILE *infile; |
| 1026 | register int c; | 1109 | register int c; |
| 1027 | char *saved_string = 0; | 1110 | char *saved_string = 0; |
| 1111 | /* These are the only files that are loaded uncompiled, and must | ||
| 1112 | follow the conventions of the doc strings expected by this | ||
| 1113 | function. These conventions are automatically followed by the | ||
| 1114 | byte compiler when it produces the .elc files. */ | ||
| 1115 | static struct { | ||
| 1116 | const char *fn; | ||
| 1117 | size_t fl; | ||
| 1118 | } const uncompiled[] = { | ||
| 1119 | DEF_ELISP_FILE (loaddefs.el), | ||
| 1120 | DEF_ELISP_FILE (loadup.el), | ||
| 1121 | DEF_ELISP_FILE (charprop.el), | ||
| 1122 | DEF_ELISP_FILE (cp51932.el), | ||
| 1123 | DEF_ELISP_FILE (eucjp-ms.el) | ||
| 1124 | }; | ||
| 1125 | int i, match; | ||
| 1126 | size_t flen = strlen (filename); | ||
| 1028 | 1127 | ||
| 1029 | if (generate_globals) | 1128 | if (generate_globals) |
| 1030 | fatal ("scanning lisp file when -g specified", 0); | 1129 | fatal ("scanning lisp file when -g specified", 0); |
| 1130 | if (flen > 3 && !strcmp (filename + flen - 3, ".el")) | ||
| 1131 | { | ||
| 1132 | for (i = 0, match = 0; i < sizeof (uncompiled) / sizeof (uncompiled[0]); | ||
| 1133 | i++) | ||
| 1134 | { | ||
| 1135 | if (uncompiled[i].fl <= flen | ||
| 1136 | && !strcmp (filename + flen - uncompiled[i].fl, uncompiled[i].fn) | ||
| 1137 | && (flen == uncompiled[i].fl | ||
| 1138 | || IS_SLASH (filename[flen - uncompiled[i].fl - 1]))) | ||
| 1139 | { | ||
| 1140 | match = 1; | ||
| 1141 | break; | ||
| 1142 | } | ||
| 1143 | } | ||
| 1144 | if (!match) | ||
| 1145 | fatal ("uncompiled lisp file %s is not supported", filename); | ||
| 1146 | } | ||
| 1031 | 1147 | ||
| 1032 | infile = fopen (filename, mode); | 1148 | infile = fopen (filename, mode); |
| 1033 | if (infile == NULL) | 1149 | if (infile == NULL) |
| 1034 | { | 1150 | { |
| 1035 | perror (filename); | 1151 | perror (filename); |
| 1036 | return 0; /* No error */ | 1152 | return 0; /* No error. */ |
| 1037 | } | 1153 | } |
| 1038 | 1154 | ||
| 1039 | c = '\n'; | 1155 | c = '\n'; |
| @@ -1110,7 +1226,7 @@ scan_lisp_file (const char *filename, const char *mode) | |||
| 1110 | type = 'F'; | 1226 | type = 'F'; |
| 1111 | read_lisp_symbol (infile, buffer); | 1227 | read_lisp_symbol (infile, buffer); |
| 1112 | 1228 | ||
| 1113 | /* Skip the arguments: either "nil" or a list in parens */ | 1229 | /* Skip the arguments: either "nil" or a list in parens. */ |
| 1114 | 1230 | ||
| 1115 | c = getc (infile); | 1231 | c = getc (infile); |
| 1116 | if (c == 'n') /* nil */ | 1232 | if (c == 'n') /* nil */ |
| @@ -1154,39 +1270,18 @@ scan_lisp_file (const char *filename, const char *mode) | |||
| 1154 | || ! strcmp (buffer, "defconst") | 1270 | || ! strcmp (buffer, "defconst") |
| 1155 | || ! strcmp (buffer, "defcustom")) | 1271 | || ! strcmp (buffer, "defcustom")) |
| 1156 | { | 1272 | { |
| 1157 | char c1 = 0, c2 = 0; | ||
| 1158 | type = 'V'; | 1273 | type = 'V'; |
| 1159 | read_lisp_symbol (infile, buffer); | 1274 | read_lisp_symbol (infile, buffer); |
| 1160 | 1275 | ||
| 1161 | if (saved_string == 0) | 1276 | if (saved_string == 0) |
| 1162 | { | 1277 | if (!search_lisp_doc_at_eol (infile)) |
| 1163 | 1278 | continue; | |
| 1164 | /* Skip until the end of line; remember two previous chars. */ | ||
| 1165 | while (c != '\n' && c != '\r' && c >= 0) | ||
| 1166 | { | ||
| 1167 | c2 = c1; | ||
| 1168 | c1 = c; | ||
| 1169 | c = getc (infile); | ||
| 1170 | } | ||
| 1171 | |||
| 1172 | /* If two previous characters were " and \, | ||
| 1173 | this is a doc string. Otherwise, there is none. */ | ||
| 1174 | if (c2 != '"' || c1 != '\\') | ||
| 1175 | { | ||
| 1176 | #ifdef DEBUG | ||
| 1177 | fprintf (stderr, "## non-docstring in %s (%s)\n", | ||
| 1178 | buffer, filename); | ||
| 1179 | #endif | ||
| 1180 | continue; | ||
| 1181 | } | ||
| 1182 | } | ||
| 1183 | } | 1279 | } |
| 1184 | 1280 | ||
| 1185 | else if (! strcmp (buffer, "custom-declare-variable") | 1281 | else if (! strcmp (buffer, "custom-declare-variable") |
| 1186 | || ! strcmp (buffer, "defvaralias") | 1282 | || ! strcmp (buffer, "defvaralias") |
| 1187 | ) | 1283 | ) |
| 1188 | { | 1284 | { |
| 1189 | char c1 = 0, c2 = 0; | ||
| 1190 | type = 'V'; | 1285 | type = 'V'; |
| 1191 | 1286 | ||
| 1192 | c = getc (infile); | 1287 | c = getc (infile); |
| @@ -1221,31 +1316,12 @@ scan_lisp_file (const char *filename, const char *mode) | |||
| 1221 | } | 1316 | } |
| 1222 | 1317 | ||
| 1223 | if (saved_string == 0) | 1318 | if (saved_string == 0) |
| 1224 | { | 1319 | if (!search_lisp_doc_at_eol (infile)) |
| 1225 | /* Skip to end of line; remember the two previous chars. */ | 1320 | continue; |
| 1226 | while (c != '\n' && c != '\r' && c >= 0) | ||
| 1227 | { | ||
| 1228 | c2 = c1; | ||
| 1229 | c1 = c; | ||
| 1230 | c = getc (infile); | ||
| 1231 | } | ||
| 1232 | |||
| 1233 | /* If two previous characters were " and \, | ||
| 1234 | this is a doc string. Otherwise, there is none. */ | ||
| 1235 | if (c2 != '"' || c1 != '\\') | ||
| 1236 | { | ||
| 1237 | #ifdef DEBUG | ||
| 1238 | fprintf (stderr, "## non-docstring in %s (%s)\n", | ||
| 1239 | buffer, filename); | ||
| 1240 | #endif | ||
| 1241 | continue; | ||
| 1242 | } | ||
| 1243 | } | ||
| 1244 | } | 1321 | } |
| 1245 | 1322 | ||
| 1246 | else if (! strcmp (buffer, "fset") || ! strcmp (buffer, "defalias")) | 1323 | else if (! strcmp (buffer, "fset") || ! strcmp (buffer, "defalias")) |
| 1247 | { | 1324 | { |
| 1248 | char c1 = 0, c2 = 0; | ||
| 1249 | type = 'F'; | 1325 | type = 'F'; |
| 1250 | 1326 | ||
| 1251 | c = getc (infile); | 1327 | c = getc (infile); |
| @@ -1278,26 +1354,8 @@ scan_lisp_file (const char *filename, const char *mode) | |||
| 1278 | } | 1354 | } |
| 1279 | 1355 | ||
| 1280 | if (saved_string == 0) | 1356 | if (saved_string == 0) |
| 1281 | { | 1357 | if (!search_lisp_doc_at_eol (infile)) |
| 1282 | /* Skip to end of line; remember the two previous chars. */ | 1358 | continue; |
| 1283 | while (c != '\n' && c != '\r' && c >= 0) | ||
| 1284 | { | ||
| 1285 | c2 = c1; | ||
| 1286 | c1 = c; | ||
| 1287 | c = getc (infile); | ||
| 1288 | } | ||
| 1289 | |||
| 1290 | /* If two previous characters were " and \, | ||
| 1291 | this is a doc string. Otherwise, there is none. */ | ||
| 1292 | if (c2 != '"' || c1 != '\\') | ||
| 1293 | { | ||
| 1294 | #ifdef DEBUG | ||
| 1295 | fprintf (stderr, "## non-docstring in %s (%s)\n", | ||
| 1296 | buffer, filename); | ||
| 1297 | #endif | ||
| 1298 | continue; | ||
| 1299 | } | ||
| 1300 | } | ||
| 1301 | } | 1359 | } |
| 1302 | 1360 | ||
| 1303 | else if (! strcmp (buffer, "autoload")) | 1361 | else if (! strcmp (buffer, "autoload")) |
| @@ -1339,29 +1397,16 @@ scan_lisp_file (const char *filename, const char *mode) | |||
| 1339 | continue; | 1397 | continue; |
| 1340 | } | 1398 | } |
| 1341 | read_c_string_or_comment (infile, 0, 0, 0); | 1399 | read_c_string_or_comment (infile, 0, 0, 0); |
| 1342 | skip_white (infile); | ||
| 1343 | 1400 | ||
| 1344 | if (saved_string == 0) | 1401 | if (saved_string == 0) |
| 1345 | { | 1402 | if (!search_lisp_doc_at_eol (infile)) |
| 1346 | /* If the next three characters aren't `dquote bslash newline' | 1403 | continue; |
| 1347 | then we're not reading a docstring. */ | ||
| 1348 | if ((c = getc (infile)) != '"' | ||
| 1349 | || (c = getc (infile)) != '\\' | ||
| 1350 | || ((c = getc (infile)) != '\n' && c != '\r')) | ||
| 1351 | { | ||
| 1352 | #ifdef DEBUG | ||
| 1353 | fprintf (stderr, "## non-docstring in %s (%s)\n", | ||
| 1354 | buffer, filename); | ||
| 1355 | #endif | ||
| 1356 | continue; | ||
| 1357 | } | ||
| 1358 | } | ||
| 1359 | } | 1404 | } |
| 1360 | 1405 | ||
| 1361 | #ifdef DEBUG | 1406 | #ifdef DEBUG |
| 1362 | else if (! strcmp (buffer, "if") | 1407 | else if (! strcmp (buffer, "if") |
| 1363 | || ! strcmp (buffer, "byte-code")) | 1408 | || ! strcmp (buffer, "byte-code")) |
| 1364 | ; | 1409 | continue; |
| 1365 | #endif | 1410 | #endif |
| 1366 | 1411 | ||
| 1367 | else | 1412 | else |
| @@ -1373,12 +1418,10 @@ scan_lisp_file (const char *filename, const char *mode) | |||
| 1373 | continue; | 1418 | continue; |
| 1374 | } | 1419 | } |
| 1375 | 1420 | ||
| 1376 | /* At this point, we should either use the previous | 1421 | /* At this point, we should either use the previous dynamic doc string in |
| 1377 | dynamic doc string in saved_string | 1422 | saved_string or gobble a doc string from the input file. |
| 1378 | or gobble a doc string from the input file. | 1423 | In the latter case, the opening quote (and leading backslash-newline) |
| 1379 | 1424 | have already been read. */ | |
| 1380 | In the latter case, the opening quote (and leading | ||
| 1381 | backslash-newline) have already been read. */ | ||
| 1382 | 1425 | ||
| 1383 | putc (037, outfile); | 1426 | putc (037, outfile); |
| 1384 | putc (type, outfile); | 1427 | putc (type, outfile); |
diff --git a/lib-src/makefile.w32-in b/lib-src/makefile.w32-in index be7f4d0b6db..cbd29f32cfe 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 W32 API. | 1 | # -*- Makefile -*- for GNU Emacs on the Microsoft Windows API. |
| 2 | # Copyright (C) 2000-2011 Free Software Foundation, Inc. | 2 | # Copyright (C) 2000-2012 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | # This file is part of GNU Emacs. | 4 | # This file is part of GNU Emacs. |
| 5 | 5 | ||
| @@ -17,33 +17,27 @@ | |||
| 17 | # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | 17 | # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
| 18 | 18 | ||
| 19 | 19 | ||
| 20 | ALL = make-docfile hexl ctags etags movemail ebrowse emacsclient | 20 | ALL = $(BLD)/test-distrib.exe $(BLD)/make-docfile.exe $(BLD)/hexl.exe\ |
| 21 | $(BLD)/ctags.exe $(BLD)/etags.exe $(BLD)/movemail.exe $(BLD)/ebrowse.exe\ | ||
| 22 | $(BLD)/emacsclient.exe $(BLD)/emacsclientw.exe $(BLD)/profile.exe | ||
| 21 | 23 | ||
| 22 | .PHONY: $(ALL) | 24 | .PHONY: make-docfile |
| 23 | 25 | ||
| 24 | LOCAL_FLAGS = -DWINDOWSNT -DDOS_NT -DNO_LDAV=1 \ | 26 | LOCAL_FLAGS = -DNO_LDAV=1 -DNO_ARCHIVES=1 -I../lib \ |
| 25 | -DNO_ARCHIVES=1 -DHAVE_CONFIG_H=1 -I../lib \ | ||
| 26 | -I../nt/inc -I../src $(EMACS_EXTRA_C_FLAGS) | 27 | -I../nt/inc -I../src $(EMACS_EXTRA_C_FLAGS) |
| 27 | 28 | ||
| 28 | LIBS = $(BASE_LIBS) $(ADVAPI32) | 29 | LIBS = $(BASE_LIBS) $(ADVAPI32) |
| 29 | 30 | ||
| 31 | # The following target is used by makefile.w32-in files in other directories. | ||
| 32 | make-docfile: $(BLD)/make-docfile.exe | ||
| 33 | |||
| 30 | $(BLD)/make-docfile.exe: $(BLD)/make-docfile.$(O) $(BLD)/ntlib.$(O) | 34 | $(BLD)/make-docfile.exe: $(BLD)/make-docfile.$(O) $(BLD)/ntlib.$(O) |
| 31 | $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/make-docfile.$(O) $(BLD)/ntlib.$(O) $(LIBS) | 35 | $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/make-docfile.$(O) $(BLD)/ntlib.$(O) $(LIBS) |
| 32 | $(BLD)/hexl.exe: $(BLD)/hexl.$(O) | 36 | $(BLD)/hexl.exe: $(BLD)/hexl.$(O) |
| 33 | $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/hexl.$(O) $(LIBS) | 37 | $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/hexl.$(O) $(LIBS) |
| 34 | $(BLD)/test-distrib.exe: $(BLD)/test-distrib.$(O) | 38 | $(BLD)/test-distrib.exe: $(BLD)/test-distrib.$(O) |
| 35 | $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/test-distrib.$(O) $(LIBS) | 39 | $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/test-distrib.$(O) $(LIBS) |
| 36 | 40 | "$(BLD)/test-distrib.exe" "$(LIB_SRC)/testfile" | |
| 37 | make-docfile: stamp_BLD $(BLD)/make-docfile.exe | ||
| 38 | ctags: stamp_BLD $(BLD)/ctags.exe | ||
| 39 | etags: stamp_BLD $(BLD)/etags.exe | ||
| 40 | ebrowse: stamp_BLD $(BLD)/ebrowse.exe | ||
| 41 | hexl: stamp_BLD $(BLD)/hexl.exe | ||
| 42 | movemail: stamp_BLD $(BLD)/movemail.exe | ||
| 43 | emacsclient: stamp_BLD $(BLD)/emacsclient.exe $(BLD)/emacsclientw.exe | ||
| 44 | |||
| 45 | test-distrib: stamp_BLD $(BLD)/test-distrib.exe | ||
| 46 | "$(BLD)/test-distrib.exe" "$(SRC)/testfile" | ||
| 47 | 41 | ||
| 48 | MOVEMAILOBJS = $(BLD)/movemail.$(O) \ | 42 | MOVEMAILOBJS = $(BLD)/movemail.$(O) \ |
| 49 | $(BLD)/pop.$(O) \ | 43 | $(BLD)/pop.$(O) \ |
| @@ -70,7 +64,7 @@ $(BLD)/emacsclient.exe: $(ECLIENTOBJS) | |||
| 70 | 64 | ||
| 71 | $(BLD)/emacsclientw.exe: $(ECLIENTOBJS) $(CLIENTRES) | 65 | $(BLD)/emacsclientw.exe: $(ECLIENTOBJS) $(CLIENTRES) |
| 72 | # put wsock32.lib before $(LIBS) to ensure we don't link to ws2_32.lib | 66 | # put wsock32.lib before $(LIBS) to ensure we don't link to ws2_32.lib |
| 73 | $(LINK) $(LINK_OUT)$@ $(CLIENTRES) -mwindows $(LINK_FLAGS) $(ECLIENTOBJS) $(WSOCK32) $(USER32) $(COMCTL32) $(LIBS) | 67 | $(LINK) $(LINK_OUT)$@ $(CLIENTRES) $(MWINDOWS) $(LINK_FLAGS) $(ECLIENTOBJS) $(WSOCK32) $(USER32) $(COMCTL32) $(LIBS) |
| 74 | 68 | ||
| 75 | $(BLD)/emacsclient.$(O): emacsclient.c | 69 | $(BLD)/emacsclient.$(O): emacsclient.c |
| 76 | $(CC) $(CFLAGS) $(ECLIENT_CFLAGS) $(CC_OUT)$@ emacsclient.c | 70 | $(CC) $(CFLAGS) $(ECLIENT_CFLAGS) $(CC_OUT)$@ emacsclient.c |
| @@ -111,10 +105,16 @@ ctags.c: etags.c | |||
| 111 | - $(DEL) ctags.c | 105 | - $(DEL) ctags.c |
| 112 | $(CP) etags.c ctags.c | 106 | $(CP) etags.c ctags.c |
| 113 | 107 | ||
| 114 | CTAGS_CFLAGS = -DCTAGS $(ETAGS_CFLAGS) -DEMACS_NAME="\"GNU Emacs\"" | 108 | CTAGS_CFLAGS = -DCTAGS $(ETAGS_CFLAGS) |
| 115 | $(BLD)/ctags.$(O): ctags.c | 109 | $(BLD)/ctags.$(O): ctags.c |
| 116 | $(CC) $(CFLAGS) $(CTAGS_CFLAGS) $(CC_OUT)$@ ctags.c | 110 | $(CC) $(CFLAGS) $(CTAGS_CFLAGS) $(CC_OUT)$@ ctags.c |
| 117 | 111 | ||
| 112 | PROFILEOBJS = $(BLD)/profile.$(O) \ | ||
| 113 | ../lib/$(BLD)/libgnu.$(A) \ | ||
| 114 | $(BLD)/ntlib.$(O) | ||
| 115 | $(BLD)/profile.exe: $(PROFILEOBJS) | ||
| 116 | $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(PROFILEOBJS) $(LIBS) | ||
| 117 | |||
| 118 | # | 118 | # |
| 119 | # From ..\src\Makefile.in | 119 | # From ..\src\Makefile.in |
| 120 | # It doesn't matter if the real name is *.obj for the files in this list, | 120 | # It doesn't matter if the real name is *.obj for the files in this list, |
| @@ -124,7 +124,7 @@ $(BLD)/ctags.$(O): ctags.c | |||
| 124 | obj = dosfns.o msdos.o \ | 124 | obj = dosfns.o msdos.o \ |
| 125 | xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \ | 125 | xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \ |
| 126 | fontset.o menu.o \ | 126 | fontset.o menu.o \ |
| 127 | w32.o w32console.o w32fns.o w32heap.o w32inevt.o \ | 127 | w32.o w32console.o w32fns.o w32heap.o w32inevt.o cygw32.o \ |
| 128 | w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o \ | 128 | w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o \ |
| 129 | font.o w32font.o w32uniscribe.o \ | 129 | font.o w32font.o w32uniscribe.o \ |
| 130 | dispnew.o frame.o scroll.o xdisp.o window.o bidi.o \ | 130 | dispnew.o frame.o scroll.o xdisp.o window.o bidi.o \ |
| @@ -140,7 +140,7 @@ obj = dosfns.o msdos.o \ | |||
| 140 | process.o callproc.o unexw32.o \ | 140 | process.o callproc.o unexw32.o \ |
| 141 | region-cache.o sound.o atimer.o \ | 141 | region-cache.o sound.o atimer.o \ |
| 142 | doprnt.o intervals.o textprop.o composite.o \ | 142 | doprnt.o intervals.o textprop.o composite.o \ |
| 143 | gnutls.o | 143 | gnutls.o xml.o profiler.o |
| 144 | 144 | ||
| 145 | # | 145 | # |
| 146 | # These are the lisp files that are loaded up in loadup.el | 146 | # These are the lisp files that are loaded up in loadup.el |
| @@ -209,39 +209,40 @@ lisp1= \ | |||
| 209 | $(lispsource)emacs-lisp/map-ynp.elc \ | 209 | $(lispsource)emacs-lisp/map-ynp.elc \ |
| 210 | $(lispsource)menu-bar.elc \ | 210 | $(lispsource)menu-bar.elc \ |
| 211 | $(lispsource)international/mule.elc \ | 211 | $(lispsource)international/mule.elc \ |
| 212 | $(lispsource)international/mule-conf.el \ | 212 | $(lispsource)international/mule-conf.elc \ |
| 213 | $(lispsource)international/mule-cmds.elc \ | 213 | $(lispsource)international/mule-cmds.elc \ |
| 214 | $(lispsource)international/characters.elc \ | 214 | $(lispsource)international/characters.elc \ |
| 215 | $(lispsource)international/charprop.el \ | 215 | $(lispsource)international/charprop.el \ |
| 216 | $(lispsource)case-table.elc | 216 | $(lispsource)case-table.elc |
| 217 | 217 | ||
| 218 | lisp2 = \ | 218 | lisp2 = \ |
| 219 | $(lispsource)language/chinese.el \ | 219 | $(lispsource)language/chinese.elc \ |
| 220 | $(lispsource)language/cyrillic.el \ | 220 | $(lispsource)language/cyrillic.elc \ |
| 221 | $(lispsource)language/indian.el \ | 221 | $(lispsource)language/indian.elc \ |
| 222 | $(lispsource)language/sinhala.el \ | 222 | $(lispsource)language/sinhala.elc \ |
| 223 | $(lispsource)language/english.el \ | 223 | $(lispsource)language/english.elc \ |
| 224 | $(lispsource)language/ethiopic.elc \ | 224 | $(lispsource)language/ethiopic.elc \ |
| 225 | $(lispsource)language/european.elc \ | 225 | $(lispsource)language/european.elc \ |
| 226 | $(lispsource)language/czech.el \ | 226 | $(lispsource)language/czech.elc \ |
| 227 | $(lispsource)language/slovak.el \ | 227 | $(lispsource)language/slovak.elc \ |
| 228 | $(lispsource)language/romanian.el \ | 228 | $(lispsource)language/romanian.elc \ |
| 229 | $(lispsource)language/greek.el \ | 229 | $(lispsource)language/greek.elc \ |
| 230 | $(lispsource)language/hebrew.elc \ | 230 | $(lispsource)language/hebrew.elc \ |
| 231 | $(lispsource)language/japanese.el \ | 231 | $(lispsource)language/japanese.elc \ |
| 232 | $(lispsource)language/korean.el \ | 232 | $(lispsource)international/cp51932.el \ |
| 233 | $(lispsource)language/lao.el \ | 233 | $(lispsource)international/eucjp-ms.el \ |
| 234 | $(lispsource)language/cham.el \ | 234 | $(lispsource)language/korean.elc \ |
| 235 | $(lispsource)language/tai-viet.el \ | 235 | $(lispsource)language/lao.elc \ |
| 236 | $(lispsource)language/thai.el \ | 236 | $(lispsource)language/cham.elc \ |
| 237 | $(lispsource)language/tai-viet.elc \ | ||
| 238 | $(lispsource)language/thai.elc \ | ||
| 237 | $(lispsource)language/tibetan.elc \ | 239 | $(lispsource)language/tibetan.elc \ |
| 238 | $(lispsource)language/vietnamese.el \ | 240 | $(lispsource)language/vietnamese.elc \ |
| 239 | $(lispsource)language/misc-lang.el \ | 241 | $(lispsource)language/misc-lang.elc \ |
| 240 | $(lispsource)language/utf-8-lang.el \ | 242 | $(lispsource)language/utf-8-lang.elc \ |
| 241 | $(lispsource)language/georgian.el \ | 243 | $(lispsource)language/georgian.elc \ |
| 242 | $(lispsource)language/khmer.el \ | 244 | $(lispsource)language/khmer.elc \ |
| 243 | $(lispsource)language/burmese.el \ | 245 | $(lispsource)language/burmese.elc \ |
| 244 | $(lispsource)paths.el \ | ||
| 245 | $(lispsource)register.elc \ | 246 | $(lispsource)register.elc \ |
| 246 | $(lispsource)replace.elc \ | 247 | $(lispsource)replace.elc \ |
| 247 | $(lispsource)simple.elc \ | 248 | $(lispsource)simple.elc \ |
| @@ -267,7 +268,7 @@ lisp2 = \ | |||
| 267 | $(WINDOW_SUPPORT) \ | 268 | $(WINDOW_SUPPORT) \ |
| 268 | $(lispsource)widget.elc \ | 269 | $(lispsource)widget.elc \ |
| 269 | $(lispsource)window.elc \ | 270 | $(lispsource)window.elc \ |
| 270 | $(lispsource)version.el | 271 | $(lispsource)version.elc |
| 271 | 272 | ||
| 272 | # This is needed the first time we build the tree, since temacs.exe | 273 | # This is needed the first time we build the tree, since temacs.exe |
| 273 | # does not exist yet, and the DOC rule needs it to rebuild DOC whenever | 274 | # does not exist yet, and the DOC rule needs it to rebuild DOC whenever |
| @@ -297,7 +298,7 @@ $(DOC): stamp_BLD $(BLD)/make-docfile.exe ../src/$(BLD)/temacs.exe $(lisp1) $(l | |||
| 297 | # | 298 | # |
| 298 | # Build the executables | 299 | # Build the executables |
| 299 | # | 300 | # |
| 300 | all: stamp_BLD $(ALL) $(DOC) | 301 | all: $(ALL) $(DOC) |
| 301 | 302 | ||
| 302 | # | 303 | # |
| 303 | # Assuming INSTALL_DIR is defined, build and install emacs in it. | 304 | # Assuming INSTALL_DIR is defined, build and install emacs in it. |
| @@ -312,6 +313,7 @@ install: $(INSTALL_FILES) | |||
| 312 | $(CP) $(BLD)/movemail.exe $(INSTALL_DIR)/bin | 313 | $(CP) $(BLD)/movemail.exe $(INSTALL_DIR)/bin |
| 313 | $(CP) $(BLD)/emacsclient.exe $(INSTALL_DIR)/bin | 314 | $(CP) $(BLD)/emacsclient.exe $(INSTALL_DIR)/bin |
| 314 | $(CP) $(BLD)/emacsclientw.exe $(INSTALL_DIR)/bin | 315 | $(CP) $(BLD)/emacsclientw.exe $(INSTALL_DIR)/bin |
| 316 | $(CP) $(BLD)/profile.exe $(INSTALL_DIR)/bin | ||
| 315 | - mkdir "$(INSTALL_DIR)/etc" | 317 | - mkdir "$(INSTALL_DIR)/etc" |
| 316 | $(CP) $(DOC) $(INSTALL_DIR)/etc | 318 | $(CP) $(DOC) $(INSTALL_DIR)/etc |
| 317 | 319 | ||
| @@ -354,114 +356,113 @@ TAGS: $(BLD)/etags.exe *.c *.h | |||
| 354 | ### DEPENDENCIES ### | 356 | ### DEPENDENCIES ### |
| 355 | 357 | ||
| 356 | EMACS_ROOT = .. | 358 | EMACS_ROOT = .. |
| 357 | SRC = . | 359 | LIB_SRC = . |
| 358 | 360 | SRC = $(EMACS_ROOT)/src | |
| 359 | $(BLD)/alloca.$(O) : \ | 361 | NT_INC = $(EMACS_ROOT)/nt/inc |
| 360 | $(SRC)/alloca.c \ | 362 | GNU_LIB = $(EMACS_ROOT)/lib |
| 361 | $(EMACS_ROOT)/src/s/ms-w32.h \ | 363 | |
| 362 | $(EMACS_ROOT)/src/m/intel386.h \ | 364 | MS_W32_H = $(NT_INC)/ms-w32.h \ |
| 363 | $(EMACS_ROOT)/src/config.h \ | 365 | $(NT_INC)/sys/stat.h |
| 364 | $(EMACS_ROOT)/src/blockinput.h | 366 | CONF_POST_H = $(SRC)/conf_post.h \ |
| 367 | $(MS_W32_H) | ||
| 368 | CONFIG_H = $(SRC)/config.h \ | ||
| 369 | $(CONF_POST_H) | ||
| 370 | INTTYPES_H = $(NT_INC)/inttypes.h \ | ||
| 371 | $(NT_INC)/stdint.h | ||
| 372 | NTLIB_H = $(LIB_SRC)/ntlib.h \ | ||
| 373 | $(NT_INC)/pwd.h | ||
| 374 | SYSTIME_H = $(SRC)/systime.h \ | ||
| 375 | $(NT_INC)/sys/time.h \ | ||
| 376 | $(GNU_LIB)/timespec.h | ||
| 377 | SYSWAIT_H = $(SRC)/syswait.h \ | ||
| 378 | $(NT_INC)/sys/wait.h | ||
| 365 | 379 | ||
| 366 | $(BLD)/ctags.$(O) : \ | 380 | $(BLD)/ctags.$(O) : \ |
| 367 | $(SRC)/ctags.c \ | 381 | $(LIB_SRC)/ctags.c \ |
| 368 | $(EMACS_ROOT)/nt/inc/sys/param.h \ | 382 | $(SRC)/regex.h \ |
| 369 | $(EMACS_ROOT)/nt/inc/sys/stat.h \ | 383 | $(NT_INC)/sys/stat.h \ |
| 370 | $(EMACS_ROOT)/src/s/ms-w32.h \ | 384 | $(NT_INC)/unistd.h \ |
| 371 | $(EMACS_ROOT)/src/m/intel386.h \ | 385 | $(GNU_LIB)/c-strcase.h \ |
| 372 | $(EMACS_ROOT)/lib-src/../src/config.h \ | 386 | $(GNU_LIB)/getopt.h \ |
| 373 | $(SRC)/ntlib.h \ | 387 | $(CONFIG_H) |
| 374 | $(EMACS_ROOT)/lib/getopt.h | ||
| 375 | 388 | ||
| 376 | $(BLD)/ebrowse.$(O) : \ | 389 | $(BLD)/ebrowse.$(O) : \ |
| 377 | $(SRC)/ebrowse.c \ | 390 | $(LIB_SRC)/ebrowse.c \ |
| 378 | $(EMACS_ROOT)/lib/min-max.h \ | 391 | $(GNU_LIB)/getopt.h \ |
| 379 | $(EMACS_ROOT)/src/s/ms-w32.h \ | 392 | $(GNU_LIB)/min-max.h \ |
| 380 | $(EMACS_ROOT)/src/m/intel386.h \ | 393 | $(CONFIG_H) |
| 381 | $(EMACS_ROOT)/lib-src/../src/config.h | ||
| 382 | 394 | ||
| 383 | $(BLD)/emacsclient.$(O) : \ | 395 | $(BLD)/emacsclient.$(O) : \ |
| 384 | $(SRC)/emacsclient.c \ | 396 | $(LIB_SRC)/emacsclient.c \ |
| 385 | $(EMACS_ROOT)/nt/inc/sys/stat.h \ | 397 | $(NT_INC)/pwd.h \ |
| 386 | $(EMACS_ROOT)/src/s/ms-w32.h \ | 398 | $(NT_INC)/sys/stat.h \ |
| 387 | $(EMACS_ROOT)/src/m/intel386.h \ | 399 | $(NT_INC)/unistd.h \ |
| 388 | $(EMACS_ROOT)/lib-src/../src/config.h | 400 | $(GNU_LIB)/getopt.h \ |
| 401 | $(CONFIG_H) | ||
| 389 | 402 | ||
| 390 | $(BLD)/etags.$(O) : \ | 403 | $(BLD)/etags.$(O) : \ |
| 391 | $(SRC)/etags.c \ | 404 | $(LIB_SRC)/etags.c \ |
| 392 | $(EMACS_ROOT)/nt/inc/sys/param.h \ | 405 | $(SRC)/regex.h \ |
| 393 | $(EMACS_ROOT)/nt/inc/sys/stat.h \ | 406 | $(NT_INC)/sys/stat.h \ |
| 394 | $(EMACS_ROOT)/src/s/ms-w32.h \ | 407 | $(NT_INC)/unistd.h \ |
| 395 | $(EMACS_ROOT)/src/m/intel386.h \ | 408 | $(GNU_LIB)/c-strcase.h \ |
| 396 | $(EMACS_ROOT)/lib-src/../src/config.h \ | 409 | $(GNU_LIB)/getopt.h \ |
| 397 | $(SRC)/ntlib.h \ | 410 | $(CONFIG_H) |
| 398 | $(EMACS_ROOT)/lib/getopt.h | ||
| 399 | |||
| 400 | $(BLD)/getdate.$(O) : \ | ||
| 401 | $(SRC)/getdate.c \ | ||
| 402 | $(EMACS_ROOT)/src/s/ms-w32.h \ | ||
| 403 | $(EMACS_ROOT)/src/m/intel386.h \ | ||
| 404 | $(EMACS_ROOT)/src/config.h \ | ||
| 405 | $(MSTOOLS_SYS)/types.h | ||
| 406 | 411 | ||
| 407 | $(BLD)/hexl.$(O) : \ | 412 | $(BLD)/hexl.$(O) : \ |
| 408 | $(SRC)/hexl.c | 413 | $(LIB_SRC)/hexl.c \ |
| 409 | 414 | $(CONFIG_H) | |
| 410 | $(BLD)/leditcfns.$(O) : \ | ||
| 411 | $(SRC)/leditcfns.c | ||
| 412 | 415 | ||
| 413 | $(BLD)/make-docfile.$(O) : \ | 416 | $(BLD)/make-docfile.$(O) : \ |
| 414 | $(SRC)/make-docfile.c \ | 417 | $(LIB_SRC)/make-docfile.c \ |
| 415 | $(EMACS_ROOT)/src/config.h | 418 | $(NT_INC)/unistd.h \ |
| 416 | 419 | $(CONFIG_H) | |
| 417 | $(BLD)/make-path.$(O) : \ | ||
| 418 | $(SRC)/make-path.c | ||
| 419 | 420 | ||
| 420 | $(BLD)/movemail.$(O) : \ | 421 | $(BLD)/movemail.$(O) : \ |
| 421 | $(SRC)/movemail.c \ | 422 | $(LIB_SRC)/movemail.c \ |
| 422 | $(EMACS_ROOT)/src/s/ms-w32.h \ | 423 | $(LIB_SRC)/pop.h \ |
| 423 | $(EMACS_ROOT)/src/m/intel386.h \ | 424 | $(NT_INC)/pwd.h \ |
| 424 | $(EMACS_ROOT)/lib-src/../src/config.h \ | 425 | $(NT_INC)/sys/file.h \ |
| 425 | $(EMACS_ROOT)/nt/inc/sys/file.h \ | 426 | $(NT_INC)/sys/stat.h \ |
| 426 | $(EMACS_ROOT)/nt/inc/sys/stat.h \ | 427 | $(NT_INC)/unistd.h \ |
| 427 | $(EMACS_ROOT)/lib-src/../src/syswait.h \ | 428 | $(GNU_LIB)/getopt.h \ |
| 428 | $(EMACS_ROOT)/nt/inc/pwd.h \ | 429 | $(CONFIG_H) \ |
| 429 | $(SRC)/ntlib.h | 430 | $(NTLIB_H) \ |
| 430 | $(CC) $(CFLAGS) -DUSG $(CC_OUT)$@ movemail.c | 431 | $(SYSWAIT_H) |
| 431 | 432 | ||
| 432 | $(BLD)/ntlib.$(O) : \ | 433 | $(BLD)/ntlib.$(O) : \ |
| 433 | $(SRC)/ntlib.c \ | 434 | $(LIB_SRC)/ntlib.c \ |
| 434 | $(SRC)/ntlib.h \ | 435 | $(NT_INC)/sys/stat.h \ |
| 435 | $(EMACS_ROOT)/nt/inc/sys/stat.h \ | 436 | $(NTLIB_H) |
| 436 | $(EMACS_ROOT)/nt/inc/pwd.h | ||
| 437 | 437 | ||
| 438 | $(BLD)/pop.$(O) : \ | 438 | $(BLD)/pop.$(O) : \ |
| 439 | $(SRC)/pop.c \ | 439 | $(LIB_SRC)/pop.c \ |
| 440 | $(SRC)/pop.h \ | 440 | $(LIB_SRC)/pop.h \ |
| 441 | $(EMACS_ROOT)/lib/min-max.h \ | 441 | $(NT_INC)/netdb.h \ |
| 442 | $(SRC)/ntlib.h | 442 | $(NT_INC)/pwd.h \ |
| 443 | $(NT_INC)/unistd.h \ | ||
| 444 | $(GNU_LIB)/min-max.h \ | ||
| 445 | $(CONFIG_H) \ | ||
| 446 | $(NTLIB_H) | ||
| 443 | 447 | ||
| 444 | $(BLD)/profile.$(O) : \ | 448 | $(BLD)/profile.$(O) : \ |
| 445 | $(SRC)/profile.c \ | 449 | $(LIB_SRC)/profile.c \ |
| 446 | $(EMACS_ROOT)/src/s/ms-w32.h \ | 450 | $(GNU_LIB)/intprops.h \ |
| 447 | $(EMACS_ROOT)/src/m/intel386.h \ | 451 | $(CONFIG_H) \ |
| 448 | $(EMACS_ROOT)/lib-src/../src/config.h \ | 452 | $(INTTYPES_H) \ |
| 449 | $(EMACS_ROOT)/lib-src/../src/systime.h | 453 | $(SYSTIME_H) |
| 450 | 454 | ||
| 451 | $(BLD)/qsort.$(O) : \ | 455 | $(BLD)/regex.$(O) : \ |
| 452 | $(SRC)/qsort.c | 456 | $(SRC)/regex.c \ |
| 453 | 457 | $(SRC)/regex.h \ | |
| 454 | $(BLD)/tcp.$(O) : \ | 458 | $(NT_INC)/stdbool.h \ |
| 455 | $(SRC)/tcp.c | 459 | $(NT_INC)/unistd.h \ |
| 460 | $(CONFIG_H) | ||
| 456 | 461 | ||
| 457 | $(BLD)/test-distrib.$(O) : \ | 462 | $(BLD)/test-distrib.$(O) : \ |
| 458 | $(SRC)/test-distrib.c | 463 | $(LIB_SRC)/test-distrib.c \ |
| 459 | 464 | $(NT_INC)/unistd.h \ | |
| 460 | $(BLD)/timer.$(O) : \ | 465 | $(CONFIG_H) |
| 461 | $(SRC)/timer.c \ | ||
| 462 | $(EMACS_ROOT)/src/s/ms-w32.h \ | ||
| 463 | $(EMACS_ROOT)/src/m/intel386.h \ | ||
| 464 | $(EMACS_ROOT)/lib-src/../src/config.h | ||
| 465 | 466 | ||
| 466 | # The following dependencies are for supporting parallel builds, where | 467 | # The following dependencies are for supporting parallel builds, where |
| 467 | # we must make sure $(BLD) exists before any compilation starts. | 468 | # we must make sure $(BLD) exists before any compilation starts. |
| @@ -472,4 +473,4 @@ $(BLD)/test-distrib.$(O) $(MOVEMAILOBJS): stamp_BLD | |||
| 472 | 473 | ||
| 473 | $(BLD)/emacsclient.$(O) $(BLD)/etags.$(O) $(BLD)/regex.$(O): stamp_BLD | 474 | $(BLD)/emacsclient.$(O) $(BLD)/etags.$(O) $(BLD)/regex.$(O): stamp_BLD |
| 474 | 475 | ||
| 475 | $(BLD)/ebrowse.$(O) $(BLD)/ctags.$(O): stamp_BLD | 476 | $(BLD)/ebrowse.$(O) $(BLD)/ctags.$(O) $(BLD)/profile.$(O): stamp_BLD |
diff --git a/lib-src/movemail.c b/lib-src/movemail.c index b6ea51f6341..264b3d292c6 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 | ||
| 4 | Copyright (C) 1986, 1992-1994, 1996, 1999, 2001-2011 | 4 | Copyright (C) 1986, 1992-1994, 1996, 1999, 2001-2012 |
| 5 | Free Software Foundation, Inc. | 5 | Free Software Foundation, Inc. |
| 6 | 6 | ||
| 7 | This file is part of GNU Emacs. | 7 | This file is part of GNU Emacs. |
| @@ -22,7 +22,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 22 | 22 | ||
| 23 | /* Important notice: defining MAIL_USE_FLOCK or MAIL_USE_LOCKF *will | 23 | /* Important notice: defining MAIL_USE_FLOCK or MAIL_USE_LOCKF *will |
| 24 | cause loss of mail* if you do it on a system that does not normally | 24 | cause loss of mail* if you do it on a system that does not normally |
| 25 | use flock as its way of interlocking access to inbox files. The | 25 | use flock/lockf as its way of interlocking access to inbox files. The |
| 26 | setting of MAIL_USE_FLOCK and MAIL_USE_LOCKF *must agree* with the | 26 | setting of MAIL_USE_FLOCK and MAIL_USE_LOCKF *must agree* with the |
| 27 | system's own conventions. It is not a choice that is up to you. | 27 | system's own conventions. It is not a choice that is up to you. |
| 28 | 28 | ||
| @@ -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,17 +96,15 @@ 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 |
| 111 | 102 | ||
| 103 | /* If your system uses the `flock' or `lockf' system call for mail locking, | ||
| 104 | define MAIL_USE_SYSTEM_LOCK. If your system type should always define | ||
| 105 | MAIL_USE_LOCKF or MAIL_USE_FLOCK but configure does not do this, | ||
| 106 | please make a bug report. */ | ||
| 107 | |||
| 112 | #ifdef MAIL_USE_LOCKF | 108 | #ifdef MAIL_USE_LOCKF |
| 113 | #define MAIL_USE_SYSTEM_LOCK | 109 | #define MAIL_USE_SYSTEM_LOCK |
| 114 | #endif | 110 | #endif |
| @@ -133,16 +129,10 @@ static char *mail_spool_name (char *); | |||
| 133 | #endif | 129 | #endif |
| 134 | #endif | 130 | #endif |
| 135 | 131 | ||
| 136 | #ifndef HAVE_STRERROR | 132 | static _Noreturn void fatal (const char *s1, const char *s2, const char *s3); |
| 137 | char *strerror (int); | ||
| 138 | #endif | ||
| 139 | |||
| 140 | static void fatal (const char *s1, const char *s2, const char *s3) NO_RETURN; | ||
| 141 | static void error (const char *s1, const char *s2, const char *s3); | 133 | static void error (const char *s1, const char *s2, const char *s3); |
| 142 | static void pfatal_with_name (char *name) NO_RETURN; | 134 | static _Noreturn void pfatal_with_name (char *name); |
| 143 | static void pfatal_and_delete (char *name) NO_RETURN; | 135 | static _Noreturn void pfatal_and_delete (char *name); |
| 144 | static char *concat (const char *s1, const char *s2, const char *s3); | ||
| 145 | static long *xmalloc (unsigned int size); | ||
| 146 | #ifdef MAIL_USE_POP | 136 | #ifdef MAIL_USE_POP |
| 147 | static int popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order); | 137 | static int popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order); |
| 148 | static int pop_retr (popserver server, int msgno, FILE *arg); | 138 | static int pop_retr (popserver server, int msgno, FILE *arg); |
| @@ -151,6 +141,21 @@ static int mbx_delimit_begin (FILE *mbf); | |||
| 151 | static int mbx_delimit_end (FILE *mbf); | 141 | static int mbx_delimit_end (FILE *mbf); |
| 152 | #endif | 142 | #endif |
| 153 | 143 | ||
| 144 | #if (defined MAIL_USE_MAILLOCK \ | ||
| 145 | || (!defined DISABLE_DIRECT_ACCESS && !defined MAIL_USE_MMDF \ | ||
| 146 | && !defined MAIL_USE_SYSTEM_LOCK)) | ||
| 147 | /* Like malloc but get fatal error if memory is exhausted. */ | ||
| 148 | |||
| 149 | static void * | ||
| 150 | xmalloc (size_t size) | ||
| 151 | { | ||
| 152 | void *result = malloc (size); | ||
| 153 | if (!result) | ||
| 154 | fatal ("virtual memory exhausted", 0, 0); | ||
| 155 | return result; | ||
| 156 | } | ||
| 157 | #endif | ||
| 158 | |||
| 154 | /* Nonzero means this is name of a lock file to delete on fatal error. */ | 159 | /* Nonzero means this is name of a lock file to delete on fatal error. */ |
| 155 | static char *delete_lockname; | 160 | static char *delete_lockname; |
| 156 | 161 | ||
| @@ -168,7 +173,7 @@ main (int argc, char **argv) | |||
| 168 | int tem; | 173 | int tem; |
| 169 | char *lockname; | 174 | char *lockname; |
| 170 | char *tempname; | 175 | char *tempname; |
| 171 | size_t inname_dirlen; | 176 | size_t inname_len, inname_dirlen; |
| 172 | int desc; | 177 | int desc; |
| 173 | #endif /* not MAIL_USE_SYSTEM_LOCK */ | 178 | #endif /* not MAIL_USE_SYSTEM_LOCK */ |
| 174 | 179 | ||
| @@ -266,13 +271,6 @@ main (int argc, char **argv) | |||
| 266 | else | 271 | else |
| 267 | #endif | 272 | #endif |
| 268 | { | 273 | { |
| 269 | #ifndef DIRECTORY_SEP | ||
| 270 | #define DIRECTORY_SEP '/' | ||
| 271 | #endif | ||
| 272 | #ifndef IS_DIRECTORY_SEP | ||
| 273 | #define IS_DIRECTORY_SEP(_c_) ((_c_) == DIRECTORY_SEP) | ||
| 274 | #endif | ||
| 275 | |||
| 276 | /* Use a lock file named after our first argument with .lock appended: | 274 | /* Use a lock file named after our first argument with .lock appended: |
| 277 | If it exists, the mail file is locked. */ | 275 | If it exists, the mail file is locked. */ |
| 278 | /* Note: this locking mechanism is *required* by the mailer | 276 | /* Note: this locking mechanism is *required* by the mailer |
| @@ -281,27 +279,23 @@ main (int argc, char **argv) | |||
| 281 | On systems that use a lock file, extracting the mail without locking | 279 | On systems that use a lock file, extracting the mail without locking |
| 282 | WILL occasionally cause loss of mail due to timing errors! | 280 | WILL occasionally cause loss of mail due to timing errors! |
| 283 | 281 | ||
| 284 | So, if creation of the lock file fails | 282 | So, if creation of the lock file fails due to access |
| 285 | due to access permission on the mail spool directory, | 283 | permission on the mail spool directory, you simply MUST |
| 286 | you simply MUST change the permission | 284 | change the permission and/or make movemail a setgid program |
| 287 | and/or make movemail a setgid program | ||
| 288 | so it can create lock files properly. | 285 | so it can create lock files properly. |
| 289 | 286 | ||
| 290 | You might also wish to verify that your system is one | 287 | You might also wish to verify that your system is one which |
| 291 | which uses lock files for this purpose. Some systems use other methods. | 288 | uses lock files for this purpose. Some systems use other methods. */ |
| 292 | 289 | ||
| 293 | If your system uses the `flock' system call for mail locking, | 290 | inname_len = strlen (inname); |
| 294 | define MAIL_USE_SYSTEM_LOCK in config.h or the s-*.h file | 291 | lockname = xmalloc (inname_len + sizeof ".lock"); |
| 295 | and recompile movemail. If the s- file for your system | 292 | strcpy (lockname, inname); |
| 296 | should define MAIL_USE_SYSTEM_LOCK but does not, send a bug report | 293 | strcpy (lockname + inname_len, ".lock"); |
| 297 | to bug-gnu-emacs@prep.ai.mit.edu so we can fix it. */ | 294 | for (inname_dirlen = inname_len; |
| 298 | |||
| 299 | lockname = concat (inname, ".lock", ""); | ||
| 300 | for (inname_dirlen = strlen (inname); | ||
| 301 | inname_dirlen && !IS_DIRECTORY_SEP (inname[inname_dirlen - 1]); | 295 | inname_dirlen && !IS_DIRECTORY_SEP (inname[inname_dirlen - 1]); |
| 302 | inname_dirlen--) | 296 | inname_dirlen--) |
| 303 | continue; | 297 | continue; |
| 304 | tempname = (char *) xmalloc (inname_dirlen + sizeof "EXXXXXX"); | 298 | tempname = xmalloc (inname_dirlen + sizeof "EXXXXXX"); |
| 305 | 299 | ||
| 306 | while (1) | 300 | while (1) |
| 307 | { | 301 | { |
| @@ -334,11 +328,8 @@ main (int argc, char **argv) | |||
| 334 | 328 | ||
| 335 | tem = link (tempname, lockname); | 329 | tem = link (tempname, lockname); |
| 336 | 330 | ||
| 337 | #ifdef EPERM | 331 | if (tem < 0 && errno != EEXIST) |
| 338 | if (tem < 0 && errno == EPERM) | 332 | pfatal_with_name (lockname); |
| 339 | fatal ("Unable to create hard link between %s and %s", | ||
| 340 | tempname, lockname); | ||
| 341 | #endif | ||
| 342 | 333 | ||
| 343 | unlink (tempname); | 334 | unlink (tempname); |
| 344 | if (tem >= 0) | 335 | if (tem >= 0) |
| @@ -548,8 +539,8 @@ main (int argc, char **argv) | |||
| 548 | wait (&wait_status); | 539 | wait (&wait_status); |
| 549 | if (!WIFEXITED (wait_status)) | 540 | if (!WIFEXITED (wait_status)) |
| 550 | exit (EXIT_FAILURE); | 541 | exit (EXIT_FAILURE); |
| 551 | else if (WRETCODE (wait_status) != 0) | 542 | else if (WEXITSTATUS (wait_status) != 0) |
| 552 | exit (WRETCODE (wait_status)); | 543 | exit (WEXITSTATUS (wait_status)); |
| 553 | 544 | ||
| 554 | #if !defined (MAIL_USE_MMDF) && !defined (MAIL_USE_SYSTEM_LOCK) | 545 | #if !defined (MAIL_USE_MMDF) && !defined (MAIL_USE_SYSTEM_LOCK) |
| 555 | #ifdef MAIL_USE_MAILLOCK | 546 | #ifdef MAIL_USE_MAILLOCK |
| @@ -583,8 +574,8 @@ mail_spool_name (char *inname) | |||
| 583 | if (stat (MAILDIR, &stat1) < 0) | 574 | if (stat (MAILDIR, &stat1) < 0) |
| 584 | return NULL; | 575 | return NULL; |
| 585 | 576 | ||
| 586 | indir = (char *) xmalloc (fname - inname + 1); | 577 | indir = xmalloc (fname - inname + 1); |
| 587 | strncpy (indir, inname, fname - inname); | 578 | memcpy (indir, inname, fname - inname); |
| 588 | indir[fname-inname] = '\0'; | 579 | indir[fname-inname] = '\0'; |
| 589 | 580 | ||
| 590 | 581 | ||
| @@ -643,33 +634,6 @@ pfatal_and_delete (char *name) | |||
| 643 | unlink (name); | 634 | unlink (name); |
| 644 | fatal ("%s for %s", s, name); | 635 | fatal ("%s for %s", s, name); |
| 645 | } | 636 | } |
| 646 | |||
| 647 | /* Return a newly-allocated string whose contents concatenate those of s1, s2, s3. */ | ||
| 648 | |||
| 649 | static char * | ||
| 650 | concat (const char *s1, const char *s2, const char *s3) | ||
| 651 | { | ||
| 652 | size_t len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3); | ||
| 653 | char *result = (char *) xmalloc (len1 + len2 + len3 + 1); | ||
| 654 | |||
| 655 | strcpy (result, s1); | ||
| 656 | strcpy (result + len1, s2); | ||
| 657 | strcpy (result + len1 + len2, s3); | ||
| 658 | *(result + len1 + len2 + len3) = 0; | ||
| 659 | |||
| 660 | return result; | ||
| 661 | } | ||
| 662 | |||
| 663 | /* Like malloc but get fatal error if memory is exhausted. */ | ||
| 664 | |||
| 665 | static long * | ||
| 666 | xmalloc (unsigned int size) | ||
| 667 | { | ||
| 668 | long *result = (long *) malloc (size); | ||
| 669 | if (!result) | ||
| 670 | fatal ("virtual memory exhausted", 0, 0); | ||
| 671 | return result; | ||
| 672 | } | ||
| 673 | 637 | ||
| 674 | /* This is the guts of the interface to the Post Office Protocol. */ | 638 | /* This is the guts of the interface to the Post Office Protocol. */ |
| 675 | 639 | ||
| @@ -851,10 +815,7 @@ pop_retr (popserver server, int msgno, FILE *arg) | |||
| 851 | 815 | ||
| 852 | if (pop_retrieve_first (server, msgno, &line)) | 816 | if (pop_retrieve_first (server, msgno, &line)) |
| 853 | { | 817 | { |
| 854 | char *msg = concat ("Error from POP server: ", pop_error, ""); | 818 | snprintf (Errmsg, sizeof Errmsg, "Error from POP server: %s", pop_error); |
| 855 | strncpy (Errmsg, msg, sizeof (Errmsg)); | ||
| 856 | Errmsg[sizeof (Errmsg)-1] = '\0'; | ||
| 857 | free (msg); | ||
| 858 | return (NOTOK); | 819 | return (NOTOK); |
| 859 | } | 820 | } |
| 860 | 821 | ||
| @@ -873,10 +834,7 @@ pop_retr (popserver server, int msgno, FILE *arg) | |||
| 873 | 834 | ||
| 874 | if (ret) | 835 | if (ret) |
| 875 | { | 836 | { |
| 876 | char *msg = concat ("Error from POP server: ", pop_error, ""); | 837 | snprintf (Errmsg, sizeof Errmsg, "Error from POP server: %s", pop_error); |
| 877 | strncpy (Errmsg, msg, sizeof (Errmsg)); | ||
| 878 | Errmsg[sizeof (Errmsg)-1] = '\0'; | ||
| 879 | free (msg); | ||
| 880 | return (NOTOK); | 838 | return (NOTOK); |
| 881 | } | 839 | } |
| 882 | 840 | ||
| @@ -939,21 +897,3 @@ mbx_delimit_end (FILE *mbf) | |||
| 939 | } | 897 | } |
| 940 | 898 | ||
| 941 | #endif /* MAIL_USE_POP */ | 899 | #endif /* MAIL_USE_POP */ |
| 942 | |||
| 943 | #ifndef HAVE_STRERROR | ||
| 944 | char * | ||
| 945 | strerror (errnum) | ||
| 946 | int errnum; | ||
| 947 | { | ||
| 948 | extern char *sys_errlist[]; | ||
| 949 | extern int sys_nerr; | ||
| 950 | |||
| 951 | if (errnum >= 0 && errnum < sys_nerr) | ||
| 952 | return sys_errlist[errnum]; | ||
| 953 | return (char *) "Unknown error"; | ||
| 954 | } | ||
| 955 | |||
| 956 | #endif /* ! HAVE_STRERROR */ | ||
| 957 | |||
| 958 | |||
| 959 | /* movemail.c ends here */ | ||
diff --git a/lib-src/ntlib.c b/lib-src/ntlib.c index 83f653f3ea3..4e125eb6d73 100644 --- a/lib-src/ntlib.c +++ b/lib-src/ntlib.c | |||
| @@ -1,5 +1,9 @@ | |||
| 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, 2001-2011 Free Software Foundation, Inc. | 2 | |
| 3 | Copyright (C) 1994, 2001-2012 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | Author: Geoff Voelker (voelker@cs.washington.edu) | ||
| 6 | Created: 10-8-94 | ||
| 3 | 7 | ||
| 4 | This file is part of GNU Emacs. | 8 | This file is part of GNU Emacs. |
| 5 | 9 | ||
| @@ -14,11 +18,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |||
| 14 | GNU General Public License for more details. | 18 | GNU General Public License for more details. |
| 15 | 19 | ||
| 16 | You should have received a copy of the GNU General Public License | 20 | You should have received a copy of the GNU General Public License |
| 17 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | 21 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 18 | |||
| 19 | |||
| 20 | Geoff Voelker (voelker@cs.washington.edu) 10-8-94 | ||
| 21 | */ | ||
| 22 | 22 | ||
| 23 | #include <windows.h> | 23 | #include <windows.h> |
| 24 | #include <stdlib.h> | 24 | #include <stdlib.h> |
| @@ -29,9 +29,17 @@ 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 | struct timezone | ||
| 38 | { | ||
| 39 | int tz_minuteswest; /* minutes west of Greenwich */ | ||
| 40 | int tz_dsttime; /* type of dst correction */ | ||
| 41 | }; | ||
| 42 | |||
| 35 | #define MAXPATHLEN _MAX_PATH | 43 | #define MAXPATHLEN _MAX_PATH |
| 36 | 44 | ||
| 37 | /* Emulate sleep...we could have done this with a define, but that | 45 | /* Emulate sleep...we could have done this with a define, but that |
| @@ -202,6 +210,29 @@ getpass (const char * prompt) | |||
| 202 | return NULL; | 210 | return NULL; |
| 203 | } | 211 | } |
| 204 | 212 | ||
| 213 | /* This is needed because lib/gettime.c calls gettimeofday, which MSVC | ||
| 214 | doesn't have. Copied from w32.c. */ | ||
| 215 | void | ||
| 216 | gettimeofday (struct timeval *tv, struct timezone *tz) | ||
| 217 | { | ||
| 218 | struct _timeb tb; | ||
| 219 | _ftime (&tb); | ||
| 220 | |||
| 221 | tv->tv_sec = tb.time; | ||
| 222 | tv->tv_usec = tb.millitm * 1000L; | ||
| 223 | /* Implementation note: _ftime sometimes doesn't update the dstflag | ||
| 224 | according to the new timezone when the system timezone is | ||
| 225 | changed. We could fix that by using GetSystemTime and | ||
| 226 | GetTimeZoneInformation, but that doesn't seem necessary, since | ||
| 227 | Emacs always calls gettimeofday with the 2nd argument NULL (see | ||
| 228 | current_emacs_time). */ | ||
| 229 | if (tz) | ||
| 230 | { | ||
| 231 | tz->tz_minuteswest = tb.timezone; /* minutes west of Greenwich */ | ||
| 232 | tz->tz_dsttime = tb.dstflag; /* type of dst correction */ | ||
| 233 | } | ||
| 234 | } | ||
| 235 | |||
| 205 | int | 236 | int |
| 206 | fchown (int fd, unsigned uid, unsigned gid) | 237 | fchown (int fd, unsigned uid, unsigned gid) |
| 207 | { | 238 | { |
| @@ -260,6 +291,7 @@ is_exec (const char * name) | |||
| 260 | stricmp (p, ".cmd") == 0)); | 291 | stricmp (p, ".cmd") == 0)); |
| 261 | } | 292 | } |
| 262 | 293 | ||
| 294 | /* FIXME? This is in config.nt now - is this still needed? */ | ||
| 263 | #define IS_DIRECTORY_SEP(x) ((x) == '/' || (x) == '\\') | 295 | #define IS_DIRECTORY_SEP(x) ((x) == '/' || (x) == '\\') |
| 264 | 296 | ||
| 265 | /* We need this because nt/inc/sys/stat.h defines struct stat that is | 297 | /* We need this because nt/inc/sys/stat.h defines struct stat that is |
| @@ -374,3 +406,9 @@ stat (const char * path, struct stat * buf) | |||
| 374 | return 0; | 406 | return 0; |
| 375 | } | 407 | } |
| 376 | 408 | ||
| 409 | int | ||
| 410 | lstat (const char * path, struct stat * buf) | ||
| 411 | { | ||
| 412 | return stat (path, buf); | ||
| 413 | } | ||
| 414 | |||
diff --git a/lib-src/ntlib.h b/lib-src/ntlib.h index be8d2a58a50..7502a8a8b34 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-2011 Free Software Foundation, Inc. | 2 | Copyright (C) 1994, 2002-2012 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | This file is part of GNU Emacs. | 4 | This file is part of GNU Emacs. |
| 5 | 5 | ||
diff --git a/lib-src/pop.c b/lib-src/pop.c index ae1000742cc..bfbcb8c9466 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 | ||
| 3 | Copyright (C) 1991, 1993, 1996-1997, 1999, 2001-2011 | 3 | Copyright (C) 1991, 1993, 1996-1997, 1999, 2001-2012 |
| 4 | Free Software Foundation, Inc. | 4 | Free Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | Author: Jonathan Kamens <jik@security.ov.com> | 6 | Author: Jonathan Kamens <jik@security.ov.com> |
| @@ -21,11 +21,7 @@ You should have received a copy of the GNU General Public License | |||
| 21 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | 21 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | #ifdef HAVE_CONFIG_H | ||
| 25 | #include <config.h> | 24 | #include <config.h> |
| 26 | #else | ||
| 27 | #define MAIL_USE_POP | ||
| 28 | #endif | ||
| 29 | 25 | ||
| 30 | #ifdef MAIL_USE_POP | 26 | #ifdef MAIL_USE_POP |
| 31 | 27 | ||
| @@ -101,7 +97,7 @@ extern char *krb_realmofhost (/* char * */); | |||
| 101 | #endif /* KERBEROS */ | 97 | #endif /* KERBEROS */ |
| 102 | 98 | ||
| 103 | #ifndef WINDOWSNT | 99 | #ifndef WINDOWSNT |
| 104 | #if !defined (HAVE_H_ERRNO) || !defined (HAVE_CONFIG_H) | 100 | #ifndef HAVE_H_ERRNO |
| 105 | extern int h_errno; | 101 | extern int h_errno; |
| 106 | #endif | 102 | #endif |
| 107 | #endif | 103 | #endif |
| @@ -344,9 +340,7 @@ pop_stat (popserver server, int *count, int *size) | |||
| 344 | if (strncmp (fromserver, "+OK ", 4)) | 340 | if (strncmp (fromserver, "+OK ", 4)) |
| 345 | { | 341 | { |
| 346 | if (0 == strncmp (fromserver, "-ERR", 4)) | 342 | if (0 == strncmp (fromserver, "-ERR", 4)) |
| 347 | { | 343 | snprintf (pop_error, ERROR_MAX, "%s", fromserver); |
| 348 | strncpy (pop_error, fromserver, ERROR_MAX); | ||
| 349 | } | ||
| 350 | else | 344 | else |
| 351 | { | 345 | { |
| 352 | strcpy (pop_error, | 346 | strcpy (pop_error, |
| @@ -447,7 +441,7 @@ pop_list (popserver server, int message, int **IDs, int **sizes) | |||
| 447 | if (strncmp (fromserver, "+OK ", 4)) | 441 | if (strncmp (fromserver, "+OK ", 4)) |
| 448 | { | 442 | { |
| 449 | if (! strncmp (fromserver, "-ERR", 4)) | 443 | if (! strncmp (fromserver, "-ERR", 4)) |
| 450 | strncpy (pop_error, fromserver, ERROR_MAX); | 444 | snprintf (pop_error, ERROR_MAX, "%s", fromserver); |
| 451 | else | 445 | else |
| 452 | { | 446 | { |
| 453 | strcpy (pop_error, | 447 | strcpy (pop_error, |
| @@ -686,7 +680,7 @@ pop_multi_first (popserver server, const char *command, char **response) | |||
| 686 | 680 | ||
| 687 | if (0 == strncmp (*response, "-ERR", 4)) | 681 | if (0 == strncmp (*response, "-ERR", 4)) |
| 688 | { | 682 | { |
| 689 | strncpy (pop_error, *response, ERROR_MAX); | 683 | snprintf (pop_error, ERROR_MAX, "%s", *response); |
| 690 | return (-1); | 684 | return (-1); |
| 691 | } | 685 | } |
| 692 | else if (0 == strncmp (*response, "+OK", 3)) | 686 | else if (0 == strncmp (*response, "+OK", 3)) |
| @@ -859,7 +853,7 @@ pop_last (popserver server) | |||
| 859 | 853 | ||
| 860 | if (! strncmp (fromserver, "-ERR", 4)) | 854 | if (! strncmp (fromserver, "-ERR", 4)) |
| 861 | { | 855 | { |
| 862 | strncpy (pop_error, fromserver, ERROR_MAX); | 856 | snprintf (pop_error, ERROR_MAX, "%s", fromserver); |
| 863 | return (-1); | 857 | return (-1); |
| 864 | } | 858 | } |
| 865 | else if (strncmp (fromserver, "+OK ", 4)) | 859 | else if (strncmp (fromserver, "+OK ", 4)) |
| @@ -1059,9 +1053,8 @@ socket_connection (char *host, int flags) | |||
| 1059 | sock = socket (PF_INET, SOCK_STREAM, 0); | 1053 | sock = socket (PF_INET, SOCK_STREAM, 0); |
| 1060 | if (sock < 0) | 1054 | if (sock < 0) |
| 1061 | { | 1055 | { |
| 1062 | strcpy (pop_error, POP_SOCKET_ERROR); | 1056 | snprintf (pop_error, ERROR_MAX, "%s%s", |
| 1063 | strncat (pop_error, strerror (errno), | 1057 | POP_SOCKET_ERROR, strerror (errno)); |
| 1064 | ERROR_MAX - sizeof (POP_SOCKET_ERROR)); | ||
| 1065 | return (-1); | 1058 | return (-1); |
| 1066 | 1059 | ||
| 1067 | } | 1060 | } |
| @@ -1090,7 +1083,7 @@ socket_connection (char *host, int flags) | |||
| 1090 | if (it->ai_addrlen == sizeof (addr)) | 1083 | if (it->ai_addrlen == sizeof (addr)) |
| 1091 | { | 1084 | { |
| 1092 | struct sockaddr_in *in_a = (struct sockaddr_in *) it->ai_addr; | 1085 | struct sockaddr_in *in_a = (struct sockaddr_in *) it->ai_addr; |
| 1093 | memcpy (&addr.sin_addr, &in_a->sin_addr, sizeof (addr.sin_addr)); | 1086 | addr.sin_addr = in_a->sin_addr; |
| 1094 | if (! connect (sock, (struct sockaddr *) &addr, sizeof (addr))) | 1087 | if (! connect (sock, (struct sockaddr *) &addr, sizeof (addr))) |
| 1095 | break; | 1088 | break; |
| 1096 | } | 1089 | } |
| @@ -1137,9 +1130,7 @@ socket_connection (char *host, int flags) | |||
| 1137 | if (! connect_ok) | 1130 | if (! connect_ok) |
| 1138 | { | 1131 | { |
| 1139 | CLOSESOCKET (sock); | 1132 | CLOSESOCKET (sock); |
| 1140 | strcpy (pop_error, CONNECT_ERROR); | 1133 | snprintf (pop_error, ERROR_MAX, "%s%s", CONNECT_ERROR, strerror (errno)); |
| 1141 | strncat (pop_error, strerror (errno), | ||
| 1142 | ERROR_MAX - sizeof (CONNECT_ERROR)); | ||
| 1143 | return (-1); | 1134 | return (-1); |
| 1144 | 1135 | ||
| 1145 | } | 1136 | } |
| @@ -1157,9 +1148,8 @@ socket_connection (char *host, int flags) | |||
| 1157 | krb5_auth_con_free (kcontext, auth_context); | 1148 | krb5_auth_con_free (kcontext, auth_context); |
| 1158 | if (kcontext) | 1149 | if (kcontext) |
| 1159 | krb5_free_context (kcontext); | 1150 | krb5_free_context (kcontext); |
| 1160 | strcpy (pop_error, KRB_ERROR); | 1151 | snprintf (pop_error, ERROR_MAX, "%s%s", |
| 1161 | strncat (pop_error, error_message (rem), | 1152 | KRB_ERROR, error_message (rem)); |
| 1162 | ERROR_MAX - sizeof (KRB_ERROR)); | ||
| 1163 | CLOSESOCKET (sock); | 1153 | CLOSESOCKET (sock); |
| 1164 | return (-1); | 1154 | return (-1); |
| 1165 | } | 1155 | } |
| @@ -1197,30 +1187,19 @@ socket_connection (char *host, int flags) | |||
| 1197 | krb5_free_principal (kcontext, server); | 1187 | krb5_free_principal (kcontext, server); |
| 1198 | if (rem) | 1188 | if (rem) |
| 1199 | { | 1189 | { |
| 1200 | strcpy (pop_error, KRB_ERROR); | 1190 | int pop_error_len = snprintf (pop_error, ERROR_MAX, "%s%s", |
| 1201 | strncat (pop_error, error_message (rem), | 1191 | KRB_ERROR, error_message (rem)); |
| 1202 | ERROR_MAX - sizeof (KRB_ERROR)); | ||
| 1203 | #if defined HAVE_KRB5_ERROR_TEXT | 1192 | #if defined HAVE_KRB5_ERROR_TEXT |
| 1204 | if (err_ret && err_ret->text.length) | 1193 | if (err_ret && err_ret->text.length) |
| 1205 | { | 1194 | { |
| 1206 | strncat (pop_error, " [server says '", | 1195 | int errlen = err_ret->text.length; |
| 1207 | ERROR_MAX - strlen (pop_error) - 1); | 1196 | snprintf (pop_error + pop_error_len, ERROR_MAX - pop_error_len, |
| 1208 | strncat (pop_error, err_ret->text.data, | 1197 | " [server says '.*%s']", errlen, err_ret->text.data); |
| 1209 | min (ERROR_MAX - strlen (pop_error) - 1, | ||
| 1210 | err_ret->text.length)); | ||
| 1211 | strncat (pop_error, "']", | ||
| 1212 | ERROR_MAX - strlen (pop_error) - 1); | ||
| 1213 | } | 1198 | } |
| 1214 | #elif defined HAVE_KRB5_ERROR_E_TEXT | 1199 | #elif defined HAVE_KRB5_ERROR_E_TEXT |
| 1215 | if (err_ret && err_ret->e_text && strlen (*err_ret->e_text)) | 1200 | if (err_ret && err_ret->e_text && **err_ret->e_text) |
| 1216 | { | 1201 | snprintf (pop_error + pop_error_len, ERRMAX - pop_error_len, |
| 1217 | strncat (pop_error, " [server says '", | 1202 | " [server says '%s']", *err_ret->e_text); |
| 1218 | ERROR_MAX - strlen (pop_error) - 1); | ||
| 1219 | strncat (pop_error, *err_ret->e_text, | ||
| 1220 | ERROR_MAX - strlen (pop_error) - 1); | ||
| 1221 | strncat (pop_error, "']", | ||
| 1222 | ERROR_MAX - strlen (pop_error) - 1); | ||
| 1223 | } | ||
| 1224 | #endif | 1203 | #endif |
| 1225 | if (err_ret) | 1204 | if (err_ret) |
| 1226 | krb5_free_error (kcontext, err_ret); | 1205 | krb5_free_error (kcontext, err_ret); |
| @@ -1241,9 +1220,7 @@ socket_connection (char *host, int flags) | |||
| 1241 | free ((char *) ticket); | 1220 | free ((char *) ticket); |
| 1242 | if (rem != KSUCCESS) | 1221 | if (rem != KSUCCESS) |
| 1243 | { | 1222 | { |
| 1244 | strcpy (pop_error, KRB_ERROR); | 1223 | snprintf (pop_error, ERROR_MAX, "%s%s", KRB_ERROR, krb_err_txt[rem]); |
| 1245 | strncat (pop_error, krb_err_txt[rem], | ||
| 1246 | ERROR_MAX - sizeof (KRB_ERROR)); | ||
| 1247 | CLOSESOCKET (sock); | 1224 | CLOSESOCKET (sock); |
| 1248 | return (-1); | 1225 | return (-1); |
| 1249 | } | 1226 | } |
| @@ -1348,9 +1325,8 @@ pop_getline (popserver server, char **line) | |||
| 1348 | server->buffer_size - server->data - 1, 0); | 1325 | server->buffer_size - server->data - 1, 0); |
| 1349 | if (ret < 0) | 1326 | if (ret < 0) |
| 1350 | { | 1327 | { |
| 1351 | strcpy (pop_error, GETLINE_ERROR); | 1328 | snprintf (pop_error, ERROR_MAX, "%s%s", |
| 1352 | strncat (pop_error, strerror (errno), | 1329 | GETLINE_ERROR, strerror (errno)); |
| 1353 | ERROR_MAX - sizeof (GETLINE_ERROR)); | ||
| 1354 | pop_trash (server); | 1330 | pop_trash (server); |
| 1355 | return (-1); | 1331 | return (-1); |
| 1356 | } | 1332 | } |
| @@ -1434,9 +1410,7 @@ sendline (popserver server, const char *line) | |||
| 1434 | if (ret < 0) | 1410 | if (ret < 0) |
| 1435 | { | 1411 | { |
| 1436 | pop_trash (server); | 1412 | pop_trash (server); |
| 1437 | strcpy (pop_error, SENDLINE_ERROR); | 1413 | snprintf (pop_error, ERROR_MAX, "%s%s", SENDLINE_ERROR, strerror (errno)); |
| 1438 | strncat (pop_error, strerror (errno), | ||
| 1439 | ERROR_MAX - sizeof (SENDLINE_ERROR)); | ||
| 1440 | return (ret); | 1414 | return (ret); |
| 1441 | } | 1415 | } |
| 1442 | 1416 | ||
| @@ -1498,8 +1472,7 @@ getok (popserver server) | |||
| 1498 | return (0); | 1472 | return (0); |
| 1499 | else if (! strncmp (fromline, "-ERR", 4)) | 1473 | else if (! strncmp (fromline, "-ERR", 4)) |
| 1500 | { | 1474 | { |
| 1501 | strncpy (pop_error, fromline, ERROR_MAX); | 1475 | snprintf (pop_error, ERROR_MAX, "%s", fromline); |
| 1502 | pop_error[ERROR_MAX-1] = '\0'; | ||
| 1503 | return (-1); | 1476 | return (-1); |
| 1504 | } | 1477 | } |
| 1505 | else | 1478 | else |
diff --git a/lib-src/pop.h b/lib-src/pop.h index bc079fcc971..682a7f93dc5 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-2011 Free Software Foundation, Inc. | 2 | Copyright (C) 1991, 1993, 2001-2012 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | Author: Jonathan Kamens <jik@security.ov.com> | 4 | Author: Jonathan Kamens <jik@security.ov.com> |
| 5 | 5 | ||
diff --git a/lib-src/profile.c b/lib-src/profile.c index 086d8cc3e9d..3489e492543 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-2011 Free Software Foundation, Inc. | 2 | Copyright (C) 1992, 1994, 1999, 2001-2012 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | Author: Boaz Ben-Zvi <boaz@lcs.mit.edu> | 4 | Author: Boaz Ben-Zvi <boaz@lcs.mit.edu> |
| 5 | 5 | ||
| @@ -20,7 +20,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | /** | 22 | /** |
| 23 | ** To be run as an emacs process. Input string that starts with: | 23 | ** To be run as an emacs subprocess. Input string that starts with: |
| 24 | ** 'z' -- resets the watch (to zero). | 24 | ** 'z' -- resets the watch (to zero). |
| 25 | ** 'p' -- return time (on stdout) as string with format <sec>.<micro-sec> | 25 | ** 'p' -- return time (on stdout) as string with format <sec>.<micro-sec> |
| 26 | ** 'q' -- exit. | 26 | ** 'q' -- exit. |
| @@ -29,53 +29,44 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 29 | ** operations: reset_watch, get_time | 29 | ** operations: reset_watch, get_time |
| 30 | */ | 30 | */ |
| 31 | #include <config.h> | 31 | #include <config.h> |
| 32 | |||
| 33 | #define SYSTIME_INLINE EXTERN_INLINE | ||
| 34 | |||
| 35 | #include <inttypes.h> | ||
| 32 | #include <stdio.h> | 36 | #include <stdio.h> |
| 37 | |||
| 38 | #include <intprops.h> | ||
| 33 | #include <systime.h> | 39 | #include <systime.h> |
| 34 | 40 | ||
| 35 | static EMACS_TIME TV1, TV2; | 41 | static EMACS_TIME TV1; |
| 36 | static int watch_not_started = 1; /* flag */ | 42 | static int watch_not_started = 1; /* flag */ |
| 37 | static char time_string[30]; | 43 | static char time_string[INT_STRLEN_BOUND (uintmax_t) + sizeof "." |
| 44 | + LOG10_EMACS_TIME_RESOLUTION]; | ||
| 38 | 45 | ||
| 39 | /* Reset the stopwatch to zero. */ | 46 | /* Reset the stopwatch to zero. */ |
| 40 | 47 | ||
| 41 | static void | 48 | static void |
| 42 | reset_watch (void) | 49 | reset_watch (void) |
| 43 | { | 50 | { |
| 44 | EMACS_GET_TIME (TV1); | 51 | TV1 = current_emacs_time (); |
| 45 | watch_not_started = 0; | 52 | watch_not_started = 0; |
| 46 | } | 53 | } |
| 47 | 54 | ||
| 48 | /* This call returns the time since the last reset_watch call. The time | 55 | /* This call returns the time since the last reset_watch call. The time |
| 49 | is returned as a string with the format <seconds>.<micro-seconds> | 56 | is returned as a string with the format <seconds>.<nanoseconds> |
| 50 | If reset_watch was not called yet, exit. */ | 57 | If reset_watch was not called yet, exit. */ |
| 51 | 58 | ||
| 52 | static char * | 59 | static char * |
| 53 | get_time (void) | 60 | get_time (void) |
| 54 | { | 61 | { |
| 62 | EMACS_TIME TV2 = sub_emacs_time (current_emacs_time (), TV1); | ||
| 63 | uintmax_t s = EMACS_SECS (TV2); | ||
| 64 | int ns = EMACS_NSECS (TV2); | ||
| 55 | if (watch_not_started) | 65 | if (watch_not_started) |
| 56 | exit (EXIT_FAILURE); /* call reset_watch first ! */ | 66 | exit (EXIT_FAILURE); /* call reset_watch first ! */ |
| 57 | EMACS_GET_TIME (TV2); | 67 | sprintf (time_string, "%"PRIuMAX".%0*d", s, LOG10_EMACS_TIME_RESOLUTION, ns); |
| 58 | EMACS_SUB_TIME (TV2, TV2, TV1); | ||
| 59 | sprintf (time_string, "%lu.%06lu", (unsigned long)EMACS_SECS (TV2), (unsigned long)EMACS_USECS (TV2)); | ||
| 60 | return time_string; | 68 | return time_string; |
| 61 | } | 69 | } |
| 62 | |||
| 63 | #if ! defined (HAVE_GETTIMEOFDAY) && defined (HAVE_TIMEVAL) | ||
| 64 | |||
| 65 | /* ARGSUSED */ | ||
| 66 | gettimeofday (tp, tzp) | ||
| 67 | struct timeval *tp; | ||
| 68 | struct timezone *tzp; | ||
| 69 | { | ||
| 70 | extern long time (); | ||
| 71 | |||
| 72 | tp->tv_sec = time ((long *)0); | ||
| 73 | tp->tv_usec = 0; | ||
| 74 | if (tzp != 0) | ||
| 75 | tzp->tz_minuteswest = -1; | ||
| 76 | } | ||
| 77 | |||
| 78 | #endif | ||
| 79 | 70 | ||
| 80 | int | 71 | int |
| 81 | main (void) | 72 | main (void) |
diff --git a/lib-src/rcs-checkin b/lib-src/rcs-checkin deleted file mode 100755 index 6861a30b40b..00000000000 --- a/lib-src/rcs-checkin +++ /dev/null | |||
| @@ -1,116 +0,0 @@ | |||
| 1 | #! /bin/sh | ||
| 2 | |||
| 3 | # This script accepts any number of file arguments and checks them into RCS. | ||
| 4 | |||
| 5 | # Copyright (C) 1993-1995, 2001-2011 Free Software Foundation, Inc. | ||
| 6 | |||
| 7 | # This file is part of GNU Emacs. | ||
| 8 | |||
| 9 | # GNU Emacs is free software: you can redistribute it and/or modify | ||
| 10 | # it under the terms of the GNU General Public License as published by | ||
| 11 | # the Free Software Foundation, either version 3 of the License, or | ||
| 12 | # (at your option) any later version. | ||
| 13 | |||
| 14 | # GNU Emacs is distributed in the hope that it will be useful, | ||
| 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | # GNU General Public License for more details. | ||
| 18 | |||
| 19 | # You should have received a copy of the GNU General Public License | ||
| 20 | # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 21 | |||
| 22 | |||
| 23 | # Arguments which are detectably either RCS masters (with names ending in ,v) | ||
| 24 | # or Emacs version files (with names of the form foo.~<number>~) are ignored. | ||
| 25 | # For each file foo, the script looks for Emacs version files related to it. | ||
| 26 | # These files are checked in as deltas, oldest first, so that the contents of | ||
| 27 | # the file itself becomes the latest revision in the master. | ||
| 28 | # | ||
| 29 | # The first line of each file is used as its description text. The file itself | ||
| 30 | # is not deleted, as under VC with vc-keep-workfiles at its default of t, but | ||
| 31 | # all the version files are. | ||
| 32 | # | ||
| 33 | # If an argument file is already version-controlled under RCS, any version | ||
| 34 | # files are added to the list of deltas and deleted, and then the workfile | ||
| 35 | # is checked in again as the latest version. This is probably not quite | ||
| 36 | # what was wanted, and is the main reason VC doesn't simply call this to | ||
| 37 | # do checkins. | ||
| 38 | # | ||
| 39 | # This script is intended to be used to convert files with an old-Emacs-style | ||
| 40 | # version history for use with VC (the Emacs 19 version-control interface), | ||
| 41 | # which likes to use RCS as its back end. It was written by Paul Eggert | ||
| 42 | # and revised/documented for use with VC by Eric S. Raymond, Mar 19 1993. | ||
| 43 | |||
| 44 | case $# in | ||
| 45 | 0) | ||
| 46 | echo "rcs-checkin: usage: rcs-checkin file ..." | ||
| 47 | echo "rcs-checkin: function: checks file.~*~ and file into a new RCS file" | ||
| 48 | echo "rcs-checkin: function: uses the file's first line for the description" | ||
| 49 | esac | ||
| 50 | |||
| 51 | # expr pattern to extract owner from ls -l output | ||
| 52 | ls_owner_pattern='[^ ][^ ]* *[^ ][^ ]* *\([^ ][^ ]*\)' | ||
| 53 | |||
| 54 | for file | ||
| 55 | do | ||
| 56 | # Make it easier to say `rcs-checkin *' | ||
| 57 | # by ignoring file names that already contain `~', or end in `,v'. | ||
| 58 | case $file in | ||
| 59 | *~* | *,v) continue | ||
| 60 | esac | ||
| 61 | # Ignore non-files too. | ||
| 62 | test -f "$file" || continue | ||
| 63 | |||
| 64 | # Check that file is readable. | ||
| 65 | test -r "$file" || exit | ||
| 66 | |||
| 67 | # If the RCS file does not already exist, | ||
| 68 | # initialize it with a description from $file's first line. | ||
| 69 | rlog -R "$file" >/dev/null 2>&1 || | ||
| 70 | rcs -i -q -t-"`sed 1q $file`" "$file" || exit | ||
| 71 | |||
| 72 | # Get list of old files. | ||
| 73 | oldfiles=` | ||
| 74 | ls $file.~[0-9]*~ 2>/dev/null | | ||
| 75 | sort -t~ -n -k 2 | ||
| 76 | ` | ||
| 77 | |||
| 78 | # Check that they are properly sorted by date. | ||
| 79 | case $oldfiles in | ||
| 80 | ?*) | ||
| 81 | oldfiles_by_date=`ls -rt $file $oldfiles` | ||
| 82 | test " $oldfiles | ||
| 83 | $file" = " $oldfiles_by_date" || { | ||
| 84 | echo >&2 "rcs-checkin: skipping $file, because its mod times are out of order. | ||
| 85 | |||
| 86 | Sorted by mod time: | ||
| 87 | $oldfiles_by_date | ||
| 88 | |||
| 89 | Sorted by name: | ||
| 90 | $oldfiles | ||
| 91 | $file" | ||
| 92 | continue | ||
| 93 | } | ||
| 94 | esac | ||
| 95 | |||
| 96 | echo >&2 rcs-checkin: checking in: $oldfiles $file | ||
| 97 | |||
| 98 | # Save $file as $file.~-~ temporarily. | ||
| 99 | mv "$file" "$file.~-~" || exit | ||
| 100 | |||
| 101 | # Rename each old file to $file, and check it in. | ||
| 102 | for oldfile in $oldfiles | ||
| 103 | do | ||
| 104 | mv "$oldfile" "$file" || exit | ||
| 105 | ls_l=`ls -l "$file"` || exit | ||
| 106 | owner=-w`expr " $ls_l" : " $ls_owner_pattern"` || owner= | ||
| 107 | echo "Formerly ${oldfile}" | ci -d -l -q $owner "$file" || exit | ||
| 108 | done | ||
| 109 | |||
| 110 | # Bring $file back from $file.~-~, and check it in. | ||
| 111 | mv "$file.~-~" "$file" || exit | ||
| 112 | ls_l=`ls -l "$file"` || exit | ||
| 113 | owner=-w`expr " $ls_l" : " $ls_owner_pattern"` || owner= | ||
| 114 | ci -d -q -u $owner -m"entered into RCS" "$file" || exit | ||
| 115 | done | ||
| 116 | |||
diff --git a/lib-src/rcs2log b/lib-src/rcs2log index 4e1dd306977..3ed54684a7e 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-2011 Free Software Foundation, Inc. | 5 | # Copyright (C) 1992-1998, 2001-2012 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 | ||
| 23 | Copyright='Copyright (C) 2011 Free Software Foundation, Inc. | 23 | Copyright='Copyright (C) 2012 Free Software Foundation, Inc. |
| 24 | This program comes with NO WARRANTY, to the extent permitted by law. | 24 | This program comes with NO WARRANTY, to the extent permitted by law. |
| 25 | You may redistribute copies of this program | 25 | You may redistribute copies of this program |
| 26 | under the terms of the GNU General Public License. | 26 | under the terms of the GNU General Public License. |
diff --git a/lib-src/test-distrib.c b/lib-src/test-distrib.c index 5ad19201118..b404c8230d1 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 | ||
| 3 | Copyright (C) 1987, 1993-1995, 1999, 2001-2011 Free Software Foundation, Inc. | 3 | Copyright (C) 1987, 1993-1995, 1999, 2001-2012 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/update-game-score.c b/lib-src/update-game-score.c index e335617df4d..59cab61aa29 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 | ||
| 3 | Copyright (C) 2002-2011 Free Software Foundation, Inc. | 3 | Copyright (C) 2002-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | Author: Colin Walters <walters@debian.org> | 5 | Author: Colin Walters <walters@debian.org> |
| 6 | 6 | ||
| @@ -42,16 +42,9 @@ 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 | 47 | #include <getopt.h> | |
| 50 | /* Needed for SunOS4, for instance. */ | ||
| 51 | extern char *optarg; | ||
| 52 | extern int optind, opterr; | ||
| 53 | |||
| 54 | static int usage (int err) NO_RETURN; | ||
| 55 | 48 | ||
| 56 | #define MAX_ATTEMPTS 5 | 49 | #define MAX_ATTEMPTS 5 |
| 57 | #define MAX_SCORES 200 | 50 | #define MAX_SCORES 200 |
| @@ -62,7 +55,7 @@ static int usage (int err) NO_RETURN; | |||
| 62 | #define difftime(t1, t0) (double)((t1) - (t0)) | 55 | #define difftime(t1, t0) (double)((t1) - (t0)) |
| 63 | #endif | 56 | #endif |
| 64 | 57 | ||
| 65 | static int | 58 | static _Noreturn void |
| 66 | usage (int err) | 59 | usage (int err) |
| 67 | { | 60 | { |
| 68 | fprintf (stdout, "Usage: update-game-score [-m MAX] [-r] [-d DIR] game/scorefile SCORE DATA\n"); | 61 | fprintf (stdout, "Usage: update-game-score [-m MAX] [-r] [-d DIR] game/scorefile SCORE DATA\n"); |
| @@ -92,34 +85,14 @@ static void sort_scores (struct score_entry *scores, int count, int reverse); | |||
| 92 | static int write_scores (const char *filename, | 85 | static int write_scores (const char *filename, |
| 93 | const struct score_entry *scores, int count); | 86 | const struct score_entry *scores, int count); |
| 94 | 87 | ||
| 95 | static void lose (const char *msg) NO_RETURN; | 88 | static _Noreturn void |
| 96 | |||
| 97 | static void | ||
| 98 | lose (const char *msg) | 89 | lose (const char *msg) |
| 99 | { | 90 | { |
| 100 | fprintf (stderr, "%s\n", msg); | 91 | fprintf (stderr, "%s\n", msg); |
| 101 | exit (EXIT_FAILURE); | 92 | exit (EXIT_FAILURE); |
| 102 | } | 93 | } |
| 103 | 94 | ||
| 104 | static void lose_syserr (const char *msg) NO_RETURN; | 95 | static _Noreturn void |
| 105 | |||
| 106 | /* Taken from sysdep.c. */ | ||
| 107 | #ifndef HAVE_STRERROR | ||
| 108 | #ifndef WINDOWSNT | ||
| 109 | char * | ||
| 110 | strerror (int errnum) | ||
| 111 | { | ||
| 112 | extern char *sys_errlist[]; | ||
| 113 | extern int sys_nerr; | ||
| 114 | |||
| 115 | if (errnum >= 0 && errnum < sys_nerr) | ||
| 116 | return sys_errlist[errnum]; | ||
| 117 | return (char *) "Unknown error"; | ||
| 118 | } | ||
| 119 | #endif /* not WINDOWSNT */ | ||
| 120 | #endif /* ! HAVE_STRERROR */ | ||
| 121 | |||
| 122 | static void | ||
| 123 | lose_syserr (const char *msg) | 96 | lose_syserr (const char *msg) |
| 124 | { | 97 | { |
| 125 | fprintf (stderr, "%s: %s\n", msg, strerror (errno)); | 98 | fprintf (stderr, "%s: %s\n", msg, strerror (errno)); |
diff --git a/lib-src/vcdiff b/lib-src/vcdiff deleted file mode 100755 index 0f975cd0ee3..00000000000 --- a/lib-src/vcdiff +++ /dev/null | |||
| @@ -1,114 +0,0 @@ | |||
| 1 | #! /bin/sh | ||
| 2 | |||
| 3 | # Enhanced sccs diff utility for use with vc mode. | ||
| 4 | # This version is more compatible with rcsdiff(1). | ||
| 5 | |||
| 6 | # Copyright (C) 1992-1993, 1995, 1997, 2001-2011 | ||
| 7 | # Free Software Foundation, Inc. | ||
| 8 | |||
| 9 | # Author: Paul Eggert | ||
| 10 | # (according to authors.el) | ||
| 11 | |||
| 12 | # This file is part of GNU Emacs. | ||
| 13 | |||
| 14 | # GNU Emacs is free software: you can redistribute it and/or modify | ||
| 15 | # it under the terms of the GNU General Public License as published by | ||
| 16 | # the Free Software Foundation, either version 3 of the License, or | ||
| 17 | # (at your option) any later version. | ||
| 18 | |||
| 19 | # GNU Emacs is distributed in the hope that it will be useful, | ||
| 20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 22 | # GNU General Public License for more details. | ||
| 23 | |||
| 24 | # You should have received a copy of the GNU General Public License | ||
| 25 | # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 26 | |||
| 27 | |||
| 28 | DIFF="diff" | ||
| 29 | usage="$0: Usage: vcdiff [--brief] [-q] [-r<sid1>] [-r<sid2>] [diffopts] sccsfile..." | ||
| 30 | |||
| 31 | # Now that we use `sccs get' rather than just `get', we don't need this. | ||
| 32 | # PATH=$PATH:/usr/ccs/bin:/usr/sccs:/usr/xpg4/bin # common SCCS hangouts | ||
| 33 | |||
| 34 | echo="echo" | ||
| 35 | sid1= sid2= | ||
| 36 | |||
| 37 | for f | ||
| 38 | do | ||
| 39 | case $f in | ||
| 40 | -*) | ||
| 41 | case $f in | ||
| 42 | --brief) | ||
| 43 | DIFF=cmp;; | ||
| 44 | -q) | ||
| 45 | echo=:;; | ||
| 46 | -r?*) | ||
| 47 | case $sid1 in | ||
| 48 | '') | ||
| 49 | sid1=$f | ||
| 50 | ;; | ||
| 51 | *) | ||
| 52 | case $sid2 in | ||
| 53 | ?*) echo "$usage" >&2; exit 2 ;; | ||
| 54 | esac | ||
| 55 | sid2=$f | ||
| 56 | ;; | ||
| 57 | esac | ||
| 58 | ;; | ||
| 59 | *) | ||
| 60 | options="$options $f" | ||
| 61 | ;; | ||
| 62 | esac | ||
| 63 | shift | ||
| 64 | ;; | ||
| 65 | *) | ||
| 66 | break | ||
| 67 | ;; | ||
| 68 | esac | ||
| 69 | done | ||
| 70 | |||
| 71 | case $# in | ||
| 72 | 0) | ||
| 73 | echo "$usage" >&2 | ||
| 74 | exit 2 | ||
| 75 | esac | ||
| 76 | |||
| 77 | |||
| 78 | rev1= rev2= status=0 | ||
| 79 | trap 'status=2; exit' 1 2 13 15 | ||
| 80 | trap 'rm -f $rev1 $rev2 || status=2; exit $status' 0 | ||
| 81 | |||
| 82 | for f | ||
| 83 | do | ||
| 84 | s=2 | ||
| 85 | |||
| 86 | case $f in | ||
| 87 | s.* | */s.*) | ||
| 88 | if | ||
| 89 | rev1=`mktemp /tmp/geta.XXXXXXXX` | ||
| 90 | sccs get -s -p -k $sid1 "$f" > $rev1 && | ||
| 91 | case $sid2 in | ||
| 92 | '') | ||
| 93 | workfile=`expr " /$f" : '.*/s.\(.*\)'` | ||
| 94 | ;; | ||
| 95 | *) | ||
| 96 | rev2=`mktemp /tmp/getb.XXXXXXXX` | ||
| 97 | sccs get -s -p -k $sid2 "$f" > $rev2 | ||
| 98 | workfile=$rev2 | ||
| 99 | esac | ||
| 100 | then | ||
| 101 | $echo $DIFF $options $rev1 $workfile >&2 | ||
| 102 | $DIFF $options $rev1 $workfile | ||
| 103 | s=$? | ||
| 104 | fi | ||
| 105 | ;; | ||
| 106 | *) | ||
| 107 | echo "$0: $f is not an SCCS file" >&2 | ||
| 108 | esac | ||
| 109 | |||
| 110 | if test $status -lt $s | ||
| 111 | then status=$s | ||
| 112 | fi | ||
| 113 | done | ||
| 114 | |||