Using saved parent location: http://bzr.savannah.gnu.org/r/emacs/trunk/ Now on revision 103381. ------------------------------------------------------------ revno: 103381 committer: Michael Albinus branch nick: trunk timestamp: Tue 2011-02-22 06:50:25 +0100 message: * eshell/esh-ext.el (eshell-external-command): Do not restrict remote check to "ftp". (Bug#8089) diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-02-21 21:25:35 +0000 +++ lisp/ChangeLog 2011-02-22 05:50:25 +0000 @@ -1,3 +1,8 @@ +2011-02-22 Seppo Sade (tiny change) + + * eshell/esh-ext.el (eshell-external-command): Do not restrict + remote check to "ftp". (Bug#8089) + 2011-02-21 Alan Mackenzie Fix bug #7930. === modified file 'lisp/eshell/esh-ext.el' --- lisp/eshell/esh-ext.el 2011-01-25 04:08:28 +0000 +++ lisp/eshell/esh-ext.el 2011-02-22 05:50:25 +0000 @@ -202,7 +202,7 @@ (defun eshell-external-command (command args) "Insert output from an external COMMAND, using ARGS." (setq args (eshell-stringify-list (eshell-flatten-list args))) - (if (string-equal (file-remote-p default-directory 'method) "ftp") + (if (file-remote-p default-directory) (eshell-remote-command command args)) (let ((interp (eshell-find-interpreter command))) (assert interp) ------------------------------------------------------------ revno: 103380 [merge] committer: Paul Eggert branch nick: trunk timestamp: Mon 2011-02-21 17:58:44 -0800 message: Merge: Assume S_ISLNK etc. work, since gnulib supports this. diff: === modified file 'ChangeLog' --- ChangeLog 2011-02-21 23:46:32 +0000 +++ ChangeLog 2011-02-22 01:55:20 +0000 @@ -1,3 +1,11 @@ +2011-02-22 Paul Eggert + + Assume S_ISLNK etc. work, since gnulib supports this. + * Makefile.in (GNULIB_MODULES): Add sys_stat. + * configure.in: Check for lstat and set HAVE_LSTAT=0 if not. + Pretend to be using the gnulib lstat module for benefit of sys/stat.h. + * configure, lib/Makefile.in, lib/gnulib.mk: Regenerate. + 2011-02-21 Paul Eggert * lib/min-max.h: New file, for "min" and "max". === modified file 'Makefile.in' --- Makefile.in 2011-02-20 10:51:50 +0000 +++ Makefile.in 2011-02-22 01:55:20 +0000 @@ -332,7 +332,7 @@ # as per $(gnulib_srcdir)/DEPENDENCIES. GNULIB_MODULES = \ crypto/md5 dtoastr filemode getloadavg getopt-gnu \ - ignore-value mktime strftime + ignore-value mktime strftime sys_stat GNULIB_TOOL_FLAGS = \ --import --no-changelog --no-vc-files --makefile-name=gnulib.mk sync-from-gnulib: $(gnulib_srcdir) === modified file 'configure' --- configure 2011-02-21 17:56:37 +0000 +++ configure 2011-02-22 01:55:20 +0000 @@ -2963,6 +2963,7 @@ as_fn_append ac_header_list " sys/stat.h" as_fn_append ac_header_list " sys/time.h" as_fn_append ac_func_list " localtime_r" +as_fn_append ac_func_list " lstat" # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false @@ -17211,6 +17212,23 @@ +# Emacs does not care about lstat's behavior on files whose names end in +# trailing slashes, so it does not use the gnulib lstat module. +# However, Emacs does want the "#define lstat stat" in sys/stat.h +# when lstat does not exist, so it pretends to use the lstat module +# even though it implements only the lstat-checking part of that module. + + + +test $ac_cv_func_lstat = yes || HAVE_LSTAT=0 + + + + GNULIB_LSTAT=1 + + + + # UNIX98 PTYs. for ac_func in grantpt do : === modified file 'configure.in' --- configure.in 2011-02-20 19:46:08 +0000 +++ configure.in 2011-02-22 01:55:20 +0000 @@ -2661,6 +2661,15 @@ gl_ASSERT_NO_GNULIB_TESTS gl_INIT +# Emacs does not care about lstat's behavior on files whose names end in +# trailing slashes, so it does not use the gnulib lstat module. +# However, Emacs does want the "#define lstat stat" in sys/stat.h +# when lstat does not exist, so it pretends to use the lstat module +# even though it implements only the lstat-checking part of that module. +AC_CHECK_FUNCS_ONCE([lstat]) +test $ac_cv_func_lstat = yes || HAVE_LSTAT=0 +gl_SYS_STAT_MODULE_INDICATOR([lstat]) + # UNIX98 PTYs. AC_CHECK_FUNCS(grantpt) === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2011-02-22 00:49:54 +0000 +++ lib-src/ChangeLog 2011-02-22 01:58:44 +0000 @@ -1,3 +1,8 @@ +2011-02-22 Paul Eggert + + Assume S_ISLNK etc. work, since gnulib supports this. + * etags.c (S_ISREG): Remove. + 2011-02-22 Juanma Barranquero * makefile.w32-in (obj): Remove filemode.o. === modified file 'lib-src/etags.c' --- lib-src/etags.c 2011-01-25 04:08:28 +0000 +++ lib-src/etags.c 2011-02-22 01:55:20 +0000 @@ -190,10 +190,6 @@ # define assert(x) ((void) 0) #endif -#if !defined (S_ISREG) && defined (S_IFREG) -# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) -#endif - #ifdef NO_LONG_OPTIONS /* define this if you don't have GNU getopt */ # define NO_LONG_OPTIONS TRUE # define getopt_long(argc,argv,optstr,lopts,lind) getopt (argc, argv, optstr) @@ -5327,7 +5323,7 @@ */ static int prolog_pr (char *s, char *last) - + /* Name of last clause. */ { int pos; @@ -5484,7 +5480,7 @@ */ static int erlang_func (char *s, char *last) - + /* Name of last clause. */ { int pos; === modified file 'lib/Makefile.in' --- lib/Makefile.in 2011-02-20 10:51:50 +0000 +++ lib/Makefile.in 2011-02-22 01:55:20 +0000 @@ -24,7 +24,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr filemode getloadavg getopt-gnu ignore-value mktime strftime +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr filemode getloadavg getopt-gnu ignore-value mktime strftime sys_stat VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ === modified file 'lib/gnulib.mk' --- lib/gnulib.mk 2011-02-20 10:51:50 +0000 +++ lib/gnulib.mk 2011-02-22 01:55:20 +0000 @@ -9,7 +9,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr filemode getloadavg getopt-gnu ignore-value mktime strftime +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr filemode getloadavg getopt-gnu ignore-value mktime strftime sys_stat MOSTLYCLEANFILES += core *.stackdump === modified file 'src/ChangeLog' --- src/ChangeLog 2011-02-21 20:00:19 +0000 +++ src/ChangeLog 2011-02-22 01:55:20 +0000 @@ -1,3 +1,22 @@ +2011-02-22 Paul Eggert + + Assume S_ISLNK etc. work, since gnulib supports this. + * config.in: Regenerate. + * dired.c (lstat): Remove. + (file_name_completion): Assume S_ISDIR works. + (file_name_completion_stat): Assume S_ISLNK works. + Do not bother calling stat unless lstat says it's a symlink. + * fileio.c (S_ISLNK, S_ISFIFO, S_ISREG, lstat): Remove. + (Fcopy_file): Assume S_ISREG and S_ISLNK work. + (check_writable, Ffile_writable_p, Fset_file_times): + Assume S_ISDIR works. + (Ffile_readable_p): Use S_IFIFO, not S_ISFIFO, to guess whether + fifos exist. + (Ffile_regular_p, Finsert_file_contents): Assumes S_ISREG works. + * filelock.c (S_ISLNK): Remove. + * lread.c (openp): Assume S_ISDIR works. + * xrdb.c (S_ISDIR): Remove. + 2011-02-21 Eli Zaretskii * makefile.w32-in ($(BLD)/filemode.$(O)): Move recipe to === modified file 'src/config.in' --- src/config.in 2011-02-20 10:53:22 +0000 +++ src/config.in 2011-02-22 01:55:20 +0000 @@ -465,6 +465,9 @@ /* Define to 1 if you have the `lrand48' function. */ #undef HAVE_LRAND48 +/* Define to 1 if you have the `lstat' function. */ +#undef HAVE_LSTAT + /* Define to 1 if using libm17n-flt. */ #undef HAVE_M17N_FLT === modified file 'src/dired.c' --- src/dired.c 2011-02-20 17:14:24 +0000 +++ src/dired.c 2011-02-22 01:55:20 +0000 @@ -84,13 +84,6 @@ struct re_registers *, Lisp_Object, int, int); -/* if system does not have symbolic links, it does not have lstat. - In that case, use ordinary stat instead. */ - -#ifndef S_IFLNK -#define lstat stat -#endif - Lisp_Object Qdirectory_files; Lisp_Object Qdirectory_files_and_attributes; Lisp_Object Qfile_name_completion; @@ -539,7 +532,7 @@ if (file_name_completion_stat (encoded_dir, dp, &st) < 0) continue; - directoryp = ((st.st_mode & S_IFMT) == S_IFDIR); + directoryp = S_ISDIR (st.st_mode); tem = Qnil; /* If all_flag is set, always include all. It would not actually be helpful to the user to ignore any possible @@ -843,20 +836,16 @@ memcpy (fullname + pos, dp->d_name, len); fullname[pos + len] = 0; -#ifdef S_IFLNK /* We want to return success if a link points to a nonexistent file, but we want to return the status for what the link points to, in case it is a directory. */ value = lstat (fullname, st_addr); - stat (fullname, st_addr); - return value; -#else - value = stat (fullname, st_addr); + if (value == 0 && S_ISLNK (st_addr->st_mode)) + stat (fullname, st_addr); #ifdef MSDOS _djstat_flags = save_djstat_flags; #endif /* MSDOS */ return value; -#endif /* S_IFLNK */ } Lisp_Object === modified file 'src/fileio.c' --- src/fileio.c 2011-02-16 18:39:46 +0000 +++ src/fileio.c 2011-02-22 01:55:20 +0000 @@ -26,18 +26,6 @@ #include #include -#if !defined (S_ISLNK) && defined (S_IFLNK) -# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) -#endif - -#if !defined (S_ISFIFO) && defined (S_IFIFO) -# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) -#endif - -#if !defined (S_ISREG) && defined (S_IFREG) -# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) -#endif - #ifdef HAVE_PWD_H #include #endif @@ -95,10 +83,6 @@ #include "commands.h" -#ifndef S_ISLNK -# define lstat stat -#endif - #ifndef FILE_SYSTEM_CASE #define FILE_SYSTEM_CASE(filename) (filename) #endif @@ -1922,7 +1906,6 @@ Fcons (file, Fcons (newname, Qnil))); } -#if defined (S_ISREG) && defined (S_ISLNK) if (input_file_statable_p) { if (!(S_ISREG (st.st_mode)) && !(S_ISLNK (st.st_mode))) @@ -1934,7 +1917,6 @@ report_file_error ("Non-regular file", Fcons (file, Qnil)); } } -#endif /* S_ISREG && S_ISLNK */ #ifdef MSDOS /* System's default file type was set to binary by _fmode in emacs.c. */ @@ -2408,7 +2390,7 @@ struct stat st; if (stat (filename, &st) < 0) return 0; - return (st.st_mode & S_IWRITE || (st.st_mode & S_IFMT) == S_IFDIR); + return (st.st_mode & S_IWRITE || S_ISDIR (st.st_mode)); #else /* not MSDOS */ #ifdef HAVE_EUIDACCESS return (euidaccess (filename, 2) >= 0); @@ -2500,7 +2482,7 @@ return Qnil; #else /* not DOS_NT and not macintosh */ flags = O_RDONLY; -#if defined (S_ISFIFO) && defined (O_NONBLOCK) +#if defined (S_IFIFO) && defined (O_NONBLOCK) /* Opening a fifo without O_NONBLOCK can wait. We don't want to wait. But we don't want to mess wth O_NONBLOCK except in the case of a fifo, on a system which handles it. */ @@ -2555,7 +2537,7 @@ should check ACLs though, which do affect this. */ if (stat (SDATA (dir), &statbuf) < 0) return Qnil; - return (statbuf.st_mode & S_IFMT) == S_IFDIR ? Qt : Qnil; + return S_ISDIR (statbuf.st_mode) ? Qt : Qnil; #else return (check_writable (!NILP (dir) ? SSDATA (dir) : "") ? Qt : Qnil); @@ -2681,7 +2663,7 @@ if (stat (SSDATA (absname), &st) < 0) return Qnil; - return (st.st_mode & S_IFMT) == S_IFDIR ? Qt : Qnil; + return S_ISDIR (st.st_mode) ? Qt : Qnil; } DEFUN ("file-accessible-directory-p", Ffile_accessible_directory_p, Sfile_accessible_directory_p, 1, 1, 0, @@ -2744,12 +2726,12 @@ if (result < 0) return Qnil; - return (st.st_mode & S_IFMT) == S_IFREG ? Qt : Qnil; + return S_ISREG (st.st_mode) ? Qt : Qnil; } #else if (stat (SSDATA (absname), &st) < 0) return Qnil; - return (st.st_mode & S_IFMT) == S_IFREG ? Qt : Qnil; + return S_ISREG (st.st_mode) ? Qt : Qnil; #endif } @@ -3007,8 +2989,7 @@ struct stat st; /* Setting times on a directory always fails. */ - if (stat (SDATA (encoded_absname), &st) == 0 - && (st.st_mode & S_IFMT) == S_IFDIR) + if (stat (SSDATA (encoded_absname), &st) == 0 && S_ISDIR (st.st_mode)) return Qnil; #endif report_file_error ("Setting file times", Fcons (absname, Qnil)); @@ -3267,7 +3248,6 @@ goto notfound; } -#ifdef S_IFREG /* This code will need to be changed in order to work on named pipes, and it's probably just not worth it. So we should at least signal an error. */ @@ -3282,7 +3262,6 @@ xsignal2 (Qfile_error, build_string ("not a regular file"), orig_filename); } -#endif if (fd < 0) if ((fd = emacs_open (SSDATA (filename), O_RDONLY, 0)) < 0) === modified file 'src/filelock.c' --- src/filelock.c 2011-02-16 15:02:50 +0000 +++ src/filelock.c 2011-02-22 01:55:20 +0000 @@ -51,10 +51,6 @@ #include #endif -#if !defined (S_ISLNK) && defined (S_IFLNK) -#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) -#endif - /* A file whose last-modified time is just after the most recent boot. Define this to be NULL to disable checking for this file. */ #ifndef BOOT_TIME_FILE === modified file 'src/lread.c' --- src/lread.c 2011-02-18 17:18:16 +0000 +++ src/lread.c 2011-02-22 01:55:20 +0000 @@ -1402,8 +1402,7 @@ encoded_fn = ENCODE_FILE (string); pfn = SSDATA (encoded_fn); - exists = (stat (pfn, &st) >= 0 - && (st.st_mode & S_IFMT) != S_IFDIR); + exists = (stat (pfn, &st) == 0 && ! S_ISDIR (st.st_mode)); if (exists) { /* Check that we can access or open it. */ @@ -4385,7 +4384,7 @@ Qdir_ok = intern_c_string ("dir-ok"); staticpro (&Qdir_ok); - + Qdo_after_load_evaluation = intern_c_string ("do-after-load-evaluation"); staticpro (&Qdo_after_load_evaluation) ; === modified file 'src/xrdb.c' --- src/xrdb.c 2011-02-14 17:21:10 +0000 +++ src/xrdb.c 2011-02-22 01:55:20 +0000 @@ -38,10 +38,6 @@ #endif #include -#if !defined(S_ISDIR) && defined(S_IFDIR) -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -#endif - #include "lisp.h" #ifdef USE_MOTIF @@ -764,4 +760,3 @@ XCloseDisplay (display); } #endif /* TESTRM */ - ------------------------------------------------------------ revno: 103379 committer: Juanma Barranquero branch nick: trunk timestamp: Tue 2011-02-22 01:49:54 +0100 message: lib-src/makefile.w32-in (obj): Remove filemode.o. diff: === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2011-02-22 00:11:56 +0000 +++ lib-src/ChangeLog 2011-02-22 00:49:54 +0000 @@ -1,3 +1,7 @@ +2011-02-22 Juanma Barranquero + + * makefile.w32-in (obj): Remove filemode.o. + 2011-02-21 Paul Eggert New file "lib/min-max.h". @@ -68,7 +72,7 @@ 2011-02-05 Paul Eggert - * emacsclient.c: conform to C89 pointer rules + * emacsclient.c: Conform to C89 pointer rules. (file_name_absolute_p): Accept const char *, not const unsigned char *, to satisfy C89 rules. @@ -226,7 +230,7 @@ * test-distrib.c (cool_read): * movemail.c (main, concat): * make-docfile.c (scan_file, write_c_args): - * emacsclient.c (get_server_config): Fix -Wconversion warning. + * emacsclient.c (get_server_config): Fix -Wconversion warning. (egetenv): Move conditional definition earlier. (progname): Use const. * sorted-doc.c (xstrdup): Use const. === modified file 'lib-src/makefile.w32-in' --- lib-src/makefile.w32-in 2011-02-21 20:00:19 +0000 +++ lib-src/makefile.w32-in 2011-02-22 00:49:54 +0000 @@ -135,7 +135,7 @@ cm.o term.o terminal.o xfaces.o \ emacs.o keyboard.o macros.o keymap.o sysdep.o \ buffer.o filelock.o insdel.o marker.o \ - minibuf.o fileio.o dired.o filemode.o \ + minibuf.o fileio.o dired.o \ cmds.o casetab.o casefiddle.o indent.o search.o regex.o undo.o \ alloc.o data.o doc.o editfns.o callint.o \ eval.o floatfns.o fns.o print.o lread.o \ ------------------------------------------------------------ revno: 103378 [merge] committer: Paul Eggert branch nick: trunk timestamp: Mon 2011-02-21 16:15:53 -0800 message: Merge: minor lib-src cleanups diff: === modified file 'ChangeLog' --- ChangeLog 2011-02-21 20:16:43 +0000 +++ ChangeLog 2011-02-21 23:46:32 +0000 @@ -1,3 +1,7 @@ +2011-02-21 Paul Eggert + + * lib/min-max.h: New file, for "min" and "max". + 2011-02-21 Christoph Scholtes * lib/makefile.w32-in: ($(BLD)/md5.$(O)): Added dependency on === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2011-02-21 20:00:19 +0000 +++ lib-src/ChangeLog 2011-02-22 00:11:56 +0000 @@ -1,3 +1,32 @@ +2011-02-21 Paul Eggert + + New file "lib/min-max.h". + * ebrowse.c (min, max): Define them by including + instead of defining it ourselves. + * pop.c (min): Likewise. + * Makefile.in (ebrowse${EXEEXT}, pop.o): Depend on min-max.h. + + * movemail.c (popmail): Report fchown failure instead of ignoring it. + But if the file already has the right ownership, don't worry about it. + + * make-docfile.c (input_buffer): Rename variables to avoid shadowing. + * test-distrib.c (buf): Make this local, to avoid shadowing. + + * movemail.c (main, pop_retr): Rename locals to avoid shadowing. + (progname, sfi, sfo, ibuffer, obuffer): Remove unused vars. + (DONE): Remove unused macro. + (DIRECTORY_SEP, IS_DIRECTORY_SEP, IS_FROM_LINE): + Define these macros only in the contexts that need them. + * pop.c (index): Remove unused macro. + (KPOP_PORT): Define only if KERBEROS is defined. + + Declare file-scope functions and variables static if not exported. + This is more consistent, and is nicer with gcc -Wstrict-prototypes. + * ebrowse.c, emacsclient.c, fakemail.c, make-docfile.c, movemail.c: + * profile.c, test-distrib.c, update-game-score.c: + Declare non-'main' functions and variables to be static. + * ebrowse.c: Omit redundant function prototypes. + 2011-02-21 Eli Zaretskii * makefile.w32-in ($(BLD)/ctags.$(O), $(BLD)/emacsclient.$(O)) === modified file 'lib-src/Makefile.in' --- lib-src/Makefile.in 2011-01-25 04:08:28 +0000 +++ lib-src/Makefile.in 2011-02-22 00:08:53 +0000 @@ -325,7 +325,7 @@ -DVERSION="\"${version}\"" ${srcdir}/etags.c \ $(REGEXPOBJ) $(LOADLIBES) -o etags -ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ../src/config.h +ebrowse${EXEEXT}: ${srcdir}/ebrowse.c ${srcdir}/../lib/min-max.h ../src/config.h $(CC) ${ALL_CFLAGS} -DVERSION="\"${version}\"" \ ${srcdir}/ebrowse.c $(LOADLIBES) -o ebrowse @@ -350,7 +350,7 @@ movemail.o: ${srcdir}/movemail.c ../src/config.h $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/movemail.c -pop.o: ${srcdir}/pop.c ../src/config.h +pop.o: ${srcdir}/pop.c ${srcdir}/../lib/min-max.h ../src/config.h $(CC) -c ${CPP_CFLAGS} ${MOVE_FLAGS} ${srcdir}/pop.c fakemail${EXEEXT}: ${srcdir}/fakemail.c ../src/config.h === modified file 'lib-src/ebrowse.c' --- lib-src/ebrowse.c 2011-01-31 08:12:52 +0000 +++ lib-src/ebrowse.c 2011-02-21 23:22:34 +0000 @@ -41,12 +41,7 @@ #define streq(X, Y) (*(X) == *(Y) && strcmp ((X) + 1, (Y) + 1) == 0) -/* The ubiquitous `max' and `min' macros. */ - -#ifndef max -#define max(X, Y) ((X) > (Y) ? (X) : (Y)) -#define min(X, Y) ((X) < (Y) ? (X) : (Y)) -#endif +#include /* Files are read in chunks of this number of bytes. */ @@ -465,59 +460,16 @@ /* Function prototypes. */ -int yylex (void); -void yyparse (void); -void re_init_parser (void); -const char *token_string (int); -char *matching_regexp (void); -void init_sym (void); -struct sym *add_sym (const char *, struct sym *); -void add_link (struct sym *, struct sym *); -void add_member_defn (struct sym *, char *, char *, - int, unsigned, int, int, int); -void add_member_decl (struct sym *, char *, char *, int, - unsigned, int, int, int, int); -void dump_roots (FILE *); -void *xmalloc (int); -void xfree (void *); -void add_global_defn (char *, char *, int, unsigned, int, int, int); -void add_global_decl (char *, char *, int, unsigned, int, int, int); -void add_define (char *, char *, int); -void mark_inherited_virtual (void); -void leave_namespace (void); -void enter_namespace (char *); -void register_namespace_alias (char *, struct link *); -void insert_keyword (const char *, int); -void re_init_scanner (void); -void init_scanner (void); -void process_file (char *); -void add_search_path (char *); -FILE *open_file (char *); -int process_pp_line (void); -int dump_members (FILE *, struct member *); -void dump_sym (FILE *, struct sym *); -int dump_tree (FILE *, struct sym *); -struct member *find_member (struct sym *, char *, int, int, unsigned); -struct member *add_member (struct sym *, char *, int, int, unsigned); -void mark_virtual (struct sym *); -struct sym *make_namespace (char *, struct sym *); -char *sym_scope (struct sym *); -char *sym_scope_1 (struct sym *); -int skip_to (int); -void skip_matching (void); -void member (struct sym *, int); -void class_body (struct sym *, int); -void class_definition (struct sym *, int, int, int); -void declaration (int); -unsigned parm_list (int *); -char *operator_name (int *); -struct sym *parse_classname (void); -struct sym *parse_qualified_ident_or_type (char **); -void parse_qualified_param_ident_or_type (char **); -int globals (int); -void yyerror (const char *, const char *); -void usage (int) NO_RETURN; -void version (void) NO_RETURN; +static char *matching_regexp (void); +static struct sym *add_sym (const char *, struct sym *); +static void add_global_defn (char *, char *, int, unsigned, int, int, int); +static void add_global_decl (char *, char *, int, unsigned, int, int, int); +static struct member *add_member (struct sym *, char *, int, int, unsigned); +static void class_definition (struct sym *, int, int, int); +static char *operator_name (int *); +static void parse_qualified_param_ident_or_type (char **); +static void usage (int) NO_RETURN; +static void version (void) NO_RETURN; @@ -528,7 +480,7 @@ /* Print an error in a printf-like style with the current input file name and line number. */ -void +static void yyerror (const char *format, const char *s) { fprintf (stderr, "%s:%d: ", filename, yyline); @@ -540,7 +492,7 @@ /* Like malloc but print an error and exit if not enough memory is available. */ -void * +static void * xmalloc (int nbytes) { void *p = malloc (nbytes); @@ -555,7 +507,7 @@ /* Like realloc but print an error and exit if out of memory. */ -void * +static void * xrealloc (void *p, int sz) { p = realloc (p, sz); @@ -571,7 +523,7 @@ /* Like strdup, but print an error and exit if not enough memory is available.. If S is null, return null. */ -char * +static char * xstrdup (char *s) { if (s) @@ -588,7 +540,7 @@ /* Initialize the symbol table. This currently only sets up the special symbol for globals (`*Globals*'). */ -void +static void init_sym (void) { global_symbols = add_sym (GLOBALS_NAME, NULL); @@ -602,7 +554,7 @@ If a symbol for NAME already exists, return that. Otherwise create a new symbol and set it to default values. */ -struct sym * +static struct sym * add_sym (const char *name, struct sym *nested_in_class) { struct sym *sym; @@ -643,7 +595,7 @@ /* Add links between superclass SUPER and subclass SUB. */ -void +static void add_link (struct sym *super, struct sym *sub) { struct link *lnk, *lnk2, *p, *prev; @@ -683,7 +635,7 @@ parameter types of functions. Value is a pointer to the member found or null if not found. */ -struct member * +static struct member * find_member (struct sym *cls, char *name, int var, int sc, unsigned int hash) { struct member **list; @@ -733,7 +685,7 @@ a bit set giving additional information about the member (see the F_* defines). */ -void +static void add_member_decl (struct sym *cls, char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int vis, int flags) { struct member *m; @@ -781,7 +733,7 @@ a bit set giving additional information about the member (see the F_* defines). */ -void +static void add_member_defn (struct sym *cls, char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags) { struct member *m; @@ -823,7 +775,7 @@ REGEXP is a regular expression matching the define in the source, if it is non-null. POS is the position in the file. */ -void +static void add_define (char *name, char *regexp, int pos) { add_global_defn (name, regexp, pos, 0, 1, SC_FRIEND, F_DEFINE); @@ -841,7 +793,7 @@ a bit set giving additional information about the member (see the F_* defines). */ -void +static void add_global_defn (char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags) { int i; @@ -872,7 +824,7 @@ a bit set giving additional information about the member (see the F_* defines). */ -void +static void add_global_decl (char *name, char *regexp, int pos, unsigned int hash, int var, int sc, int flags) { /* Add declaration only if not already declared. Header files must @@ -911,7 +863,7 @@ member. HASH is a hash code for the parameter types of a function. Value is a pointer to the member's structure. */ -struct member * +static struct member * add_member (struct sym *cls, char *name, int var, int sc, unsigned int hash) { struct member *m = (struct member *) xmalloc (sizeof *m + strlen (name)); @@ -982,7 +934,7 @@ recursively, marking functions as virtual that are declared virtual in base classes. */ -void +static void mark_virtual (struct sym *r) { struct link *p; @@ -1006,7 +958,7 @@ /* For all roots of the class tree, mark functions as virtual that are virtual because of a virtual declaration in a base class. */ -void +static void mark_inherited_virtual (void) { struct sym *r; @@ -1021,7 +973,7 @@ /* Create and return a symbol for a namespace with name NAME. */ -struct sym * +static struct sym * make_namespace (char *name, struct sym *context) { struct sym *s = (struct sym *) xmalloc (sizeof *s + strlen (name)); @@ -1036,7 +988,7 @@ /* Find the symbol for namespace NAME. If not found, retrun NULL */ -struct sym * +static struct sym * check_namespace (char *name, struct sym *context) { struct sym *p = NULL; @@ -1053,7 +1005,7 @@ /* Find the symbol for namespace NAME. If not found, add a new symbol for NAME to all_namespaces. */ -struct sym * +static struct sym * find_namespace (char *name, struct sym *context) { struct sym *p = check_namespace (name, context); @@ -1067,7 +1019,7 @@ /* Find namespace alias with name NAME. If not found return NULL. */ -struct link * +static struct link * check_namespace_alias (char *name) { struct link *p = NULL; @@ -1091,7 +1043,7 @@ /* Register the name NEW_NAME as an alias for namespace list OLD_NAME. */ -void +static void register_namespace_alias (char *new_name, struct link *old_name) { unsigned h; @@ -1119,7 +1071,7 @@ /* Enter namespace with name NAME. */ -void +static void enter_namespace (char *name) { struct sym *p = find_namespace (name, current_namespace); @@ -1140,7 +1092,7 @@ /* Leave the current namespace. */ -void +static void leave_namespace (void) { assert (namespace_sp > 0); @@ -1182,7 +1134,7 @@ /* Make sure scope_buffer has enough room to add LEN chars to it. */ -void +static void ensure_scope_buffer_room (int len) { if (scope_buffer_len + len >= scope_buffer_size) @@ -1198,7 +1150,7 @@ namespaces to scope_buffer. Value is a pointer to the complete scope name constructed. */ -char * +static char * sym_scope_1 (struct sym *p) { int len; @@ -1232,7 +1184,7 @@ /* Return the scope of symbol P in printed representation, i.e. as it would appear in a C*+ source file. */ -char * +static char * sym_scope (struct sym *p) { if (!scope_buffer) @@ -1254,7 +1206,7 @@ /* Dump the list of members M to file FP. Value is the length of the list. */ -int +static int dump_members (FILE *fp, struct member *m) { int n; @@ -1287,7 +1239,7 @@ /* Dump class ROOT to stream FP. */ -void +static void dump_sym (FILE *fp, struct sym *root) { fputs (CLASS_STRUCT, fp); @@ -1313,7 +1265,7 @@ /* Dump class ROOT and its subclasses to file FP. Value is the number of classes written. */ -int +static int dump_tree (FILE *fp, struct sym *root) { struct link *lk; @@ -1360,7 +1312,7 @@ /* Dump the entire class tree to file FP. */ -void +static void dump_roots (FILE *fp) { int i, n = 0; @@ -1434,7 +1386,7 @@ /* Process a preprocessor line. Value is the next character from the input buffer not consumed. */ -int +static int process_pp_line (void) { int in_comment = 0, in_string = 0; @@ -1505,7 +1457,7 @@ /* Value is the next token from the input buffer. */ -int +static int yylex (void) { int c; @@ -1927,7 +1879,7 @@ position in the input buffer, or maybe a bit more if that string is shorter than min_regexp. */ -char * +static char * matching_regexp (void) { char *p; @@ -1978,7 +1930,7 @@ /* Return a printable representation of token T. */ -const char * +static const char * token_string (int t) { static char b[3]; @@ -2095,7 +2047,7 @@ /* Reinitialize the scanner for a new input file. */ -void +static void re_init_scanner (void) { in = inbuffer; @@ -2113,7 +2065,7 @@ /* Insert a keyword NAME with token value TK into the keyword hash table. */ -void +static void insert_keyword (const char *name, int tk) { const char *s; @@ -2134,7 +2086,7 @@ /* Initialize the scanner for the first file. This sets up the character class vectors and fills the keyword hash table. */ -void +static void init_scanner (void) { int i; @@ -2278,7 +2230,7 @@ /* Skip forward until a given token TOKEN or YYEOF is seen and return the current lookahead token after skipping. */ -int +static int skip_to (int token) { while (!LOOKING_AT2 (YYEOF, token)) @@ -2289,7 +2241,7 @@ /* Skip over pairs of tokens (parentheses, square brackets, angle brackets, curly brackets) matching the current lookahead. */ -void +static void skip_matching (void) { int open, close, n; @@ -2332,7 +2284,7 @@ } } -void +static void skip_initializer (void) { for (;;) @@ -2359,7 +2311,7 @@ /* Build qualified namespace alias (A::B::c) and return it. */ -struct link * +static struct link * match_qualified_namespace_alias (void) { struct link *head = NULL; @@ -2396,7 +2348,7 @@ /* Re-initialize the parser by resetting the lookahead token. */ -void +static void re_init_parser (void) { tk = -1; @@ -2409,7 +2361,7 @@ Returns a hash code for the parameter types. This value is used to distinguish between overloaded functions. */ -unsigned +static unsigned parm_list (int *flags) { unsigned hash = 0; @@ -2522,7 +2474,7 @@ /* Print position info to stdout. */ -void +static void print_info (void) { if (info_position >= 0 && BUFFER_POS () <= info_position) @@ -2537,7 +2489,7 @@ the access specifier for the member (private, protected, public). */ -void +static void member (struct sym *cls, int vis) { char *id = NULL; @@ -2746,7 +2698,7 @@ /* Parse the body of class CLS. TAG is the tag of the class (struct, union, class). */ -void +static void class_body (struct sym *cls, int tag) { int vis = tag == CLASS ? PRIVATE : PUBLIC; @@ -2807,7 +2759,7 @@ qualified ident has the form `X<..>::Y<...>::T<...>. Returns a symbol for that class. */ -struct sym * +static struct sym * parse_classname (void) { struct sym *last_class = NULL; @@ -2837,7 +2789,7 @@ implicitly static operator has been parsed. Value is a pointer to a static buffer holding the constructed operator name string. */ -char * +static char * operator_name (int *sc) { static int id_size = 0; @@ -2927,7 +2879,7 @@ `X::Y::z'. This IDENT is returned in LAST_ID. Value is the symbol structure for the ident. */ -struct sym * +static struct sym * parse_qualified_ident_or_type (char **last_id) { struct sym *cls = NULL; @@ -2992,7 +2944,7 @@ `X::Y::z'. This IDENT is returned in LAST_ID. Value is the symbol structure for the ident. */ -void +static void parse_qualified_param_ident_or_type (char **last_id) { struct sym *cls = NULL; @@ -3034,7 +2986,7 @@ Current lookahead is the class name. */ -void +static void class_definition (struct sym *containing, int tag, int flags, int nested) { struct sym *current; @@ -3131,7 +3083,7 @@ the storage class of *ID. FLAGS is a bit set giving additional information about the member (see the F_* defines). */ -void +static void add_declarator (struct sym **cls, char **id, int flags, int sc) { if (LOOKING_AT2 (';', ',')) @@ -3174,7 +3126,7 @@ /* Parse a declaration. */ -void +static void declaration (int flags) { char *id = NULL; @@ -3328,7 +3280,7 @@ parsing in an `extern "C"' block. Value is 1 if EOF is reached, 0 otherwise. */ -int +static int globals (int start_flags) { int anonymous; @@ -3446,7 +3398,7 @@ /* Parse the current input file. */ -void +static void yyparse (void) { while (globals (0) == 0) @@ -3462,7 +3414,7 @@ /* Add the list of paths PATH_LIST to the current search path for input files. */ -void +static void add_search_path (char *path_list) { while (*path_list) @@ -3497,7 +3449,7 @@ opened. Try to find FILE in search_path first, then try the unchanged file name. */ -FILE * +static FILE * open_file (char *file) { FILE *fp = NULL; @@ -3556,7 +3508,7 @@ --version display version info\n\ " -void +static void usage (int error) { puts (USAGE); @@ -3571,7 +3523,7 @@ # define VERSION "21" #endif -void +static void version (void) { /* Makes it easier to update automatically. */ @@ -3587,7 +3539,7 @@ /* Parse one input file FILE, adding classes and members to the symbol table. */ -void +static void process_file (char *file) { FILE *fp; @@ -3642,7 +3594,7 @@ containing its contents without the terminating newline. Value is null when EOF is reached. */ -char * +static char * read_line (FILE *fp) { static char *buffer; === modified file 'lib-src/emacsclient.c' --- lib-src/emacsclient.c 2011-02-18 22:28:09 +0000 +++ lib-src/emacsclient.c 2011-02-21 18:06:25 +0000 @@ -150,8 +150,8 @@ /* PID of the Emacs server process. */ int emacs_pid = 0; -void print_help_and_exit (void) NO_RETURN; -void fail (void) NO_RETURN; +static void print_help_and_exit (void) NO_RETURN; +static void fail (void) NO_RETURN; struct option longopts[] = @@ -178,7 +178,7 @@ /* Like malloc but get fatal error if memory is exhausted. */ -long * +static long * xmalloc (unsigned int size) { long *result = (long *) malloc (size); @@ -192,7 +192,7 @@ /* Like strdup but get a fatal error if memory is exhausted. */ -char * +static char * xstrdup (const char *s) { char *result = strdup (s); @@ -473,7 +473,7 @@ /* Display a normal or error message. On Windows, use a message box if compiled as a Windows app. */ -void +static void message (int is_error, const char *message, ...) { char msg[2048]; @@ -504,7 +504,7 @@ /* Decode the options from argv and argc. The global variable `optind' will say how many arguments we used up. */ -void +static void decode_options (int argc, char **argv) { alternate_editor = egetenv ("ALTERNATE_EDITOR"); @@ -630,7 +630,7 @@ } -void +static void print_help_and_exit (void) { /* Spaces and tabs are significant in this message; they're chosen so the @@ -675,7 +675,7 @@ defined-- exit with an errorcode. Uses argv, but gets it from the global variable main_argv. */ -void +static void fail (void) { if (alternate_editor) @@ -718,7 +718,7 @@ /* On Windows, the socket library was historically separate from the standard C library, so errors are handled differently. */ -void +static void sock_err_message (const char *function_name) { #ifdef WINDOWSNT @@ -742,7 +742,7 @@ - the data ends in "\n", or - the buffer is full (but this shouldn't happen) Otherwise, we just accumulate it. */ -void +static void send_to_emacs (HSOCKET s, const char *data) { while (data) @@ -781,7 +781,7 @@ return value never contains a space. Does not change the string. Outputs the result to S. */ -void +static void quote_argument (HSOCKET s, const char *str) { char *copy = (char *) xmalloc (strlen (str) * 2 + 1); @@ -822,7 +822,7 @@ /* The inverse of quote_argument. Removes quoting in string STR by modifying the string in place. Returns STR. */ -char * +static char * unquote_argument (char *str) { char *p, *q; @@ -853,7 +853,7 @@ } -int +static int file_name_absolute_p (const char *filename) { /* Sanity check, it shouldn't happen. */ @@ -907,7 +907,7 @@ * Read the information needed to set up a TCP comm channel with * the Emacs server: host, port, and authentication string. */ -int +static int get_server_config (struct sockaddr_in *server, char *authentication) { char dotted[32]; @@ -965,7 +965,7 @@ return TRUE; } -HSOCKET +static HSOCKET set_tcp_socket (void) { HSOCKET s; @@ -1024,7 +1024,7 @@ and the name in TTY_NAME, and return 1. Otherwise, fail if NOABORT is zero, or return 0 if NOABORT is non-zero. */ -int +static int find_tty (char **tty_type, char **tty_name, int noabort) { char *type = egetenv ("TERM"); @@ -1097,7 +1097,7 @@ /* A signal handler that passes the signal to the Emacs process. Useful for SIGWINCH. */ -SIGTYPE +static SIGTYPE pass_signal_to_emacs (int signalnum) { int old_errno = errno; @@ -1112,7 +1112,7 @@ /* Signal handler for SIGCONT; notify the Emacs process that it can now resume our tty frame. */ -SIGTYPE +static SIGTYPE handle_sigcont (int signalnum) { int old_errno = errno; @@ -1138,7 +1138,7 @@ reality, we may get a SIGTSTP on C-z. Handling this signal and notifying Emacs about it should get things under control again. */ -SIGTYPE +static SIGTYPE handle_sigtstp (int signalnum) { int old_errno = errno; @@ -1162,7 +1162,7 @@ /* Set up signal handlers before opening a frame on the current tty. */ -void +static void init_signals (void) { /* Set up signal handlers. */ @@ -1182,7 +1182,7 @@ } -HSOCKET +static HSOCKET set_local_socket (void) { HSOCKET s; @@ -1331,7 +1331,7 @@ } #endif /* ! NO_SOCKETS_IN_FILE_SYSTEM */ -HSOCKET +static HSOCKET set_socket (int no_exit_if_error) { HSOCKET s; @@ -1447,7 +1447,7 @@ /* Start the emacs daemon and try to connect to it. */ -void +static void start_daemon_and_retry_set_socket (void) { #ifndef WINDOWSNT @@ -1722,7 +1722,7 @@ if (rl <= 0) break; - + string[rl] = '\0'; p = string + strlen (string) - 1; === modified file 'lib-src/fakemail.c' --- lib-src/fakemail.c 2011-01-25 04:08:28 +0000 +++ lib-src/fakemail.c 2011-02-21 18:06:25 +0000 @@ -198,7 +198,7 @@ /* Initialize a linebuffer for use */ -void +static void init_linebuffer (struct linebuffer *linebuffer) { linebuffer->size = INITIAL_LINE_SIZE; @@ -208,7 +208,7 @@ /* Read a line of text from `stream' into `linebuffer'. Return the length of the line. */ -long +static long readline (struct linebuffer *linebuffer, FILE *stream) { char *buffer = linebuffer->buffer; @@ -243,7 +243,7 @@ If there is no keyword, return NULL and don't alter *REST. */ -char * +static char * get_keyword (register char *field, char **rest) { static char keyword[KEYWORD_SIZE]; @@ -268,7 +268,7 @@ /* Nonzero if the string FIELD starts with a colon-terminated keyword. */ -boolean +static boolean has_keyword (char *field) { char *ignored; @@ -285,7 +285,7 @@ We don't pay attention to overflowing WHERE; the caller has to make it big enough. */ -char * +static char * add_field (line_list the_list, register char *field, register char *where) { register char c; @@ -341,7 +341,7 @@ return where; } -line_list +static line_list make_file_preface (void) { char *the_string, *temp; @@ -385,7 +385,7 @@ return result; } -void +static void write_line_list (register line_list the_list, FILE *the_stream) { for ( ; @@ -398,7 +398,7 @@ return; } -int +static int close_the_streams (void) { register stream_list rem; @@ -411,7 +411,7 @@ return (no_problems ? EXIT_SUCCESS : EXIT_FAILURE); } -void +static void add_a_stream (FILE *the_stream, int (*closing_action) (FILE *)) { stream_list old = the_streams; @@ -422,7 +422,7 @@ return; } -int +static int my_fclose (FILE *the_file) { putc ('\n', the_file); @@ -430,7 +430,7 @@ return fclose (the_file); } -boolean +static boolean open_a_file (char *name) { FILE *the_stream = fopen (name, "a"); @@ -445,7 +445,7 @@ return false; } -void +static void put_string (char *s) { register stream_list rem; @@ -456,7 +456,7 @@ return; } -void +static void put_line (const char *string) { register stream_list rem; @@ -516,7 +516,7 @@ the header name), and THE_LIST holds the continuation lines if any. Call open_a_file for each file. */ -void +static void setup_files (register line_list the_list, register char *field) { register char *start; @@ -552,7 +552,7 @@ /* Compute the total size of all recipient names stored in THE_HEADER. The result says how big to make the buffer to pass to parse_header. */ -int +static int args_size (header the_header) { register header old = the_header; @@ -583,7 +583,7 @@ Also, if the header has any FCC fields, call setup_files for each one. */ -void +static void parse_header (header the_header, register char *where) { register header old = the_header; @@ -615,7 +615,7 @@ one for each line in that field. Continuation lines are grouped in the headers they continue. */ -header +static header read_header (void) { register header the_header = ((header) NULL); @@ -669,7 +669,7 @@ return the_header->next; } -void +static void write_header (header the_header) { register header old = the_header; === modified file 'lib-src/make-docfile.c' --- lib-src/make-docfile.c 2011-02-21 18:02:49 +0000 +++ lib-src/make-docfile.c 2011-02-21 19:37:54 +0000 @@ -66,12 +66,12 @@ #define IS_DIRECTORY_SEP(_c_) ((_c_) == DIRECTORY_SEP) #endif -int scan_file (char *filename); -int scan_lisp_file (const char *filename, const char *mode); -int scan_c_file (char *filename, const char *mode); -void fatal (const char *s1, const char *s2) NO_RETURN; -void start_globals (void); -void write_globals (void); +static int scan_file (char *filename); +static int scan_lisp_file (const char *filename, const char *mode); +static int scan_c_file (char *filename, const char *mode); +static void fatal (const char *s1, const char *s2) NO_RETURN; +static void start_globals (void); +static void write_globals (void); #ifdef MSDOS /* s/msdos.h defines this as sys_chdir, but we're not linking with the @@ -93,7 +93,7 @@ /* Print error message. `s1' is printf control string, `s2' is arg for it. */ /* VARARGS1 */ -void +static void error (const char *s1, const char *s2) { fprintf (stderr, "%s: ", progname); @@ -104,7 +104,7 @@ /* Print error message and exit. */ /* VARARGS1 */ -void +static void fatal (const char *s1, const char *s2) { error (s1, s2); @@ -113,7 +113,7 @@ /* Like malloc but get fatal error if memory is exhausted. */ -void * +static void * xmalloc (unsigned int size) { void *result = (void *) malloc (size); @@ -124,7 +124,7 @@ /* Like realloc but get fatal error if memory is exhausted. */ -void * +static void * xrealloc (void *arg, unsigned int size) { void *result = (void *) realloc (arg, size); @@ -212,7 +212,7 @@ } /* Add a source file name boundary marker in the output file. */ -void +static void put_filename (char *filename) { char *tmp; @@ -231,7 +231,7 @@ /* Read file FILENAME and output its doc strings to outfile. */ /* Return 1 if file is not found, 0 if it is found. */ -int +static int scan_file (char *filename) { @@ -247,7 +247,7 @@ return scan_c_file (filename, READ_TEXT); } -void +static void start_globals (void) { fprintf (outfile, "/* This file was auto-generated by make-docfile. */\n"); @@ -255,7 +255,7 @@ fprintf (outfile, "struct emacs_globals {\n"); } -char buf[128]; +static char input_buffer[128]; /* Some state during the execution of `read_c_string_or_comment'. */ struct rcsoc_state @@ -388,14 +388,14 @@ at the beginning of a line will be removed, and *SAW_USAGE set to true if any were encountered. */ -int +static int read_c_string_or_comment (FILE *infile, int printflag, int comment, int *saw_usage) { register int c; struct rcsoc_state state; state.in_file = infile; - state.buf_ptr = (printflag < 0 ? buf : 0); + state.buf_ptr = (printflag < 0 ? input_buffer : 0); state.out_file = (printflag > 0 ? outfile : 0); state.pending_spaces = 0; state.pending_newlines = 0; @@ -476,7 +476,7 @@ /* Write to file OUT the argument names of function FUNC, whose text is in BUF. MINARGS and MAXARGS are the minimum and maximum number of arguments. */ -void +static void write_c_args (FILE *out, char *func, char *buf, int minargs, int maxargs) { register char *p; @@ -610,7 +610,7 @@ return strcmp (ga->name, gb->name); } -void +static void write_globals (void) { int i; @@ -652,7 +652,7 @@ Looks for DEFUN constructs such as are defined in ../src/lisp.h. Accepts any word starting DEF... so it finds DEFSIMPLE and DEFPRED. */ -int +static int scan_c_file (char *filename, const char *mode) { FILE *infile; @@ -795,15 +795,15 @@ /* Read in the identifier. */ do { - buf[i++] = c; + input_buffer[i++] = c; c = getc (infile); } while (! (c == ',' || c == ' ' || c == '\t' || c == '\n' || c == '\r')); - buf[i] = '\0'; + input_buffer[i] = '\0'; name = xmalloc (i + 1); - memcpy (name, buf, i + 1); + memcpy (name, input_buffer, i + 1); add_global (type, name); continue; } @@ -888,7 +888,7 @@ putc (037, outfile); putc (defvarflag ? 'V' : 'F', outfile); - fprintf (outfile, "%s\n", buf); + fprintf (outfile, "%s\n", input_buffer); if (comment) getc (infile); /* Skip past `*' */ @@ -931,11 +931,12 @@ *p = '\0'; /* Output them. */ fprintf (outfile, "\n\n"); - write_c_args (outfile, buf, argbuf, minargs, maxargs); + write_c_args (outfile, input_buffer, argbuf, minargs, maxargs); } else if (defunflag && maxargs == -1 && !saw_usage) /* The DOC should provide the usage form. */ - fprintf (stderr, "Missing `usage' for function `%s'.\n", buf); + fprintf (stderr, "Missing `usage' for function `%s'.\n", + input_buffer); } } eof: @@ -979,7 +980,7 @@ An entry is output only if DOCSTRING has \ newline just after the opening " */ -void +static void skip_white (FILE *infile) { char c = ' '; @@ -988,7 +989,7 @@ ungetc (c, infile); } -void +static void read_lisp_symbol (FILE *infile, char *buffer) { char c; @@ -1016,7 +1017,7 @@ skip_white (infile); } -int +static int scan_lisp_file (const char *filename, const char *mode) { FILE *infile; === modified file 'lib-src/movemail.c' --- lib-src/movemail.c 2011-01-26 08:36:39 +0000 +++ lib-src/movemail.c 2011-02-22 00:11:56 +0000 @@ -80,13 +80,6 @@ #undef access #endif /* MSDOS */ -#ifndef DIRECTORY_SEP -#define DIRECTORY_SEP '/' -#endif -#ifndef IS_DIRECTORY_SEP -#define IS_DIRECTORY_SEP(_c_) ((_c_) == DIRECTORY_SEP) -#endif - #ifdef WINDOWSNT #include "ntlib.h" #undef access @@ -161,7 +154,7 @@ #endif /* Nonzero means this is name of a lock file to delete on fatal error. */ -char *delete_lockname; +static char *delete_lockname; int main (int argc, char **argv) @@ -169,7 +162,7 @@ char *inname, *outname; int indesc, outdesc; ssize_t nread; - int status; + int wait_status; int c, preserve_mail = 0; #ifndef MAIL_USE_SYSTEM_LOCK @@ -269,6 +262,13 @@ if (! spool_name) #endif { + #ifndef DIRECTORY_SEP + #define DIRECTORY_SEP '/' + #endif + #ifndef IS_DIRECTORY_SEP + #define IS_DIRECTORY_SEP(_c_) ((_c_) == DIRECTORY_SEP) + #endif + /* Use a lock file named after our first argument with .lock appended: If it exists, the mail file is locked. */ /* Note: this locking mechanism is *required* by the mailer @@ -527,11 +527,11 @@ exit (EXIT_SUCCESS); } - wait (&status); - if (!WIFEXITED (status)) + wait (&wait_status); + if (!WIFEXITED (wait_status)) exit (EXIT_FAILURE); - else if (WRETCODE (status) != 0) - exit (WRETCODE (status)); + else if (WRETCODE (wait_status) != 0) + exit (WRETCODE (wait_status)); #if !defined (MAIL_USE_MMDF) && !defined (MAIL_USE_SYSTEM_LOCK) #ifdef MAIL_USE_MAILLOCK @@ -670,14 +670,8 @@ #define NOTOK (-1) #define OK 0 -#define DONE 1 -char *progname; -FILE *sfi; -FILE *sfo; -char ibuffer[BUFSIZ]; -char obuffer[BUFSIZ]; -char Errmsg[200]; /* POP errors, at least, can exceed +static char Errmsg[200]; /* POP errors, at least, can exceed the original length of 80. */ /* @@ -736,7 +730,18 @@ error ("Error in open: %s, %s", strerror (errno), outfile); return EXIT_FAILURE; } - fchown (mbfi, getuid (), -1); + + if (fchown (mbfi, getuid (), -1) != 0) + { + int fchown_errno = errno; + struct stat st; + if (fstat (mbfi, &st) != 0 || st.st_uid != getuid ()) + { + pop_close (server); + error ("Error in fchown: %s, %s", strerror (fchown_errno), outfile); + return EXIT_FAILURE; + } + } if ((mbf = fdopen (mbfi, "wb")) == NULL) { @@ -828,10 +833,10 @@ if (pop_retrieve_first (server, msgno, &line)) { - char *error = concat ("Error from POP server: ", pop_error, ""); - strncpy (Errmsg, error, sizeof (Errmsg)); + char *msg = concat ("Error from POP server: ", pop_error, ""); + strncpy (Errmsg, msg, sizeof (Errmsg)); Errmsg[sizeof (Errmsg)-1] = '\0'; - free(error); + free (msg); return (NOTOK); } @@ -850,27 +855,26 @@ if (ret) { - char *error = concat ("Error from POP server: ", pop_error, ""); - strncpy (Errmsg, error, sizeof (Errmsg)); + char *msg = concat ("Error from POP server: ", pop_error, ""); + strncpy (Errmsg, msg, sizeof (Errmsg)); Errmsg[sizeof (Errmsg)-1] = '\0'; - free(error); + free (msg); return (NOTOK); } return (OK); } -/* Do this as a macro instead of using strcmp to save on execution time. */ -#define IS_FROM_LINE(a) ((a[0] == 'F') \ - && (a[1] == 'r') \ - && (a[2] == 'o') \ - && (a[3] == 'm') \ - && (a[4] == ' ')) - static int mbx_write (char *line, int len, FILE *mbf) { #ifdef MOVEMAIL_QUOTE_POP_FROM_LINES + /* Do this as a macro instead of using strcmp to save on execution time. */ + # define IS_FROM_LINE(a) ((a[0] == 'F') \ + && (a[1] == 'r') \ + && (a[2] == 'o') \ + && (a[3] == 'm') \ + && (a[4] == ' ')) if (IS_FROM_LINE (line)) { if (fputc ('>', mbf) == EOF) === modified file 'lib-src/pop.c' --- lib-src/pop.c 2011-01-26 08:36:39 +0000 +++ lib-src/pop.c 2011-02-21 23:22:34 +0000 @@ -67,7 +67,6 @@ #include #ifdef STDC_HEADERS #include -#define index strchr #endif #include @@ -91,6 +90,8 @@ # endif #endif /* KERBEROS */ +#include + #ifdef KERBEROS #ifndef KERBEROS5 extern int krb_sendauth (/* long, int, KTEXT, char *, char *, char *, @@ -122,19 +123,15 @@ to be bigger than the original value of 80 */ #define POP_PORT 110 +#define POP_SERVICE "pop3" /* we don't want the POP2 port! */ +#ifdef KERBEROS #define KPOP_PORT 1109 -#define POP_SERVICE "pop3" /* we don't want the POP2 port! */ -#ifdef KERBEROS #define KPOP_SERVICE "kpop" /* never used: look for 20060515 to see why */ #endif char pop_error[ERROR_MAX]; int pop_debug = 0; -#ifndef min -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif - /* * Function: pop_open (char *host, char *username, char *password, * int flags) === modified file 'lib-src/profile.c' --- lib-src/profile.c 2011-01-25 04:08:28 +0000 +++ lib-src/profile.c 2011-02-21 18:06:25 +0000 @@ -38,7 +38,7 @@ /* Reset the stopwatch to zero. */ -void +static void reset_watch (void) { EMACS_GET_TIME (TV1); @@ -49,7 +49,7 @@ is returned as a string with the format . If reset_watch was not called yet, exit. */ -char * +static char * get_time (void) { if (watch_not_started) === modified file 'lib-src/test-distrib.c' --- lib-src/test-distrib.c 2011-01-25 04:08:28 +0000 +++ lib-src/test-distrib.c 2011-02-21 23:15:17 +0000 @@ -26,18 +26,16 @@ /* Break string in two parts to avoid buggy C compilers that ignore characters after nulls in strings. */ -char string1[] = "Testing distribution of nonprinting chars:\n\ +static char string1[] = "Testing distribution of nonprinting chars:\n\ Should be 0177: \177 Should be 0377: \377 Should be 0212: \212.\n\ Should be 0000: "; -char string2[] = ".\n\ +static char string2[] = ".\n\ This file is read by the `test-distribution' program.\n\ If you change it, you will make that program fail.\n"; -char buf[300]; - /* Like `read' but keeps trying until it gets SIZE bytes or reaches eof. */ -int +static int cool_read (int fd, char *buf, size_t size) { ssize_t num; @@ -57,6 +55,7 @@ main (int argc, char **argv) { int fd; + char buf[300]; if (argc != 2) { === modified file 'lib-src/update-game-score.c' --- lib-src/update-game-score.c 2011-01-26 08:36:39 +0000 +++ lib-src/update-game-score.c 2011-02-21 18:06:25 +0000 @@ -57,7 +57,7 @@ extern char *optarg; extern int optind, opterr; -int usage (int err) NO_RETURN; +static int usage (int err) NO_RETURN; #define MAX_ATTEMPTS 5 #define MAX_SCORES 200 @@ -68,7 +68,7 @@ #define difftime(t1, t0) (double)((t1) - (t0)) #endif -int +static int usage (int err) { fprintf (stdout, "Usage: update-game-score [-m MAX ] [ -r ] game/scorefile SCORE DATA\n"); @@ -80,8 +80,8 @@ exit (err); } -int lock_file (const char *filename, void **state); -int unlock_file (const char *filename, void *state); +static int lock_file (const char *filename, void **state); +static int unlock_file (const char *filename, void *state); struct score_entry { @@ -90,24 +90,24 @@ char *data; }; -int read_scores (const char *filename, struct score_entry **scores, - int *count); -int push_score (struct score_entry **scores, int *count, - int newscore, char *username, char *newdata); -void sort_scores (struct score_entry *scores, int count, int reverse); -int write_scores (const char *filename, const struct score_entry *scores, - int count); - -void lose (const char *msg) NO_RETURN; - -void +static int read_scores (const char *filename, struct score_entry **scores, + int *count); +static int push_score (struct score_entry **scores, int *count, + int newscore, char *username, char *newdata); +static void sort_scores (struct score_entry *scores, int count, int reverse); +static int write_scores (const char *filename, + const struct score_entry *scores, int count); + +static void lose (const char *msg) NO_RETURN; + +static void lose (const char *msg) { fprintf (stderr, "%s\n", msg); exit (EXIT_FAILURE); } -void lose_syserr (const char *msg) NO_RETURN; +static void lose_syserr (const char *msg) NO_RETURN; /* Taken from sysdep.c. */ #ifndef HAVE_STRERROR @@ -126,14 +126,14 @@ #endif /* not WINDOWSNT */ #endif /* ! HAVE_STRERROR */ -void +static void lose_syserr (const char *msg) { fprintf (stderr, "%s: %s\n", msg, strerror (errno)); exit (EXIT_FAILURE); } -char * +static char * get_user_id (void) { char *name; @@ -154,7 +154,7 @@ return buf->pw_name; } -const char * +static const char * get_prefix (int running_suid, const char *user_prefix) { if (!running_suid && user_prefix == NULL) @@ -258,7 +258,7 @@ exit (EXIT_SUCCESS); } -int +static int read_score (FILE *f, struct score_entry *score) { int c; @@ -342,7 +342,7 @@ return 0; } -int +static int read_scores (const char *filename, struct score_entry **scores, int *count) { int readval, scorecount, cursize; @@ -375,7 +375,7 @@ return 0; } -int +static int score_compare (const void *a, const void *b) { const struct score_entry *sa = (const struct score_entry *) a; @@ -383,7 +383,7 @@ return (sb->score > sa->score) - (sb->score < sa->score); } -int +static int score_compare_reverse (const void *a, const void *b) { const struct score_entry *sa = (const struct score_entry *) a; @@ -407,14 +407,14 @@ return 0; } -void +static void sort_scores (struct score_entry *scores, int count, int reverse) { qsort (scores, count, sizeof (struct score_entry), reverse ? score_compare_reverse : score_compare); } -int +static int write_scores (const char *filename, const struct score_entry *scores, int count) { FILE *f; @@ -443,7 +443,7 @@ return 0; } -int +static int lock_file (const char *filename, void **state) { int fd; @@ -484,7 +484,7 @@ return 0; } -int +static int unlock_file (const char *filename, void *state) { char *lockpath = (char *) state; === added file 'lib/min-max.h' --- lib/min-max.h 1970-01-01 00:00:00 +0000 +++ lib/min-max.h 2011-02-21 23:22:34 +0000 @@ -0,0 +1,6 @@ +#ifndef min +# define min(a,b) ((a) < (b) ? (a) : (b)) +#endif +#ifndef max +# define max(a,b) ((a) > (b) ? (a) : (b)) +#endif ------------------------------------------------------------ revno: 103377 committer: Alan Mackenzie branch nick: trunk timestamp: Mon 2011-02-21 21:25:35 +0000 message: (c-state-literal-at): Prevent positions in macros finding their way into c-state-nonlit-pos-cache. Strengthen the comments. (c-state-dump): New commented out diagnostic routine. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-02-21 19:14:56 +0000 +++ lisp/ChangeLog 2011-02-21 21:25:35 +0000 @@ -1,3 +1,11 @@ +2011-02-21 Alan Mackenzie + + Fix bug #7930. + * progmodes/cc-engine.el (c-state-literal-at): Prevent positions + in macros finding their way into c-state-nonlit-pos-cache. + Strengthen the comments. + (c-state-dump): New commented out diagnostic routine. + 2011-02-21 Michael Albinus * net/tramp.el (tramp-rfn-eshadow-setup-minibuffer): Do not use === modified file 'lisp/progmodes/cc-engine.el' --- lisp/progmodes/cc-engine.el 2011-02-13 20:25:15 +0000 +++ lisp/progmodes/cc-engine.el 2011-02-21 21:25:35 +0000 @@ -2023,9 +2023,9 @@ (defvar c-state-nonlit-pos-cache nil) (make-variable-buffer-local 'c-state-nonlit-pos-cache) -;; A list of buffer positions which are known not to be in a literal. This is -;; ordered with higher positions at the front of the list. Only those which -;; are less than `c-state-nonlit-pos-cache-limit' are valid. +;; A list of buffer positions which are known not to be in a literal or a cpp +;; construct. This is ordered with higher positions at the front of the list. +;; Only those which are less than `c-state-nonlit-pos-cache-limit' are valid. (defvar c-state-nonlit-pos-cache-limit 1) (make-variable-buffer-local 'c-state-nonlit-pos-cache-limit) @@ -2056,6 +2056,12 @@ ;; This function is almost the same as `c-literal-limits'. It differs in ;; that it is a lower level function, and that it rigourously follows the ;; syntax from BOB, whereas `c-literal-limits' uses a "local" safe position. + ;; + ;; NOTE: This function manipulates `c-state-nonlit-pos-cache'. This cache + ;; MAY NOT contain any positions within macros, since macros are frequently + ;; turned into comments by use of the `c-cpp-delimiter' category properties. + ;; We cannot rely on this mechanism whilst determining a cache pos since + ;; this function is also called from outwith `c-parse-state'. (save-restriction (widen) (save-excursion @@ -2074,6 +2080,11 @@ here) (setq lit (c-state-pp-to-literal pos npos)) (setq pos (or (cdr lit) npos)) ; end of literal containing npos. + (goto-char pos) + (when (and (c-beginning-of-macro) (/= (point) pos)) + (c-syntactic-end-of-macro) + (or (eobp) (forward-char)) + (setq pos (point))) (setq c-state-nonlit-pos-cache (cons pos c-state-nonlit-pos-cache))) (if (> pos c-state-nonlit-pos-cache-limit) @@ -2158,7 +2169,7 @@ ;; of fruitless backward scans. (defvar c-state-brace-pair-desert nil) (make-variable-buffer-local 'c-state-brace-pair-desert) -;; Used only in `c-append-lower-brace-pair-to-state-cache'. It is set when an +;; Used only in `c-append-lower-brace-pair-to-state-cache'. It is set when ;; that defun has searched backwards for a brace pair and not found one. Its ;; value is either nil or a cons (PA . FROM), where PA is the position of the ;; enclosing opening paren/brace/bracket which bounds the backwards search (or @@ -2843,6 +2854,29 @@ c-state-old-cpp-end nil) (c-state-mark-point-min-literal)) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Debugging routines to dump `c-state-cache' in a "replayable" form. +;; (defmacro c-sc-de (elt) ; "c-state-cache-dump-element" +;; `(format ,(concat "(setq " (symbol-name elt) " %s) ") ,elt)) +;; (defmacro c-sc-qde (elt) ; "c-state-cache-quote-dump-element" +;; `(format ,(concat "(setq " (symbol-name elt) " '%s) ") ,elt)) +;; (defun c-state-dump () +;; ;; For debugging. +;; ;(message +;; (concat +;; (c-sc-qde c-state-cache) +;; (c-sc-de c-state-cache-good-pos) +;; (c-sc-qde c-state-nonlit-pos-cache) +;; (c-sc-de c-state-nonlit-pos-cache-limit) +;; (c-sc-qde c-state-brace-pair-desert) +;; (c-sc-de c-state-point-min) +;; (c-sc-de c-state-point-min-lit-type) +;; (c-sc-de c-state-point-min-lit-start) +;; (c-sc-de c-state-min-scan-pos) +;; (c-sc-de c-state-old-cpp-beg) +;; (c-sc-de c-state-old-cpp-end))) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + (defun c-invalidate-state-cache-1 (here) ;; Invalidate all info on `c-state-cache' that applies to the buffer at HERE ;; or higher and set `c-state-cache-good-pos' accordingly. The cache is ------------------------------------------------------------ revno: 103376 author: Christoph Scholtes committer: Eli Zaretskii branch nick: trunk timestamp: Mon 2011-02-21 22:16:43 +0200 message: Add stdint.h for MS-Windows. nt/inc/stdint.h: New file, to support compilation with tool chains that do not have stdint.h (e.g. MSVC). lib/makefile.w32-in: ($(BLD)/md5.$(O)): Added dependency on $(EMACS_ROOT)/nt/inc/stdint.h. diff: === modified file 'ChangeLog' --- ChangeLog 2011-02-21 20:00:19 +0000 +++ ChangeLog 2011-02-21 20:16:43 +0000 @@ -1,3 +1,8 @@ +2011-02-21 Christoph Scholtes + + * lib/makefile.w32-in: ($(BLD)/md5.$(O)): Added dependency on + $(EMACS_ROOT)/nt/inc/stdint.h. + 2011-02-21 Eli Zaretskii * lib/makefile.w32-in ($(BLD)/filemode.$(O)): Move from === modified file 'lib/makefile.w32-in' --- lib/makefile.w32-in 2011-02-21 20:00:19 +0000 +++ lib/makefile.w32-in 2011-02-21 20:16:43 +0000 @@ -98,6 +98,7 @@ $(BLD)/md5.$(O) : \ $(SRC)/md5.c \ $(SRC)/md5.h \ + $(EMACS_ROOT)/nt/inc/stdint.h \ $(EMACS_ROOT)/src/s/ms-w32.h \ $(EMACS_ROOT)/src/m/intel386.h \ $(EMACS_ROOT)/src/config.h === modified file 'nt/ChangeLog' --- nt/ChangeLog 2011-02-21 20:00:19 +0000 +++ nt/ChangeLog 2011-02-21 20:16:43 +0000 @@ -1,3 +1,8 @@ +2011-02-21 Christoph Scholtes + + * inc/stdint.h: New file, to support compilation with tool chains + that do not have stdint.h (e.g. MSVC). + 2011-02-21 Eli Zaretskii * inc/sys/stat.h (S_ISUID, S_ISGID, S_ISVTX, S_IRGRP, S_IROTH) === added file 'nt/inc/stdint.h' --- nt/inc/stdint.h 1970-01-01 00:00:00 +0000 +++ nt/inc/stdint.h 2011-02-21 20:16:43 +0000 @@ -0,0 +1,34 @@ +/* Replacement stdint.h file for building GNU Emacs on Windows. + +Copyright (C) 2011 Free Software Foundation, Inc. + +This file is part of GNU Emacs. + +GNU Emacs is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +GNU Emacs is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Emacs. If not, see . */ + +#ifndef _NT_STDINT_H_ +#define _NT_STDINT_H_ + +#ifdef __GNUC__ +# include_next /* use stdint.h if available */ +#else /* !__GNUC__ */ + +/* Minimum definitions to allow compilation with tool chains where + stdint.h is not available, e.g. Microsoft Visual Studio. */ + +typedef unsigned int uint32_t; + +#endif /* !__GNUC__ */ + +#endif /* _NT_STDINT_H_ */ ------------------------------------------------------------ revno: 103375 committer: Eli Zaretskii branch nick: trunk timestamp: Mon 2011-02-21 22:00:19 +0200 message: Adapt MS-Windows build to import of filemode.c from gnulib. nt/inc/sys/stat.h (S_ISUID, S_ISGID, S_ISVTX, S_IRGRP, S_IROTH) (S_IWGRP, S_IWOTH, S_IXGRP, S_IXOTH, S_ISSOCK, S_ISLNK, S_ISCTG) (S_ISDOOR, S_ISMPB, S_ISMPC, S_ISNWK, S_ISPORT, S_ISWHT) (S_TYPEISMQ, S_TYPEISSEM, S_TYPEISSHM, S_TYPEISTMO): Define. (lstat): Define to stat. lib/makefile.w32-in ($(BLD)/filemode.$(O)): Move from src/makefile.w32-in and adapt. Depend on stamp_BLD. (GNULIBOBJS): Add $(BLD)/filemode.$(O). src/makefile.w32-in ($(BLD)/filemode.$(O)): Move recipe to lib/makefilw.w32-in. ($(BLD)/dired.$(O)): Depend on $(EMACS_ROOT)/lib/filemode.h. (GLOBAL_SOURCES): Remove filemode.c. (OBJ1): Remove $(BLD)/filemode.$(O). lib-src/makefile.w32-in ($(BLD)/ctags.$(O), $(BLD)/emacsclient.$(O)) ($(BLD)/etags.$(O), $(BLD)/movemail.$(O), $(BLD)/ntlib.$(O)): Depend on $(EMACS_ROOT)/nt/inc/sys/stat.h. diff: === modified file 'ChangeLog' --- ChangeLog 2011-02-21 17:56:37 +0000 +++ ChangeLog 2011-02-21 20:00:19 +0000 @@ -1,3 +1,9 @@ +2011-02-21 Eli Zaretskii + + * lib/makefile.w32-in ($(BLD)/filemode.$(O)): Move from + src/makefile.w32-in and adapt. Depend on stamp_BLD. + (GNULIBOBJS): Add $(BLD)/filemode.$(O). + 2011-02-20 Paul Eggert Import filemode module from gnulib. === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2011-02-21 18:02:49 +0000 +++ lib-src/ChangeLog 2011-02-21 20:00:19 +0000 @@ -1,3 +1,9 @@ +2011-02-21 Eli Zaretskii + + * makefile.w32-in ($(BLD)/ctags.$(O), $(BLD)/emacsclient.$(O)) + ($(BLD)/etags.$(O), $(BLD)/movemail.$(O), $(BLD)/ntlib.$(O)): + Depend on $(EMACS_ROOT)/nt/inc/sys/stat.h. + 2011-02-21 Ben Key (tiny change) * make-docfile.c (scan_c_file): Adapt DEFVAR_PER_BUFFER case to === modified file 'lib-src/makefile.w32-in' --- lib-src/makefile.w32-in 2011-02-20 22:17:39 +0000 +++ lib-src/makefile.w32-in 2011-02-21 20:00:19 +0000 @@ -374,6 +374,7 @@ $(BLD)/ctags.$(O) : \ $(SRC)/ctags.c \ $(EMACS_ROOT)/nt/inc/sys/param.h \ + $(EMACS_ROOT)/nt/inc/sys/stat.h \ $(EMACS_ROOT)/src/s/ms-w32.h \ $(EMACS_ROOT)/src/m/intel386.h \ $(EMACS_ROOT)/lib-src/../src/config.h \ @@ -382,6 +383,7 @@ $(BLD)/emacsclient.$(O) : \ $(SRC)/emacsclient.c \ + $(EMACS_ROOT)/nt/inc/sys/stat.h \ $(EMACS_ROOT)/src/s/ms-w32.h \ $(EMACS_ROOT)/src/m/intel386.h \ $(EMACS_ROOT)/lib-src/../src/config.h @@ -389,6 +391,7 @@ $(BLD)/etags.$(O) : \ $(SRC)/etags.c \ $(EMACS_ROOT)/nt/inc/sys/param.h \ + $(EMACS_ROOT)/nt/inc/sys/stat.h \ $(EMACS_ROOT)/src/s/ms-w32.h \ $(EMACS_ROOT)/src/m/intel386.h \ $(EMACS_ROOT)/lib-src/../src/config.h \ @@ -429,6 +432,7 @@ $(EMACS_ROOT)/src/m/intel386.h \ $(EMACS_ROOT)/lib-src/../src/config.h \ $(EMACS_ROOT)/nt/inc/sys/file.h \ + $(EMACS_ROOT)/nt/inc/sys/stat.h \ $(EMACS_ROOT)/lib-src/../src/syswait.h \ $(EMACS_ROOT)/nt/inc/pwd.h \ $(SRC)/ntlib.h @@ -437,6 +441,7 @@ $(BLD)/ntlib.$(O) : \ $(SRC)/ntlib.c \ $(SRC)/ntlib.h \ + $(EMACS_ROOT)/nt/inc/sys/stat.h \ $(EMACS_ROOT)/nt/inc/pwd.h $(BLD)/pop.$(O) : \ === modified file 'lib/makefile.w32-in' --- lib/makefile.w32-in 2011-02-20 21:09:45 +0000 +++ lib/makefile.w32-in 2011-02-21 20:00:19 +0000 @@ -28,7 +28,8 @@ $(BLD)/getopt1.$(O) \ $(BLD)/strftime.$(O) \ $(BLD)/time_r.$(O) \ - $(BLD)/md5.$(O) + $(BLD)/md5.$(O) \ + $(BLD)/filemode.$(O) # # Build the library @@ -95,17 +96,26 @@ $(EMACS_ROOT)/src/config.h $(BLD)/md5.$(O) : \ - $(EMACS_ROOT)/lib/md5.c \ - $(EMACS_ROOT)/src/s/ms-w32.h \ - $(EMACS_ROOT)/src/m/intel386.h \ - $(EMACS_ROOT)/src/config.h \ - $(EMACS_ROOT)/lib/md5.h + $(SRC)/md5.c \ + $(SRC)/md5.h \ + $(EMACS_ROOT)/src/s/ms-w32.h \ + $(EMACS_ROOT)/src/m/intel386.h \ + $(EMACS_ROOT)/src/config.h + +$(BLD)/filemode.$(O) : \ + $(SRC)/filemode.c \ + $(SRC)/filemode.h \ + $(EMACS_ROOT)/nt/inc/sys/stat.h \ + $(EMACS_ROOT)/src/s/ms-w32.h \ + $(EMACS_ROOT)/src/m/intel386.h \ + $(EMACS_ROOT)/src/config.h # The following dependencies are for supporting parallel builds, where # we must make sure $(BLD) exists before any compilation starts. # $(BLD)/dtoastr.$(O) $(BLD)/getopt.$(O) $(BLD)/getopt1.$(O): stamp_BLD $(BLD)/strftime.$(O) $(BLD)/time_r.$(O) $(BLD)/md5.$(O): stamp_BLD +$(BLD)/filemode.$(O): stamp_BLD # # Headers we would preprocess if we could. === modified file 'nt/ChangeLog' --- nt/ChangeLog 2011-02-09 20:50:17 +0000 +++ nt/ChangeLog 2011-02-21 20:00:19 +0000 @@ -1,3 +1,11 @@ +2011-02-21 Eli Zaretskii + + * inc/sys/stat.h (S_ISUID, S_ISGID, S_ISVTX, S_IRGRP, S_IROTH) + (S_IWGRP, S_IWOTH, S_IXGRP, S_IXOTH, S_ISSOCK, S_ISLNK, S_ISCTG) + (S_ISDOOR, S_ISMPB, S_ISMPC, S_ISNWK, S_ISPORT, S_ISWHT) + (S_TYPEISMQ, S_TYPEISSEM, S_TYPEISSHM, S_TYPEISTMO): Define. + (lstat): Define to stat. + 2011-02-09 Eli Zaretskii * makefile.w32-in (bootstrap-nmake, bootstrap-gmake): Make the === modified file 'nt/inc/sys/stat.h' --- nt/inc/sys/stat.h 2011-01-25 04:08:28 +0000 +++ nt/inc/sys/stat.h 2011-02-21 20:00:19 +0000 @@ -56,6 +56,31 @@ #define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) #define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) +/* These don't exist on Windows, but lib/filemode.c wants them. */ +#define S_ISUID 0 +#define S_ISGID 0 +#define S_ISVTX 0 +#define S_IRGRP (S_IRUSR >> 3) +#define S_IROTH (S_IRUSR >> 6) +#define S_IWGRP (S_IWUSR >> 3) +#define S_IWOTH (S_IWUSR >> 6) +#define S_IXGRP (S_IXUSR >> 3) +#define S_IXOTH (S_IXUSR >> 6) + +#define S_ISSOCK(m) 0 +#define S_ISLNK(m) 0 +#define S_ISCTG(p) 0 +#define S_ISDOOR(m) 0 +#define S_ISMPB(m) 0 +#define S_ISMPC(m) 0 +#define S_ISNWK(m) 0 +#define S_ISPORT(m) 0 +#define S_ISWHT(m) 0 +#define S_TYPEISMQ(p) 0 +#define S_TYPEISSEM(p) 0 +#define S_TYPEISSHM(p) 0 +#define S_TYPEISTMO(p) 0 + struct stat { unsigned __int64 st_ino; /* ino_t in sys/types.h is too narrow */ dev_t st_dev; @@ -76,5 +101,8 @@ _CRTIMP int __cdecl __MINGW_NOTHROW chmod (const char*, int); _CRTIMP int __cdecl __MINGW_NOTHROW stat (const char*, struct stat*); +/* fileio.c and dired.c want lstat. */ +#define lstat stat + #endif /* INC_SYS_STAT_H_ */ === modified file 'src/ChangeLog' --- src/ChangeLog 2011-02-21 17:56:37 +0000 +++ src/ChangeLog 2011-02-21 20:00:19 +0000 @@ -1,3 +1,11 @@ +2011-02-21 Eli Zaretskii + + * makefile.w32-in ($(BLD)/filemode.$(O)): Move recipe to + lib/makefilw.w32-in. + ($(BLD)/dired.$(O)): Depend on $(EMACS_ROOT)/lib/filemode.h. + (GLOBAL_SOURCES): Remove filemode.c. + (OBJ1): Remove $(BLD)/filemode.$(O). + 2011-02-21 Paul Eggert Import filemode module from gnulib. === modified file 'src/makefile.w32-in' --- src/makefile.w32-in 2011-02-20 18:50:26 +0000 +++ src/makefile.w32-in 2011-02-21 20:00:19 +0000 @@ -72,7 +72,6 @@ $(BLD)/eval.$(O) \ $(BLD)/fileio.$(O) \ $(BLD)/filelock.$(O) \ - $(BLD)/filemode.$(O) \ $(BLD)/fns.$(O) \ $(BLD)/indent.$(O) \ $(BLD)/insdel.$(O) \ @@ -213,7 +212,7 @@ cm.c term.c terminal.c xfaces.c \ emacs.c keyboard.c macros.c keymap.c sysdep.c \ buffer.c filelock.c insdel.c marker.c \ - minibuf.c fileio.c dired.c filemode.c \ + minibuf.c fileio.c dired.c \ cmds.c casetab.c casefiddle.c indent.c search.c regex.c undo.c \ alloc.c data.c doc.c editfns.c callint.c \ eval.c floatfns.c fns.c print.c lread.c \ @@ -663,6 +662,7 @@ $(SRC)/coding.h \ $(SRC)/commands.h \ $(SRC)/composite.h \ + $(EMACS_ROOT)/lib/filemode.h \ $(SRC)/ndir.h \ $(SRC)/regex.h \ $(SRC)/systime.h @@ -821,10 +821,6 @@ $(SRC)/composite.h \ $(SRC)/systime.h -$(BLD)/filemode.$(O) : \ - $(SRC)/filemode.c \ - $(CONFIG_H) - $(BLD)/firstfile.$(O) : \ $(SRC)/firstfile.c \ $(CONFIG_H) ------------------------------------------------------------ revno: 103374 committer: Michael Albinus branch nick: trunk timestamp: Mon 2011-02-21 20:14:56 +0100 message: * net/tramp.el (tramp-rfn-eshadow-setup-minibuffer): Do not use `field' property of `rfn-eshadow-overlay'. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-02-21 13:29:15 +0000 +++ lisp/ChangeLog 2011-02-21 19:14:56 +0000 @@ -1,3 +1,8 @@ +2011-02-21 Michael Albinus + + * net/tramp.el (tramp-rfn-eshadow-setup-minibuffer): Do not use + `field' property of `rfn-eshadow-overlay'. + 2011-02-21 Lars Ingebrigtsen * net/netrc.el (netrc-parse): Comment fix. @@ -264,7 +269,7 @@ 2011-02-16 Alex Harsanyi - * soap-client.el (soap-well-known-xmlns, soap-local-xmlns) + * net/soap-client.el (soap-well-known-xmlns, soap-local-xmlns) (soap-default-xmlns, soap-target-xmlns, soap-multi-refs) (soap-decoded-multi-refs, soap-current-wsdl) (soap-encoded-namespaces): Rename CL-style *...* variables. === modified file 'lisp/net/tramp.el' --- lisp/net/tramp.el 2011-02-13 12:25:45 +0000 +++ lisp/net/tramp.el 2011-02-21 19:14:56 +0000 @@ -1574,8 +1574,12 @@ (let ((props (tramp-compat-funcall 'overlay-properties (symbol-value 'rfn-eshadow-overlay)))) (while props - (tramp-compat-funcall - 'overlay-put tramp-rfn-eshadow-overlay (pop props) (pop props)))))) + ;; The `field' property prevents correct minibuffer + ;; completion; we exclude it. + (if (not (eq (car props) 'field)) + (tramp-compat-funcall + 'overlay-put tramp-rfn-eshadow-overlay (pop props) (pop props)) + (pop props) (pop props)))))) (when (boundp 'rfn-eshadow-setup-minibuffer-hook) (add-hook 'rfn-eshadow-setup-minibuffer-hook ------------------------------------------------------------ revno: 103373 author: Ben Key committer: Chong Yidong branch nick: trunk timestamp: Mon 2011-02-21 13:02:49 -0500 message: * make-docfile.c (scan_c_file): Adapt to the new BVAR macro. diff: === modified file 'lib-src/ChangeLog' --- lib-src/ChangeLog 2011-02-20 22:17:39 +0000 +++ lib-src/ChangeLog 2011-02-21 18:02:49 +0000 @@ -1,3 +1,8 @@ +2011-02-21 Ben Key (tiny change) + + * make-docfile.c (scan_c_file): Adapt DEFVAR_PER_BUFFER case to + the new BVAR macro. + 2011-02-20 Juanma Barranquero * makefile.w32-in (obj): Remove md5.o. === modified file 'lib-src/make-docfile.c' --- lib-src/make-docfile.c 2011-02-09 00:30:33 +0000 +++ lib-src/make-docfile.c 2011-02-21 18:02:49 +0000 @@ -815,7 +815,7 @@ if (defunflag) commas = 5; else if (defvarperbufferflag) - commas = 2; + commas = 3; else if (defvarflag) commas = 1; else /* For DEFSIMPLE and DEFPRED */ ------------------------------------------------------------ revno: 103372 [merge] committer: Paul Eggert branch nick: trunk timestamp: Mon 2011-02-21 09:56:37 -0800 message: Import filemode module from gnulib. diff: === modified file '.bzrignore' --- .bzrignore 2011-02-20 08:48:52 +0000 +++ .bzrignore 2011-02-20 10:51:50 +0000 @@ -42,6 +42,7 @@ lib/c++defs.h lib/getopt.h lib/stdlib.h +lib/sys/ lib/time.h lib/unistd.h lib/warn-on-use.h === modified file 'ChangeLog' --- ChangeLog 2011-02-20 21:09:45 +0000 +++ ChangeLog 2011-02-21 17:56:37 +0000 @@ -1,3 +1,18 @@ +2011-02-20 Paul Eggert + + Import filemode module from gnulib. + * .bzrignore: Add lib/sys/. + * Makefile.in (GNULIB_MODULES): Add filemode. + * lib/Makefile.am (MOSTLYCLEANDIRS): New macro. + * lib/filemode.c: Renamed from src/filemode.c and regenerated + from gnulib. This adds support for some more file types, e.g., + Cray DMF migrated files. + * lisp/emacs-lisp/find-gc.el (find-gc-source-files): Remove filemode.c. + * lib/filemode.h, lib/sys_stat.in.h, m4/filemode.m4, m4/st_dm_mode.m4: + * m4/sys_stat_h.m4: New files, generated from gnulib. + * aclocal.m4, configure, lib/Makefile.in, lib/gnulib.mk, m4/gl-comp.m4: + Regenerate. + 2011-02-20 Eli Zaretskii * lib/makefile.w32-in ($(BLD)/md5.$(O)): Don't depend on === modified file 'Makefile.in' --- Makefile.in 2011-02-18 08:07:03 +0000 +++ Makefile.in 2011-02-20 10:51:50 +0000 @@ -331,7 +331,8 @@ # $(gnulib_srcdir) (relative to $(srcdir) and should have build tools # as per $(gnulib_srcdir)/DEPENDENCIES. GNULIB_MODULES = \ - crypto/md5 dtoastr getloadavg getopt-gnu ignore-value mktime strftime + crypto/md5 dtoastr filemode getloadavg getopt-gnu \ + ignore-value mktime strftime GNULIB_TOOL_FLAGS = \ --import --no-changelog --no-vc-files --makefile-name=gnulib.mk sync-from-gnulib: $(gnulib_srcdir) === modified file 'aclocal.m4' --- aclocal.m4 2011-02-19 07:28:29 +0000 +++ aclocal.m4 2011-02-20 10:51:50 +0000 @@ -987,6 +987,7 @@ m4_include([m4/00gnulib.m4]) m4_include([m4/c-strtod.m4]) m4_include([m4/extensions.m4]) +m4_include([m4/filemode.m4]) m4_include([m4/getloadavg.m4]) m4_include([m4/getopt.m4]) m4_include([m4/gl-comp.m4]) @@ -996,11 +997,13 @@ m4_include([m4/md5.m4]) m4_include([m4/mktime.m4]) m4_include([m4/multiarch.m4]) +m4_include([m4/st_dm_mode.m4]) m4_include([m4/stdbool.m4]) m4_include([m4/stddef_h.m4]) m4_include([m4/stdint.m4]) m4_include([m4/stdlib_h.m4]) m4_include([m4/strftime.m4]) +m4_include([m4/sys_stat_h.m4]) m4_include([m4/time_h.m4]) m4_include([m4/time_r.m4]) m4_include([m4/tm_gmtoff.m4]) === modified file 'configure' --- configure 2011-02-20 19:46:08 +0000 +++ configure 2011-02-21 17:56:37 +0000 @@ -677,6 +677,40 @@ TIME_H_DEFINES_STRUCT_TIMESPEC NEXT_AS_FIRST_DIRECTIVE_TIME_H NEXT_TIME_H +NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H +NEXT_SYS_STAT_H +REPLACE_UTIMENSAT +REPLACE_STAT +REPLACE_MKNOD +REPLACE_MKFIFO +REPLACE_MKDIR +REPLACE_LSTAT +REPLACE_FUTIMENS +REPLACE_FSTATAT +REPLACE_FSTAT +HAVE_UTIMENSAT +HAVE_MKNODAT +HAVE_MKNOD +HAVE_MKFIFOAT +HAVE_MKFIFO +HAVE_MKDIRAT +HAVE_LSTAT +HAVE_LCHMOD +HAVE_FUTIMENS +HAVE_FSTATAT +HAVE_FCHMODAT +GNULIB_UTIMENSAT +GNULIB_STAT +GNULIB_MKNODAT +GNULIB_MKNOD +GNULIB_MKFIFOAT +GNULIB_MKFIFO +GNULIB_MKDIRAT +GNULIB_LSTAT +GNULIB_LCHMOD +GNULIB_FUTIMENS +GNULIB_FSTATAT +GNULIB_FCHMODAT NEXT_AS_FIRST_DIRECTIVE_STDLIB_H NEXT_STDLIB_H STDINT_H @@ -2926,6 +2960,7 @@ as_fn_append ac_header_list " wchar.h" as_fn_append ac_header_list " stdint.h" as_fn_append ac_func_list " tzset" +as_fn_append ac_header_list " sys/stat.h" as_fn_append ac_header_list " sys/time.h" as_fn_append ac_func_list " localtime_r" # Check that the precious variables saved in the cache have kept the same @@ -6089,6 +6124,7 @@ # Code from module dtoastr: # Code from module extensions: + # Code from module filemode: # Code from module getloadavg: # Code from module getopt-gnu: # Code from module getopt-posix: @@ -6103,6 +6139,7 @@ # Code from module stdint: # Code from module stdlib: # Code from module strftime: + # Code from module sys_stat: # Code from module time: # Code from module time_r: # Code from module unistd: @@ -13687,6 +13724,52 @@ fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for st_dm_mode in struct stat" >&5 +$as_echo_n "checking for st_dm_mode in struct stat... " >&6; } +if ${ac_cv_struct_st_dm_mode+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +int +main () +{ +struct stat s; s.st_dm_mode; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_struct_st_dm_mode=yes +else + ac_cv_struct_st_dm_mode=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_st_dm_mode" >&5 +$as_echo "$ac_cv_struct_st_dm_mode" >&6; } + + if test $ac_cv_struct_st_dm_mode = yes; then + +$as_echo "#define HAVE_ST_DM_MODE 1" >>confdefs.h + + fi + + +ac_fn_c_check_decl "$LINENO" "strmode" "ac_cv_have_decl_strmode" "$ac_includes_default" +if test "x$ac_cv_have_decl_strmode" = xyes; then : + ac_have_decl=1 +else + ac_have_decl=0 +fi + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRMODE $ac_have_decl +_ACEOF + GNULIB__EXIT=0; GNULIB_ATOLL=0; @@ -14739,6 +14822,84 @@ + + GNULIB_FCHMODAT=0; + GNULIB_FSTATAT=0; + GNULIB_FUTIMENS=0; + GNULIB_LCHMOD=0; + GNULIB_LSTAT=0; + GNULIB_MKDIRAT=0; + GNULIB_MKFIFO=0; + GNULIB_MKFIFOAT=0; + GNULIB_MKNOD=0; + GNULIB_MKNODAT=0; + GNULIB_STAT=0; + GNULIB_UTIMENSAT=0; + HAVE_FCHMODAT=1; + HAVE_FSTATAT=1; + HAVE_FUTIMENS=1; + HAVE_LCHMOD=1; + HAVE_LSTAT=1; + HAVE_MKDIRAT=1; + HAVE_MKFIFO=1; + HAVE_MKFIFOAT=1; + HAVE_MKNOD=1; + HAVE_MKNODAT=1; + HAVE_UTIMENSAT=1; + REPLACE_FSTAT=0; + REPLACE_FSTATAT=0; + REPLACE_FUTIMENS=0; + REPLACE_LSTAT=0; + REPLACE_MKDIR=0; + REPLACE_MKFIFO=0; + REPLACE_MKNOD=0; + REPLACE_STAT=0; + REPLACE_UTIMENSAT=0; + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat file-mode macros are broken" >&5 +$as_echo_n "checking whether stat file-mode macros are broken... " >&6; } +if ${ac_cv_header_stat_broken+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include + +#if defined S_ISBLK && defined S_IFDIR +extern char c1[S_ISBLK (S_IFDIR) ? -1 : 1]; +#endif + +#if defined S_ISBLK && defined S_IFCHR +extern char c2[S_ISBLK (S_IFCHR) ? -1 : 1]; +#endif + +#if defined S_ISLNK && defined S_IFREG +extern char c3[S_ISLNK (S_IFREG) ? -1 : 1]; +#endif + +#if defined S_ISSOCK && defined S_IFREG +extern char c4[S_ISSOCK (S_IFREG) ? -1 : 1]; +#endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stat_broken=no +else + ac_cv_header_stat_broken=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stat_broken" >&5 +$as_echo "$ac_cv_header_stat_broken" >&6; } +if test $ac_cv_header_stat_broken = yes; then + +$as_echo "#define STAT_MACROS_BROKEN 1" >>confdefs.h + +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5 $as_echo_n "checking for C/C++ restrict keyword... " >&6; } if ${ac_cv_c_restrict+:} false; then : @@ -15002,6 +15163,21 @@ # Code from module dtoastr: # Code from module extensions: + # Code from module filemode: + + + + + + + + + + + gl_LIBOBJS="$gl_LIBOBJS filemode.$ac_objext" + + + # Code from module getloadavg: @@ -16752,6 +16928,90 @@ + # Code from module sys_stat: + + + + + + + + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_sys_stat_h='<'sys/stat.h'>' + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +$as_echo_n "checking absolute name of ... " >&6; } +if ${gl_cv_next_sys_stat_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + + if test $ac_cv_header_sys_stat_h = yes; then + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + gl_cv_next_sys_stat_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n '\#/sys/stat.h#{ + s#.*"\(.*/sys/stat.h\)".*#\1# + s#^/[^/]#//&# + p + q + }'`'"' + else + gl_cv_next_sys_stat_h='<'sys/stat.h'>' + fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_stat_h" >&5 +$as_echo "$gl_cv_next_sys_stat_h" >&6; } + fi + NEXT_SYS_STAT_H=$gl_cv_next_sys_stat_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'sys/stat.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_sys_stat_h + fi + NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H=$gl_next_as_first_directive + + + + + + ac_fn_c_check_type "$LINENO" "nlink_t" "ac_cv_type_nlink_t" "#include + #include +" +if test "x$ac_cv_type_nlink_t" = xyes; then : + +else + +$as_echo "#define nlink_t int" >>confdefs.h + +fi + + + + + # Code from module time: === modified file 'lib/Makefile.am' --- lib/Makefile.am 2011-02-06 22:13:03 +0000 +++ lib/Makefile.am 2011-02-20 10:51:50 +0000 @@ -1,5 +1,6 @@ BUILT_SOURCES = EXTRA_DIST = +MOSTLYCLEANDIRS = MOSTLYCLEANFILES = noinst_LIBRARIES = === modified file 'lib/Makefile.in' --- lib/Makefile.in 2011-02-19 07:28:29 +0000 +++ lib/Makefile.in 2011-02-20 10:51:50 +0000 @@ -24,7 +24,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr getloadavg getopt-gnu ignore-value mktime strftime +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr filemode getloadavg getopt-gnu ignore-value mktime strftime VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ @@ -51,13 +51,15 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \ $(top_srcdir)/m4/c-strtod.m4 $(top_srcdir)/m4/extensions.m4 \ - $(top_srcdir)/m4/getloadavg.m4 $(top_srcdir)/m4/getopt.m4 \ - $(top_srcdir)/m4/gl-comp.m4 $(top_srcdir)/m4/gnulib-common.m4 \ + $(top_srcdir)/m4/filemode.m4 $(top_srcdir)/m4/getloadavg.m4 \ + $(top_srcdir)/m4/getopt.m4 $(top_srcdir)/m4/gl-comp.m4 \ + $(top_srcdir)/m4/gnulib-common.m4 \ $(top_srcdir)/m4/include_next.m4 $(top_srcdir)/m4/longlong.m4 \ $(top_srcdir)/m4/md5.m4 $(top_srcdir)/m4/mktime.m4 \ - $(top_srcdir)/m4/multiarch.m4 $(top_srcdir)/m4/stdbool.m4 \ - $(top_srcdir)/m4/stddef_h.m4 $(top_srcdir)/m4/stdint.m4 \ - $(top_srcdir)/m4/stdlib_h.m4 $(top_srcdir)/m4/strftime.m4 \ + $(top_srcdir)/m4/multiarch.m4 $(top_srcdir)/m4/st_dm_mode.m4 \ + $(top_srcdir)/m4/stdbool.m4 $(top_srcdir)/m4/stddef_h.m4 \ + $(top_srcdir)/m4/stdint.m4 $(top_srcdir)/m4/stdlib_h.m4 \ + $(top_srcdir)/m4/strftime.m4 $(top_srcdir)/m4/sys_stat_h.m4 \ $(top_srcdir)/m4/time_h.m4 $(top_srcdir)/m4/time_r.m4 \ $(top_srcdir)/m4/tm_gmtoff.m4 $(top_srcdir)/m4/unistd_h.m4 \ $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/configure.in @@ -152,9 +154,12 @@ GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@ GNULIB_FACCESSAT = @GNULIB_FACCESSAT@ GNULIB_FCHDIR = @GNULIB_FCHDIR@ +GNULIB_FCHMODAT = @GNULIB_FCHMODAT@ GNULIB_FCHOWNAT = @GNULIB_FCHOWNAT@ +GNULIB_FSTATAT = @GNULIB_FSTATAT@ GNULIB_FSYNC = @GNULIB_FSYNC@ GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@ +GNULIB_FUTIMENS = @GNULIB_FUTIMENS@ GNULIB_GETCWD = @GNULIB_GETCWD@ GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@ GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@ @@ -167,12 +172,19 @@ GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@ GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@ GNULIB_GRANTPT = @GNULIB_GRANTPT@ +GNULIB_LCHMOD = @GNULIB_LCHMOD@ GNULIB_LCHOWN = @GNULIB_LCHOWN@ GNULIB_LINK = @GNULIB_LINK@ GNULIB_LINKAT = @GNULIB_LINKAT@ GNULIB_LSEEK = @GNULIB_LSEEK@ +GNULIB_LSTAT = @GNULIB_LSTAT@ GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@ +GNULIB_MKDIRAT = @GNULIB_MKDIRAT@ GNULIB_MKDTEMP = @GNULIB_MKDTEMP@ +GNULIB_MKFIFO = @GNULIB_MKFIFO@ +GNULIB_MKFIFOAT = @GNULIB_MKFIFOAT@ +GNULIB_MKNOD = @GNULIB_MKNOD@ +GNULIB_MKNODAT = @GNULIB_MKNODAT@ GNULIB_MKOSTEMP = @GNULIB_MKOSTEMP@ GNULIB_MKOSTEMPS = @GNULIB_MKOSTEMPS@ GNULIB_MKSTEMP = @GNULIB_MKSTEMP@ @@ -194,6 +206,7 @@ GNULIB_RPMATCH = @GNULIB_RPMATCH@ GNULIB_SETENV = @GNULIB_SETENV@ GNULIB_SLEEP = @GNULIB_SLEEP@ +GNULIB_STAT = @GNULIB_STAT@ GNULIB_STRPTIME = @GNULIB_STRPTIME@ GNULIB_STRTOD = @GNULIB_STRTOD@ GNULIB_STRTOLL = @GNULIB_STRTOLL@ @@ -211,6 +224,7 @@ GNULIB_UNLOCKPT = @GNULIB_UNLOCKPT@ GNULIB_UNSETENV = @GNULIB_UNSETENV@ GNULIB_USLEEP = @GNULIB_USLEEP@ +GNULIB_UTIMENSAT = @GNULIB_UTIMENSAT@ GNULIB_WRITE = @GNULIB_WRITE@ GNULIB__EXIT = @GNULIB__EXIT@ GNU_OBJC_CFLAGS = @GNU_OBJC_CFLAGS@ @@ -239,9 +253,12 @@ HAVE_EUIDACCESS = @HAVE_EUIDACCESS@ HAVE_FACCESSAT = @HAVE_FACCESSAT@ HAVE_FCHDIR = @HAVE_FCHDIR@ +HAVE_FCHMODAT = @HAVE_FCHMODAT@ HAVE_FCHOWNAT = @HAVE_FCHOWNAT@ +HAVE_FSTATAT = @HAVE_FSTATAT@ HAVE_FSYNC = @HAVE_FSYNC@ HAVE_FTRUNCATE = @HAVE_FTRUNCATE@ +HAVE_FUTIMENS = @HAVE_FUTIMENS@ HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@ HAVE_GETGROUPS = @HAVE_GETGROUPS@ HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@ @@ -251,12 +268,19 @@ HAVE_GETSUBOPT = @HAVE_GETSUBOPT@ HAVE_GRANTPT = @HAVE_GRANTPT@ HAVE_INTTYPES_H = @HAVE_INTTYPES_H@ +HAVE_LCHMOD = @HAVE_LCHMOD@ HAVE_LCHOWN = @HAVE_LCHOWN@ HAVE_LINK = @HAVE_LINK@ HAVE_LINKAT = @HAVE_LINKAT@ HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@ +HAVE_LSTAT = @HAVE_LSTAT@ HAVE_MAKEINFO = @HAVE_MAKEINFO@ +HAVE_MKDIRAT = @HAVE_MKDIRAT@ HAVE_MKDTEMP = @HAVE_MKDTEMP@ +HAVE_MKFIFO = @HAVE_MKFIFO@ +HAVE_MKFIFOAT = @HAVE_MKFIFOAT@ +HAVE_MKNOD = @HAVE_MKNOD@ +HAVE_MKNODAT = @HAVE_MKNODAT@ HAVE_MKOSTEMP = @HAVE_MKOSTEMP@ HAVE_MKOSTEMPS = @HAVE_MKOSTEMPS@ HAVE_MKSTEMP = @HAVE_MKSTEMP@ @@ -298,6 +322,7 @@ HAVE_UNLOCKPT = @HAVE_UNLOCKPT@ HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@ HAVE_USLEEP = @HAVE_USLEEP@ +HAVE_UTIMENSAT = @HAVE_UTIMENSAT@ HAVE_WCHAR_H = @HAVE_WCHAR_H@ HAVE_WCHAR_T = @HAVE_WCHAR_T@ HAVE_XSERVER = @HAVE_XSERVER@ @@ -369,12 +394,14 @@ NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@ NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@ NEXT_AS_FIRST_DIRECTIVE_STDLIB_H = @NEXT_AS_FIRST_DIRECTIVE_STDLIB_H@ +NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H@ NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@ NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@ NEXT_GETOPT_H = @NEXT_GETOPT_H@ NEXT_STDDEF_H = @NEXT_STDDEF_H@ NEXT_STDINT_H = @NEXT_STDINT_H@ NEXT_STDLIB_H = @NEXT_STDLIB_H@ +NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@ NEXT_TIME_H = @NEXT_TIME_H@ NEXT_UNISTD_H = @NEXT_UNISTD_H@ NS_OBJ = @NS_OBJ@ @@ -410,6 +437,9 @@ REPLACE_DUP = @REPLACE_DUP@ REPLACE_DUP2 = @REPLACE_DUP2@ REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@ +REPLACE_FSTAT = @REPLACE_FSTAT@ +REPLACE_FSTATAT = @REPLACE_FSTATAT@ +REPLACE_FUTIMENS = @REPLACE_FUTIMENS@ REPLACE_GETCWD = @REPLACE_GETCWD@ REPLACE_GETDOMAINNAME = @REPLACE_GETDOMAINNAME@ REPLACE_GETGROUPS = @REPLACE_GETGROUPS@ @@ -420,7 +450,11 @@ REPLACE_LINKAT = @REPLACE_LINKAT@ REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@ REPLACE_LSEEK = @REPLACE_LSEEK@ +REPLACE_LSTAT = @REPLACE_LSTAT@ REPLACE_MALLOC = @REPLACE_MALLOC@ +REPLACE_MKDIR = @REPLACE_MKDIR@ +REPLACE_MKFIFO = @REPLACE_MKFIFO@ +REPLACE_MKNOD = @REPLACE_MKNOD@ REPLACE_MKSTEMP = @REPLACE_MKSTEMP@ REPLACE_MKTIME = @REPLACE_MKTIME@ REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@ @@ -434,6 +468,7 @@ REPLACE_RMDIR = @REPLACE_RMDIR@ REPLACE_SETENV = @REPLACE_SETENV@ REPLACE_SLEEP = @REPLACE_SLEEP@ +REPLACE_STAT = @REPLACE_STAT@ REPLACE_STRTOD = @REPLACE_STRTOD@ REPLACE_SYMLINK = @REPLACE_SYMLINK@ REPLACE_TIMEGM = @REPLACE_TIMEGM@ @@ -442,6 +477,7 @@ REPLACE_UNLINKAT = @REPLACE_UNLINKAT@ REPLACE_UNSETENV = @REPLACE_UNSETENV@ REPLACE_USLEEP = @REPLACE_USLEEP@ +REPLACE_UTIMENSAT = @REPLACE_UTIMENSAT@ REPLACE_WRITE = @REPLACE_WRITE@ RSVG_CFLAGS = @RSVG_CFLAGS@ RSVG_LIBS = @RSVG_LIBS@ @@ -559,25 +595,27 @@ # present in all Makefile.am that need it. This is ensured by the applicability # 'all' defined above. BUILT_SOURCES = arg-nonnull.h c++defs.h $(GETOPT_H) $(STDBOOL_H) \ - $(STDDEF_H) $(STDINT_H) stdlib.h time.h unistd.h warn-on-use.h + $(STDDEF_H) $(STDINT_H) stdlib.h sys/stat.h time.h unistd.h \ + warn-on-use.h EXTRA_DIST = $(top_srcdir)/./arg-nonnull.h $(top_srcdir)/./c++defs.h \ - md5.c md5.h ftoastr.c ftoastr.h getloadavg.c getopt.c \ - getopt.in.h getopt1.c getopt_int.h intprops.h \ - mktime-internal.h mktime.c stdbool.in.h stddef.in.h \ - stdint.in.h stdlib.in.h strftime.c strftime.h time.in.h \ - time_r.c unistd.in.h $(top_srcdir)/./warn-on-use.h + md5.c md5.h ftoastr.c ftoastr.h filemode.c filemode.h \ + getloadavg.c getopt.c getopt.in.h getopt1.c getopt_int.h \ + intprops.h mktime-internal.h mktime.c stdbool.in.h stddef.in.h \ + stdint.in.h stdlib.in.h strftime.c strftime.h sys_stat.in.h \ + time.in.h time_r.c unistd.in.h $(top_srcdir)/./warn-on-use.h +MOSTLYCLEANDIRS = sys MOSTLYCLEANFILES = core *.stackdump arg-nonnull.h arg-nonnull.h-t \ c++defs.h c++defs.h-t getopt.h getopt.h-t stdbool.h \ stdbool.h-t stddef.h stddef.h-t stdint.h stdint.h-t stdlib.h \ - stdlib.h-t time.h time.h-t unistd.h unistd.h-t warn-on-use.h \ - warn-on-use.h-t + stdlib.h-t sys/stat.h sys/stat.h-t time.h time.h-t unistd.h \ + unistd.h-t warn-on-use.h warn-on-use.h-t noinst_LIBRARIES = libgnu.a DEFAULT_INCLUDES = -I. -I../src -I$(top_srcdir)/src libgnu_a_SOURCES = dtoastr.c gettext.h ignore-value.h libgnu_a_LIBADD = $(gl_LIBOBJS) libgnu_a_DEPENDENCIES = $(gl_LIBOBJS) -EXTRA_libgnu_a_SOURCES = md5.c ftoastr.c getloadavg.c getopt.c \ - getopt1.c mktime.c strftime.c time_r.c +EXTRA_libgnu_a_SOURCES = md5.c ftoastr.c filemode.c getloadavg.c \ + getopt.c getopt1.c mktime.c strftime.c time_r.c ARG_NONNULL_H = arg-nonnull.h CXXDEFS_H = c++defs.h WARN_ON_USE_H = warn-on-use.h @@ -631,6 +669,7 @@ -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtoastr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filemode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftoastr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getloadavg.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getopt.Po@am__quote@ @@ -1021,6 +1060,55 @@ } > $@-t && \ mv $@-t $@ +# We need the following in order to create when the system +# has one that is incomplete. +sys/stat.h: sys_stat.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) + $(AM_V_at)$(MKDIR_P) sys + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ + -e 's|@''GNULIB_FCHMODAT''@|$(GNULIB_FCHMODAT)|g' \ + -e 's|@''GNULIB_FSTATAT''@|$(GNULIB_FSTATAT)|g' \ + -e 's|@''GNULIB_FUTIMENS''@|$(GNULIB_FUTIMENS)|g' \ + -e 's|@''GNULIB_LCHMOD''@|$(GNULIB_LCHMOD)|g' \ + -e 's|@''GNULIB_LSTAT''@|$(GNULIB_LSTAT)|g' \ + -e 's|@''GNULIB_MKDIRAT''@|$(GNULIB_MKDIRAT)|g' \ + -e 's|@''GNULIB_MKFIFO''@|$(GNULIB_MKFIFO)|g' \ + -e 's|@''GNULIB_MKFIFOAT''@|$(GNULIB_MKFIFOAT)|g' \ + -e 's|@''GNULIB_MKNOD''@|$(GNULIB_MKNOD)|g' \ + -e 's|@''GNULIB_MKNODAT''@|$(GNULIB_MKNODAT)|g' \ + -e 's|@''GNULIB_STAT''@|$(GNULIB_STAT)|g' \ + -e 's|@''GNULIB_UTIMENSAT''@|$(GNULIB_UTIMENSAT)|g' \ + -e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \ + -e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \ + -e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \ + -e 's|@''HAVE_LCHMOD''@|$(HAVE_LCHMOD)|g' \ + -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \ + -e 's|@''HAVE_MKDIRAT''@|$(HAVE_MKDIRAT)|g' \ + -e 's|@''HAVE_MKFIFO''@|$(HAVE_MKFIFO)|g' \ + -e 's|@''HAVE_MKFIFOAT''@|$(HAVE_MKFIFOAT)|g' \ + -e 's|@''HAVE_MKNOD''@|$(HAVE_MKNOD)|g' \ + -e 's|@''HAVE_MKNODAT''@|$(HAVE_MKNODAT)|g' \ + -e 's|@''HAVE_UTIMENSAT''@|$(HAVE_UTIMENSAT)|g' \ + -e 's|@''REPLACE_FSTAT''@|$(REPLACE_FSTAT)|g' \ + -e 's|@''REPLACE_FSTATAT''@|$(REPLACE_FSTATAT)|g' \ + -e 's|@''REPLACE_FUTIMENS''@|$(REPLACE_FUTIMENS)|g' \ + -e 's|@''REPLACE_LSTAT''@|$(REPLACE_LSTAT)|g' \ + -e 's|@''REPLACE_MKDIR''@|$(REPLACE_MKDIR)|g' \ + -e 's|@''REPLACE_MKFIFO''@|$(REPLACE_MKFIFO)|g' \ + -e 's|@''REPLACE_MKNOD''@|$(REPLACE_MKNOD)|g' \ + -e 's|@''REPLACE_STAT''@|$(REPLACE_STAT)|g' \ + -e 's|@''REPLACE_UTIMENSAT''@|$(REPLACE_UTIMENSAT)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ + < $(srcdir)/sys_stat.in.h; \ + } > $@-t && \ + mv $@-t $@ + # We need the following in order to create when the system # doesn't have one that works with the given compiler. time.h: time.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) === renamed file 'src/filemode.c' => 'lib/filemode.c' --- src/filemode.c 2011-01-25 04:08:28 +0000 +++ lib/filemode.c 2011-02-20 10:51:50 +0000 @@ -1,10 +1,12 @@ /* filemode.c -- make a string describing file modes - Copyright (C) 1985, 1990, 1993, 2001-2011 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + Copyright (C) 1985, 1990, 1993, 1998-2000, 2004, 2006, 2009-2011 Free + Software Foundation, Inc. + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3, or (at your option) - any later version. + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -12,234 +14,167 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. */ - + along with this program. If not, see . */ + #include -#include -#include - -#if !S_IRUSR -# if S_IREAD -# define S_IRUSR S_IREAD -# else -# define S_IRUSR 00400 -# endif -#endif - -#if !S_IWUSR -# if S_IWRITE -# define S_IWUSR S_IWRITE -# else -# define S_IWUSR 00200 -# endif -#endif - -#if !S_IXUSR -# if S_IEXEC -# define S_IXUSR S_IEXEC -# else -# define S_IXUSR 00100 -# endif -#endif - -#ifdef STAT_MACROS_BROKEN -#undef S_ISBLK -#undef S_ISCHR -#undef S_ISDIR -#undef S_ISFIFO -#undef S_ISLNK -#undef S_ISMPB -#undef S_ISMPC -#undef S_ISNWK -#undef S_ISREG -#undef S_ISSOCK -#endif /* STAT_MACROS_BROKEN. */ - -#if !defined(S_ISBLK) && defined(S_IFBLK) -#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) -#endif -#if !defined(S_ISCHR) && defined(S_IFCHR) -#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) -#endif -#if !defined(S_ISDIR) && defined(S_IFDIR) -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -#endif -#if !defined(S_ISREG) && defined(S_IFREG) -#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) -#endif -#if !defined(S_ISFIFO) && defined(S_IFIFO) -#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) -#endif -#if !defined(S_ISLNK) && defined(S_IFLNK) -#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) -#endif -#if !defined(S_ISSOCK) && defined(S_IFSOCK) -#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) -#endif -#if !defined(S_ISMPB) && defined(S_IFMPB) /* V7 */ -#define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) -#define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC) -#endif -#if !defined(S_ISNWK) && defined(S_IFNWK) /* HP/UX */ -#define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK) -#endif - -void mode_string (short unsigned int mode, char *str); -static char ftypelet (long int bits); -static void rwx (short unsigned int bits, char *chars); -static void setst (short unsigned int bits, char *chars); - -/* filemodestring - fill in string STR with an ls-style ASCII - representation of the st_mode field of file stats block STATP. - 10 characters are stored in STR; no terminating null is added. - The characters stored in STR are: - - 0 File type. 'd' for directory, 'c' for character - special, 'b' for block special, 'm' for multiplex, - 'l' for symbolic link, 's' for socket, 'p' for fifo, - '-' for regular, '?' for any other file type - - 1 'r' if the owner may read, '-' otherwise. - - 2 'w' if the owner may write, '-' otherwise. - - 3 'x' if the owner may execute, 's' if the file is - set-user-id, '-' otherwise. - 'S' if the file is set-user-id, but the execute - bit isn't set. - - 4 'r' if group members may read, '-' otherwise. - - 5 'w' if group members may write, '-' otherwise. - - 6 'x' if group members may execute, 's' if the file is - set-group-id, '-' otherwise. - 'S' if it is set-group-id but not executable. - - 7 'r' if any user may read, '-' otherwise. - - 8 'w' if any user may write, '-' otherwise. - - 9 'x' if any user may execute, 't' if the file is "sticky" - (will be retained in swap space after execution), '-' - otherwise. - 'T' if the file is sticky but not executable. */ - -void -filemodestring (struct stat *statp, char *str) -{ - mode_string (statp->st_mode, str); -} - -/* Like filemodestring, but only the relevant part of the `struct stat' - is given as an argument. */ - -void -mode_string (short unsigned int mode, char *str) -{ - str[0] = ftypelet ((long) mode); - rwx ((mode & 0700) << 0, &str[1]); - rwx ((mode & 0070) << 3, &str[4]); - rwx ((mode & 0007) << 6, &str[7]); - setst (mode, str); -} + +#include "filemode.h" + +/* The following is for Cray DMF (Data Migration Facility), which is a + HSM file system. A migrated file has a `st_dm_mode' that is + different from the normal `st_mode', so any tests for migrated + files should use the former. */ +#if HAVE_ST_DM_MODE +# define IS_MIGRATED_FILE(statp) \ + (S_ISOFD (statp->st_dm_mode) || S_ISOFL (statp->st_dm_mode)) +#else +# define IS_MIGRATED_FILE(statp) 0 +#endif + +#if ! HAVE_DECL_STRMODE /* Return a character indicating the type of file described by file mode BITS: - 'd' for directories - 'b' for block special files - 'c' for character special files - 'm' for multiplexor files - 'l' for symbolic links - 's' for sockets - 'p' for fifos - '-' for regular files - '?' for any other file type. */ + '-' regular file + 'b' block special file + 'c' character special file + 'C' high performance ("contiguous data") file + 'd' directory + 'D' door + 'l' symbolic link + 'm' multiplexed file (7th edition Unix; obsolete) + 'n' network special file (HP-UX) + 'p' fifo (named pipe) + 'P' port + 's' socket + 'w' whiteout (4.4BSD) + '?' some other file type */ static char -ftypelet (long int bits) +ftypelet (mode_t bits) { -#ifdef S_ISBLK + /* These are the most common, so test for them first. */ + if (S_ISREG (bits)) + return '-'; + if (S_ISDIR (bits)) + return 'd'; + + /* Other letters standardized by POSIX 1003.1-2004. */ if (S_ISBLK (bits)) return 'b'; -#endif if (S_ISCHR (bits)) return 'c'; - if (S_ISDIR (bits)) - return 'd'; - if (S_ISREG (bits)) - return '-'; -#ifdef S_ISFIFO + if (S_ISLNK (bits)) + return 'l'; if (S_ISFIFO (bits)) return 'p'; -#endif -#ifdef S_ISLNK - if (S_ISLNK (bits)) - return 'l'; -#endif -#ifdef S_ISSOCK + + /* Other file types (though not letters) standardized by POSIX. */ if (S_ISSOCK (bits)) return 's'; -#endif -#ifdef S_ISMPC - if (S_ISMPC (bits)) + + /* Nonstandard file types. */ + if (S_ISCTG (bits)) + return 'C'; + if (S_ISDOOR (bits)) + return 'D'; + if (S_ISMPB (bits) || S_ISMPC (bits)) return 'm'; -#endif -#ifdef S_ISNWK if (S_ISNWK (bits)) return 'n'; -#endif + if (S_ISPORT (bits)) + return 'P'; + if (S_ISWHT (bits)) + return 'w'; + return '?'; } -/* Look at read, write, and execute bits in BITS and set - flags in CHARS accordingly. */ - -static void -rwx (short unsigned int bits, char *chars) -{ - chars[0] = (bits & S_IRUSR) ? 'r' : '-'; - chars[1] = (bits & S_IWUSR) ? 'w' : '-'; - chars[2] = (bits & S_IXUSR) ? 'x' : '-'; -} - -/* Set the 's' and 't' flags in file attributes string CHARS, - according to the file mode BITS. */ - -static void -setst (short unsigned int bits, char *chars) -{ -#ifdef S_ISUID - if (bits & S_ISUID) - { - if (chars[3] != 'x') - /* Set-uid, but not executable by owner. */ - chars[3] = 'S'; - else - chars[3] = 's'; - } -#endif -#ifdef S_ISGID - if (bits & S_ISGID) - { - if (chars[6] != 'x') - /* Set-gid, but not executable by group. */ - chars[6] = 'S'; - else - chars[6] = 's'; - } -#endif -#ifdef S_ISVTX - if (bits & S_ISVTX) - { - if (chars[9] != 'x') - /* Sticky, but not executable by others. */ - chars[9] = 'T'; - else - chars[9] = 't'; - } -#endif -} - +/* Like filemodestring, but rely only on MODE. */ + +void +strmode (mode_t mode, char *str) +{ + str[0] = ftypelet (mode); + str[1] = mode & S_IRUSR ? 'r' : '-'; + str[2] = mode & S_IWUSR ? 'w' : '-'; + str[3] = (mode & S_ISUID + ? (mode & S_IXUSR ? 's' : 'S') + : (mode & S_IXUSR ? 'x' : '-')); + str[4] = mode & S_IRGRP ? 'r' : '-'; + str[5] = mode & S_IWGRP ? 'w' : '-'; + str[6] = (mode & S_ISGID + ? (mode & S_IXGRP ? 's' : 'S') + : (mode & S_IXGRP ? 'x' : '-')); + str[7] = mode & S_IROTH ? 'r' : '-'; + str[8] = mode & S_IWOTH ? 'w' : '-'; + str[9] = (mode & S_ISVTX + ? (mode & S_IXOTH ? 't' : 'T') + : (mode & S_IXOTH ? 'x' : '-')); + str[10] = ' '; + str[11] = '\0'; +} + +#endif /* ! HAVE_DECL_STRMODE */ + +/* filemodestring - fill in string STR with an ls-style ASCII + representation of the st_mode field of file stats block STATP. + 12 characters are stored in STR. + The characters stored in STR are: + + 0 File type, as in ftypelet above, except that other letters are used + for files whose type cannot be determined solely from st_mode: + + 'F' semaphore + 'M' migrated file (Cray DMF) + 'Q' message queue + 'S' shared memory object + 'T' typed memory object + + 1 'r' if the owner may read, '-' otherwise. + + 2 'w' if the owner may write, '-' otherwise. + + 3 'x' if the owner may execute, 's' if the file is + set-user-id, '-' otherwise. + 'S' if the file is set-user-id, but the execute + bit isn't set. + + 4 'r' if group members may read, '-' otherwise. + + 5 'w' if group members may write, '-' otherwise. + + 6 'x' if group members may execute, 's' if the file is + set-group-id, '-' otherwise. + 'S' if it is set-group-id but not executable. + + 7 'r' if any user may read, '-' otherwise. + + 8 'w' if any user may write, '-' otherwise. + + 9 'x' if any user may execute, 't' if the file is "sticky" + (will be retained in swap space after execution), '-' + otherwise. + 'T' if the file is sticky but not executable. + + 10 ' ' for compatibility with 4.4BSD strmode, + since this interface does not support ACLs. + + 11 '\0'. */ + +void +filemodestring (struct stat const *statp, char *str) +{ + strmode (statp->st_mode, str); + + if (S_TYPEISSEM (statp)) + str[0] = 'F'; + else if (IS_MIGRATED_FILE (statp)) + str[0] = 'M'; + else if (S_TYPEISMQ (statp)) + str[0] = 'Q'; + else if (S_TYPEISSHM (statp)) + str[0] = 'S'; + else if (S_TYPEISTMO (statp)) + str[0] = 'T'; +} === added file 'lib/filemode.h' --- lib/filemode.h 1970-01-01 00:00:00 +0000 +++ lib/filemode.h 2011-02-20 10:51:50 +0000 @@ -0,0 +1,44 @@ +/* Make a string describing file modes. + + Copyright (C) 1998-1999, 2003, 2006, 2009-2011 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifndef FILEMODE_H_ + +# include +# include + +/* Get the declaration of strmode. */ +# if HAVE_DECL_STRMODE +# include /* MacOS X, FreeBSD, OpenBSD */ +# include /* NetBSD */ +# endif + +# ifdef __cplusplus +extern "C" { +# endif + +# if !HAVE_DECL_STRMODE +extern void strmode (mode_t mode, char *str); +# endif + +extern void filemodestring (struct stat const *statp, char *str); + +# ifdef __cplusplus +} +# endif + +#endif === modified file 'lib/gnulib.mk' --- lib/gnulib.mk 2011-02-19 07:28:29 +0000 +++ lib/gnulib.mk 2011-02-20 10:51:50 +0000 @@ -9,7 +9,7 @@ # the same distribution terms as the rest of that program. # # Generated by gnulib-tool. -# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr getloadavg getopt-gnu ignore-value mktime strftime +# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=. --makefile-name=gnulib.mk --no-libtool --macro-prefix=gl --no-vc-files crypto/md5 dtoastr filemode getloadavg getopt-gnu ignore-value mktime strftime MOSTLYCLEANFILES += core *.stackdump @@ -88,6 +88,15 @@ ## end gnulib module dtoastr +## begin gnulib module filemode + + +EXTRA_DIST += filemode.c filemode.h + +EXTRA_libgnu_a_SOURCES += filemode.c + +## end gnulib module filemode + ## begin gnulib module getloadavg @@ -331,6 +340,65 @@ ## end gnulib module strftime +## begin gnulib module sys_stat + +BUILT_SOURCES += sys/stat.h + +# We need the following in order to create when the system +# has one that is incomplete. +sys/stat.h: sys_stat.in.h $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) + $(AM_V_at)$(MKDIR_P) sys + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \ + sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_SYS_STAT_H''@|$(NEXT_SYS_STAT_H)|g' \ + -e 's|@''GNULIB_FCHMODAT''@|$(GNULIB_FCHMODAT)|g' \ + -e 's|@''GNULIB_FSTATAT''@|$(GNULIB_FSTATAT)|g' \ + -e 's|@''GNULIB_FUTIMENS''@|$(GNULIB_FUTIMENS)|g' \ + -e 's|@''GNULIB_LCHMOD''@|$(GNULIB_LCHMOD)|g' \ + -e 's|@''GNULIB_LSTAT''@|$(GNULIB_LSTAT)|g' \ + -e 's|@''GNULIB_MKDIRAT''@|$(GNULIB_MKDIRAT)|g' \ + -e 's|@''GNULIB_MKFIFO''@|$(GNULIB_MKFIFO)|g' \ + -e 's|@''GNULIB_MKFIFOAT''@|$(GNULIB_MKFIFOAT)|g' \ + -e 's|@''GNULIB_MKNOD''@|$(GNULIB_MKNOD)|g' \ + -e 's|@''GNULIB_MKNODAT''@|$(GNULIB_MKNODAT)|g' \ + -e 's|@''GNULIB_STAT''@|$(GNULIB_STAT)|g' \ + -e 's|@''GNULIB_UTIMENSAT''@|$(GNULIB_UTIMENSAT)|g' \ + -e 's|@''HAVE_FCHMODAT''@|$(HAVE_FCHMODAT)|g' \ + -e 's|@''HAVE_FSTATAT''@|$(HAVE_FSTATAT)|g' \ + -e 's|@''HAVE_FUTIMENS''@|$(HAVE_FUTIMENS)|g' \ + -e 's|@''HAVE_LCHMOD''@|$(HAVE_LCHMOD)|g' \ + -e 's|@''HAVE_LSTAT''@|$(HAVE_LSTAT)|g' \ + -e 's|@''HAVE_MKDIRAT''@|$(HAVE_MKDIRAT)|g' \ + -e 's|@''HAVE_MKFIFO''@|$(HAVE_MKFIFO)|g' \ + -e 's|@''HAVE_MKFIFOAT''@|$(HAVE_MKFIFOAT)|g' \ + -e 's|@''HAVE_MKNOD''@|$(HAVE_MKNOD)|g' \ + -e 's|@''HAVE_MKNODAT''@|$(HAVE_MKNODAT)|g' \ + -e 's|@''HAVE_UTIMENSAT''@|$(HAVE_UTIMENSAT)|g' \ + -e 's|@''REPLACE_FSTAT''@|$(REPLACE_FSTAT)|g' \ + -e 's|@''REPLACE_FSTATAT''@|$(REPLACE_FSTATAT)|g' \ + -e 's|@''REPLACE_FUTIMENS''@|$(REPLACE_FUTIMENS)|g' \ + -e 's|@''REPLACE_LSTAT''@|$(REPLACE_LSTAT)|g' \ + -e 's|@''REPLACE_MKDIR''@|$(REPLACE_MKDIR)|g' \ + -e 's|@''REPLACE_MKFIFO''@|$(REPLACE_MKFIFO)|g' \ + -e 's|@''REPLACE_MKNOD''@|$(REPLACE_MKNOD)|g' \ + -e 's|@''REPLACE_STAT''@|$(REPLACE_STAT)|g' \ + -e 's|@''REPLACE_UTIMENSAT''@|$(REPLACE_UTIMENSAT)|g' \ + -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ + -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ + < $(srcdir)/sys_stat.in.h; \ + } > $@-t && \ + mv $@-t $@ +MOSTLYCLEANFILES += sys/stat.h sys/stat.h-t +MOSTLYCLEANDIRS += sys + +EXTRA_DIST += sys_stat.in.h + +## end gnulib module sys_stat + ## begin gnulib module time BUILT_SOURCES += time.h === added file 'lib/sys_stat.in.h' --- lib/sys_stat.in.h 1970-01-01 00:00:00 +0000 +++ lib/sys_stat.in.h 2011-02-20 10:51:50 +0000 @@ -0,0 +1,646 @@ +/* Provide a more complete sys/stat header file. + Copyright (C) 2005-2011 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* Written by Eric Blake, Paul Eggert, and Jim Meyering. */ + +/* This file is supposed to be used on platforms where is + incomplete. It is intended to provide definitions and prototypes + needed by an application. Start with what the system provides. */ + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +#if defined __need_system_sys_stat_h +/* Special invocation convention. */ + +#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@ + +#else +/* Normal invocation convention. */ + +#ifndef _GL_SYS_STAT_H + +/* Get nlink_t. */ +#include + +/* Get struct timespec. */ +#include + +/* The include_next requires a split double-inclusion guard. */ +#@INCLUDE_NEXT@ @NEXT_SYS_STAT_H@ + +#ifndef _GL_SYS_STAT_H +#define _GL_SYS_STAT_H + +/* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ + +/* The definition of _GL_ARG_NONNULL is copied here. */ + +/* The definition of _GL_WARN_ON_USE is copied here. */ + +/* Before doing "#define mkdir rpl_mkdir" below, we need to include all + headers that may declare mkdir(). */ +#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ +# include /* mingw32, mingw64 */ +# include /* mingw64 */ +#endif + +#ifndef S_IFMT +# define S_IFMT 0170000 +#endif + +#if STAT_MACROS_BROKEN +# undef S_ISBLK +# undef S_ISCHR +# undef S_ISDIR +# undef S_ISFIFO +# undef S_ISLNK +# undef S_ISNAM +# undef S_ISMPB +# undef S_ISMPC +# undef S_ISNWK +# undef S_ISREG +# undef S_ISSOCK +#endif + +#ifndef S_ISBLK +# ifdef S_IFBLK +# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) +# else +# define S_ISBLK(m) 0 +# endif +#endif + +#ifndef S_ISCHR +# ifdef S_IFCHR +# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) +# else +# define S_ISCHR(m) 0 +# endif +#endif + +#ifndef S_ISDIR +# ifdef S_IFDIR +# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +# else +# define S_ISDIR(m) 0 +# endif +#endif + +#ifndef S_ISDOOR /* Solaris 2.5 and up */ +# define S_ISDOOR(m) 0 +#endif + +#ifndef S_ISFIFO +# ifdef S_IFIFO +# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) +# else +# define S_ISFIFO(m) 0 +# endif +#endif + +#ifndef S_ISLNK +# ifdef S_IFLNK +# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) +# else +# define S_ISLNK(m) 0 +# endif +#endif + +#ifndef S_ISMPB /* V7 */ +# ifdef S_IFMPB +# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) +# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC) +# else +# define S_ISMPB(m) 0 +# define S_ISMPC(m) 0 +# endif +#endif + +#ifndef S_ISNAM /* Xenix */ +# ifdef S_IFNAM +# define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM) +# else +# define S_ISNAM(m) 0 +# endif +#endif + +#ifndef S_ISNWK /* HP/UX */ +# ifdef S_IFNWK +# define S_ISNWK(m) (((m) & S_IFMT) == S_IFNWK) +# else +# define S_ISNWK(m) 0 +# endif +#endif + +#ifndef S_ISPORT /* Solaris 10 and up */ +# define S_ISPORT(m) 0 +#endif + +#ifndef S_ISREG +# ifdef S_IFREG +# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +# else +# define S_ISREG(m) 0 +# endif +#endif + +#ifndef S_ISSOCK +# ifdef S_IFSOCK +# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) +# else +# define S_ISSOCK(m) 0 +# endif +#endif + + +#ifndef S_TYPEISMQ +# define S_TYPEISMQ(p) 0 +#endif + +#ifndef S_TYPEISTMO +# define S_TYPEISTMO(p) 0 +#endif + + +#ifndef S_TYPEISSEM +# ifdef S_INSEM +# define S_TYPEISSEM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSEM) +# else +# define S_TYPEISSEM(p) 0 +# endif +#endif + +#ifndef S_TYPEISSHM +# ifdef S_INSHD +# define S_TYPEISSHM(p) (S_ISNAM ((p)->st_mode) && (p)->st_rdev == S_INSHD) +# else +# define S_TYPEISSHM(p) 0 +# endif +#endif + +/* high performance ("contiguous data") */ +#ifndef S_ISCTG +# define S_ISCTG(p) 0 +#endif + +/* Cray DMF (data migration facility): off line, with data */ +#ifndef S_ISOFD +# define S_ISOFD(p) 0 +#endif + +/* Cray DMF (data migration facility): off line, with no data */ +#ifndef S_ISOFL +# define S_ISOFL(p) 0 +#endif + +/* 4.4BSD whiteout */ +#ifndef S_ISWHT +# define S_ISWHT(m) 0 +#endif + +/* If any of the following are undefined, + define them to their de facto standard values. */ +#if !S_ISUID +# define S_ISUID 04000 +#endif +#if !S_ISGID +# define S_ISGID 02000 +#endif + +/* S_ISVTX is a common extension to POSIX. */ +#ifndef S_ISVTX +# define S_ISVTX 01000 +#endif + +#if !S_IRUSR && S_IREAD +# define S_IRUSR S_IREAD +#endif +#if !S_IRUSR +# define S_IRUSR 00400 +#endif +#if !S_IRGRP +# define S_IRGRP (S_IRUSR >> 3) +#endif +#if !S_IROTH +# define S_IROTH (S_IRUSR >> 6) +#endif + +#if !S_IWUSR && S_IWRITE +# define S_IWUSR S_IWRITE +#endif +#if !S_IWUSR +# define S_IWUSR 00200 +#endif +#if !S_IWGRP +# define S_IWGRP (S_IWUSR >> 3) +#endif +#if !S_IWOTH +# define S_IWOTH (S_IWUSR >> 6) +#endif + +#if !S_IXUSR && S_IEXEC +# define S_IXUSR S_IEXEC +#endif +#if !S_IXUSR +# define S_IXUSR 00100 +#endif +#if !S_IXGRP +# define S_IXGRP (S_IXUSR >> 3) +#endif +#if !S_IXOTH +# define S_IXOTH (S_IXUSR >> 6) +#endif + +#if !S_IRWXU +# define S_IRWXU (S_IRUSR | S_IWUSR | S_IXUSR) +#endif +#if !S_IRWXG +# define S_IRWXG (S_IRGRP | S_IWGRP | S_IXGRP) +#endif +#if !S_IRWXO +# define S_IRWXO (S_IROTH | S_IWOTH | S_IXOTH) +#endif + +/* S_IXUGO is a common extension to POSIX. */ +#if !S_IXUGO +# define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH) +#endif + +#ifndef S_IRWXUGO +# define S_IRWXUGO (S_IRWXU | S_IRWXG | S_IRWXO) +#endif + +/* Macros for futimens and utimensat. */ +#ifndef UTIME_NOW +# define UTIME_NOW (-1) +# define UTIME_OMIT (-2) +#endif + + +#if @GNULIB_FCHMODAT@ +# if !@HAVE_FCHMODAT@ +_GL_FUNCDECL_SYS (fchmodat, int, + (int fd, char const *file, mode_t mode, int flag) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (fchmodat, int, + (int fd, char const *file, mode_t mode, int flag)); +_GL_CXXALIASWARN (fchmodat); +#elif defined GNULIB_POSIXCHECK +# undef fchmodat +# if HAVE_RAW_DECL_FCHMODAT +_GL_WARN_ON_USE (fchmodat, "fchmodat is not portable - " + "use gnulib module openat for portability"); +# endif +#endif + + +#if @REPLACE_FSTAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define fstat rpl_fstat +# endif +_GL_FUNCDECL_RPL (fstat, int, (int fd, struct stat *buf) _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (fstat, int, (int fd, struct stat *buf)); +#else +_GL_CXXALIAS_SYS (fstat, int, (int fd, struct stat *buf)); +#endif +_GL_CXXALIASWARN (fstat); + + +#if @GNULIB_FSTATAT@ +# if @REPLACE_FSTATAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef fstatat +# define fstatat rpl_fstatat +# endif +_GL_FUNCDECL_RPL (fstatat, int, + (int fd, char const *name, struct stat *st, int flags) + _GL_ARG_NONNULL ((2, 3))); +_GL_CXXALIAS_RPL (fstatat, int, + (int fd, char const *name, struct stat *st, int flags)); +# else +# if !@HAVE_FSTATAT@ +_GL_FUNCDECL_SYS (fstatat, int, + (int fd, char const *name, struct stat *st, int flags) + _GL_ARG_NONNULL ((2, 3))); +# endif +_GL_CXXALIAS_SYS (fstatat, int, + (int fd, char const *name, struct stat *st, int flags)); +# endif +_GL_CXXALIASWARN (fstatat); +#elif defined GNULIB_POSIXCHECK +# undef fstatat +# if HAVE_RAW_DECL_FSTATAT +_GL_WARN_ON_USE (fstatat, "fstatat is not portable - " + "use gnulib module openat for portability"); +# endif +#endif + + +#if @GNULIB_FUTIMENS@ +# if @REPLACE_FUTIMENS@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef futimens +# define futimens rpl_futimens +# endif +_GL_FUNCDECL_RPL (futimens, int, (int fd, struct timespec const times[2])); +_GL_CXXALIAS_RPL (futimens, int, (int fd, struct timespec const times[2])); +# else +# if !@HAVE_FUTIMENS@ +_GL_FUNCDECL_SYS (futimens, int, (int fd, struct timespec const times[2])); +# endif +_GL_CXXALIAS_SYS (futimens, int, (int fd, struct timespec const times[2])); +# endif +_GL_CXXALIASWARN (futimens); +#elif defined GNULIB_POSIXCHECK +# undef futimens +# if HAVE_RAW_DECL_FUTIMENS +_GL_WARN_ON_USE (futimens, "futimens is not portable - " + "use gnulib module futimens for portability"); +# endif +#endif + + +#if @GNULIB_LCHMOD@ +/* Change the mode of FILENAME to MODE, without dereferencing it if FILENAME + denotes a symbolic link. */ +# if !@HAVE_LCHMOD@ +/* The lchmod replacement follows symbolic links. Callers should take + this into account; lchmod should be applied only to arguments that + are known to not be symbolic links. On hosts that lack lchmod, + this can lead to race conditions between the check and the + invocation of lchmod, but we know of no workarounds that are + reliable in general. You might try requesting support for lchmod + from your operating system supplier. */ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define lchmod chmod +# endif +/* Need to cast, because on mingw, the second parameter of chmod is + int mode. */ +_GL_CXXALIAS_RPL_CAST_1 (lchmod, chmod, int, + (const char *filename, mode_t mode)); +# else +# if 0 /* assume already declared */ +_GL_FUNCDECL_SYS (lchmod, int, (const char *filename, mode_t mode) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (lchmod, int, (const char *filename, mode_t mode)); +# endif +# if @HAVE_LCHMOD@ +_GL_CXXALIASWARN (lchmod); +# endif +#elif defined GNULIB_POSIXCHECK +# undef lchmod +# if HAVE_RAW_DECL_LCHMOD +_GL_WARN_ON_USE (lchmod, "lchmod is unportable - " + "use gnulib module lchmod for portability"); +# endif +#endif + + +#if @GNULIB_LSTAT@ +# if ! @HAVE_LSTAT@ +/* mingw does not support symlinks, therefore it does not have lstat. But + without links, stat does just fine. */ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define lstat stat +# endif +_GL_CXXALIAS_RPL_1 (lstat, stat, int, (const char *name, struct stat *buf)); +# elif @REPLACE_LSTAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef lstat +# define lstat rpl_lstat +# endif +_GL_FUNCDECL_RPL (lstat, int, (const char *name, struct stat *buf) + _GL_ARG_NONNULL ((1, 2))); +_GL_CXXALIAS_RPL (lstat, int, (const char *name, struct stat *buf)); +# else +_GL_CXXALIAS_SYS (lstat, int, (const char *name, struct stat *buf)); +# endif +# if @HAVE_LSTAT@ +_GL_CXXALIASWARN (lstat); +# endif +#elif defined GNULIB_POSIXCHECK +# undef lstat +# if HAVE_RAW_DECL_LSTAT +_GL_WARN_ON_USE (lstat, "lstat is unportable - " + "use gnulib module lstat for portability"); +# endif +#endif + + +#if @REPLACE_MKDIR@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef mkdir +# define mkdir rpl_mkdir +# endif +_GL_FUNCDECL_RPL (mkdir, int, (char const *name, mode_t mode) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode)); +#else +/* mingw's _mkdir() function has 1 argument, but we pass 2 arguments. + Additionally, it declares _mkdir (and depending on compile flags, an + alias mkdir), only in the nonstandard includes and , + which are included above. */ +# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ + +# if !GNULIB_defined_rpl_mkdir +static inline int +rpl_mkdir (char const *name, mode_t mode) +{ + return _mkdir (name); +} +# define GNULIB_defined_rpl_mkdir 1 +# endif + +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# define mkdir rpl_mkdir +# endif +_GL_CXXALIAS_RPL (mkdir, int, (char const *name, mode_t mode)); +# else +_GL_CXXALIAS_SYS (mkdir, int, (char const *name, mode_t mode)); +# endif +#endif +_GL_CXXALIASWARN (mkdir); + + +#if @GNULIB_MKDIRAT@ +# if !@HAVE_MKDIRAT@ +_GL_FUNCDECL_SYS (mkdirat, int, (int fd, char const *file, mode_t mode) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (mkdirat, int, (int fd, char const *file, mode_t mode)); +_GL_CXXALIASWARN (mkdirat); +#elif defined GNULIB_POSIXCHECK +# undef mkdirat +# if HAVE_RAW_DECL_MKDIRAT +_GL_WARN_ON_USE (mkdirat, "mkdirat is not portable - " + "use gnulib module openat for portability"); +# endif +#endif + + +#if @GNULIB_MKFIFO@ +# if @REPLACE_MKFIFO@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef mkfifo +# define mkfifo rpl_mkfifo +# endif +_GL_FUNCDECL_RPL (mkfifo, int, (char const *file, mode_t mode) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (mkfifo, int, (char const *file, mode_t mode)); +# else +# if !@HAVE_MKFIFO@ +_GL_FUNCDECL_SYS (mkfifo, int, (char const *file, mode_t mode) + _GL_ARG_NONNULL ((1))); +# endif +_GL_CXXALIAS_SYS (mkfifo, int, (char const *file, mode_t mode)); +# endif +_GL_CXXALIASWARN (mkfifo); +#elif defined GNULIB_POSIXCHECK +# undef mkfifo +# if HAVE_RAW_DECL_MKFIFO +_GL_WARN_ON_USE (mkfifo, "mkfifo is not portable - " + "use gnulib module mkfifo for portability"); +# endif +#endif + + +#if @GNULIB_MKFIFOAT@ +# if !@HAVE_MKFIFOAT@ +_GL_FUNCDECL_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (mkfifoat, int, (int fd, char const *file, mode_t mode)); +_GL_CXXALIASWARN (mkfifoat); +#elif defined GNULIB_POSIXCHECK +# undef mkfifoat +# if HAVE_RAW_DECL_MKFIFOAT +_GL_WARN_ON_USE (mkfifoat, "mkfifoat is not portable - " + "use gnulib module mkfifoat for portability"); +# endif +#endif + + +#if @GNULIB_MKNOD@ +# if @REPLACE_MKNOD@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef mknod +# define mknod rpl_mknod +# endif +_GL_FUNCDECL_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev) + _GL_ARG_NONNULL ((1))); +_GL_CXXALIAS_RPL (mknod, int, (char const *file, mode_t mode, dev_t dev)); +# else +# if !@HAVE_MKNOD@ +_GL_FUNCDECL_SYS (mknod, int, (char const *file, mode_t mode, dev_t dev) + _GL_ARG_NONNULL ((1))); +# endif +/* Need to cast, because on OSF/1 5.1, the third parameter is '...'. */ +_GL_CXXALIAS_SYS_CAST (mknod, int, (char const *file, mode_t mode, dev_t dev)); +# endif +_GL_CXXALIASWARN (mknod); +#elif defined GNULIB_POSIXCHECK +# undef mknod +# if HAVE_RAW_DECL_MKNOD +_GL_WARN_ON_USE (mknod, "mknod is not portable - " + "use gnulib module mknod for portability"); +# endif +#endif + + +#if @GNULIB_MKNODAT@ +# if !@HAVE_MKNODAT@ +_GL_FUNCDECL_SYS (mknodat, int, + (int fd, char const *file, mode_t mode, dev_t dev) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (mknodat, int, + (int fd, char const *file, mode_t mode, dev_t dev)); +_GL_CXXALIASWARN (mknodat); +#elif defined GNULIB_POSIXCHECK +# undef mknodat +# if HAVE_RAW_DECL_MKNODAT +_GL_WARN_ON_USE (mknodat, "mknodat is not portable - " + "use gnulib module mkfifoat for portability"); +# endif +#endif + + +#if @GNULIB_STAT@ +# if @REPLACE_STAT@ +/* We can't use the object-like #define stat rpl_stat, because of + struct stat. This means that rpl_stat will not be used if the user + does (stat)(a,b). Oh well. */ +# undef stat +# ifdef _LARGE_FILES + /* With _LARGE_FILES defined, AIX (only) defines stat to stat64, + so we have to replace stat64() instead of stat(). */ +# define stat stat64 +# undef stat64 +# define stat64(name, st) rpl_stat (name, st) +# else /* !_LARGE_FILES */ +# define stat(name, st) rpl_stat (name, st) +# endif /* !_LARGE_FILES */ +_GL_EXTERN_C int stat (const char *name, struct stat *buf) + _GL_ARG_NONNULL ((1, 2)); +# endif +#elif defined GNULIB_POSIXCHECK +# undef stat +# if HAVE_RAW_DECL_STAT +_GL_WARN_ON_USE (stat, "stat is unportable - " + "use gnulib module stat for portability"); +# endif +#endif + + +#if @GNULIB_UTIMENSAT@ +# if @REPLACE_UTIMENSAT@ +# if !(defined __cplusplus && defined GNULIB_NAMESPACE) +# undef utimensat +# define utimensat rpl_utimensat +# endif +_GL_FUNCDECL_RPL (utimensat, int, (int fd, char const *name, + struct timespec const times[2], int flag) + _GL_ARG_NONNULL ((2))); +_GL_CXXALIAS_RPL (utimensat, int, (int fd, char const *name, + struct timespec const times[2], int flag)); +# else +# if !@HAVE_UTIMENSAT@ +_GL_FUNCDECL_SYS (utimensat, int, (int fd, char const *name, + struct timespec const times[2], int flag) + _GL_ARG_NONNULL ((2))); +# endif +_GL_CXXALIAS_SYS (utimensat, int, (int fd, char const *name, + struct timespec const times[2], int flag)); +# endif +_GL_CXXALIASWARN (utimensat); +#elif defined GNULIB_POSIXCHECK +# undef utimensat +# if HAVE_RAW_DECL_UTIMENSAT +_GL_WARN_ON_USE (utimensat, "utimensat is not portable - " + "use gnulib module utimensat for portability"); +# endif +#endif + + +#endif /* _GL_SYS_STAT_H */ +#endif /* _GL_SYS_STAT_H */ +#endif === modified file 'lisp/emacs-lisp/find-gc.el' --- lisp/emacs-lisp/find-gc.el 2011-01-25 04:08:28 +0000 +++ lisp/emacs-lisp/find-gc.el 2011-02-20 10:51:50 +0000 @@ -55,7 +55,7 @@ "term.c" "cm.c" "emacs.c" "keyboard.c" "macros.c" "keymap.c" "sysdep.c" "buffer.c" "filelock.c" "insdel.c" "marker.c" "minibuf.c" "fileio.c" - "dired.c" "filemode.c" "cmds.c" "casefiddle.c" + "dired.c" "cmds.c" "casefiddle.c" "indent.c" "search.c" "regex.c" "undo.c" "alloc.c" "data.c" "doc.c" "editfns.c" "callint.c" "eval.c" "fns.c" "print.c" "lread.c" === added file 'm4/filemode.m4' --- m4/filemode.m4 1970-01-01 00:00:00 +0000 +++ m4/filemode.m4 2011-02-20 10:51:50 +0000 @@ -0,0 +1,12 @@ +# filemode.m4 serial 7 +dnl Copyright (C) 2002, 2005-2006, 2009-2011 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +AC_DEFUN([gl_FILEMODE], +[ + AC_REQUIRE([AC_STRUCT_ST_DM_MODE]) + AC_LIBOBJ([filemode]) + AC_CHECK_DECLS_ONCE([strmode]) +]) === modified file 'm4/gl-comp.m4' --- m4/gl-comp.m4 2011-02-19 07:28:29 +0000 +++ m4/gl-comp.m4 2011-02-20 10:51:50 +0000 @@ -32,6 +32,7 @@ # Code from module dtoastr: # Code from module extensions: AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) + # Code from module filemode: # Code from module getloadavg: # Code from module getopt-gnu: # Code from module getopt-posix: @@ -46,6 +47,7 @@ # Code from module stdint: # Code from module stdlib: # Code from module strftime: + # Code from module sys_stat: # Code from module time: # Code from module time_r: # Code from module unistd: @@ -75,6 +77,8 @@ # Code from module dtoastr: AC_REQUIRE([gl_C99_STRTOLD]) # Code from module extensions: + # Code from module filemode: + gl_FILEMODE # Code from module getloadavg: gl_GETLOADAVG([$gl_source_base]) gl_STDLIB_MODULE_INDICATOR([getloadavg]) @@ -105,6 +109,9 @@ gl_STDLIB_H # Code from module strftime: gl_FUNC_GNU_STRFTIME + # Code from module sys_stat: + gl_HEADER_SYS_STAT_H + AC_PROG_MKDIR_P # Code from module time: gl_HEADER_TIME_H # Code from module time_r: @@ -257,6 +264,8 @@ build-aux/c++defs.h build-aux/warn-on-use.h lib/dtoastr.c + lib/filemode.c + lib/filemode.h lib/ftoastr.c lib/ftoastr.h lib/getloadavg.c @@ -277,12 +286,14 @@ lib/stdlib.in.h lib/strftime.c lib/strftime.h + lib/sys_stat.in.h lib/time.in.h lib/time_r.c lib/unistd.in.h m4/00gnulib.m4 m4/c-strtod.m4 m4/extensions.m4 + m4/filemode.m4 m4/getloadavg.m4 m4/getopt.m4 m4/gnulib-common.m4 @@ -291,11 +302,13 @@ m4/md5.m4 m4/mktime.m4 m4/multiarch.m4 + m4/st_dm_mode.m4 m4/stdbool.m4 m4/stddef_h.m4 m4/stdint.m4 m4/stdlib_h.m4 m4/strftime.m4 + m4/sys_stat_h.m4 m4/time_h.m4 m4/time_r.m4 m4/tm_gmtoff.m4 === added file 'm4/st_dm_mode.m4' --- m4/st_dm_mode.m4 1970-01-01 00:00:00 +0000 +++ m4/st_dm_mode.m4 2011-02-20 10:51:50 +0000 @@ -0,0 +1,23 @@ +# serial 6 + +# Copyright (C) 1998-1999, 2001, 2009-2011 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# Define HAVE_ST_DM_MODE if struct stat has an st_dm_mode member. + +AC_DEFUN([AC_STRUCT_ST_DM_MODE], + [AC_CACHE_CHECK([for st_dm_mode in struct stat], [ac_cv_struct_st_dm_mode], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +#include +#include ]], [[struct stat s; s.st_dm_mode;]])], + [ac_cv_struct_st_dm_mode=yes], + [ac_cv_struct_st_dm_mode=no])]) + + if test $ac_cv_struct_st_dm_mode = yes; then + AC_DEFINE([HAVE_ST_DM_MODE], [1], + [Define if struct stat has an st_dm_mode member. ]) + fi + ] +) === added file 'm4/sys_stat_h.m4' --- m4/sys_stat_h.m4 1970-01-01 00:00:00 +0000 +++ m4/sys_stat_h.m4 2011-02-20 10:51:50 +0000 @@ -0,0 +1,82 @@ +# sys_stat_h.m4 serial 24 -*- Autoconf -*- +dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Eric Blake. +dnl Provide a GNU-like . + +AC_DEFUN([gl_HEADER_SYS_STAT_H], +[ + AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) + + dnl For the mkdir substitute. + AC_REQUIRE([AC_C_INLINE]) + + dnl Check for broken stat macros. + AC_REQUIRE([AC_HEADER_STAT]) + + gl_CHECK_NEXT_HEADERS([sys/stat.h]) + + dnl Define types that are supposed to be defined in or + dnl . + AC_CHECK_TYPE([nlink_t], [], + [AC_DEFINE([nlink_t], [int], + [Define to the type of st_nlink in struct stat, or a supertype.])], + [#include + #include ]) + + dnl Check for declarations of anything we want to poison if the + dnl corresponding gnulib module is not in use. + gl_WARN_ON_USE_PREPARE([[#include + ]], [fchmodat fstatat futimens lchmod lstat mkdirat mkfifo mkfifoat + mknod mknodat stat utimensat]) +]) # gl_HEADER_SYS_STAT_H + +AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR], +[ + dnl Use AC_REQUIRE here, so that the default settings are expanded once only. + AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) + gl_MODULE_INDICATOR_SET_VARIABLE([$1]) + dnl Define it also as a C macro, for the benefit of the unit tests. + gl_MODULE_INDICATOR_FOR_TESTS([$1]) +]) + +AC_DEFUN([gl_SYS_STAT_H_DEFAULTS], +[ + AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR + GNULIB_FCHMODAT=0; AC_SUBST([GNULIB_FCHMODAT]) + GNULIB_FSTATAT=0; AC_SUBST([GNULIB_FSTATAT]) + GNULIB_FUTIMENS=0; AC_SUBST([GNULIB_FUTIMENS]) + GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD]) + GNULIB_LSTAT=0; AC_SUBST([GNULIB_LSTAT]) + GNULIB_MKDIRAT=0; AC_SUBST([GNULIB_MKDIRAT]) + GNULIB_MKFIFO=0; AC_SUBST([GNULIB_MKFIFO]) + GNULIB_MKFIFOAT=0; AC_SUBST([GNULIB_MKFIFOAT]) + GNULIB_MKNOD=0; AC_SUBST([GNULIB_MKNOD]) + GNULIB_MKNODAT=0; AC_SUBST([GNULIB_MKNODAT]) + GNULIB_STAT=0; AC_SUBST([GNULIB_STAT]) + GNULIB_UTIMENSAT=0; AC_SUBST([GNULIB_UTIMENSAT]) + dnl Assume proper GNU behavior unless another module says otherwise. + HAVE_FCHMODAT=1; AC_SUBST([HAVE_FCHMODAT]) + HAVE_FSTATAT=1; AC_SUBST([HAVE_FSTATAT]) + HAVE_FUTIMENS=1; AC_SUBST([HAVE_FUTIMENS]) + HAVE_LCHMOD=1; AC_SUBST([HAVE_LCHMOD]) + HAVE_LSTAT=1; AC_SUBST([HAVE_LSTAT]) + HAVE_MKDIRAT=1; AC_SUBST([HAVE_MKDIRAT]) + HAVE_MKFIFO=1; AC_SUBST([HAVE_MKFIFO]) + HAVE_MKFIFOAT=1; AC_SUBST([HAVE_MKFIFOAT]) + HAVE_MKNOD=1; AC_SUBST([HAVE_MKNOD]) + HAVE_MKNODAT=1; AC_SUBST([HAVE_MKNODAT]) + HAVE_UTIMENSAT=1; AC_SUBST([HAVE_UTIMENSAT]) + REPLACE_FSTAT=0; AC_SUBST([REPLACE_FSTAT]) + REPLACE_FSTATAT=0; AC_SUBST([REPLACE_FSTATAT]) + REPLACE_FUTIMENS=0; AC_SUBST([REPLACE_FUTIMENS]) + REPLACE_LSTAT=0; AC_SUBST([REPLACE_LSTAT]) + REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR]) + REPLACE_MKFIFO=0; AC_SUBST([REPLACE_MKFIFO]) + REPLACE_MKNOD=0; AC_SUBST([REPLACE_MKNOD]) + REPLACE_STAT=0; AC_SUBST([REPLACE_STAT]) + REPLACE_UTIMENSAT=0; AC_SUBST([REPLACE_UTIMENSAT]) +]) === modified file 'src/ChangeLog' --- src/ChangeLog 2011-02-20 18:50:26 +0000 +++ src/ChangeLog 2011-02-21 17:56:37 +0000 @@ -1,3 +1,13 @@ +2011-02-21 Paul Eggert + + Import filemode module from gnulib. + * Makefile.in (base_obj): Remove filemode.o, as it's now in ../lib. + * deps.mk (dired.o): Depend on ../lib/filemode.h, too. + (filemode.o): Remove; this is now in ../lib. + * dired.c: Include . + (filemodestring): Remove now-redundant decl. + * config.in: Regenerate. + 2011-02-20 Eli Zaretskii * makefile.w32-in ($(BLD)/fns.$(O)): Depend on === modified file 'src/Makefile.in' --- src/Makefile.in 2011-02-20 08:48:52 +0000 +++ src/Makefile.in 2011-02-20 10:53:22 +0000 @@ -347,7 +347,7 @@ cm.o term.o terminal.o xfaces.o $(XOBJ) $(GTK_OBJ) $(DBUS_OBJ) \ emacs.o keyboard.o macros.o keymap.o sysdep.o \ buffer.o filelock.o insdel.o marker.o \ - minibuf.o fileio.o dired.o filemode.o \ + minibuf.o fileio.o dired.o \ cmds.o casetab.o casefiddle.o indent.o search.o regex.o undo.o \ alloc.o data.o doc.o editfns.o callint.o \ eval.o floatfns.o fns.o font.o print.o lread.o \ === modified file 'src/config.in' --- src/config.in 2011-02-19 07:28:29 +0000 +++ src/config.in 2011-02-20 10:53:22 +0000 @@ -152,6 +152,10 @@ don't. */ #undef HAVE_DECL_LOCALTIME_R +/* Define to 1 if you have the declaration of `strmode', and to 0 if you + don't. */ +#undef HAVE_DECL_STRMODE + /* Define to 1 if you have the declaration of `sys_siglist', and to 0 if you don't. */ #undef HAVE_DECL_SYS_SIGLIST @@ -686,6 +690,9 @@ /* Define to 1 if `struct utimbuf' is declared by . */ #undef HAVE_STRUCT_UTIMBUF +/* Define if struct stat has an st_dm_mode member. */ +#undef HAVE_ST_DM_MODE + /* Define to 1 if you have the `sync' function. */ #undef HAVE_SYNC @@ -981,6 +988,9 @@ STACK_DIRECTION = 0 => direction of growth unknown */ #undef STACK_DIRECTION +/* Define to 1 if the `S_IS*' macros in do not work properly. */ +#undef STAT_MACROS_BROKEN + /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS @@ -1149,6 +1159,9 @@ /* Define to the name of the strftime replacement function. */ #undef my_strftime +/* Define to the type of st_nlink in struct stat, or a supertype. */ +#undef nlink_t + /* Define to `int' if does not define. */ #undef pid_t === modified file 'src/deps.mk' --- src/deps.mk 2011-02-19 09:51:59 +0000 +++ src/deps.mk 2011-02-20 10:53:22 +0000 @@ -73,7 +73,7 @@ dbusbind.o: dbusbind.c termhooks.h frame.h keyboard.h lisp.h $(config_h) dired.o: dired.c commands.h buffer.h lisp.h $(config_h) character.h charset.h \ coding.h regex.h systime.h blockinput.h atimer.h composite.h \ - ../lib/unistd.h globals.h + ../lib/filemode.h ../lib/unistd.h globals.h dispnew.o: dispnew.c systime.h commands.h process.h frame.h coding.h \ window.h buffer.h termchar.h termopts.h termhooks.h cm.h \ disptab.h indent.h $(INTERVALS_H) nsgui.h ../lib/unistd.h \ @@ -98,7 +98,6 @@ commands.h globals.h ../lib/unistd.h filelock.o: filelock.c buffer.h character.h coding.h systime.h composite.h \ ../lib/unistd.h lisp.h globals.h $(config_h) -filemode.o: filemode.c $(config_h) font.o: font.c dispextern.h frame.h window.h ccl.h character.h charset.h \ font.h lisp.h globals.h $(config_h) buffer.h composite.h fontset.h \ xterm.h nsgui.h msdos.h === modified file 'src/dired.c' --- src/dired.c 2011-02-16 15:02:50 +0000 +++ src/dired.c 2011-02-20 17:14:24 +0000 @@ -61,6 +61,8 @@ #endif /* HAVE_DIRENT_H */ +#include + #ifdef MSDOS #define DIRENTRY_NONEMPTY(p) ((p)->d_name[0] != 0) #else @@ -82,9 +84,6 @@ struct re_registers *, Lisp_Object, int, int); -/* From filemode.c. Can't go in Lisp.h because of `stat'. */ -extern void filemodestring (struct stat *, char *); - /* if system does not have symbolic links, it does not have lstat. In that case, use ordinary stat instead. */ ------------------------------------------------------------ revno: 103371 author: Lars Ingebrigtsen committer: Katsumi Yamaoka branch nick: trunk timestamp: Mon 2011-02-21 13:29:15 +0000 message: Merge changes made in Gnus trunk. gnus.texi (Window Layout): Document layout names. nntp.el (nntp-finish-retrieve-group-infos): Add a kludge to use the given method as in the group name if we're using an extended method. (nntp-finish-retrieve-group-infos): Wait for the end of the LIST ACTIVE command, if we're using that, instead of waiting for the beginning. gnus-start.el (gnus-get-unread-articles): Extend the methods so that we're sure to get unique server names, and we don't output two async commands in the same buffer. This fixes an NNTP hang for some users. netrc.el (netrc-parse): Comment fix. gnus-sum.el (gnus-summary-next-article): Add a kludge to reselect the summary buffer before reading going to the next buffer. This avoids putting the point in the group buffer if you `C-g' the command. auth-source.el (auth-source-netrc-parse): Add an in-memory netrc cache (for now) to make ~/.authinfo.gpg files usable. nnfolder.el (copyright-update): Define for the compiler. auth-source.el (auth-source-search): Fix unbound variable. diff: === modified file 'doc/misc/ChangeLog' --- doc/misc/ChangeLog 2011-02-19 20:36:54 +0000 +++ doc/misc/ChangeLog 2011-02-21 13:29:15 +0000 @@ -1,3 +1,7 @@ +2011-02-20 Lars Ingebrigtsen + + * gnus.texi (Window Layout): Document layout names. + 2011-02-19 Eli Zaretskii * ada-mode.texi: Sync @dircategory with ../../info/dir. === modified file 'doc/misc/gnus.texi' --- doc/misc/gnus.texi 2011-02-19 19:40:59 +0000 +++ doc/misc/gnus.texi 2011-02-21 13:29:15 +0000 @@ -22823,6 +22823,81 @@ to fiddle with @code{gnus-tree-minimize-window} to avoid having the windows resized. +@subsection Window Configuration Names + +Here's a list of most of the currently known window configurations, +and when they're used: + +@itemize @code +@item group +The group buffer. + +@item summary +Entering a group and showing only the summary. + +@item article +Selecting an article. + +@item server +The server buffer. + +@item browse +Browsing groups from the server buffer. + +@item message +Composing a (new) message. + +@item only-article +Showing only the article buffer. + +@item edit-article +Editing an article. + +@item edit-form +Editing group parameters and the like. + +@item edit-score +Editing a server definition. + +@item post +Composing a news message. + +@item reply +Replying or following up an article without yanking the text. + +@item forward +Forwarding a message. + +@item reply-yank +Replying or following up an article with yanking the text. + +@item mail-bound +Bouncing a message. + +@item pipe +Sending an article to an external process. + +@item bug +Sending a bug report. + +@item score-trace +Displaying the score trace. + +@item score-words +Displaying the score words. + +@item split-trace +Displaying the split trace. + +@item compose-bounce +Composing a bounce message. + +@item mml-preview +Previewing a @acronym{MIME} part. + +@end itemize + + @subsection Example Window Configurations @itemize @bullet === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-02-21 06:03:36 +0000 +++ lisp/ChangeLog 2011-02-21 13:29:15 +0000 @@ -1,3 +1,7 @@ +2011-02-21 Lars Ingebrigtsen + + * net/netrc.el (netrc-parse): Comment fix. + 2011-02-21 Chong Yidong * color.el (color-name-to-rgb): Rename from color-rgb->normalize. === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2011-02-21 06:03:36 +0000 +++ lisp/gnus/ChangeLog 2011-02-21 13:29:15 +0000 @@ -4,6 +4,30 @@ color-rgb-to-hex, color-name-to-rgb, color-srgb-to-lab, and color-lab-to-srgb. +2011-02-21 Lars Ingebrigtsen + + * nntp.el (nntp-finish-retrieve-group-infos): Add a kludge to use the + given method as in the group name if we're using an extended method. + (nntp-finish-retrieve-group-infos): Wait for the end of the LIST ACTIVE + command, if we're using that, instead of waiting for the beginning. + + * gnus-start.el (gnus-get-unread-articles): Extend the methods so that + we're sure to get unique server names, and we don't output two async + commands in the same buffer. This fixes an NNTP hang for some users. + +2011-02-21 Lars Ingebrigtsen + + * gnus-sum.el (gnus-summary-next-article): Add a kludge to reselect the + summary buffer before reading going to the next buffer. This avoids + putting the point in the group buffer if you `C-g' the command. + + * auth-source.el (auth-source-netrc-parse): Add an in-memory netrc + cache (for now) to make ~/.authinfo.gpg files usable. + + * nnfolder.el (copyright-update): Define for the compiler. + + * auth-source.el (auth-source-search): Fix unbound variable. + 2011-02-19 Glenn Morris * gnus.el (gnus-meta): Doc fix. === modified file 'lisp/gnus/auth-source.el' --- lisp/gnus/auth-source.el 2011-02-18 23:15:24 +0000 +++ lisp/gnus/auth-source.el 2011-02-21 13:29:15 +0000 @@ -500,7 +500,7 @@ unless (memq (nth i spec) ignored-keys) collect (nth i spec))) (found (auth-source-recall spec)) - filtered-backends accessor-key found-here goal matches) + filtered-backends accessor-key found-here goal matches backend) (if (and found auth-source-do-cache) (auth-source-do-debug @@ -680,6 +680,8 @@ ;;; Backend specific parsing: netrc/authinfo backend +(defvar auth-source-netrc-cache nil) + ;;; (auth-source-netrc-parse "~/.authinfo.gpg") (defun* auth-source-netrc-parse (&rest spec @@ -698,7 +700,19 @@ (max (or max 5000)) ; sanity check: default to stop at 5K (modified 0) alist elem result pair) - (insert-file-contents file) + (if (and auth-source-netrc-cache + (equal (car auth-source-netrc-cache) + (nth 5 (file-attributes file)))) + (insert (base64-decode-string + (rot13-string (cdr auth-source-netrc-cache)))) + (insert-file-contents file) + (when (string-match "\\.gpg\\'" file) + ;; Store the contents of the file heavily encrypted in memory. + (setq auth-source-netrc-cache + (cons (nth 5 (file-attributes file)) + (rot13-string + (base64-encode-string + (buffer-string))))))) (goto-char (point-min)) ;; Go through the file, line by line. (while (and (not (eobp)) === modified file 'lisp/gnus/gnus-start.el' --- lisp/gnus/gnus-start.el 2011-02-15 11:24:37 +0000 +++ lisp/gnus/gnus-start.el 2011-02-21 13:29:15 +0000 @@ -1675,7 +1675,20 @@ (lambda (c1 c2) (< (gnus-method-rank (cadr c1) (car c1)) (gnus-method-rank (cadr c2) (car c2)))))) - + ;; Go through the list of servers and possibly extend methods that + ;; aren't equal (and that need extension; i.e., they are async). + (let ((methods nil)) + (dolist (elem type-cache) + (destructuring-bind (method method-type infos dummy) elem + (let ((gnus-opened-servers methods)) + (when (and (gnus-similar-server-opened method) + (gnus-check-backend-function + 'retrieve-group-data-early (car method))) + (setq method (gnus-server-extend-method + (gnus-info-group (car infos)) + method)) + (setcar elem method)) + (push (list method 'ok) methods))))) ;; Start early async retrieval of data. (dolist (elem type-cache) (destructuring-bind (method method-type infos dummy) elem === modified file 'lisp/gnus/gnus-sum.el' --- lisp/gnus/gnus-sum.el 2011-02-16 23:12:47 +0000 +++ lisp/gnus/gnus-sum.el 2011-02-21 13:29:15 +0000 @@ -7734,6 +7734,7 @@ (point (with-current-buffer gnus-group-buffer (point))) + (current-summary (current-buffer)) (group (if (eq gnus-keep-same-level 'best) (gnus-summary-best-group gnus-newsgroup-name) @@ -7758,6 +7759,10 @@ (gnus-summary-next-group nil group backward))) (t (when (gnus-key-press-event-p last-input-event) + ;; Somehow or other, we may now have selected a different + ;; window. Make point go back to the summary buffer. + (when (eq current-summary (current-buffer)) + (select-window (get-buffer-window current-summary))) (gnus-summary-walk-group-buffer gnus-newsgroup-name cmd unread backward point)))))))) === modified file 'lisp/gnus/nnfolder.el' --- lisp/gnus/nnfolder.el 2011-02-19 19:40:59 +0000 +++ lisp/gnus/nnfolder.el 2011-02-21 13:29:15 +0000 @@ -1083,6 +1083,8 @@ (or nnfolder-nov-directory nnfolder-directory))) (concat (nnfolder-group-pathname group) nnfolder-nov-file-suffix))) +(defvar copyright-update) + (defun nnfolder-save-buffer () "Save the buffer." (when (buffer-modified-p) === modified file 'lisp/gnus/nntp.el' --- lisp/gnus/nntp.el 2011-02-15 11:24:37 +0000 +++ lisp/gnus/nntp.el 2011-02-21 13:29:15 +0000 @@ -808,7 +808,11 @@ (progn (goto-char last-point) ;; Count replies. - (while (re-search-forward "^[0-9]" nil t) + (while (re-search-forward + (if nntp-server-list-active-group + "^[.]" + "^[0-9]") + nil t) (incf received)) (setq last-point (point)) (< received count))) @@ -828,8 +832,13 @@ (progn (forward-line 1) (point)))) (nntp-copy-to-buffer nntp-server-buffer (point-min) (point-max)) (with-current-buffer nntp-server-buffer - (gnus-active-to-gnus-format method gnus-active-hashtb - nil t)))))))) + (gnus-active-to-gnus-format + ;; Kludge to use the extended method name if you have + ;; an extended one. + (if (consp (gnus-info-method (car infos))) + (gnus-info-method (car infos)) + method) + gnus-active-hashtb nil t)))))))) (deffoo nntp-retrieve-groups (groups &optional server) "Retrieve group info on GROUPS." === modified file 'lisp/net/netrc.el' --- lisp/net/netrc.el 2011-01-25 04:08:28 +0000 +++ lisp/net/netrc.el 2011-02-21 13:29:15 +0000 @@ -63,10 +63,10 @@ alist elem result pair) (if (and netrc-cache (equal (car netrc-cache) (nth 5 (file-attributes file)))) - ;; Store the contents of the file heavily encrypted in memory. (insert (base64-decode-string (rot13-string (cdr netrc-cache)))) (insert-file-contents file) (when (string-match "\\.gpg\\'" file) + ;; Store the contents of the file heavily encrypted in memory. (setq netrc-cache (cons (nth 5 (file-attributes file)) (rot13-string (base64-encode-string ------------------------------------------------------------ revno: 103370 committer: Chong Yidong branch nick: trunk timestamp: Mon 2011-02-21 01:03:36 -0500 message: Merge some code from hexrgb.el into color.el. * lisp/color.el (color-name-to-rgb): Rename from color-rgb->normalize. Autoload. Add optional arg FRAME, and pass it to color-values. (color-complement): Caller changed. Doc fix. (color-gradient): Rewrite for better clarity and efficiency. (color-rgb-to-hex): Rename from color-rgb->hex. (color-rgb-to-hsv): Rename from color-rgb->hsv. Force hue and saturation to zero if the value is too small. (color-rgb-to-hsl): Rename from color-rgb->hsl. (color-srgb-to-xyz): Rename from color-srgb->xyz. Doc fix. (color-xyz-to-srgb): Rename from color-xyz->srgb. Doc fix. (color-xyz-to-lab): Rename from color-xyz->lab. Doc fix. (color-lab-to-xyz): Rename from color-lab->xyz. Doc fix. (color-lab-to-srgb): Rename from color-lab->srgb. Doc fix. (color-cie-de2000): Doc fix. * lisp/facemenu.el (color-rgb-to-hsv): Deleted; use the version in lisp/color.el instead. (list-colors-sort-key, list-colors-print): Use color-normalized-values. * lisp/faces.el (color-values): Use cond for clarity. Doc fix. * lisp/gnus/shr-color.el (shr-color->hexadecimal): Use renamed function names color-rgb-to-hex, color-name-to-rgb, color-srgb-to-lab, and color-lab-to-srgb. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-02-20 18:35:30 +0000 +++ lisp/ChangeLog 2011-02-21 06:03:36 +0000 @@ -1,3 +1,31 @@ +2011-02-21 Chong Yidong + + * color.el (color-name-to-rgb): Rename from color-rgb->normalize. + Autoload. Add optional arg FRAME, and pass it to color-values. + (color-complement): Caller changed. Doc fix. + (color-gradient): Rewrite for better clarity and efficiency. + + * faces.el (color-values): Use cond for clarity. Doc fix. + + * facemenu.el (color-rgb-to-hsv): Deleted; use the version in + color.el instead. + (list-colors-sort-key, list-colors-print): Use + color-normalized-values. + +2011-02-20 Drew Adams + + * color.el: First part of merge from hexrgb.el. + (color-rgb-to-hex): Rename from color-rgb->hex. + (color-rgb-to-hsv): Rename from color-rgb->hsv. Force hue and + saturation to zero if the value is too small. + (color-rgb-to-hsl): Rename from color-rgb->hsl. + (color-srgb-to-xyz): Rename from color-srgb->xyz. Doc fix. + (color-xyz-to-srgb): Rename from color-xyz->srgb. Doc fix. + (color-xyz-to-lab): Rename from color-xyz->lab. Doc fix. + (color-lab-to-xyz): Rename from color-lab->xyz. Doc fix. + (color-lab-to-srgb): Rename from color-lab->srgb. Doc fix. + (color-cie-de2000): Doc fix. + 2011-02-20 Alan Mackenzie * progmodes/cc-cmds.el (c-beginning-of-statement): Avoid loop in === modified file 'lisp/color.el' --- lisp/color.el 2011-02-01 23:46:27 +0000 +++ lisp/color.el 2011-02-21 06:03:36 +0000 @@ -1,9 +1,10 @@ -;;; color.el --- Color manipulation laboratory routines -*- coding: utf-8; -*- +;;; color.el --- Color manipulation library -*- coding: utf-8; -*- ;; Copyright (C) 2010-2011 Free Software Foundation, Inc. -;; Author: Julien Danjou -;; Keywords: html +;; Authors: Julien Danjou +;; Drew Adams +;; Keywords: lisp, faces, color, hex, rgb, hsv, hsl, cie-lab, background ;; This file is part of GNU Emacs. @@ -22,7 +23,13 @@ ;;; Commentary: -;; This package provides color manipulation functions. +;; This package provides functions for manipulating colors, including +;; converting between color representations, computing color +;; complements, and computing CIEDE2000 color distances. +;; +;; Supported color representations include RGB (red, green, blue), HSV +;; (hue, saturation, value), HSL (hue, saturation, luminence), sRGB, +;; CIE XYZ, and CIE L*a*b* color components. ;;; Code: @@ -34,15 +41,31 @@ (unless (boundp 'float-pi) (defconst float-pi (* 4 (atan 1)) "The value of Pi (3.1415926...)."))) -(defun color-rgb->hex (red green blue) - "Return hexadecimal notation for RED GREEN BLUE color. -RED GREEN BLUE must be values between 0 and 1 inclusively." +;;;###autoload +(defun color-name-to-rgb (color &optional frame) + "Convert COLOR string to a list of normalized RGB components. +COLOR should be a color name (e.g. \"white\") or an RGB triplet +string (e.g. \"#ff12ec\"). + +Normally the return value is a list of three floating-point +numbers, (RED GREEN BLUE), each between 0.0 and 1.0 inclusive. + +Optional arg FRAME specifies the frame where the color is to be +displayed. If FRAME is omitted or nil, use the selected frame. +If FRAME cannot display COLOR, return nil." + (mapcar (lambda (x) (/ x 65535.0)) (color-values color frame))) + +(defun color-rgb-to-hex (red green blue) + "Return hexadecimal notation for the color RED GREEN BLUE. +RED GREEN BLUE must be numbers between 0.0 and 1.0 inclusive." (format "#%02x%02x%02x" (* red 255) (* green 255) (* blue 255))) -(defun color-complement (color) - "Return the color that is the complement of COLOR." - (let ((color (color-rgb->normalize color))) +(defun color-complement (color-name) + "Return the color that is the complement of COLOR-NAME. +COLOR-NAME should be a string naming a color (e.g. \"white\"), or +a string specifying a color's RGB components (e.g. \"#ff12ec\")." + (let ((color (color-name-to-rgb color-name))) (list (- 1.0 (car color)) (- 1.0 (cadr color)) (- 1.0 (caddr color))))) @@ -52,50 +75,62 @@ The color list builds a color gradient starting at color START to color STOP. It does not include the START and STOP color in the resulting list." - (loop for i from 1 to step-number - with red-step = (/ (- (car stop) (car start)) (1+ step-number)) - with green-step = (/ (- (cadr stop) (cadr start)) (1+ step-number)) - with blue-step = (/ (- (caddr stop) (caddr start)) (1+ step-number)) - collect (list - (+ (car start) (* i red-step)) - (+ (cadr start) (* i green-step)) - (+ (caddr start) (* i blue-step))))) + (let* ((r (nth 0 start)) + (g (nth 1 start)) + (b (nth 2 start)) + (r-step (/ (- (nth 0 stop) r) (1+ step-number))) + (g-step (/ (- (nth 1 stop) g) (1+ step-number))) + (b-step (/ (- (nth 2 stop) b) (1+ step-number))) + result) + (dotimes (n step-number) + (push (list (setq r (+ r r-step)) + (setq g (+ g g-step)) + (setq b (+ b b-step))) + result)) + (nreverse result))) (defun color-complement-hex (color) "Return the color that is the complement of COLOR, in hexadecimal format." - (apply 'color-rgb->hex (color-complement color))) + (apply 'color-rgb-to-hex (color-complement color))) -(defun color-rgb->hsv (red green blue) - "Convert RED GREEN BLUE values to HSV representation. -Hue is in radians. Saturation and values are between 0 and 1 -inclusively." - (let* ((r (float red)) +(defun color-rgb-to-hsv (red green blue) + "Convert RED, GREEN, and BLUE color components to HSV. +RED, GREEN, and BLUE should each be numbers between 0.0 and 1.0, +inclusive. Return a list (HUE, SATURATION, VALUE), where HUE is +in radians and both SATURATION and VALUE are between 0.0 and 1.0, +inclusive." + (let* ((r (float red)) (g (float green)) (b (float blue)) (max (max r g b)) (min (min r g b))) - (list - (/ (* 2 float-pi - (cond ((and (= r g) (= g b)) 0) - ((and (= r max) - (>= g b)) - (* 60 (/ (- g b) (- max min)))) - ((and (= r max) - (< g b)) - (+ 360 (* 60 (/ (- g b) (- max min))))) - ((= max g) - (+ 120 (* 60 (/ (- b r) (- max min))))) - ((= max b) - (+ 240 (* 60 (/ (- r g) (- max min))))))) - 360) - (if (= max 0) - 0 - (- 1 (/ min max))) - (/ max 255.0)))) + (if (< (- max min) 1e-8) + (list 0.0 0.0 0.0) + (list + (/ (* 2 float-pi + (cond ((and (= r g) (= g b)) 0) + ((and (= r max) + (>= g b)) + (* 60 (/ (- g b) (- max min)))) + ((and (= r max) + (< g b)) + (+ 360 (* 60 (/ (- g b) (- max min))))) + ((= max g) + (+ 120 (* 60 (/ (- b r) (- max min))))) + ((= max b) + (+ 240 (* 60 (/ (- r g) (- max min))))))) + 360) + (if (= max 0) 0 (- 1 (/ min max))) + (/ max 255.0))))) -(defun color-rgb->hsl (red green blue) +(defun color-rgb-to-hsl (red green blue) "Convert RED GREEN BLUE colors to their HSL representation. -RED, GREEN and BLUE must be between 0 and 1 inclusively." +RED, GREEN, and BLUE should each be numbers between 0.0 and 1.0, +inclusive. + +Return a list (HUE, SATURATION, LUMINENCE), where HUE is in radians +and both SATURATION and LUMINENCE are between 0.0 and 1.0, +inclusive." (let* ((r red) (g green) (b blue) @@ -104,13 +139,13 @@ (delta (- max min)) (l (/ (+ max min) 2.0))) (list - (if (= max min) + (if (< (- max min) 1e-8) 0 (* 2 float-pi (/ (cond ((= max r) (+ (/ (- g b) delta) (if (< g b) 6 0))) ((= max g) - (+ (/ (- b r) delta) 2)) + (+ (/ (- b r) delta) 2)) (t (+ (/ (- r g) delta) 4))) 6))) @@ -121,9 +156,9 @@ (/ delta (+ max min)))) l))) -(defun color-srgb->xyz (red green blue) - "Converts RED GREEN BLUE colors from the sRGB color space to CIE XYZ. -RED, BLUE and GREEN must be between 0 and 1 inclusively." +(defun color-srgb-to-xyz (red green blue) + "Convert RED GREEN BLUE colors from the sRGB color space to CIE XYZ. +RED, BLUE and GREEN must be between 0 and 1, inclusive." (let ((r (if (<= red 0.04045) (/ red 12.95) (expt (/ (+ red 0.055) 1.055) 2.4))) @@ -137,8 +172,8 @@ (+ (* 0.21266729 r) (* 0.7151522 g) (* 0.0721750 b)) (+ (* 0.0193339 r) (* 0.1191920 g) (* 0.9503041 b))))) -(defun color-xyz->srgb (X Y Z) - "Converts CIE X Y Z colors to sRGB color space." +(defun color-xyz-to-srgb (X Y Z) + "Convert CIE X Y Z colors to sRGB color space." (let ((r (+ (* 3.2404542 X) (* -1.5371385 Y) (* -0.4985314 Z))) (g (+ (* -0.9692660 X) (* 1.8760108 Y) (* 0.0415560 Z))) (b (+ (* 0.0556434 X) (* -0.2040259 Y) (* 1.0572252 Z)))) @@ -158,10 +193,10 @@ (defconst color-cie-ε (/ 216 24389.0)) (defconst color-cie-κ (/ 24389 27.0)) -(defun color-xyz->lab (X Y Z &optional white-point) - "Converts CIE XYZ to CIE L*a*b*. -WHITE-POINT can be specified as (X Y Z) white point to use. If -none is set, `color-d65-xyz' is used." +(defun color-xyz-to-lab (X Y Z &optional white-point) + "Convert CIE XYZ to CIE L*a*b*. +WHITE-POINT specifies the (X Y Z) white point for the +conversion. If omitted or nil, use `color-d65-xyz'." (destructuring-bind (Xr Yr Zr) (or white-point color-d65-xyz) (let* ((xr (/ X Xr)) (yr (/ Y Yr)) @@ -180,10 +215,10 @@ (* 500 (- fx fy)) ; a (* 200 (- fy fz)))))) ; b -(defun color-lab->xyz (L a b &optional white-point) - "Converts CIE L*a*b* to CIE XYZ. -WHITE-POINT can be specified as (X Y Z) white point to use. If -none is set, `color-d65-xyz' is used." +(defun color-lab-to-xyz (L a b &optional white-point) + "Convert CIE L*a*b* to CIE XYZ. +WHITE-POINT specifies the (X Y Z) white point for the +conversion. If omitted or nil, use `color-d65-xyz'." (destructuring-bind (Xr Yr Zr) (or white-point color-d65-xyz) (let* ((fy (/ (+ L 16) 116.0)) (fz (- fy (/ b 200.0))) @@ -201,21 +236,18 @@ (* yr Yr) ; Y (* zr Zr))))) ; Z -(defun color-srgb->lab (red green blue) - "Converts RGB to CIE L*a*b*." - (apply 'color-xyz->lab (color-srgb->xyz red green blue))) - -(defun color-rgb->normalize (color) - "Normalize a RGB color to values between 0 and 1 inclusively." - (mapcar (lambda (x) (/ x 65535.0)) (x-color-values color))) - -(defun color-lab->srgb (L a b) - "Converts CIE L*a*b* to RGB." - (apply 'color-xyz->srgb (color-lab->xyz L a b))) +(defun color-srgb-to-lab (red green blue) + "Convert RGB to CIE L*a*b*." + (apply 'color-xyz-to-lab (color-srgb-to-xyz red green blue))) + +(defun color-lab-to-srgb (L a b) + "Convert CIE L*a*b* to RGB." + (apply 'color-xyz-to-srgb (color-lab-to-xyz L a b))) (defun color-cie-de2000 (color1 color2 &optional kL kC kH) - "Computes the CIEDE2000 color distance between COLOR1 and COLOR2. -Colors must be in CIE L*a*b* format." + "Return the CIEDE2000 color distance between COLOR1 and COLOR2. +Both COLOR1 and COLOR2 should be in CIE L*a*b* format, as +returned by `color-srgb-to-lab' or `color-xyz-to-lab'." (destructuring-bind (L₁ a₁ b₁) color1 (destructuring-bind (L₂ a₂ b₂) color2 (let* ((kL (or kL 1)) === modified file 'lisp/facemenu.el' --- lisp/facemenu.el 2011-01-25 04:08:28 +0000 +++ lisp/facemenu.el 2011-02-21 06:03:36 +0000 @@ -463,25 +463,6 @@ (defalias 'facemenu-read-color 'read-color) -(defun color-rgb-to-hsv (r g b) - "For R, G, B color components return a list of hue, saturation, value. -R, G, B input values should be in [0..65535] range. -Output values for hue are integers in [0..360] range. -Output values for saturation and value are integers in [0..100] range." - (let* ((r (/ r 65535.0)) - (g (/ g 65535.0)) - (b (/ b 65535.0)) - (max (max r g b)) - (min (min r g b)) - (h (cond ((= max min) 0) - ((= max r) (mod (+ (* 60 (/ (- g b) (- max min))) 360) 360)) - ((= max g) (+ (* 60 (/ (- b r) (- max min))) 120)) - ((= max b) (+ (* 60 (/ (- r g) (- max min))) 240)))) - (s (cond ((= max 0) 0) - (t (- 1 (/ min max))))) - (v max)) - (list (round h) (round s 0.01) (round v 0.01)))) - (defcustom list-colors-sort nil "Color sort order for `list-colors-display'. `nil' means default implementation-dependent order (defined in `x-colors'). @@ -508,6 +489,7 @@ "Return a list of keys for sorting colors depending on `list-colors-sort'. COLOR is the name of the color. When return value is nil, filter out the color from the output." + (require 'color) (cond ((null list-colors-sort) color) ((eq list-colors-sort 'name) @@ -517,12 +499,12 @@ ((eq (car-safe list-colors-sort) 'rgb-dist) (color-distance color (cdr list-colors-sort))) ((eq list-colors-sort 'hsv) - (apply 'color-rgb-to-hsv (color-values color))) + (apply 'color-rgb-to-hsv (color-name-to-rgb color))) ((eq (car-safe list-colors-sort) 'hsv-dist) - (let* ((c-rgb (color-values color)) + (let* ((c-rgb (color-name-to-rgb color)) (c-hsv (apply 'color-rgb-to-hsv c-rgb)) (o-hsv (apply 'color-rgb-to-hsv - (color-values (cdr list-colors-sort))))) + (color-name-to-rgb (cdr list-colors-sort))))) (unless (and (eq (nth 0 c-rgb) (nth 1 c-rgb)) ; exclude grayscale (eq (nth 1 c-rgb) (nth 2 c-rgb))) ;; 3D Euclidean distance (sqrt is not needed for sorting) @@ -638,7 +620,7 @@ 'mouse-face 'highlight 'help-echo (let ((hsv (apply 'color-rgb-to-hsv - (color-values (car color))))) + (color-name-to-rgb (car color))))) (format "H:%d S:%d V:%d" (nth 0 hsv) (nth 1 hsv) (nth 2 hsv))))) (when callback === modified file 'lisp/faces.el' --- lisp/faces.el 2011-02-12 23:40:43 +0000 +++ lisp/faces.el 2011-02-21 06:03:36 +0000 @@ -1653,18 +1653,28 @@ (defun color-values (color &optional frame) "Return a description of the color named COLOR on frame FRAME. -The value is a list of integer RGB values--(RED GREEN BLUE). -These values appear to range from 0 to 65280 or 65535, depending -on the system; white is \(65280 65280 65280\) or \(65535 65535 65535\). +COLOR should be a string naming a color (e.g. \"white\"), or a +string specifying a color's RGB components (e.g. \"#ff12ec\"). + +Return a list of three integers, (RED GREEN BLUE), each between 0 +and either 65280 or 65535 (the maximum depends on the system). +Use `color-name-to-rgb' if you want RGB floating-point values +normalized to 1.0. + If FRAME is omitted or nil, use the selected frame. If FRAME cannot display COLOR, the value is nil. -If COLOR is the symbol `unspecified' or one of the strings -\"unspecified-fg\" or \"unspecified-bg\", the value is nil." - (if (member color '(unspecified "unspecified-fg" "unspecified-bg")) - nil - (if (memq (framep (or frame (selected-frame))) '(x w32 ns)) - (xw-color-values color frame) - (tty-color-values color frame)))) + +COLOR can also be the symbol `unspecified' or one of the strings +\"unspecified-fg\" or \"unspecified-bg\", in which case the +return value is nil." + (cond + ((member color '(unspecified "unspecified-fg" "unspecified-bg")) + nil) + ((memq (framep (or frame (selected-frame))) '(x w32 ns)) + (xw-color-values color frame)) + (t + (tty-color-values color frame)))) + (defalias 'x-color-values 'color-values) (declare-function xw-display-color-p "xfns.c" (&optional terminal)) === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2011-02-20 04:08:04 +0000 +++ lisp/gnus/ChangeLog 2011-02-21 06:03:36 +0000 @@ -1,3 +1,9 @@ +2011-02-20 Chong Yidong + + * shr-color.el (shr-color->hexadecimal): Use renamed function names + color-rgb-to-hex, color-name-to-rgb, color-srgb-to-lab, and + color-lab-to-srgb. + 2011-02-19 Glenn Morris * gnus.el (gnus-meta): Doc fix. === modified file 'lisp/gnus/shr-color.el' --- lisp/gnus/shr-color.el 2011-01-25 04:08:28 +0000 +++ lisp/gnus/shr-color.el 2011-02-21 06:03:36 +0000 @@ -259,7 +259,7 @@ (l (/ (string-to-number (match-string-no-properties 3 color)) 100.0))) (destructuring-bind (r g b) (shr-color-hsl-to-rgb-fractions h s l) - (color-rgb->hex r g b)))) + (color-rgb-to-hex r g b)))) ;; Color names ((cdr (assoc-string color shr-color-html-colors-alist t))) ;; Unrecognized color :( @@ -325,13 +325,13 @@ new background color will not be computed. Only the foreground color will be adapted to be visible on BG." ;; Convert fg and bg to CIE Lab - (let ((fg-norm (color-rgb->normalize fg)) - (bg-norm (color-rgb->normalize bg))) + (let ((fg-norm (color-name-to-rgb fg)) + (bg-norm (color-name-to-rgb bg))) (if (or (null fg-norm) (null bg-norm)) (list bg fg) - (let* ((fg-lab (apply 'color-srgb->lab fg-norm)) - (bg-lab (apply 'color-srgb->lab bg-norm)) + (let* ((fg-lab (apply 'color-srgb-to-lab fg-norm)) + (bg-lab (apply 'color-srgb-to-lab bg-norm)) ;; Compute color distance using CIE DE 2000 (fg-bg-distance (color-cie-de2000 fg-lab bg-lab)) ;; Compute luminance distance (substract L component) @@ -351,10 +351,10 @@ bg (apply 'format "#%02x%02x%02x" (mapcar (lambda (x) (* (max (min 1 x) 0) 255)) - (apply 'color-lab->srgb bg-lab)))) + (apply 'color-lab-to-srgb bg-lab)))) (apply 'format "#%02x%02x%02x" (mapcar (lambda (x) (* (max (min 1 x) 0) 255)) - (apply 'color-lab->srgb fg-lab)))))))))) + (apply 'color-lab-to-srgb fg-lab)))))))))) (provide 'shr-color) ------------------------------------------------------------ Use --include-merges or -n0 to see merged revisions.