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