aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorMiles Bader2006-12-07 04:14:14 +0000
committerMiles Bader2006-12-07 04:14:14 +0000
commita0451a715e4ed018a02b825d0eb823424693d1de (patch)
treed2b10fcc69c333ccc438d7a9ad116fbc1495fc9e /lib-src
parentd324f894beea8b485792c779659e8e20c1cb699d (diff)
parent12f7728e938fe5bb850ce2928637d1e349919142 (diff)
downloademacs-a0451a715e4ed018a02b825d0eb823424693d1de.tar.gz
emacs-a0451a715e4ed018a02b825d0eb823424693d1de.zip
Merge from emacs--devo--0
Patches applied: * emacs--devo--0 (patch 523-544) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 168-171) - Update from CVS - Merge from emacs--devo--0 Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-150
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog75
-rw-r--r--lib-src/emacsclient.c178
-rw-r--r--lib-src/etags.c17
-rw-r--r--lib-src/makefile.w32-in20
4 files changed, 210 insertions, 80 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 70bd5bb6ed7..97266d8a66e 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,78 @@
12006-12-06 Christoph Conrad <christoph.conrad@gmx.de>
2
3 * makefile.w32-in ($(BLD)/emacsclient.exe, $(BLD)/emacsclientw.exe):
4 Use $(USER32) for compatibility with Visual Studio .NET 2003.
5
62006-11-30 Juanma Barranquero <lekktu@gmail.com>
7
8 * emacsclient.c (emacs_pid): New variable.
9 (message): Remove leftover code.
10 (get_server_config): Set emacs_pid. Don't allow Emacs to grab the
11 focus yet; emacsclient can still display an informational message
12 before sending requests to Emacs.
13 (main): Allow Emacs to grab the focus. Simplify message() call.
14
152006-11-30 Michael Mauger <mmaug@yahoo.com>
16
17 * emacsclient.c (message): Make sure the message is properly
18 written even if it contains printf escapes, and flush the result.
19 (set_tcp_socket): Make the message for non-local connections
20 informational rather than an error.
21
222006-11-28 Kevin Ryde <user42@zip.com.au> (tiny change)
23
24 * etags.c (readline): Check for double quote after #line.
25
262006-11-28 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> (tiny change)
27
28 * etags.c (readline): sscanf could in principle return 2.
29
302006-11-28 Francesco Potort,Al(B <pot@gnu.org>
31
32 * etags.c (readline): lno is unsigned.
33 (TeX_commands): Use p++ (rather than *p++) to increment p.
34 (Lua_functions): Explicitly discard LOOKING_AT's return value.
35
362006-11-27 Juanma Barranquero <lekktu@gmail.com>
37
38 * makefile.w32-in (TRES): New macro (copied from nt/makefile.w32-in).
39 ($(TRES)): New rule (copied from nt/makefile.w32-in).
40 ($(BLD)/emacsclientw.exe): Add dependency.
41
422006-11-27 Eli Zaretskii <eliz@gnu.org>
43
44 * makefile.w32-in ($(BLD)/emacsclient.$(O)): Depend on
45 makefile.w32-in.
46
472006-11-25 Juanma Barranquero <lekktu@gmail.com>
48
49 * makefile.w32-in (VERSION): New macro.
50 (ECLIENT_CFLAGS): Add -DVERSION.
51
522006-11-25 Jason Rumney <jasonr@gnu.org>
53
54 * emacsclient.c (file_name_absolute_p) [WINDOWSNT]: Use isalpha().
55
562006-11-24 Michael Mauger <mmaug@yahoo.com>
57
58 * emacsclient.c (file_name_absolute_p) [WINDOWSNT]: Support
59 absolute file names with forward slashes.
60
612006-11-23 Juanma Barranquero <lekktu@gmail.com>
62
63 * emacsclient.c (print_help_and_exit): Tweak message contents and
64 tabs/spaces to improve alignment in message boxes.
65
662006-11-22 Lennart Borgman <lennart.borgman.073@student.lu.se>
67
68 * emacsclient.c: Include <stdarg.h>.
69 [WINDOWSNT]: Include <windows.h>.
70 (w32_check_console_app): New function.
71 (message): New function.
72 (decode_options, print_help_and_exit, fail, main)
73 (initialize_sockets, get_server_config, set_tcp_socket)
74 (set_local_socket, set_socket): Use message().
75
12006-11-13 Jason Rumney <jasonr@gnu.org> 762006-11-13 Jason Rumney <jasonr@gnu.org>
2 77
3 * emacsclient.c [WINDOWSNT]: Let config.h define HAVE_SOCKETS and 78 * emacsclient.c [WINDOWSNT]: Let config.h define HAVE_SOCKETS and
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 3e8c56f2ce5..f05b98eccee 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -34,6 +34,7 @@ Boston, MA 02110-1301, USA. */
34 34
35# include <malloc.h> 35# include <malloc.h>
36# include <stdlib.h> 36# include <stdlib.h>
37# include <windows.h>
37 38
38# define NO_SOCKETS_IN_FILE_SYSTEM 39# define NO_SOCKETS_IN_FILE_SYSTEM
39 40
@@ -58,6 +59,7 @@ Boston, MA 02110-1301, USA. */
58 59
59#undef signal 60#undef signal
60 61
62#include <stdarg.h>
61#include <ctype.h> 63#include <ctype.h>
62#include <stdio.h> 64#include <stdio.h>
63#include "getopt.h" 65#include "getopt.h"
@@ -127,6 +129,9 @@ char *socket_name = NULL;
127/* If non-NULL, the filename of the authentication file. */ 129/* If non-NULL, the filename of the authentication file. */
128char *server_file = NULL; 130char *server_file = NULL;
129 131
132/* PID of the Emacs server process. */
133int emacs_pid = 0;
134
130void print_help_and_exit () NO_RETURN; 135void print_help_and_exit () NO_RETURN;
131 136
132struct option longopts[] = 137struct option longopts[] =
@@ -144,6 +149,53 @@ struct option longopts[] =
144 { 0, 0, 0, 0 } 149 { 0, 0, 0, 0 }
145}; 150};
146 151
152/* Message functions. */
153
154#ifdef WINDOWSNT
155/* I first tried to check for STDOUT. The check did not work,
156 I get a valid handle also in nonconsole apps.
157 Instead I test for console title, which seems to work. */
158int
159w32_window_app()
160{
161 static int window_app = -1;
162 char szTitle[MAX_PATH];
163
164 if (window_app < 0)
165 window_app = (GetConsoleTitleA (szTitle, MAX_PATH) == 0);
166
167 return window_app;
168}
169#endif
170
171void
172message (int is_error, char *message, ...)
173{
174 char msg [2048];
175 va_list args;
176
177 va_start (args, message);
178 vsprintf (msg, message, args);
179 va_end (args);
180
181#ifdef WINDOWSNT
182 if (w32_window_app ())
183 {
184 if (is_error)
185 MessageBox (NULL, msg, "Emacsclient ERROR", MB_ICONERROR);
186 else
187 MessageBox (NULL, msg, "Emacsclient", MB_ICONINFORMATION);
188 }
189 else
190#endif
191 {
192 FILE *f = is_error ? stderr : stdout;
193
194 fputs (msg, f);
195 fflush (f);
196 }
197}
198
147/* Decode the options from argv and argc. 199/* Decode the options from argv and argc.
148 The global variable `optind' will say how many arguments we used up. */ 200 The global variable `optind' will say how many arguments we used up. */
149 201
@@ -201,7 +253,7 @@ decode_options (argc, argv)
201 break; 253 break;
202 254
203 case 'V': 255 case 'V':
204 printf ("emacsclient %s\n", VERSION); 256 message (FALSE, "emacsclient %s\n", VERSION);
205 exit (EXIT_SUCCESS); 257 exit (EXIT_SUCCESS);
206 break; 258 break;
207 259
@@ -210,7 +262,7 @@ decode_options (argc, argv)
210 break; 262 break;
211 263
212 default: 264 default:
213 fprintf (stderr, "Try `%s --help' for more information\n", progname); 265 message (TRUE, "Try `%s --help' for more information\n", progname);
214 exit (EXIT_FAILURE); 266 exit (EXIT_FAILURE);
215 break; 267 break;
216 } 268 }
@@ -220,25 +272,26 @@ decode_options (argc, argv)
220void 272void
221print_help_and_exit () 273print_help_and_exit ()
222{ 274{
223 printf ( 275 message (FALSE,
224 "Usage: %s [OPTIONS] FILE...\n\ 276 "Usage: %s [OPTIONS] FILE...\n\
225Tell the Emacs server to visit the specified files.\n\ 277Tell the Emacs server to visit the specified files.\n\
226Every FILE can be either just a FILENAME or [+LINE[:COLUMN]] FILENAME.\n\ 278Every FILE can be either just a FILENAME or [+LINE[:COLUMN]] FILENAME.\n\
227\n\ 279\n\
228The following OPTIONS are accepted:\n\ 280The following OPTIONS are accepted:\n\
229-V, --version Just print a version info and return\n\ 281\n\
230-H, --help Print this usage information message\n\ 282-V, --version Just print version info and return\n\
231-n, --no-wait Don't wait for the server to return\n\ 283-H, --help Print this usage information message\n\
232-e, --eval Evaluate the FILE arguments as ELisp expressions\n\ 284-e, --eval Evaluate FILE arguments as Lisp expressions\n\
233-d, --display=DISPLAY Visit the file in the given display\n" 285-n, --no-wait Don't wait for the server to return\n\
286-d, --display=DISPLAY Visit the file in the given display\n"
234#ifndef NO_SOCKETS_IN_FILE_SYSTEM 287#ifndef NO_SOCKETS_IN_FILE_SYSTEM
235"-s, --socket-name=FILENAME\n\ 288"-s, --socket-name=FILENAME\n\
236 Set the filename of the UNIX socket for communication\n" 289 Set filename of the UNIX socket for communication\n"
237#endif 290#endif
238"-f, --server-file=FILENAME\n\ 291"-f, --server-file=FILENAME\n\
239 Set the filename of the TCP configuration file\n\ 292 Set filename of the TCP authentication file\n\
240-a, --alternate-editor=EDITOR\n\ 293-a, --alternate-editor=EDITOR\n\
241 Editor to fallback to if the server is not running\n\ 294 Editor to fallback to if server is not running\n\
242\n\ 295\n\
243Report bugs to bug-gnu-emacs@gnu.org.\n", progname); 296Report bugs to bug-gnu-emacs@gnu.org.\n", progname);
244 exit (EXIT_SUCCESS); 297 exit (EXIT_SUCCESS);
@@ -261,7 +314,7 @@ fail (argc, argv)
261 argv[i] = (char *)alternate_editor; 314 argv[i] = (char *)alternate_editor;
262#endif 315#endif
263 execvp (alternate_editor, argv + i); 316 execvp (alternate_editor, argv + i);
264 fprintf (stderr, "%s: error executing alternate editor \"%s\"\n", 317 message (TRUE, "%s: error executing alternate editor \"%s\"\n",
265 progname, alternate_editor); 318 progname, alternate_editor);
266 } 319 }
267 exit (EXIT_FAILURE); 320 exit (EXIT_FAILURE);
@@ -275,9 +328,8 @@ main (argc, argv)
275 int argc; 328 int argc;
276 char **argv; 329 char **argv;
277{ 330{
278 fprintf (stderr, "%s: Sorry, the Emacs server is supported only\n", 331 message (TRUE, "%s: Sorry, the Emacs server is supported only\non systems with Berkely sockets.\n",
279 argv[0]); 332 argv[0]);
280 fprintf (stderr, "on systems with Berkeley sockets.\n");
281 333
282 fail (argc, argv); 334 fail (argc, argv);
283} 335}
@@ -399,8 +451,8 @@ file_name_absolute_p (filename)
399 451
400#ifdef WINDOWSNT 452#ifdef WINDOWSNT
401 /* X:\xxx is always absolute; X:xxx is an error and will fail. */ 453 /* X:\xxx is always absolute; X:xxx is an error and will fail. */
402 if (islower (tolower (filename[0])) 454 if (isalpha (filename[0])
403 && filename[1] == ':' && filename[2] == '\\') 455 && filename[1] == ':' && (filename[2] == '\\' || filename[2] == '/'))
404 return TRUE; 456 return TRUE;
405 457
406 /* Both \xxx and \\xxx\yyy are absolute. */ 458 /* Both \xxx and \\xxx\yyy are absolute. */
@@ -411,7 +463,7 @@ file_name_absolute_p (filename)
411} 463}
412 464
413#ifdef WINDOWSNT 465#ifdef WINDOWSNT
414/* Wrapper to make WSACleanup a cdecl, as required by atexit(). */ 466/* Wrapper to make WSACleanup a cdecl, as required by atexit(). */
415void 467void
416__cdecl close_winsock () 468__cdecl close_winsock ()
417{ 469{
@@ -426,7 +478,7 @@ initialize_sockets ()
426 478
427 if (WSAStartup (MAKEWORD (2, 0), &wsaData)) 479 if (WSAStartup (MAKEWORD (2, 0), &wsaData))
428 { 480 {
429 fprintf (stderr, "%s: error initializing WinSock2", progname); 481 message (TRUE, "%s: error initializing WinSock2", progname);
430 exit (EXIT_FAILURE); 482 exit (EXIT_FAILURE);
431 } 483 }
432 484
@@ -482,7 +534,7 @@ get_server_config (server, authentication)
482 } 534 }
483 else 535 else
484 { 536 {
485 fprintf (stderr, "%s: invalid configuration info", progname); 537 message (TRUE, "%s: invalid configuration info", progname);
486 exit (EXIT_FAILURE); 538 exit (EXIT_FAILURE);
487 } 539 }
488 540
@@ -492,35 +544,13 @@ get_server_config (server, authentication)
492 544
493 if (! fread (authentication, AUTH_KEY_LENGTH, 1, config)) 545 if (! fread (authentication, AUTH_KEY_LENGTH, 1, config))
494 { 546 {
495 fprintf (stderr, "%s: cannot read authentication info", progname); 547 message (TRUE, "%s: cannot read authentication info", progname);
496 exit (EXIT_FAILURE); 548 exit (EXIT_FAILURE);
497 } 549 }
498 550
499 fclose (config); 551 fclose (config);
500 552
501#ifdef WINDOWSNT 553 emacs_pid = atoi (pid);
502 /*
503 Modern Windows restrict which processes can set the foreground window.
504 So, for emacsclient to be able to force Emacs into the foreground, we
505 have to call AllowSetForegroundWindow(). Unfortunately, older Windows
506 (W95, W98 and NT) don't have this function, so we have to check first.
507
508 We're doing this here because it has to be done before sending info
509 to Emacs, and otherwise we'll need a global variable just to pass around
510 the pid, which is also inelegant.
511 */
512 {
513 HMODULE hUser32;
514
515 if (hUser32 = LoadLibrary ("user32.dll"))
516 {
517 FARPROC set_fg;
518 if (set_fg = GetProcAddress (hUser32, "AllowSetForegroundWindow"))
519 set_fg (atoi (pid));
520 FreeLibrary (hUser32);
521 }
522 }
523#endif
524 554
525 return TRUE; 555 return TRUE;
526} 556}
@@ -537,7 +567,7 @@ set_tcp_socket ()
537 return INVALID_SOCKET; 567 return INVALID_SOCKET;
538 568
539 if (server.sin_addr.s_addr != inet_addr ("127.0.0.1")) 569 if (server.sin_addr.s_addr != inet_addr ("127.0.0.1"))
540 fprintf (stderr, "%s: connected to remote socket at %s\n", 570 message (FALSE, "%s: connected to remote socket at %s\n",
541 progname, inet_ntoa (server.sin_addr)); 571 progname, inet_ntoa (server.sin_addr));
542 572
543 /* 573 /*
@@ -545,8 +575,7 @@ set_tcp_socket ()
545 */ 575 */
546 if ((s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) 576 if ((s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
547 { 577 {
548 fprintf (stderr, "%s: ", progname); 578 message (TRUE, "%s: socket: %s\n", progname, strerror (errno));
549 perror ("socket");
550 return INVALID_SOCKET; 579 return INVALID_SOCKET;
551 } 580 }
552 581
@@ -555,8 +584,7 @@ set_tcp_socket ()
555 */ 584 */
556 if (connect (s, (struct sockaddr *) &server, sizeof server) < 0) 585 if (connect (s, (struct sockaddr *) &server, sizeof server) < 0)
557 { 586 {
558 fprintf (stderr, "%s: ", progname); 587 message (TRUE, "%s: connect: %s\n", progname, strerror (errno));
559 perror ("connect");
560 return INVALID_SOCKET; 588 return INVALID_SOCKET;
561 } 589 }
562 590
@@ -608,8 +636,7 @@ set_local_socket ()
608 636
609 if ((s = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) 637 if ((s = socket (AF_UNIX, SOCK_STREAM, 0)) < 0)
610 { 638 {
611 fprintf (stderr, "%s: ", progname); 639 message (TRUE, "%s: socket: %s\n", progname, strerror (errno));
612 perror ("socket");
613 return INVALID_SOCKET; 640 return INVALID_SOCKET;
614 } 641 }
615 642
@@ -639,7 +666,7 @@ set_local_socket ()
639 strcpy (server.sun_path, socket_name); 666 strcpy (server.sun_path, socket_name);
640 else 667 else
641 { 668 {
642 fprintf (stderr, "%s: socket-name %s too long", 669 message (TRUE, "%s: socket-name %s too long",
643 progname, socket_name); 670 progname, socket_name);
644 exit (EXIT_FAILURE); 671 exit (EXIT_FAILURE);
645 } 672 }
@@ -674,7 +701,7 @@ set_local_socket ()
674 strcpy (server.sun_path, socket_name); 701 strcpy (server.sun_path, socket_name);
675 else 702 else
676 { 703 {
677 fprintf (stderr, "%s: socket-name %s too long", 704 message (TRUE, "%s: socket-name %s too long",
678 progname, socket_name); 705 progname, socket_name);
679 exit (EXIT_FAILURE); 706 exit (EXIT_FAILURE);
680 } 707 }
@@ -694,7 +721,7 @@ set_local_socket ()
694 we are root. */ 721 we are root. */
695 if (0 != geteuid ()) 722 if (0 != geteuid ())
696 { 723 {
697 fprintf (stderr, "%s: Invalid socket owner\n", progname); 724 message (TRUE, "%s: Invalid socket owner\n", progname);
698 return INVALID_SOCKET; 725 return INVALID_SOCKET;
699 } 726 }
700 break; 727 break;
@@ -702,12 +729,12 @@ set_local_socket ()
702 case 2: 729 case 2:
703 /* `stat' failed */ 730 /* `stat' failed */
704 if (saved_errno == ENOENT) 731 if (saved_errno == ENOENT)
705 fprintf (stderr, 732 message (TRUE,
706 "%s: can't find socket; have you started the server?\n\ 733 "%s: can't find socket; have you started the server?\n\
707To start the server in Emacs, type \"M-x server-start\".\n", 734To start the server in Emacs, type \"M-x server-start\".\n",
708 progname); 735 progname);
709 else 736 else
710 fprintf (stderr, "%s: can't stat %s: %s\n", 737 message (TRUE, "%s: can't stat %s: %s\n",
711 progname, server.sun_path, strerror (saved_errno)); 738 progname, server.sun_path, strerror (saved_errno));
712 return INVALID_SOCKET; 739 return INVALID_SOCKET;
713 } 740 }
@@ -716,8 +743,7 @@ To start the server in Emacs, type \"M-x server-start\".\n",
716 if (connect (s, (struct sockaddr *) &server, strlen (server.sun_path) + 2) 743 if (connect (s, (struct sockaddr *) &server, strlen (server.sun_path) + 2)
717 < 0) 744 < 0)
718 { 745 {
719 fprintf (stderr, "%s: ", progname); 746 message (TRUE, "%s: connect: %s\n", progname, strerror (errno));
720 perror ("connect");
721 return INVALID_SOCKET; 747 return INVALID_SOCKET;
722 } 748 }
723 749
@@ -740,7 +766,7 @@ set_socket ()
740 if ((s != INVALID_SOCKET) || alternate_editor) 766 if ((s != INVALID_SOCKET) || alternate_editor)
741 return s; 767 return s;
742 768
743 fprintf (stderr, "%s: error accessing socket \"%s\"", 769 message (TRUE, "%s: error accessing socket \"%s\"",
744 progname, socket_name); 770 progname, socket_name);
745 exit (EXIT_FAILURE); 771 exit (EXIT_FAILURE);
746 } 772 }
@@ -756,7 +782,7 @@ set_socket ()
756 if ((s != INVALID_SOCKET) || alternate_editor) 782 if ((s != INVALID_SOCKET) || alternate_editor)
757 return s; 783 return s;
758 784
759 fprintf (stderr, "%s: error accessing server file \"%s\"", 785 message (TRUE, "%s: error accessing server file \"%s\"",
760 progname, server_file); 786 progname, server_file);
761 exit (EXIT_FAILURE); 787 exit (EXIT_FAILURE);
762 } 788 }
@@ -775,7 +801,7 @@ set_socket ()
775 return s; 801 return s;
776 802
777 /* No implicit or explicit socket, and no alternate editor. */ 803 /* No implicit or explicit socket, and no alternate editor. */
778 fprintf (stderr, "%s: No socket or alternate editor. Please use:\n\n" 804 message (TRUE, "%s: No socket or alternate editor. Please use:\n\n"
779#ifndef NO_SOCKETS_IN_FILE_SYSTEM 805#ifndef NO_SOCKETS_IN_FILE_SYSTEM
780"\t--socket-name\n" 806"\t--socket-name\n"
781#endif 807#endif
@@ -802,8 +828,8 @@ main (argc, argv)
802 828
803 if ((argc - optind < 1) && !eval) 829 if ((argc - optind < 1) && !eval)
804 { 830 {
805 fprintf (stderr, "%s: file name or argument required\n", progname); 831 message (TRUE, "%s: file name or argument required\nTry `%s --help' for more information\n",
806 fprintf (stderr, "Try `%s --help' for more information\n", progname); 832 progname, progname);
807 exit (EXIT_FAILURE); 833 exit (EXIT_FAILURE);
808 } 834 }
809 835
@@ -818,15 +844,37 @@ main (argc, argv)
818 if (cwd == 0) 844 if (cwd == 0)
819 { 845 {
820 /* getwd puts message in STRING if it fails. */ 846 /* getwd puts message in STRING if it fails. */
847 message (TRUE, "%s: %s (%s)\n", progname,
821#ifdef HAVE_GETCWD 848#ifdef HAVE_GETCWD
822 fprintf (stderr, "%s: %s (%s)\n", progname, 849 "Cannot get current working directory",
823 "Cannot get current working directory", strerror (errno));
824#else 850#else
825 fprintf (stderr, "%s: %s (%s)\n", progname, string, strerror (errno)); 851 string,
826#endif 852#endif
853 strerror (errno));
827 fail (argc, argv); 854 fail (argc, argv);
828 } 855 }
829 856
857#ifdef WINDOWSNT
858 /*
859 Modern Windows restrict which processes can set the foreground window.
860 emacsclient can allow Emacs to grab the focus by calling the function
861 AllowSetForegroundWindow(). Unfortunately, older Windows (W95, W98
862 and NT) lack this function, so we have to check its availability.
863 */
864 if (emacs_pid)
865 {
866 HMODULE hUser32;
867
868 if (hUser32 = LoadLibrary ("user32.dll"))
869 {
870 FARPROC set_fg;
871 if (set_fg = GetProcAddress (hUser32, "AllowSetForegroundWindow"))
872 set_fg (emacs_pid);
873 FreeLibrary (hUser32);
874 }
875 }
876#endif
877
830 if (nowait) 878 if (nowait)
831 SEND_STRING ("-nowait "); 879 SEND_STRING ("-nowait ");
832 880
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 49a18be1df5..26dac368b4d 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -41,7 +41,7 @@
41 * configuration file containing regexp definitions for etags. 41 * configuration file containing regexp definitions for etags.
42 */ 42 */
43 43
44char pot_etags_version[] = "@(#) pot revision number is 17.20"; 44char pot_etags_version[] = "@(#) pot revision number is $Revision: 3.61 $";
45 45
46#define TRUE 1 46#define TRUE 1
47#define FALSE 0 47#define FALSE 0
@@ -4955,7 +4955,7 @@ Lua_functions (inf)
4955 if (bp[0] != 'f' && bp[0] != 'l') 4955 if (bp[0] != 'f' && bp[0] != 'l')
4956 continue; 4956 continue;
4957 4957
4958 LOOKING_AT (bp, "local"); /* skip possible "local" */ 4958 (void)LOOKING_AT (bp, "local"); /* skip possible "local" */
4959 4959
4960 if (LOOKING_AT (bp, "function")) 4960 if (LOOKING_AT (bp, "function"))
4961 get_tag (bp, NULL); 4961 get_tag (bp, NULL);
@@ -5137,7 +5137,7 @@ TeX_commands (inf)
5137 if (!opgrp || *p == TEX_clgrp) 5137 if (!opgrp || *p == TEX_clgrp)
5138 { 5138 {
5139 while (*p != '\0' && *p != TEX_opgrp && *p != TEX_clgrp) 5139 while (*p != '\0' && *p != TEX_opgrp && *p != TEX_clgrp)
5140 *p++; 5140 p++;
5141 linelen = p - lb.buffer + 1; 5141 linelen = p - lb.buffer + 1;
5142 } 5142 }
5143 make_tag (cp, namelen, TRUE, 5143 make_tag (cp, namelen, TRUE,
@@ -6256,15 +6256,14 @@ readline (lbp, stream)
6256 /* Check whether this is a #line directive. */ 6256 /* Check whether this is a #line directive. */
6257 if (result > 12 && strneq (lbp->buffer, "#line ", 6)) 6257 if (result > 12 && strneq (lbp->buffer, "#line ", 6))
6258 { 6258 {
6259 int start, lno; 6259 unsigned int lno;
6260 int start = 0;
6260 6261
6261 if (DEBUG) start = 0; /* shut up the compiler */ 6262 if (sscanf (lbp->buffer, "#line %u \"%n", &lno, &start) >= 1
6262 if (sscanf (lbp->buffer, "#line %d %n\"", &lno, &start) >= 1 6263 && start > 0) /* double quote character found */
6263 && lbp->buffer[start] == '"')
6264 { 6264 {
6265 char *endp = lbp->buffer + ++start; 6265 char *endp = lbp->buffer + start;
6266 6266
6267 assert (start > 0);
6268 while ((endp = etags_strchr (endp, '"')) != NULL 6267 while ((endp = etags_strchr (endp, '"')) != NULL
6269 && endp[-1] == '\\') 6268 && endp[-1] == '\\')
6270 endp++; 6269 endp++;
diff --git a/lib-src/makefile.w32-in b/lib-src/makefile.w32-in
index c04637056f8..65d40255ae7 100644
--- a/lib-src/makefile.w32-in
+++ b/lib-src/makefile.w32-in
@@ -24,11 +24,13 @@ ALL = make-docfile hexl ctags etags movemail ebrowse sorted-doc digest-doc emacs
24 24
25.PHONY: $(ALL) 25.PHONY: $(ALL)
26 26
27VERSION = 22.0.91
28
27LOCAL_FLAGS = -DWINDOWSNT -DDOS_NT -DSTDC_HEADERS=1 -DNO_LDAV=1 \ 29LOCAL_FLAGS = -DWINDOWSNT -DDOS_NT -DSTDC_HEADERS=1 -DNO_LDAV=1 \
28 -DNO_ARCHIVES=1 -DHAVE_CONFIG_H=1 -I../nt/inc \ 30 -DNO_ARCHIVES=1 -DHAVE_CONFIG_H=1 -I../nt/inc \
29 -I../src 31 -I../src
30 32
31LIBS = $(BASE_LIBS) $(ADVAPI32) 33LIBS = $(BASE_LIBS) $(ADVAPI32)
32 34
33$(BLD)/make-docfile.exe: $(BLD)/make-docfile.$(O) $(BLD)/ntlib.$(O) 35$(BLD)/make-docfile.exe: $(BLD)/make-docfile.$(O) $(BLD)/ntlib.$(O)
34 $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/make-docfile.$(O) $(BLD)/ntlib.$(O) $(LIBS) 36 $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/make-docfile.$(O) $(BLD)/ntlib.$(O) $(LIBS)
@@ -68,21 +70,27 @@ $(BLD)/movemail.exe: $(MOVEMAILOBJS) getopt.h
68# put wsock32.lib before $(LIBS) to ensure we don't link to ws2_32.lib 70# put wsock32.lib before $(LIBS) to ensure we don't link to ws2_32.lib
69 $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(MOVEMAILOBJS) $(WSOCK32) $(LIBS) 71 $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(MOVEMAILOBJS) $(WSOCK32) $(LIBS)
70 72
71ECLIENT_CFLAGS = -DHAVE_GETCWD -DHAVE_STRERROR 73ECLIENT_CFLAGS = -DHAVE_GETCWD -DHAVE_STRERROR -DVERSION="\"$(VERSION)\""
72ECLIENTOBJS = $(BLD)/emacsclient.$(O) \ 74ECLIENTOBJS = $(BLD)/emacsclient.$(O) \
73 $(BLD)/getopt.$(O) \ 75 $(BLD)/getopt.$(O) \
74 $(BLD)/getopt1.$(O) \ 76 $(BLD)/getopt1.$(O) \
75 $(BLD)/ntlib.$(O) 77 $(BLD)/ntlib.$(O)
78TRES = ../nt/$(BLD)/emacs.res
79
80$(TRES): ../nt/emacs.rc
81 $(RC) $(RC_OUT)../nt/$(BLD)/emacs.res $(ALL_DEPS)
76 82
77$(BLD)/emacsclient.exe: $(ECLIENTOBJS) 83$(BLD)/emacsclient.exe: $(ECLIENTOBJS)
78# put wsock32.lib before $(LIBS) to ensure we don't link to ws2_32.lib 84# put wsock32.lib before $(LIBS) to ensure we don't link to ws2_32.lib
79 $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(ECLIENTOBJS) $(WSOCK32) $(LIBS) 85 $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(ECLIENTOBJS) $(WSOCK32) $(USER32) $(LIBS)
80 86
81$(BLD)/emacsclientw.exe: $(ECLIENTOBJS) 87$(BLD)/emacsclientw.exe: $(ECLIENTOBJS) $(TRES)
82# put wsock32.lib before $(LIBS) to ensure we don't link to ws2_32.lib 88# put wsock32.lib before $(LIBS) to ensure we don't link to ws2_32.lib
83 $(LINK) $(LINK_OUT)$@ -mwindows $(LINK_FLAGS) $(ECLIENTOBJS) $(WSOCK32) $(LIBS) 89 $(LINK) $(LINK_OUT)$@ $(TRES) -mwindows $(LINK_FLAGS) $(ECLIENTOBJS) $(WSOCK32) $(USER32) $(LIBS)
84 90
85$(BLD)/emacsclient.$(O): emacsclient.c 91# emacsclient.$(O) depends on makefile.w32-in because makefile.w32-in
92# can be edited to define VERSION string, which is part of ECLIENT_CFLAGS.
93$(BLD)/emacsclient.$(O): emacsclient.c makefile.w32-in
86 $(CC) $(CFLAGS) $(ECLIENT_CFLAGS) $(CC_OUT)$@ emacsclient.c 94 $(CC) $(CFLAGS) $(ECLIENT_CFLAGS) $(CC_OUT)$@ emacsclient.c
87 95
88ETAGSOBJ = $(BLD)/etags.$(O) \ 96ETAGSOBJ = $(BLD)/etags.$(O) \