diff options
Diffstat (limited to 'lib-src')
-rw-r--r-- | lib-src/ChangeLog | 72 | ||||
-rw-r--r-- | lib-src/emacsclient.c | 27 | ||||
-rw-r--r-- | lib-src/etags.c | 116 | ||||
-rw-r--r-- | lib-src/make-docfile.c | 4 | ||||
-rw-r--r-- | lib-src/makefile.w32-in | 19 | ||||
-rw-r--r-- | lib-src/movemail.c | 35 | ||||
-rw-r--r-- | lib-src/update-game-score.c | 2 |
7 files changed, 148 insertions, 127 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 1cf30eefcdc..81876d86165 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,75 @@ +2013-02-08 Paul Eggert <eggert@cs.ucla.edu> + + * movemail.c (getenv): Remove decl (unused since 1994). + +2013-01-15 Paul Eggert <eggert@cs.ucla.edu> + + * make-docfile.c (write_globals): Make it a bit clearer (Bug#13448). + This pacifies GCC 4.7.2 when Emacs is configured with + --enable-link-time-optimization and --enable-gcc-warnings. + +2013-01-01 Juanma Barranquero <lekktu@gmail.com> + + * makefile.w32-in (lisp1): Add macroexp.elc (bug#13320). + +2012-12-11 Juanma Barranquero <lekktu@gmail.com> + + * makefile.w32-in (SYSWAIT_H): Update dependencies. + +2012-12-10 Eli Zaretskii <eliz@gnu.org> + + * makefile.w32-in (obj): Add w32notify.o. Add missing X and Unix + sources. + +2012-12-02 Kevin Ryde <user42@zip.com.au> + + * etags.c (Lisp_functions): Skip (defvar foo) declarations unless + the --declarations flag is enabled (Bug#5600). + (Lisp_help): Update. + (skip_name): New function. + +2012-12-01 Kevin Ryde <user42@zip.com.au> + + * etags.c (Perl_functions): Support "use constant" (Bug#5055). + +2012-11-27 Paul Eggert <eggert@cs.ucla.edu> + + Assume POSIX 1003.1-1988 or later for errno.h (Bug#12968). + * movemail.c (main): Assume EAGAIN and EBUSY. + +2012-11-23 Paul Eggert <eggert@cs.ucla.edu> + + movemail: treat EACCES etc. failures as permanent + * movemail.c (main): Treat any link failure other than EEXIST as a + permanent failure, not just EPERM. EACCES, for example. + +2012-11-21 Paul Eggert <eggert@cs.ucla.edu> + + Assume POSIX 1003.1-1988 or later for unistd.h (Bug#12945). + * emacsclient.c (getcwd): Remove decl. + (get_current_dir_name): Assume getcwd exists. + * etags.c (HAVE_GETCWD): Remove. + (getcwd): Remove decl. + (NO_LONG_OPTIONS): Remove this. All uses removed. + Emacs always has GNU getopt. + (etags_getcwd): Assume getcwd exists. + * movemail.c (F_OK, X_OK, W_OK, R_OK): Remove. + +2012-11-20 Paul Eggert <eggert@cs.ucla.edu> + + * emacsclient.c (handle_sigcont, handle_sigtstp): Use raise (sig) + rather than kill (getpid (), sig), as it's simpler and safer. + +2012-11-17 Juanma Barranquero <lekktu@gmail.com> + + * makefile.w32-in (SYSWAIT_H): New macro. + ($(BLD)/movemail.$(O)): Update dependencies. + +2012-11-17 Paul Eggert <eggert@cs.ucla.edu> + + Assume POSIX 1003.1-1988 or later for fcntl.h (Bug#12881). + * movemail.c, update-game-score.c: Assume <fcntl.h> exists. + 2012-10-26 Glenn Morris <rgm@gnu.org> * Makefile.in (uninstall): No INSTALLABLES live in archlibdir. diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 1652d2fa373..6feaf18ba60 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -88,10 +88,7 @@ char *w32_getenv (char *); -char *getenv (const char *), *getwd (char *); -#ifdef HAVE_GETCWD -char *(getcwd) (char *, size_t); -#endif +char *getenv (const char *); #ifndef VERSION #define VERSION "unspecified" @@ -223,7 +220,7 @@ get_current_dir_name (void) char *buf; const char *pwd; struct stat dotstat, pwdstat; - /* If PWD is accurate, use it instead of calling getwd. PWD is + /* If PWD is accurate, use it instead of calling getcwd. PWD is sometimes a nicer name, and using it may avoid a fatal error if a parent directory is searchable but not readable. */ if ((pwd = egetenv ("PWD")) != 0 @@ -240,7 +237,6 @@ get_current_dir_name (void) buf = (char *) xmalloc (strlen (pwd) + 1); strcpy (buf, pwd); } -#ifdef HAVE_GETCWD else { size_t buf_size = 1024; @@ -267,20 +263,6 @@ get_current_dir_name (void) } } } -#else - else - { - /* We need MAXPATHLEN here. */ - buf = (char *) xmalloc (MAXPATHLEN + 1); - if (getwd (buf) == NULL) - { - int tmp_errno = errno; - free (buf); - errno = tmp_errno; - return NULL; - } - } -#endif return buf; } #endif @@ -1138,7 +1120,7 @@ handle_sigcont (int signalnum) else { /* We are in the background; cancel the continue. */ - kill (getpid (), SIGSTOP); + raise (SIGSTOP); } signal (signalnum, handle_sigcont); @@ -1165,7 +1147,7 @@ handle_sigtstp (int signalnum) sigprocmask (SIG_BLOCK, NULL, &set); sigdelset (&set, signalnum); signal (signalnum, SIG_DFL); - kill (getpid (), signalnum); + raise (signalnum); sigprocmask (SIG_SETMASK, &set, NULL); /* Let's the above signal through. */ signal (signalnum, handle_sigtstp); @@ -1592,7 +1574,6 @@ main (int argc, char **argv) cwd = get_current_dir_name (); if (cwd == 0) { - /* getwd puts message in STRING if it fails. */ message (TRUE, "%s: %s\n", progname, "Cannot get current working directory"); fail (); diff --git a/lib-src/etags.c b/lib-src/etags.c index 73462c83ad7..ec96f45fc94 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -123,19 +123,9 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; # undef HAVE_NTGUI # undef DOS_NT # define DOS_NT -# ifndef HAVE_GETCWD -# define HAVE_GETCWD -# endif /* undef HAVE_GETCWD */ -#else /* not WINDOWSNT */ -#endif /* !WINDOWSNT */ +#endif /* WINDOWSNT */ #include <unistd.h> -#ifndef HAVE_UNISTD_H -# if defined (HAVE_GETCWD) && !defined (WINDOWSNT) - extern char *getcwd (char *buf, size_t size); -# endif -#endif /* HAVE_UNISTD_H */ - #include <stdarg.h> #include <stdlib.h> #include <string.h> @@ -152,16 +142,7 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; # define assert(x) ((void) 0) #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) - extern char *optarg; - extern int optind, opterr; -#else -# define NO_LONG_OPTIONS FALSE -# include <getopt.h> -#endif /* NO_LONG_OPTIONS */ - +#include <getopt.h> #include <regex.h> /* Define CTAGS to make the program "ctags" compatible with the usual one. @@ -372,6 +353,7 @@ static void put_entries (node *); static char *concat (const char *, const char *, const char *); static char *skip_spaces (char *); static char *skip_non_spaces (char *); +static char *skip_name (char *); static char *savenstr (const char *, int); static char *savestr (const char *); static char *etags_strchr (const char *, int); @@ -638,7 +620,8 @@ static const char Lisp_help [] = "In Lisp code, any function defined with `defun', any variable\n\ defined with `defvar' or `defconst', and in general the first\n\ argument of any expression that starts with `(def' in column zero\n\ -is a tag."; +is a tag.\n\ +The `--declarations' option tags \"(defvar foo)\" constructs too."; static const char *Lua_suffixes [] = { "lua", "LUA", NULL }; @@ -869,11 +852,7 @@ print_help (argument *argbuffer) printf ("Usage: %s [options] [[regex-option ...] file-name] ...\n\ \n\ These are the options accepted by %s.\n", progname, progname); - if (NO_LONG_OPTIONS) - puts ("WARNING: long option names do not work with this executable,\n\ -as it is not linked with GNU getopt."); - else - puts ("You may use unambiguous abbreviations for the long option names."); + puts ("You may use unambiguous abbreviations for the long option names."); puts (" A - as file name means read names from stdin (one per line).\n\ Absolute names are stored in the output file as they are.\n\ Relative ones are stored relative to the output file's directory.\n"); @@ -1065,9 +1044,9 @@ main (int argc, char **argv) /* When the optstring begins with a '-' getopt_long does not rearrange the non-options arguments to be at the end, but leaves them alone. */ - optstring = concat (NO_LONG_OPTIONS ? "" : "-", - "ac:Cf:Il:o:r:RSVhH", - (CTAGS) ? "BxdtTuvw" : "Di:"); + optstring = concat ("-ac:Cf:Il:o:r:RSVhH", + (CTAGS) ? "BxdtTuvw" : "Di:", + ""); while ((opt = getopt_long (argc, argv, optstring, longopts, NULL)) != EOF) switch (opt) @@ -4292,6 +4271,7 @@ Asm_labels (FILE *inf) /* * Perl support * Perl sub names: /^sub[ \t\n]+[^ \t\n{]+/ + * /^use constant[ \t\n]+[^ \t\n{=,;]+/ * Perl variable names: /^(my|local).../ * Original code by Bart Robinson <lomew@cs.utah.edu> (1995) * Additions by Michael Ernst <mernst@alum.mit.edu> (1997) @@ -4314,9 +4294,10 @@ Perl_functions (FILE *inf) } else if (LOOKING_AT (cp, "sub")) { - char *pos; - char *sp = cp; + char *pos, *sp; + subr: + sp = cp; while (!notinname (*cp)) cp++; if (cp == sp) @@ -4339,8 +4320,21 @@ Perl_functions (FILE *inf) lb.buffer, cp - lb.buffer + 1, lineno, linecharno); free (name); } + } + else if (LOOKING_AT (cp, "use constant") + || LOOKING_AT (cp, "use constant::defer")) + { + /* For hash style multi-constant like + use constant { FOO => 123, + BAR => 456 }; + only the first FOO is picked up. Parsing across the value + expressions would be difficult in general, due to possible nested + hashes, here-documents, etc. */ + if (*cp == '{') + cp = skip_spaces (cp+1); + goto subr; } - else if (globals) /* only if we are tagging global vars */ + else if (globals) /* only if we are tagging global vars */ { /* Skip a qualifier, if any. */ bool qual = LOOKING_AT (cp, "my") || LOOKING_AT (cp, "local"); @@ -4755,6 +4749,19 @@ Lisp_functions (FILE *inf) if (dbp[0] != '(') continue; + /* "(defvar foo)" is a declaration rather than a definition. */ + if (! declarations) + { + char *p = dbp + 1; + if (LOOKING_AT (p, "defvar")) + { + p = skip_name (p); /* past var name */ + p = skip_spaces (p); + if (*p == ')') + continue; + } + } + if (strneq (dbp+1, "def", 3) || strneq (dbp+1, "DEF", 3)) { dbp = skip_non_spaces (dbp); @@ -6315,6 +6322,16 @@ skip_non_spaces (char *cp) return cp; } +/* Skip any chars in the "name" class.*/ +static char * +skip_name (char *cp) +{ + /* '\0' is a notinname() so loop stops there too */ + while (! notinname (*cp)) + cp++; + return cp; +} + /* Print error message and exit. */ void fatal (const char *s1, const char *s2) @@ -6333,8 +6350,8 @@ pfatal (const char *s1) static void suggest_asking_for_help (void) { - fprintf (stderr, "\tTry `%s %s' for a complete list of options.\n", - progname, NO_LONG_OPTIONS ? "-h" : "--help"); + fprintf (stderr, "\tTry `%s --help' for a complete list of options.\n", + progname); exit (EXIT_FAILURE); } @@ -6372,7 +6389,6 @@ concat (const char *s1, const char *s2, const char *s3) static char * etags_getcwd (void) { -#ifdef HAVE_GETCWD int bufsize = 200; char *path = xnew (bufsize, char); @@ -6387,34 +6403,6 @@ etags_getcwd (void) canonicalize_filename (path); return path; - -#else /* not HAVE_GETCWD */ -#if MSDOS - - char *p, path[MAXPATHLEN + 1]; /* Fixed size is safe on MSDOS. */ - - getwd (path); - - for (p = path; *p != '\0'; p++) - if (*p == '\\') - *p = '/'; - else - *p = lowcase (*p); - - return strdup (path); -#else /* not MSDOS */ - linebuffer path; - FILE *pipe; - - linebuffer_init (&path); - pipe = (FILE *) popen ("pwd 2>/dev/null", "r"); - if (pipe == NULL || readline_internal (&path, pipe) == 0) - pfatal ("pwd"); - pclose (pipe); - - return path.buffer; -#endif /* not MSDOS */ -#endif /* not HAVE_GETCWD */ } /* Return a newly allocated string containing the file name of FILE diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index 54a53c0d441..68e5279fd15 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c @@ -624,7 +624,7 @@ write_globals (void) qsort (globals, num_globals, sizeof (struct global), compare_globals); for (i = 0; i < num_globals; ++i) { - char const *type; + char const *type = 0; switch (globals[i].type) { @@ -649,7 +649,7 @@ write_globals (void) fatal ("not a recognized DEFVAR_", 0); } - if (globals[i].type != FUNCTION) + if (type) { fprintf (outfile, " %s f_%s;\n", type, globals[i].name); fprintf (outfile, "#define %s globals.f_%s\n", diff --git a/lib-src/makefile.w32-in b/lib-src/makefile.w32-in index 51fac61cb2d..8d016bc16be 100644 --- a/lib-src/makefile.w32-in +++ b/lib-src/makefile.w32-in @@ -123,10 +123,13 @@ $(BLD)/profile.exe: $(PROFILEOBJS) # obj = dosfns.o msdos.o \ xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \ - fontset.o menu.o \ - w32.o w32console.o w32fns.o w32heap.o w32inevt.o cygw32.o \ + fontset.o menu.o dbusbind.o cygw32.o \ + nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o \ + w32.o w32console.o w32fns.o w32heap.o w32inevt.o w32notify.o \ w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o \ - font.o w32font.o w32uniscribe.o \ + w16select.o widget.o xfont.o ftfont.o xftfont.o ftxfont.o gtkutil.o \ + xsettings.o xgselect.o termcap.o \ + font.o w32font.o w32uniscribe.o w32notify.o \ dispnew.o frame.o scroll.o xdisp.o window.o bidi.o \ charset.o coding.o category.o ccl.o character.o chartab.o \ cm.o term.o terminal.o xfaces.o \ @@ -213,7 +216,8 @@ lisp1= \ $(lispsource)international/mule-cmds.elc \ $(lispsource)international/characters.elc \ $(lispsource)international/charprop.el \ - $(lispsource)case-table.elc + $(lispsource)case-table.elc \ + $(lispsource)emacs-lisp/macroexp.elc lisp2 = \ $(lispsource)language/chinese.elc \ @@ -374,6 +378,9 @@ NTLIB_H = $(LIB_SRC)/ntlib.h \ SYSTIME_H = $(SRC)/systime.h \ $(NT_INC)/sys/time.h \ $(GNU_LIB)/timespec.h +SYSWAIT_H = $(SRC)/syswait.h \ + $(NT_INC)/stdbool.h \ + $(NT_INC)/sys/wait.h $(BLD)/ctags.$(O) : \ $(LIB_SRC)/ctags.c \ @@ -419,14 +426,14 @@ $(BLD)/make-docfile.$(O) : \ $(BLD)/movemail.$(O) : \ $(LIB_SRC)/movemail.c \ $(LIB_SRC)/pop.h \ - $(SRC)/syswait.h \ $(NT_INC)/pwd.h \ $(NT_INC)/sys/file.h \ $(NT_INC)/sys/stat.h \ $(NT_INC)/unistd.h \ $(GNU_LIB)/getopt.h \ $(CONFIG_H) \ - $(NTLIB_H) + $(NTLIB_H) \ + $(SYSWAIT_H) $(BLD)/ntlib.$(O) : \ $(LIB_SRC)/ntlib.c \ diff --git a/lib-src/movemail.c b/lib-src/movemail.c index 0a8806621d3..cf93fb78d98 100644 --- a/lib-src/movemail.c +++ b/lib-src/movemail.c @@ -65,9 +65,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <getopt.h> #include <unistd.h> -#ifdef HAVE_FCNTL_H #include <fcntl.h> -#endif #include <string.h> #include "syswait.h" #ifdef MAIL_USE_POP @@ -98,13 +96,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <fcntl.h> #endif /* WINDOWSNT */ -#ifndef F_OK -#define F_OK 0 -#define X_OK 1 -#define W_OK 2 -#define R_OK 4 -#endif - #ifdef WINDOWSNT #include <sys/locking.h> #endif @@ -337,11 +328,8 @@ main (int argc, char **argv) tem = link (tempname, lockname); -#ifdef EPERM - if (tem < 0 && errno == EPERM) - fatal ("Unable to create hard link between %s and %s", - tempname, lockname); -#endif + if (tem < 0 && errno != EEXIST) + pfatal_with_name (lockname); unlink (tempname); if (tem >= 0) @@ -442,22 +430,10 @@ main (int argc, char **argv) for certain failure codes. */ if (status < 0) { - if (++lockcount <= 5) + if (++lockcount <= 5 && (errno == EAGAIN || errno == EBUSY)) { -#ifdef EAGAIN - if (errno == EAGAIN) - { - sleep (1); - goto retry_lock; - } -#endif -#ifdef EBUSY - if (errno == EBUSY) - { - sleep (1); - goto retry_lock; - } -#endif + sleep (1); + goto retry_lock; } pfatal_with_name (inname); @@ -689,7 +665,6 @@ popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse register int i; int mbfi; FILE *mbf; - char *getenv (const char *); popserver server; int start, end, increment; char *user, *hostname; diff --git a/lib-src/update-game-score.c b/lib-src/update-game-score.c index 7cd17bf1d54..29c81a8936c 100644 --- a/lib-src/update-game-score.c +++ b/lib-src/update-game-score.c @@ -42,9 +42,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <time.h> #include <pwd.h> #include <ctype.h> -#ifdef HAVE_FCNTL_H #include <fcntl.h> -#endif #include <sys/stat.h> #include <getopt.h> |