annotate lib-src/gnuserv.h @ 1314:15a91d7ae2d1

[xemacs-hg @ 2003-02-20 08:16:21 by ben] check in makefile fixes et al Makefile.in.in: Major surgery. Move all stuff related to building anything in the src/ directory into src/. Simplify the dependencies -- everything in src/ is dependent on the single entry `src' in MAKE_SUBDIRS. Remove weirdo targets like `all-elc[s]', dump-elc[s], etc. mule/mule-msw-init.el: Removed. Delete this file. mule/mule-win32-init.el: New file, with stuff from mule-msw-init.el -- not just for MS Windows native, boys and girls! bytecomp.el: Change code inserted to catch trying to load a Mule-only .elc file in a non-Mule XEmacs. Formerly you got the rather cryptic "The required feature `mule' cannot be provided". Now you get "Loading this file requires Mule support". finder.el: Remove dependency on which directory this function is invoked from. update-elc.el: Don't mess around with ../src/BYTECOMPILE_CHANGE. Now that Makefile.in.in and xemacs.mak are in sync, both of them use NEEDTODUMP and the other one isn't used. dumped-lisp.el: Rewrite in terms of `list' and `nconc' instead of assemble-list, so we can have arbitrary forms, not just `when-feature'. very-early-lisp.el: Nuke this file. finder-inf.el, packages.el, update-elc.el, update-elc-2.el, loadup.el, make-docfile.el: Eliminate references to very-early-lisp. msw-glyphs.el: Comment clarification. xemacs.mak: Add macros DO_TEMACS, DO_XEMACS, and a few others; this macro section is now completely in sync with src/Makefile.in.in. Copy check-features, load-shadows, and rebuilding finder-inf.el from src/Makefile.in.in. The main build/dump/recompile process is now synchronized with src/Makefile.in.in. Change `WARNING' to `NOTE' and `error checking' to `error-checking' TO avoid tripping faux warnings and errors in the VC++ IDE. Makefile.in.in: Major surgery. Move all stuff related to building anything in the src/ directory from top-level Makefile.in.in to here. Simplify the dependencies. Rearrange into logical subsections. Synchronize the main compile/dump/build-elcs section with xemacs.mak, which is already clean and in good working order. Remove weirdo targets like `all-elc[s]', dump-elc[s], etc. Add additional levels of macros \(e.g. DO_TEMACS, DO_XEMACS, TEMACS_BATCH, XEMACS_BATCH, XEMACS_BATCH_PACKAGES) to factor out duplicated stuff. Clean up handling of "HEAP_IN_DATA" (Cygwin) so it doesn't need to ignore the return value from dumping. Add .NO_PARALLEL since various aspects of building and dumping must be serialized but do not always have dependencies between them (this is impossible in some cases). Everything related to src/ now gets built in one pass in this directory by just running `make' (except the Makefiles themselves and config.h, paths.h, Emacs.ad.h, and other generated .h files). console.c: Update list of possibly valid console types. emacs.c: Rationalize the specifying and handling of the type of the first frame. This was originally prompted by a workspace in which I got GTK to compile under C++ and in the process fixed it so it could coexist with X in the same build -- hence, a combined TTY/X/MS-Windows/GTK build is now possible under Cygwin. (However, you can't simultaneously *display* more than one kind of device connection -- but getting that to work is not that difficult. Perhaps a project for a bored grad student. I (ben) would do it but don't see the use.) To make sense of this, I added new switches that can be used to specifically indicate the window system: -x [aka --use-x], -tty \[aka --use-tty], -msw [aka --use-ms-windows], -gtk [aka --use-gtk], and -gnome [aka --use-gnome, same as --use-gtk]. -nw continues as an alias for -tty. When none have been given, XEmacs checks for other parameters implying particular device types (-t -> tty, -display -> x [or should it have same treatment as DISPLAY below?]), and has ad-hoc logic afterwards: if env var DISPLAY is set, use x (or gtk? perhaps should check whether gnome is running), else MS Windows if it exsits, else TTY if it exists, else stream, and you must be running in batch mode. This also fixes an existing bug whereby compiling with no x, no mswin, no tty, when running non- interactively (e.g. to dump) I get "sorry, must have TTY support". emacs.c: Turn on Vstack_trace_on_error so that errors are debuggable even when occurring extremely early in reinitialization. emacs.c: Try to make sure that the user can see message output under Windows (i.e. it doesn't just disappear right away) regardless of when it occurs, e.g. in the middle of creating the first frame. emacs.c: Define new function `emacs-run-status', indicating whether XEmacs is noninteractive or interactive, whether raw, post-dump/pdump-load or run-temacs, whether we are dumping, whether pdump is in effect. event-stream.c: It's "mommas are fat", not "momas are fat". Fix other typo. event-stream.c: Conditionalize in_menu_callback check on HAVE_MENUBARS, because it won't exist on w/o menubar support, lisp.h: More hackery on RETURN_NOT_REACHED. Cygwin v3.2 DOES complain here if RETURN_NOT_REACHED() is blank, as it is for GCC 2.5+. So make it blank only for GCC 2.5 through 2.999999999999999. Declare Vstack_trace_on_error. profile.c: Need to include "profile.h" to fix warnings. sheap.c: Don't fatal() when need to rerun Make, just stderr_out() and exit(0). That way we can distinguish between a dumping failing expectedly (due to lack of stack space, triggering another dump) and unexpectedly, in which case, we want to stop building. (or go on, if -K is given) syntax.c, syntax.h: Use ints where they belong, and enum syntaxcode's where they belong, and fix warnings thereby. syntax.h: Fix crash caused by an edge condition in the syntax-cache macros. text.h: Spacing fixes. xmotif.h: New file, to get around shadowing warnings. EmacsManager.c, event-Xt.c, glyphs-x.c, gui-x.c, input-method-motif.c, xmmanagerp.h, xmprimitivep.h: Include xmotif.h. alloc.c: Conditionalize in_malloc on ERROR_CHECK_MALLOC. config.h.in, file-coding.h, fileio.c, getloadavg.c, select-x.c, signal.c, sysdep.c, sysfile.h, systime.h, text.c, unicode.c: Eliminate HAVE_WIN32_CODING_SYSTEMS, use WIN32_ANY instead. Replace defined (WIN32_NATIVE) || defined (CYGWIN) with WIN32_ANY. lisp.h: More futile attempts to walk and chew gum at the same time when dealing with subr's that don't return.
author ben
date Thu, 20 Feb 2003 08:16:21 +0000
parents 13e47461d509
children aa5ed11f473b
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
613
023b83f4e54b [xemacs-hg @ 2001-06-10 10:42:16 by ben]
ben
parents: 464
diff changeset
5 This file is part of XEmacs.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 Copying is permitted under those conditions described by the GNU
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 General Public License.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 Copyright (C) 1989 Free Software Foundation, Inc.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 Author: Andy Norman (ange@hplb.hpl.hp.com), based on
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 'etc/server.c' and 'etc/emacsclient.c' from the 18.52 GNU
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 Emacs distribution.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16 Please mail bugs and suggestions to the author at the above address.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 /* HISTORY
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 * 11-Nov-1990 bristor@simba
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21 * Added EOT stuff.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25 * This file incorporates new features added by Bob Weiner <weiner@mot.com>,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 * Darrell Kindred <dkindred@cmu.edu> and Arup Mukherjee <arup@cmu.edu>.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 * 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
28 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 * (If gnuserv came bundled with your emacs, the README file is probably
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 * ../etc/gnuserv.README relative to the directory containing this file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32
456
e7ef97881643 Import from CVS: tag r21-2-43
cvs
parents: 442
diff changeset
33 #define GNUSERV_VERSION "3.12"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34
464
5aa1854ad537 Import from CVS: tag r21-2-47
cvs
parents: 456
diff changeset
35 /* Note: this setting can cause client-server connection failure if the
5aa1854ad537 Import from CVS: tag r21-2-47
cvs
parents: 456
diff changeset
36 * 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
37 */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38 #define USE_TMPDIR
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40 #define PATCHLEVEL 2
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 #define NO_SHORTNAMES
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 /* gnuserv should not be compiled using SOCKS */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 #define DO_NOT_SOCKSIFY
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
45 #include <config.h>
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 #undef signal
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 /* Define the communication method between server and clients:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 * 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
50 * sockets with sysv ipc
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
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 #define INTERNET_DOMAIN_SOCKETS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 #ifdef HAVE_SYS_UN_H
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 #define UNIX_DOMAIN_SOCKETS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57 /* #define SYSV_IPC */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 * Define additional authentication protocols to be used. These methods will
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 * be tried before falling back to the default gnuserv protocol (based on
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63 * the GNU_SECURE environment variable). Currently, only MIT-MAGIC-COOKIE-1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 * is also supported.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 * 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
67 * appropriate authentication protocol.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 */
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 #if defined (HAVE_XAUTH)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 #define AUTH_MAGIC_COOKIE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 #endif /* HAVE_XAUTH */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 * stuff related to supporting MIT-MAGIC-COOKIE-1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 #define MCOOKIE_SCREEN "999" /* screen # to use as the gnuserv cookie */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 #define MCOOKIE_NAME "MAGIC-1" /* authentication protocol name */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 #define MCOOKIE_X_NAME "MIT-MAGIC-COOKIE-1" /* as needed by X */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 #define DEFAUTH_NAME "GNU-SECURE" /* name of default auth protocol */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 #define AUTH_TIMEOUT 15 /* # seconds to wait for auth data */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 #define AUTH_NAMESZ 15 /* max allows auth protocol name size */
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 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 * Pick a default communication scheme, if none was specified.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 */
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 #if !defined(SYSV_IPC) && !defined(UNIX_DOMAIN_SOCKETS) && !defined(INTERNET_DOMAIN_SOCKETS)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 #ifdef HAVE_SYSVIPC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 #define SYSV_IPC /* SYSV systems use SYSV IPC by default */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 #endif /* HAVE_SYSVIPC */
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 #ifdef BSD
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 #define UNIX_DOMAIN_SOCKETS /* BSD systems use Unix Domain sockets by default */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100 #endif /* BSD */
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 #endif /* No communication method pre-defined */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103
978
13e47461d509 [xemacs-hg @ 2002-08-29 19:45:20 by james]
james
parents: 954
diff changeset
104 #include <sys/types.h>
13e47461d509 [xemacs-hg @ 2002-08-29 19:45:20 by james]
james
parents: 954
diff changeset
105 #include <sys/param.h>
13e47461d509 [xemacs-hg @ 2002-08-29 19:45:20 by james]
james
parents: 954
diff changeset
106 #include <sys/stat.h>
13e47461d509 [xemacs-hg @ 2002-08-29 19:45:20 by james]
james
parents: 954
diff changeset
107 #include <stdio.h>
13e47461d509 [xemacs-hg @ 2002-08-29 19:45:20 by james]
james
parents: 954
diff changeset
108 #include <stdlib.h>
13e47461d509 [xemacs-hg @ 2002-08-29 19:45:20 by james]
james
parents: 954
diff changeset
109 #include <string.h>
13e47461d509 [xemacs-hg @ 2002-08-29 19:45:20 by james]
james
parents: 954
diff changeset
110 #include "syssignal.h"
13e47461d509 [xemacs-hg @ 2002-08-29 19:45:20 by james]
james
parents: 954
diff changeset
111 #include <errno.h>
13e47461d509 [xemacs-hg @ 2002-08-29 19:45:20 by james]
james
parents: 954
diff changeset
112
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 #ifdef HAVE_UNISTD_H
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 #include <unistd.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 #ifdef HAVE_SYS_TIME_H
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118 #include <sys/time.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 /*
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 * 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
123 * 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
124 * 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
125 * msgsend will start failing. For sockets, using the system BUFSIZ is usually
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 * what you want.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 # define GSERV_BUFSZ BUFSIZ
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 #ifdef SYSV_IPC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 #include <sys/ipc.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 #include <sys/msg.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 #define send_string(s,str) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 if (strlen(msgp->mtext) + strlen(str) < GSERV_BUFSZ) \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
138 strcat(msgp->mtext,str); \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139 else \
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 fprintf(stderr,"%s: not enough message buffer space\n",progname); \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
142 exit(1); \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 } \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 #endif /* SYSV_IPC */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 #if defined(INTERNET_DOMAIN_SOCKETS) || defined(UNIX_DOMAIN_SOCKETS)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 #include <sys/socket.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149 #endif /* INTERNET_DOMAIN_SOCKETS || UNIX_DOMAIN_SOCKETS */
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 #ifdef INTERNET_DOMAIN_SOCKETS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 #include <netdb.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 #include <netinet/in.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 #include <arpa/inet.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 #define TABLE_SIZE 101 /* The number of entries in the hash table */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 #define HASH(host) host /* Rather simplistic hash function */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 #define DEFAULT_PORT 21490 /* default port number to use is
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 * DEFAULT_PORT + uid */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 #endif /* INTERNET_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 UNIX_DOMAIN_SOCKETS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 #include <sys/un.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 #define HIDE_UNIX_SOCKET /* put the unix socket in a protected dir */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 #endif /* UNIX_DOMAIN_SOCKETS */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 /* 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
167 * characters like ^D to pass through to emacs. This problem has only
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168 * been observed under emacs18; fsf19 and lemacs are probably okay without it.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 #ifndef DONT_USE_LITOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 #if !defined(HAVE_TERMIO) && !defined(HAVE_TERMIOS) && !defined(VMS)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 438
diff changeset
172 #if !defined(BSD4_1)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 #define USE_LITOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 #define HOSTNAMSZ 255 /* max size of a hostname */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 #define REPLYSIZ 300 /* max size of reply from server to client */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 #undef FALSE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 #define FALSE 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 #undef TRUE
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 #define TRUE 1
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 extern char *optarg;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 extern int optind;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 extern char *progname;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 extern char *tmpdir;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 /* 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
192 are actually used. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 #define max2(x,y) (((int) (x) > (int) (y)) ? (x) : (y))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194 #define min2(x,y) (((int) (x) < (int) (y)) ? (x) : (y))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 #ifndef _NFILE /* rough guess at maximum number of open files */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 #define _NFILE 20
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 #define EOT_STR "\004"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 #define EOT_CHR '\004'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 /* connection types */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 #define CONN_UNIX 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 #define CONN_INTERNET 1
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 #define CONN_IPC 2
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 /* function declarations */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 int make_connection (char *hostarg, int portarg, int *s);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 #ifdef SYSV_IPC
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 void disconnect_from_ipc_server();
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 #if defined(INTERNET_DOMAIN_SOCKETS) || defined(UNIX_DOMAIN_SOCKETS)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 438
diff changeset
214 void send_string (int s, const char *msg);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 void disconnect_from_server (int s, int echo);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 int read_line (int s, char *dest);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 #ifdef INTERNET_DOMAIN_SOCKETS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 int internet_addr (char *host);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 #endif