annotate lib-src/gnuserv.h @ 5908:6174848f3e6c

Use parse_integer() in read_atom(); support bases with ratios like integers src/ChangeLog addition: 2015-05-08 Aidan Kehoe <kehoea@parhasard.net> * data.c (init_errors_once_early): Move the Qunsupported_type here from numbers.c, so it's available when the majority of our types are not supported. * general-slots.h: Add it here, too. * number.c: Remove the definition of Qunsupported_type from here. * lread.c (read_atom): Check if the first character could reflect a rational, if so, call parse_integer(), don't check the syntax of the other characters. This allows us to accept the non-ASCII digit characters too. If that worked partially, but not completely, and the next char is a slash, try to parse as a ratio. If that fails, try isfloat_string(), but only if the first character could plausibly be part of a float. Otherwise, treat as a symbol. * lread.c (read_rational): Rename from read_integer. Handle ratios with the same radix specification as was used for integers. * lread.c (read1): Rename read_integer in this function. Support the Common Lisp #NNNrMMM syntax for parsing a number MMM of arbitrary radix NNN. man/ChangeLog addition: 2015-05-08 Aidan Kehoe <kehoea@parhasard.net> * lispref/numbers.texi (Numbers): Describe the newly-supported arbitrary-base syntax for rationals (integers and ratios). Describe that ratios can take the same base specification as integers, something also new. tests/ChangeLog addition: 2015-05-08 Aidan Kehoe <kehoea@parhasard.net> * automated/lisp-reader-tests.el: Check the arbitrary-base integer reader syntax support, just added. Check the reader base support for ratios, just added. Check the non-ASCII-digit support in the reader, just added.
author Aidan Kehoe <kehoea@parhasard.net>
date Sat, 09 May 2015 00:40:57 +0100
parents 8bda66cd0414
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* -*-C-*-
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2
613
023b83f4e54b [xemacs-hg @ 2001-06-10 10:42:16 by ben]
ben
parents: 464
diff changeset
3 Header file for the XEmacs server and client C code.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
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
023b83f4e54b [xemacs-hg @ 2001-06-10 10:42:16 by ben]
ben
parents: 464
diff changeset
7 This file is part of XEmacs.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 Author: Andy Norman (ange@hplb.hpl.hp.com), based on
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23 'etc/server.c' and 'etc/emacsclient.c' from the 18.52 GNU
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 Emacs distribution.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 Please mail bugs and suggestions to the author at the above address.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 /* HISTORY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 * 11-Nov-1990 bristor@simba
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 * Added EOT stuff.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
33
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 * This file incorporates new features added by Bob Weiner <weiner@mot.com>,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 * Darrell Kindred <dkindred@cmu.edu> and Arup Mukherjee <arup@cmu.edu>.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 * Please see the note at the end of the README file for details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 * (If gnuserv came bundled with your emacs, the README file is probably
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 * ../etc/gnuserv.README relative to the directory containing this file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42
456
e7ef97881643 Import from CVS: tag r21-2-43
cvs
parents: 442
diff changeset
43 #define GNUSERV_VERSION "3.12"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44
464
5aa1854ad537 Import from CVS: tag r21-2-47
cvs
parents: 456
diff changeset
45 /* Note: this setting can cause client-server connection failure if the
5aa1854ad537 Import from CVS: tag r21-2-47
cvs
parents: 456
diff changeset
46 * value of TMPDIR is not shared by client and server at run-time.
5aa1854ad537 Import from CVS: tag r21-2-47
cvs
parents: 456
diff changeset
47 */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 #define USE_TMPDIR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 #define PATCHLEVEL 2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52 #define NO_SHORTNAMES
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 /* gnuserv should not be compiled using SOCKS */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 #define DO_NOT_SOCKSIFY
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
55 #include <config.h>
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 #undef signal
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 /* Define the communication method between server and clients:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 * You can have either or both kinds of sockets, but you can't mix
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 * sockets with sysv ipc
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 #define INTERNET_DOMAIN_SOCKETS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 #ifdef HAVE_SYS_UN_H
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 #define UNIX_DOMAIN_SOCKETS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 /* #define SYSV_IPC */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 * Define additional authentication protocols to be used. These methods will
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 * be tried before falling back to the default gnuserv protocol (based on
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 * the GNU_SECURE environment variable). Currently, only MIT-MAGIC-COOKIE-1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 * is also supported.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 * Comment out the next line(s) if you don't want to enable the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 * appropriate authentication protocol.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 #if defined (HAVE_XAUTH)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 #define AUTH_MAGIC_COOKIE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 #endif /* HAVE_XAUTH */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 * stuff related to supporting MIT-MAGIC-COOKIE-1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 #define MCOOKIE_SCREEN "999" /* screen # to use as the gnuserv cookie */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 #define MCOOKIE_NAME "MAGIC-1" /* authentication protocol name */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 #define MCOOKIE_X_NAME "MIT-MAGIC-COOKIE-1" /* as needed by X */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 #define DEFAUTH_NAME "GNU-SECURE" /* name of default auth protocol */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 #define AUTH_TIMEOUT 15 /* # seconds to wait for auth data */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 #define AUTH_NAMESZ 15 /* max allows auth protocol name size */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 * Pick a default communication scheme, if none was specified.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
102 #if !defined(SYSV_IPC) && !defined(UNIX_DOMAIN_SOCKETS) && !defined(INTERNET_DOMAIN_SOCKETS)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 #ifdef HAVE_SYSVIPC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 #define SYSV_IPC /* SYSV systems use SYSV IPC by default */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 #endif /* HAVE_SYSVIPC */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 #ifdef BSD
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 #define UNIX_DOMAIN_SOCKETS /* BSD systems use Unix Domain sockets by default */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 #endif /* BSD */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 #endif /* No communication method pre-defined */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113
978
13e47461d509 [xemacs-hg @ 2002-08-29 19:45:20 by james]
james
parents: 954
diff changeset
114 #include <sys/types.h>
13e47461d509 [xemacs-hg @ 2002-08-29 19:45:20 by james]
james
parents: 954
diff changeset
115 #include <sys/param.h>
13e47461d509 [xemacs-hg @ 2002-08-29 19:45:20 by james]
james
parents: 954
diff changeset
116 #include <sys/stat.h>
13e47461d509 [xemacs-hg @ 2002-08-29 19:45:20 by james]
james
parents: 954
diff changeset
117 #include <stdio.h>
13e47461d509 [xemacs-hg @ 2002-08-29 19:45:20 by james]
james
parents: 954
diff changeset
118 #include <stdlib.h>
13e47461d509 [xemacs-hg @ 2002-08-29 19:45:20 by james]
james
parents: 954
diff changeset
119 #include <string.h>
13e47461d509 [xemacs-hg @ 2002-08-29 19:45:20 by james]
james
parents: 954
diff changeset
120 #include "syssignal.h"
13e47461d509 [xemacs-hg @ 2002-08-29 19:45:20 by james]
james
parents: 954
diff changeset
121 #include <errno.h>
13e47461d509 [xemacs-hg @ 2002-08-29 19:45:20 by james]
james
parents: 954
diff changeset
122
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 #ifdef HAVE_UNISTD_H
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 #include <unistd.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 #ifdef HAVE_SYS_TIME_H
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 #include <sys/time.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 * If you are using SYSV_IPC, you might want to make the buffer size bigger
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 * since it limits the size of requests and responses. Don't make it bigger
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 * than your system's max message size though (usually a couple of k) or else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 * msgsend will start failing. For sockets, using the system BUFSIZ is usually
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 * what you want.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 # define GSERV_BUFSZ BUFSIZ
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
140
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
141
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 #ifdef SYSV_IPC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 #include <sys/ipc.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 #include <sys/msg.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146 #define send_string(s,str) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 if (strlen(msgp->mtext) + strlen(str) < GSERV_BUFSZ) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 strcat(msgp->mtext,str); \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 else \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 { \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 fprintf(stderr,"%s: not enough message buffer space\n",progname); \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 exit(1); \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 } \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 #endif /* SYSV_IPC */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 #if defined(INTERNET_DOMAIN_SOCKETS) || defined(UNIX_DOMAIN_SOCKETS)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 #include <sys/socket.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 #endif /* INTERNET_DOMAIN_SOCKETS || UNIX_DOMAIN_SOCKETS */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 #ifdef INTERNET_DOMAIN_SOCKETS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 #include <netdb.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 #include <netinet/in.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 #include <arpa/inet.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 #define TABLE_SIZE 101 /* The number of entries in the hash table */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 #define HASH(host) host /* Rather simplistic hash function */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 #define DEFAULT_PORT 21490 /* default port number to use is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 * DEFAULT_PORT + uid */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 #endif /* INTERNET_DOMAIN_SOCKETS */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 #ifdef UNIX_DOMAIN_SOCKETS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 #include <sys/un.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 #define HIDE_UNIX_SOCKET /* put the unix socket in a protected dir */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 #endif /* UNIX_DOMAIN_SOCKETS */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 /* On some platforms, we need to do the equivalent of "stty litout" to get
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 * characters like ^D to pass through to emacs. This problem has only
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 * been observed under emacs18; fsf19 and lemacs are probably okay without it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 #ifndef DONT_USE_LITOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 #if !defined(HAVE_TERMIO) && !defined(HAVE_TERMIOS) && !defined(VMS)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 #define USE_LITOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 #define HOSTNAMSZ 255 /* max size of a hostname */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 #define REPLYSIZ 300 /* max size of reply from server to client */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 #undef FALSE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 #define FALSE 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 #undef TRUE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 #define TRUE 1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 extern char *optarg;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 extern int optind;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 extern char *progname;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 extern char *tmpdir;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 /* The casts shut Sun's compiler up and are safe in the context these
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 are actually used. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 #define max2(x,y) (((int) (x) > (int) (y)) ? (x) : (y))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202 #define min2(x,y) (((int) (x) < (int) (y)) ? (x) : (y))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 #ifndef _NFILE /* rough guess at maximum number of open files */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 #define _NFILE 20
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 #define EOT_STR "\004"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 #define EOT_CHR '\004'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 /* connection types */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 #define CONN_UNIX 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 #define CONN_INTERNET 1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 #define CONN_IPC 2
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 /* function declarations */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 int make_connection (char *hostarg, int portarg, int *s);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 #ifdef SYSV_IPC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 void disconnect_from_ipc_server();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 #if defined(INTERNET_DOMAIN_SOCKETS) || defined(UNIX_DOMAIN_SOCKETS)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 438
diff changeset
222 void send_string (int s, const char *msg);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223 void disconnect_from_server (int s, int echo);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 int read_line (int s, char *dest);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 #ifdef INTERNET_DOMAIN_SOCKETS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 int internet_addr (char *host);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 #endif