Mercurial > hg > xemacs-beta
annotate lib-src/gnuserv.h @ 5746:b8c2808b33d4
Document #'events-to-keys some more, use it less.
lisp/ChangeLog addition:
2013-07-10 Aidan Kehoe <kehoea@parhasard.net>
* minibuf.el (get-user-response):
* cmdloop.el (y-or-n-p-minibuf):
No need to call #'events-to-keys in these two functions,
#'lookup-key accepts events directly.
* keymap.el:
* keymap.el (events-to-keys):
Document this function some more.
Stop passing strings through unexamined, treat them as vectors of
characters.
Event keys are never integers, remove some code that only ran if
(integerp (event-key ce)).
Event keys are never numbers, don't check for that.
Don't create (menu-selection call-interactively function-name)
keystrokes for menu choices, #'character-to-event doesn't
understand that syntax, so nothing uses it.
Don't ever accept mouse events, #'character-to-event doesn't
accept our synthesising of them.
src/ChangeLog addition:
2013-07-10 Aidan Kehoe <kehoea@parhasard.net>
* keymap.c:
* keymap.c (key_desc_list_to_event):
Drop the allow_menu_events argument.
Don't accept lists starting with Qmenu_selection as describing
keys, nothing generates them in a way this function
understands. The intention is reasonable but the implementation
was never documented and never finished.
* keymap.c (syms_of_keymap):
Drop Qmenu_selection.
* events.c (Fcharacter_to_event):
* keymap.h:
Drop the allow_menu_events argument to key_desc_list_to_event.
| author | Aidan Kehoe <kehoea@parhasard.net> |
|---|---|
| date | Wed, 10 Jul 2013 14:14:30 +0100 |
| parents | 8bda66cd0414 |
| children |
| rev | line source |
|---|---|
| 428 | 1 /* -*-C-*- |
| 2 | |
| 613 | 3 Header file for the XEmacs server and client C code. |
| 428 | 4 |
|
5290
e6508b64ee08
More permission consistency.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4759
diff
changeset
|
5 Copyright (C) 1989 Free Software Foundation, Inc. |
|
e6508b64ee08
More permission consistency.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4759
diff
changeset
|
6 |
| 613 | 7 This file is part of XEmacs. |
| 428 | 8 |
|
5425
8bda66cd0414
Convert misc remaining files with GPLv2 or later to GPLv3 or later
Mats Lidell <matsl@xemacs.org>
parents:
5290
diff
changeset
|
9 XEmacs is free software: you can redistribute it and/or modify it |
|
8bda66cd0414
Convert misc remaining files with GPLv2 or later to GPLv3 or later
Mats Lidell <matsl@xemacs.org>
parents:
5290
diff
changeset
|
10 under the terms of the GNU General Public License as published by the |
|
8bda66cd0414
Convert misc remaining files with GPLv2 or later to GPLv3 or later
Mats Lidell <matsl@xemacs.org>
parents:
5290
diff
changeset
|
11 Free Software Foundation, either version 3 of the License, or (at your |
|
8bda66cd0414
Convert misc remaining files with GPLv2 or later to GPLv3 or later
Mats Lidell <matsl@xemacs.org>
parents:
5290
diff
changeset
|
12 option) any later version. |
| 428 | 13 |
|
5425
8bda66cd0414
Convert misc remaining files with GPLv2 or later to GPLv3 or later
Mats Lidell <matsl@xemacs.org>
parents:
5290
diff
changeset
|
14 XEmacs is distributed in the hope that it will be useful, but WITHOUT |
|
8bda66cd0414
Convert misc remaining files with GPLv2 or later to GPLv3 or later
Mats Lidell <matsl@xemacs.org>
parents:
5290
diff
changeset
|
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
8bda66cd0414
Convert misc remaining files with GPLv2 or later to GPLv3 or later
Mats Lidell <matsl@xemacs.org>
parents:
5290
diff
changeset
|
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
8bda66cd0414
Convert misc remaining files with GPLv2 or later to GPLv3 or later
Mats Lidell <matsl@xemacs.org>
parents:
5290
diff
changeset
|
17 for more details. |
|
5290
e6508b64ee08
More permission consistency.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4759
diff
changeset
|
18 |
|
e6508b64ee08
More permission consistency.
Stephen J. Turnbull <stephen@xemacs.org>
parents:
4759
diff
changeset
|
19 You should have received a copy of the GNU General Public License |
|
5425
8bda66cd0414
Convert misc remaining files with GPLv2 or later to GPLv3 or later
Mats Lidell <matsl@xemacs.org>
parents:
5290
diff
changeset
|
20 along with XEmacs. If not, see <http://www.gnu.org/licenses/>. |
| 428 | 21 |
| 22 Author: Andy Norman (ange@hplb.hpl.hp.com), based on | |
| 23 'etc/server.c' and 'etc/emacsclient.c' from the 18.52 GNU | |
| 24 Emacs distribution. | |
| 25 | |
| 26 Please mail bugs and suggestions to the author at the above address. | |
| 27 */ | |
| 28 | |
| 29 /* HISTORY | |
| 30 * 11-Nov-1990 bristor@simba | |
| 31 * Added EOT stuff. | |
| 32 */ | |
| 33 | |
| 34 /* | |
| 35 * This file incorporates new features added by Bob Weiner <weiner@mot.com>, | |
| 36 * Darrell Kindred <dkindred@cmu.edu> and Arup Mukherjee <arup@cmu.edu>. | |
| 37 * Please see the note at the end of the README file for details. | |
| 38 * | |
| 39 * (If gnuserv came bundled with your emacs, the README file is probably | |
| 40 * ../etc/gnuserv.README relative to the directory containing this file) | |
| 41 */ | |
| 42 | |
| 456 | 43 #define GNUSERV_VERSION "3.12" |
| 428 | 44 |
| 464 | 45 /* Note: this setting can cause client-server connection failure if the |
| 46 * value of TMPDIR is not shared by client and server at run-time. | |
| 47 */ | |
| 428 | 48 #define USE_TMPDIR |
| 49 | |
| 50 #define PATCHLEVEL 2 | |
| 51 | |
| 52 #define NO_SHORTNAMES | |
| 53 /* gnuserv should not be compiled using SOCKS */ | |
| 54 #define DO_NOT_SOCKSIFY | |
| 438 | 55 #include <config.h> |
| 428 | 56 #undef signal |
| 57 | |
| 58 /* Define the communication method between server and clients: | |
| 59 * You can have either or both kinds of sockets, but you can't mix | |
| 60 * sockets with sysv ipc | |
| 61 */ | |
| 62 | |
| 63 | |
| 64 #define INTERNET_DOMAIN_SOCKETS | |
| 65 #ifdef HAVE_SYS_UN_H | |
| 66 #define UNIX_DOMAIN_SOCKETS | |
| 67 /* #define SYSV_IPC */ | |
| 68 #endif | |
| 69 | |
| 70 /* | |
| 71 * Define additional authentication protocols to be used. These methods will | |
| 72 * be tried before falling back to the default gnuserv protocol (based on | |
| 73 * the GNU_SECURE environment variable). Currently, only MIT-MAGIC-COOKIE-1 | |
| 74 * is also supported. | |
| 75 * | |
| 76 * Comment out the next line(s) if you don't want to enable the | |
| 77 * appropriate authentication protocol. | |
| 78 */ | |
| 79 | |
| 80 #if defined (HAVE_XAUTH) | |
| 81 #define AUTH_MAGIC_COOKIE | |
| 82 #endif /* HAVE_XAUTH */ | |
| 83 | |
| 84 /* | |
| 85 * stuff related to supporting MIT-MAGIC-COOKIE-1 | |
| 86 */ | |
| 87 | |
| 88 #define MCOOKIE_SCREEN "999" /* screen # to use as the gnuserv cookie */ | |
| 89 #define MCOOKIE_NAME "MAGIC-1" /* authentication protocol name */ | |
| 90 #define MCOOKIE_X_NAME "MIT-MAGIC-COOKIE-1" /* as needed by X */ | |
| 91 | |
| 92 | |
| 93 #define DEFAUTH_NAME "GNU-SECURE" /* name of default auth protocol */ | |
| 94 #define AUTH_TIMEOUT 15 /* # seconds to wait for auth data */ | |
| 95 #define AUTH_NAMESZ 15 /* max allows auth protocol name size */ | |
| 96 | |
| 97 | |
| 98 /* | |
| 99 * Pick a default communication scheme, if none was specified. | |
| 100 */ | |
| 101 | |
| 102 #if !defined(SYSV_IPC) && !defined(UNIX_DOMAIN_SOCKETS) && !defined(INTERNET_DOMAIN_SOCKETS) | |
| 103 | |
| 104 #ifdef HAVE_SYSVIPC | |
| 105 #define SYSV_IPC /* SYSV systems use SYSV IPC by default */ | |
| 106 #endif /* HAVE_SYSVIPC */ | |
| 107 | |
| 108 #ifdef BSD | |
| 109 #define UNIX_DOMAIN_SOCKETS /* BSD systems use Unix Domain sockets by default */ | |
| 110 #endif /* BSD */ | |
| 111 | |
| 112 #endif /* No communication method pre-defined */ | |
| 113 | |
| 978 | 114 #include <sys/types.h> |
| 115 #include <sys/param.h> | |
| 116 #include <sys/stat.h> | |
| 117 #include <stdio.h> | |
| 118 #include <stdlib.h> | |
| 119 #include <string.h> | |
| 120 #include "syssignal.h" | |
| 121 #include <errno.h> | |
| 122 | |
| 428 | 123 #ifdef HAVE_UNISTD_H |
| 124 #include <unistd.h> | |
| 125 #endif | |
| 126 | |
| 127 #ifdef HAVE_SYS_TIME_H | |
| 128 #include <sys/time.h> | |
| 129 #endif | |
| 130 | |
| 131 /* | |
| 132 * If you are using SYSV_IPC, you might want to make the buffer size bigger | |
| 133 * since it limits the size of requests and responses. Don't make it bigger | |
| 134 * than your system's max message size though (usually a couple of k) or else | |
| 135 * msgsend will start failing. For sockets, using the system BUFSIZ is usually | |
| 136 * what you want. | |
| 137 */ | |
| 138 | |
| 139 # define GSERV_BUFSZ BUFSIZ | |
| 140 | |
| 141 | |
| 142 #ifdef SYSV_IPC | |
| 143 #include <sys/ipc.h> | |
| 144 #include <sys/msg.h> | |
| 145 | |
| 146 #define send_string(s,str) \ | |
| 147 if (strlen(msgp->mtext) + strlen(str) < GSERV_BUFSZ) \ | |
| 148 strcat(msgp->mtext,str); \ | |
| 149 else \ | |
| 150 { \ | |
| 151 fprintf(stderr,"%s: not enough message buffer space\n",progname); \ | |
| 152 exit(1); \ | |
| 153 } \ | |
| 154 | |
| 155 #endif /* SYSV_IPC */ | |
| 156 | |
| 157 #if defined(INTERNET_DOMAIN_SOCKETS) || defined(UNIX_DOMAIN_SOCKETS) | |
| 158 #include <sys/socket.h> | |
| 159 #endif /* INTERNET_DOMAIN_SOCKETS || UNIX_DOMAIN_SOCKETS */ | |
| 160 | |
| 161 #ifdef INTERNET_DOMAIN_SOCKETS | |
| 162 #include <netdb.h> | |
| 163 #include <netinet/in.h> | |
| 164 #include <arpa/inet.h> | |
| 165 #define TABLE_SIZE 101 /* The number of entries in the hash table */ | |
| 166 #define HASH(host) host /* Rather simplistic hash function */ | |
| 167 #define DEFAULT_PORT 21490 /* default port number to use is | |
| 168 * DEFAULT_PORT + uid */ | |
| 169 #endif /* INTERNET_DOMAIN_SOCKETS */ | |
| 170 | |
| 171 #ifdef UNIX_DOMAIN_SOCKETS | |
| 172 #include <sys/un.h> | |
| 173 #define HIDE_UNIX_SOCKET /* put the unix socket in a protected dir */ | |
| 174 #endif /* UNIX_DOMAIN_SOCKETS */ | |
| 175 | |
| 176 /* On some platforms, we need to do the equivalent of "stty litout" to get | |
| 177 * characters like ^D to pass through to emacs. This problem has only | |
| 178 * been observed under emacs18; fsf19 and lemacs are probably okay without it. | |
| 179 */ | |
| 180 #ifndef DONT_USE_LITOUT | |
| 181 #if !defined(HAVE_TERMIO) && !defined(HAVE_TERMIOS) && !defined(VMS) | |
| 182 #define USE_LITOUT | |
| 183 #endif | |
| 184 #endif | |
| 185 | |
| 186 | |
| 187 #define HOSTNAMSZ 255 /* max size of a hostname */ | |
| 188 #define REPLYSIZ 300 /* max size of reply from server to client */ | |
| 189 #undef FALSE | |
| 190 #define FALSE 0 | |
| 191 #undef TRUE | |
| 192 #define TRUE 1 | |
| 193 | |
| 194 extern char *optarg; | |
| 195 extern int optind; | |
| 196 extern char *progname; | |
| 197 extern char *tmpdir; | |
| 198 | |
| 199 /* The casts shut Sun's compiler up and are safe in the context these | |
| 200 are actually used. */ | |
| 201 #define max2(x,y) (((int) (x) > (int) (y)) ? (x) : (y)) | |
| 202 #define min2(x,y) (((int) (x) < (int) (y)) ? (x) : (y)) | |
| 203 | |
| 204 #ifndef _NFILE /* rough guess at maximum number of open files */ | |
| 205 #define _NFILE 20 | |
| 206 #endif | |
| 207 | |
| 208 #define EOT_STR "\004" | |
| 209 #define EOT_CHR '\004' | |
| 210 | |
| 211 /* connection types */ | |
| 212 #define CONN_UNIX 0 | |
| 213 #define CONN_INTERNET 1 | |
| 214 #define CONN_IPC 2 | |
| 215 | |
| 216 /* function declarations */ | |
| 217 int make_connection (char *hostarg, int portarg, int *s); | |
| 218 #ifdef SYSV_IPC | |
| 219 void disconnect_from_ipc_server(); | |
| 220 #endif | |
| 221 #if defined(INTERNET_DOMAIN_SOCKETS) || defined(UNIX_DOMAIN_SOCKETS) | |
| 442 | 222 void send_string (int s, const char *msg); |
| 428 | 223 void disconnect_from_server (int s, int echo); |
| 224 int read_line (int s, char *dest); | |
| 225 #endif | |
| 226 #ifdef INTERNET_DOMAIN_SOCKETS | |
| 227 int internet_addr (char *host); | |
| 228 #endif |
