diff options
| author | Karoly Lorentey | 2004-02-20 01:22:10 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2004-02-20 01:22:10 +0000 |
| commit | a9298135d89f27d4dba9c3e7ca5a7f91839ad944 (patch) | |
| tree | 67a8b9fa950f77c4c602ad8aeebee051b2e53574 /lib-src | |
| parent | 77134727c9430ee77bff150206fce33f2045dfc0 (diff) | |
| download | emacs-a9298135d89f27d4dba9c3e7ca5a7f91839ad944.tar.gz emacs-a9298135d89f27d4dba9c3e7ca5a7f91839ad944.zip | |
Verify the version of Emacsclient.
lib-src/emacsclient.c (main): Send the version number of emacsclient
to the Emacs process, and exit with error if Emacs does not accept it.
lisp/server.el (server-with-errors-reported): Removed.
(server-process-filter): Cleaned up error handling.
Compare the version of emacsclient with emacs-version;
signal an error if they do not match.
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-84
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/emacsclient.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 90224fe51ee..3bb2b70ba6d 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c | |||
| @@ -562,6 +562,9 @@ To start the server in Emacs, type \"M-x server-start\".\n", | |||
| 562 | fail (); | 562 | fail (); |
| 563 | } | 563 | } |
| 564 | 564 | ||
| 565 | /* First of all, send our version number for verification. */ | ||
| 566 | fprintf (out, "-version %s ", VERSION); | ||
| 567 | |||
| 565 | if (nowait) | 568 | if (nowait) |
| 566 | fprintf (out, "-nowait "); | 569 | fprintf (out, "-nowait "); |
| 567 | 570 | ||
| @@ -650,7 +653,20 @@ To start the server in Emacs, type \"M-x server-start\".\n", | |||
| 650 | /* Now, wait for an answer and print any messages. */ | 653 | /* Now, wait for an answer and print any messages. */ |
| 651 | while ((str = fgets (string, BUFSIZ, in))) | 654 | while ((str = fgets (string, BUFSIZ, in))) |
| 652 | { | 655 | { |
| 653 | if (strprefix ("-emacs-pid ", str)) | 656 | if (strprefix ("-good-version ", str)) |
| 657 | { | ||
| 658 | /* OK, we got the green light. */ | ||
| 659 | } | ||
| 660 | else if (strprefix ("-bad-version ", str)) | ||
| 661 | { | ||
| 662 | if (str[strlen (str) - 1] == '\n') | ||
| 663 | str[strlen (str) - 1] = 0; | ||
| 664 | |||
| 665 | fprintf (stderr, "%s: Version mismatch: Emacs is %s, but we are %s\n", | ||
| 666 | argv[0], str + strlen ("-bad-version "), VERSION); | ||
| 667 | fail (); | ||
| 668 | } | ||
| 669 | else if (strprefix ("-emacs-pid ", str)) | ||
| 654 | { | 670 | { |
| 655 | emacs_pid = strtol (string + strlen ("-emacs-pid"), NULL, 10); | 671 | emacs_pid = strtol (string + strlen ("-emacs-pid"), NULL, 10); |
| 656 | } | 672 | } |