diff options
| author | Miles Bader <miles@gnu.org> | 2008-01-30 07:57:28 +0000 |
|---|---|---|
| committer | Miles Bader <miles@gnu.org> | 2008-01-30 07:57:28 +0000 |
| commit | d235ca2ff8fab139ce797757fcb159d1e28fa7e0 (patch) | |
| tree | 96c5cd1a06a0d9dc26e8470c6eabfc032c0046f3 /lib-src | |
| parent | 3709a060f679dba14df71ae64a0035fa2b5b3106 (diff) | |
| parent | 02cbe062bee38a6705bafb1699d77e3c44cfafcf (diff) | |
| download | emacs-d235ca2ff8fab139ce797757fcb159d1e28fa7e0.tar.gz | |
Merge from emacs--devo--0
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-324
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/ChangeLog | 45 | ||||
| -rw-r--r-- | lib-src/emacsclient.c | 47 | ||||
| -rw-r--r-- | lib-src/make-docfile.c | 4 | ||||
| -rw-r--r-- | lib-src/movemail.c | 16 | ||||
| -rw-r--r-- | lib-src/pop.c | 35 |
5 files changed, 108 insertions, 39 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 8cdce18bd87..9ebfbc29ecd 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,48 @@ +2008-01-26 Stefan Monnier <monnier@iro.umontreal.ca> + + * emacsclient.c (decode_options): Default to a NULL display, as Emacs-22. + Allow the -d option under w32 again, for those rare cases where it + actually does make sense. + +2008-01-25 Juanma Barranquero <lekktu@gmail.com> + + * emacsclient.c (set_tcp_socket): Don't send "\n" after + the authentication string; there's no need to haste. + +2008-01-22 Chong Yidong <cyd@stupidchicken.com> + + * pop.c (pop_stat, pop_last): Fix last fix. + +2008-01-18 Dan Nicolaescu <dann@ics.uci.edu> + + * movemail.c: Remove references to XENIX. + +2008-01-13 Dan Nicolaescu <dann@ics.uci.edu> + + * movemail.c: + * make-docfile.c: Remove reference to symbols defined by systems + not supported anymore: MAC_OS8, XENIX and STRIDE. + +2008-01-12 Eli Zaretskii <eliz@gnu.org> + + * emacsclient.c (decode_options) [WINDOWSNT]: Don't use the value + of DISPLAY in the environment. Don't support -d. + (print_help_and_exit) [WINDOWSNT]: Don't show the --display option. + (longopts) [WINDOWSNT]: Remove --display. + +2008-01-10 Chong Yidong <cyd@stupidchicken.com> + + * pop.c (pop_stat, pop_last): Check validity of string-to-integer + conversion. Mistakes spotted by Nico Golde. + +2008-01-09 Glenn Morris <rgm@gnu.org> + + * emacsclient.c: Add missing final newlines to message calls. + +2008-01-09 Daniel Hackney <dan@haxney.org> (tiny change) + + * emacsclient.c (set_socket): Add final newline to socket error message. + 2008-01-04 Glenn Morris <rgm@gnu.org> * ebrowse.c (version) <emacs_copyright>: New variable. diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 9de812d1c73..707be43b5f7 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -170,7 +170,9 @@ struct option longopts[] = { "socket-name", required_argument, NULL, 's' }, #endif { "server-file", required_argument, NULL, 'f' }, +#ifndef WINDOWSNT { "display", required_argument, NULL, 'd' }, +#endif { 0, 0, 0, 0 } }; @@ -227,7 +229,7 @@ xstrdup (const char *s) /* Return the current working directory. Returns NULL on errors. - Any other returned value must be freed with free. This is used + Any other returned value must be freed with free. This is used only when get_current_dir_name is not defined on the system. */ char* get_current_dir_name () @@ -477,9 +479,15 @@ decode_options (argc, argv) char **argv; { alternate_editor = egetenv ("ALTERNATE_EDITOR"); + + /* We used to set `display' to $DISPLAY by default, but this changed the + default behavior and is sometimes inconvenient. So instead of forcing + users to say "--display ''" when they want to use Emacs's existing tty + or display connection, we force them to use "--display $DISPLAY" if + they want Emacs to connect to their current display. */ +#if 0 display = egetenv ("DISPLAY"); - if (display && strlen (display) == 0) - display = NULL; +#endif while (1) { @@ -515,9 +523,15 @@ decode_options (argc, argv) server_file = optarg; break; + /* We used to disallow this argument in w32, but it seems better + to allow it, for the occasional case where the user is + connecting with a w32 client to a server compiled with X11 + support. */ +#if 1 /* !defined WINDOWS */ case 'd': display = optarg; break; +#endif case 'n': nowait = 1; @@ -552,6 +566,9 @@ decode_options (argc, argv) } } + if (display && strlen (display) == 0) + display = NULL; + if (!tty && display) window_system = 1; #if !defined (WINDOWSNT) && !defined (HAVE_CARBON) @@ -594,8 +611,10 @@ The following OPTIONS are accepted:\n\ -c, --create-frame Create a new frame instead of trying to\n\ use the current Emacs frame\n\ -e, --eval Evaluate the FILE arguments as ELisp expressions\n\ --n, --no-wait Don't wait for the server to return\n\ --d, --display=DISPLAY Visit the file in the given display\n" +-n, --no-wait Don't wait for the server to return\n" +#ifndef WINDOWSNT +"-d, --display=DISPLAY Visit the file in the given display\n" +#endif #ifndef NO_SOCKETS_IN_FILE_SYSTEM "-s, --socket-name=FILENAME\n\ Set filename of the UNIX socket for communication\n" @@ -882,7 +901,7 @@ initialize_sockets () if (WSAStartup (MAKEWORD (2, 0), &wsaData)) { - message (TRUE, "%s: error initializing WinSock2", progname); + message (TRUE, "%s: error initializing WinSock2\n", progname); exit (EXIT_FAILURE); } @@ -939,7 +958,7 @@ get_server_config (server, authentication) } else { - message (TRUE, "%s: invalid configuration info", progname); + message (TRUE, "%s: invalid configuration info\n", progname); exit (EXIT_FAILURE); } @@ -949,7 +968,7 @@ get_server_config (server, authentication) if (! fread (authentication, AUTH_KEY_LENGTH, 1, config)) { - message (TRUE, "%s: cannot read authentication info", progname); + message (TRUE, "%s: cannot read authentication info\n", progname); exit (EXIT_FAILURE); } @@ -1002,7 +1021,7 @@ set_tcp_socket () send_to_emacs (s, "-auth "); send_to_emacs (s, auth_string); - send_to_emacs (s, "\n"); + send_to_emacs (s, " "); return s; } @@ -1092,7 +1111,7 @@ handle_sigtstp (int signalnum) if (emacs_socket) send_to_emacs (emacs_socket, "-suspend \n"); - /* Unblock this signal and call the default handler by temprarily + /* Unblock this signal and call the default handler by temporarily changing the handler and resignalling. */ sigprocmask (SIG_BLOCK, NULL, &set); sigdelset (&set, signalnum); @@ -1167,7 +1186,7 @@ set_local_socket () strcpy (server.sun_path, socket_name); else { - message (TRUE, "%s: socket-name %s too long", + message (TRUE, "%s: socket-name %s too long\n", progname, socket_name); fail (); } @@ -1202,7 +1221,7 @@ set_local_socket () strcpy (server.sun_path, socket_name); else { - message (TRUE, "%s: socket-name %s too long", + message (TRUE, "%s: socket-name %s too long\n", progname, socket_name); exit (EXIT_FAILURE); } @@ -1266,7 +1285,7 @@ set_socket () s = set_local_socket (); if ((s != INVALID_SOCKET) || alternate_editor) return s; - message (TRUE, "%s: error accessing socket \"%s\"", + message (TRUE, "%s: error accessing socket \"%s\"\n", progname, socket_name); exit (EXIT_FAILURE); } @@ -1282,7 +1301,7 @@ set_socket () if ((s != INVALID_SOCKET) || alternate_editor) return s; - message (TRUE, "%s: error accessing server file \"%s\"", + message (TRUE, "%s: error accessing server file \"%s\"\n", progname, server_file); exit (EXIT_FAILURE); } diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index 1564aca5bbe..6e22eb857e3 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c @@ -62,11 +62,7 @@ Boston, MA 02110-1301, USA. */ #endif /* not DOS_NT */ #ifndef DIRECTORY_SEP -#ifdef MAC_OS8 -#define DIRECTORY_SEP ':' -#else /* not MAC_OS8 */ #define DIRECTORY_SEP '/' -#endif /* not MAC_OS8 */ #endif #ifndef IS_DIRECTORY_SEP diff --git a/lib-src/movemail.c b/lib-src/movemail.c index 7c647676ff5..1f95735878d 100644 --- a/lib-src/movemail.c +++ b/lib-src/movemail.c @@ -113,7 +113,7 @@ Boston, MA 02110-1301, USA. */ #define R_OK 4 #endif -#if defined (XENIX) || defined (WINDOWSNT) +#ifdef WINDOWSNT #include <sys/locking.h> #endif @@ -388,13 +388,13 @@ main (argc, argv) if (indesc < 0) pfatal_with_name (inname); -#if defined (BSD_SYSTEM) || defined (XENIX) +#ifdef BSD_SYSTEM /* In case movemail is setuid to root, make sure the user can read the output file. */ /* This is desirable for all systems but I don't want to assume all have the umask system call */ umask (umask (0) & 0333); -#endif /* BSD_SYSTEM || XENIX */ +#endif /* BSD_SYSTEM */ outdesc = open (outname, O_WRONLY | O_CREAT | O_EXCL, 0666); if (outdesc < 0) pfatal_with_name (outname); @@ -422,15 +422,11 @@ main (argc, argv) #ifdef MAIL_USE_LOCKF status = lockf (indesc, F_LOCK, 0); #else /* not MAIL_USE_LOCKF */ -#ifdef XENIX - status = locking (indesc, LK_RLCK, 0L); -#else #ifdef WINDOWSNT status = locking (indesc, LK_RLCK, -1L); #else status = flock (indesc, LOCK_EX); #endif -#endif #endif /* not MAIL_USE_LOCKF */ #endif /* MAIL_USE_SYSTEM_LOCK */ } @@ -503,13 +499,7 @@ main (argc, argv) #ifdef MAIL_USE_SYSTEM_LOCK if (! preserve_mail) { -#if defined (STRIDE) || defined (XENIX) - /* Stride, xenix have file locking, but no ftruncate. - This mess will do. */ - close (open (inname, O_CREAT | O_TRUNC | O_RDWR, 0666)); -#else ftruncate (indesc, 0L); -#endif /* STRIDE or XENIX */ } #endif /* MAIL_USE_SYSTEM_LOCK */ diff --git a/lib-src/pop.c b/lib-src/pop.c index 61c90abe2bf..f15a3fb23b6 100644 --- a/lib-src/pop.c +++ b/lib-src/pop.c @@ -352,6 +352,7 @@ pop_stat (server, count, size) int *size; { char *fromserver; + char *end_ptr; if (server->in_multi) { @@ -377,18 +378,26 @@ pop_stat (server, count, size) return (-1); } - *count = atoi (&fromserver[4]); - - fromserver = index (&fromserver[4], ' '); - if (! fromserver) + errno = 0; + *count = strtol (&fromserver[4], &end_ptr, 10); + /* Check validity of string-to-integer conversion. */ + if (fromserver + 4 == end_ptr || *end_ptr != ' ' || errno) { - strcpy (pop_error, - "Badly formatted response from server in pop_stat"); + strcpy (pop_error, "Unexpected response from POP server in pop_stat"); pop_trash (server); return (-1); } - *size = atoi (fromserver + 1); + fromserver = end_ptr; + + errno = 0; + *size = strtol (fromserver + 1, &end_ptr, 10); + if (fromserver + 1 == end_ptr || errno) + { + strcpy (pop_error, "Unexpected response from POP server in pop_stat"); + pop_trash (server); + return (-1); + } return (0); } @@ -913,7 +922,17 @@ pop_last (server) } else { - return (atoi (&fromserver[4])); + char *end_ptr; + int count; + errno = 0; + count = strtol (&fromserver[4], &end_ptr, 10); + if (fromserver + 4 == end_ptr || errno) + { + strcpy (pop_error, "Unexpected response from server in pop_last"); + pop_trash (server); + return (-1); + } + return count; } } |
