annotate lib-src/gnuclient.c @ 30:ec9a17fef872 r19-15b98

Import from CVS: tag r19-15b98
author cvs
date Mon, 13 Aug 2007 08:52:29 +0200
parents bcdc7deadc19
children 131b0175ea99
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* -*-C-*-
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Client code to allow local and remote editing of files by XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 Copyright (C) 1989 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 Copyright (C) 1995 Sun Microsystems, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 under the terms of the GNU General Public License as published by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 Free Software Foundation; either version 2, or (at your option) any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 along with XEmacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 Boston, MA 02111-1307, USA.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 Author: Andy Norman (ange@hplb.hpl.hp.com), based on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 'etc/emacsclient.c' from the GNU Emacs 18.52 distribution.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 Please mail bugs and suggestions to the author at the above address.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 * This file incorporates new features added by Bob Weiner <weiner@mot.com>,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 * Darrell Kindred <dkindred@cmu.edu> and Arup Mukherjee <arup@cmu.edu>.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 * GNUATTACH support added by Ben Wing <wing@xemacs.org>.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 * Please see the note at the end of the README file for details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 * (If gnuserv came bundled with your emacs, the README file is probably
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 * ../etc/gnuserv.README relative to the directory containing this file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 #if 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 /* Hand-munged RCS header */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 static char rcsid [] = "!Header: gnuclient.c,v 2.2 95/12/12 01:39:21 wing nene !";
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 #include "gnuserv.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 #include "getopt.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 #include <stdio.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 #include <stdlib.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 #include <string.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 #include <sys/types.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 #include <unistd.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 #if !defined(SYSV_IPC) && !defined(UNIX_DOMAIN_SOCKETS) && \
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 !defined(INTERNET_DOMAIN_SOCKETS)
12
bcdc7deadc19 Import from CVS: tag r19-15b7
cvs
parents: 0
diff changeset
55 int
bcdc7deadc19 Import from CVS: tag r19-15b7
cvs
parents: 0
diff changeset
56 main (int argc, char *argv[])
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 fprintf (stderr, "Sorry, the Emacs server is only "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 "supported on systems that have\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 fprintf (stderr, "Unix Domain sockets, Internet Domain "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 "sockets or System V IPC.\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 exit (1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 } /* main */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 #else /* SYSV_IPC || UNIX_DOMAIN_SOCKETS || INTERNET_DOMAIN_SOCKETS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 static char cwd[MAXPATHLEN+2]; /* current working directory when calculated */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 static char *cp = NULL; /* ptr into valid bit of cwd above */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68
30
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
69 #ifdef GNUATTACH
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
70 #include <signal.h>
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
71
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
72 static pid_t emacs_pid; /* Process id for emacs process */
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
73
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
74 void tell_emacs_to_resume(int sig)
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
75 {
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
76 char buffer[GSERV_BUFSZ+1];
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
77 int s; /* socket / msqid to server */
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
78 int connect_type; /* CONN_UNIX, CONN_INTERNET, or
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
79 * CONN_IPC */
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
80
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
81 /* Why is SYSV so retarded? */
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
82 /* We want emacs to realize that we are resuming */
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
83 signal(SIGCONT, tell_emacs_to_resume);
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
84
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
85 connect_type = make_connection (NULL, (u_short) 0, &s);
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
86
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
87 sprintf(buffer,"(server-eval '(resume-pid-console %d))", getpid());
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
88 send_string(s, buffer);
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
89
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
90 #ifdef SYSV_IPC
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
91 if (connect_type == (int) CONN_IPC)
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
92 disconnect_from_ipc_server (s, msgp, FALSE);
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
93 #else /* !SYSV_IPC */
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
94 if (connect_type != (int) CONN_IPC)
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
95 disconnect_from_server (s, FALSE);
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
96 #endif /* !SYSV_IPC */
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
97 }
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
98
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
99 void pass_signal_to_emacs(int sig)
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
100 {
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
101 if (kill(emacs_pid, sig) == -1) {
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
102 fprintf(stderr, "gnuattach: Could not pass signal to emacs process\n");
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
103 exit(1);
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
104 }
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
105 }
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
106
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
107 void initialize_signals()
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
108 {
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
109 /* Set up signal handler to pass relevant signals to emacs process */
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
110 signal(SIGHUP, pass_signal_to_emacs);
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
111 signal(SIGQUIT, pass_signal_to_emacs);
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
112 signal(SIGILL, pass_signal_to_emacs);
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
113 signal(SIGTRAP, pass_signal_to_emacs);
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
114 signal(SIGSEGV, pass_signal_to_emacs);
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
115 signal(SIGPIPE, pass_signal_to_emacs);
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
116 signal(SIGTERM, pass_signal_to_emacs);
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
117 #ifdef SIGBUS
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
118 signal(SIGBUS, pass_signal_to_emacs);
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
119 #endif
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
120 #ifdef SIGIOT
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
121 signal(SIGIOT, pass_signal_to_emacs);
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
122 #endif
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
123
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
124 /* We want emacs to realize that we are resuming */
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
125 signal(SIGCONT, tell_emacs_to_resume);
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
126 }
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
127
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
128 #endif /* GNUATTACH */
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
129
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 get_current_working_directory -- return the cwd.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 static char *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 get_current_working_directory (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 if (cp == NULL)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 { /* haven't calculated it yet */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 #ifdef BSD
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 if (getwd (cwd) == 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 #else /* !BSD */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 if (getcwd (cwd,MAXPATHLEN) == NULL)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 #endif /* !BSD */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 perror (progname);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 fprintf (stderr, "%s: unable to get current working directory\n",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 progname);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 exit (1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 } /* if */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 /* on some systems, cwd can look like '@machine/' ... */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 /* ignore everything before the first '/' */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 for (cp = cwd; *cp && *cp != '/'; ++cp)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 ;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 } /* if */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 return cp;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 } /* get_current_working_directory */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 filename_expand -- try to convert the given filename into a fully-qualified
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 pathname.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 filename_expand (char *fullpath, char *filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 /* fullpath - returned full pathname */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 /* filename - filename to expand */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 int len;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 fullpath[0] = '\0';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 if (filename[0] && filename[0] != '/')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 { /* relative filename */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 strcat (fullpath, get_current_working_directory ());
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 len = strlen (fullpath);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 if (len > 0 && fullpath[len-1] == '/') /* trailing slash already? */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 ; /* yep */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 strcat (fullpath, "/"); /* nope, append trailing slash */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 } /* if */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 strcat (fullpath,filename);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 } /* filename_expand */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190
12
bcdc7deadc19 Import from CVS: tag r19-15b7
cvs
parents: 0
diff changeset
191 int
bcdc7deadc19 Import from CVS: tag r19-15b7
cvs
parents: 0
diff changeset
192 main (int argc, char *argv[])
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 int starting_line = 1; /* line to start editing at */
30
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
195 char command[MAXPATHLEN+50]; /* emacs command buffer */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 char fullpath[MAXPATHLEN+1]; /* full pathname to file */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 #ifndef GNUATTACH
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 int qflg = 0; /* quick edit, don't wait for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 * user to finish */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 int errflg = 0; /* option error */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 int c; /* char from getopt */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 int s; /* socket / msqid to server */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 int connect_type; /* CONN_UNIX, CONN_INTERNET, or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 * CONN_IPC */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 #ifdef INTERNET_DOMAIN_SOCKETS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 char *hostarg = NULL; /* remote hostname */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 char thishost[HOSTNAMSZ]; /* this hostname */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 char remotepath[MAXPATHLEN+1]; /* remote pathname */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 int rflg = 0; /* pathname given on cmdline */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 u_short portarg = 0; /* port to server */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 char *ptr; /* return from getenv */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 #endif /* INTERNET_DOMAIN_SOCKETS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 #ifdef SYSV_IPC
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 struct msgbuf *msgp; /* message */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 #endif /* SYSV_IPC */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 #ifdef GNUATTACH
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 char *tty;
30
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
219 char buffer[GSERV_BUFSZ+1]; /* buffer to read pid */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 #ifdef INTERNET_DOMAIN_SOCKETS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 memset (remotepath, 0, sizeof (remotepath));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 #endif /* INTERNET_DOMAIN_SOCKETS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 progname = argv[0];
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 while ((c = getopt (argc, argv,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 #ifdef INTERNET_DOMAIN_SOCKETS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 "h:p:r:q"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 #else /* !INTERNET_DOMAIN_SOCKETS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 # ifdef GNUATTACH
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 ""
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 # else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 "q"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 # endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 #endif /* !INTERNET_DOMAIN_SOCKETS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 )) != EOF)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 switch (c)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 #ifndef GNUATTACH
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 case 'q': /* quick mode specified */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 qflg++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 #ifdef INTERNET_DOMAIN_SOCKETS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 case 'h': /* server host name specified */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 hostarg = optarg;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 case 'r': /* remote path from server specifed */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 strcpy (remotepath,optarg);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 rflg++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 case 'p': /* port number specified */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 portarg = atoi (optarg);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 #endif /* INTERNET_DOMAIN_SOCKETS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 case '?':
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 errflg++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 } /* switch */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 if (errflg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 fprintf (stderr,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 #ifdef INTERNET_DOMAIN_SOCKETS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 "usage: %s [-q] [-h hostname] [-p port] [-r pathname] "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 "[[+line] path] ...\n",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 #else /* !INTERNET_DOMAIN_SOCKETS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 # ifdef GNUATTACH
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 "usage: %s [[+line] path] ...\n",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 # else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 "usage: %s [-q] [[+line] path] ...\n",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 # endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 #endif /* !INTERNET_DOMAIN_SOCKETS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 progname);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 exit (1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 } /* if */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 #ifdef GNUATTACH
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 tty = ttyname (0);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 if (!tty)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 fprintf (stderr, "%s: Not connected to a tty", progname);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 exit (1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 }
30
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
290
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
291 /* This next stuff added in an attempt to make handling of
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
292 the tty do the right thing when dealing with signals.
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
293 Idea is to pass all the appropriate signals to the emacs process
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
294 */
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
295
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
296 connect_type = make_connection (NULL, (u_short) 0, &s);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297
30
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
298 send_string(s,"(server-eval '(emacs-pid))");
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
299 send_string(s,EOT_STR);
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
300
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
301 if (read_line(s,buffer) == 0) {
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
302 fprintf(stderr, "%s: Could not establish emacs procces id\n",progname);
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
303 exit(1);
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
304 }
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
305 /* don't do disconnect_from_server becasue we have already read data,
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
306 and disconnect doesn't do anything else
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
307 */
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
308 #ifdef SYSV_IPC
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
309 if (connect_type == (int) CONN_IPC)
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
310 disconnect_from_ipc_server (s, msgp, FALSE);
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
311 #endif /* !SYSV_IPC */
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
312
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
313 emacs_pid = (pid_t)atol(buffer);
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
314 initialize_signals();
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
315
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
316 #endif /*GNUATTACH */
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
317
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
318 #if defined(INTERNET_DOMAIN_SOCKETS) && !defined(GNUATTACH)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 connect_type = make_connection (hostarg, portarg, &s);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 connect_type = make_connection (NULL, (u_short) 0, &s);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 #ifdef INTERNET_DOMAIN_SOCKETS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 if (connect_type == (int) CONN_INTERNET)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 gethostname (thishost, HOSTNAMSZ);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 if (!rflg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 { /* attempt to generate a path
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 * to this machine */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 if ((ptr = getenv ("GNU_NODE")) != NULL)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 /* user specified a path */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 strcpy (remotepath, ptr);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 #if 0 /* This is really bogus... re-enable it if you must have it! */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 #if defined (hp9000s300) || defined (hp9000s800)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 else if (strcmp (thishost,hostarg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 { /* try /net/thishost */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 strcpy (remotepath, "/net/"); /* (this fails using internet
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 addresses) */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 strcat (remotepath, thishost);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 { /* same machines, no need for path */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 remotepath[0] = '\0'; /* default is the empty path */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 #endif /* INTERNET_DOMAIN_SOCKETS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 #ifdef SYSV_IPC
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 if ((msgp = (struct msgbuf *)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 malloc (sizeof *msgp + GSERV_BUFSZ)) == NULL)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 fprintf (stderr, "%s: not enough memory for message buffer\n", progname);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 exit (1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 } /* if */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 msgp->mtext[0] = '\0'; /* ready for later strcats */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 #endif /* SYSV_IPC */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 #ifdef GNUATTACH
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 ptr = getenv ("TERM");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 if (!ptr)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 fprintf (stderr, "%s: unknown terminal type\n", progname);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 exit (1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 }
30
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
370 sprintf (command, "(server-tty-edit-files \"%s\" \"%s\" %d '(",
ec9a17fef872 Import from CVS: tag r19-15b98
cvs
parents: 12
diff changeset
371 tty, ptr, getpid());
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 send_string (s, command);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374 if (qflg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 send_string (s, "(server-edit-files-quickly '(");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 send_string (s, "(server-edit-files '(");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 for (; optind < argc; optind++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 if (*argv[optind] == '+')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 starting_line = atoi (argv[optind]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 filename_expand (fullpath, argv[optind]);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 sprintf (command, "(%d . \"%s%s\")", starting_line,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393 #ifdef INTERNET_DOMAIN_SOCKETS
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 remotepath,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 #else /* !INTERNET_DOMAIN_SOCKETS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 "",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 fullpath);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 send_string (s,command);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 starting_line = 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 } /* else */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 } /* for */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 send_string (s,"))");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 #ifdef SYSV_IPC
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 if (connect_type == (int) CONN_IPC)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 disconnect_from_ipc_server (s, msgp, FALSE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 #else /* !SYSV_IPC */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 if (connect_type != (int) CONN_IPC)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 disconnect_from_server (s, FALSE);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 #endif /* !SYSV_IPC */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413
12
bcdc7deadc19 Import from CVS: tag r19-15b7
cvs
parents: 0
diff changeset
414 return 0;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 } /* main */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 #endif /* SYSV_IPC || UNIX_DOMAIN_SOCKETS || INTERNET_DOMAIN_SOCKETS */