0
|
1 /* -*-C-*-
|
|
2 Client code to allow local and remote editing of files by XEmacs.
|
|
3 Copyright (C) 1989 Free Software Foundation, Inc.
|
|
4 Copyright (C) 1995 Sun Microsystems, Inc.
|
149
|
5 Copyright (C) 1997 Free Software Foundation, Inc.
|
0
|
6
|
|
7 This file is part of XEmacs.
|
|
8
|
|
9 XEmacs is free software; you can redistribute it and/or modify it
|
|
10 under the terms of the GNU General Public License as published by the
|
|
11 Free Software Foundation; either version 2, or (at your option) any
|
|
12 later version.
|
|
13
|
|
14 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
17 for more details.
|
|
18
|
|
19 You should have received a copy of the GNU General Public License
|
|
20 along with XEmacs; see the file COPYING. If not, write to
|
|
21 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
22 Boston, MA 02111-1307, USA.
|
|
23
|
|
24 Author: Andy Norman (ange@hplb.hpl.hp.com), based on
|
|
25 'etc/emacsclient.c' from the GNU Emacs 18.52 distribution.
|
|
26
|
|
27 Please mail bugs and suggestions to the author at the above address.
|
|
28 */
|
|
29
|
|
30 /*
|
|
31 * This file incorporates new features added by Bob Weiner <weiner@mot.com>,
|
|
32 * Darrell Kindred <dkindred@cmu.edu> and Arup Mukherjee <arup@cmu.edu>.
|
|
33 * GNUATTACH support added by Ben Wing <wing@xemacs.org>.
|
|
34 * Please see the note at the end of the README file for details.
|
|
35 *
|
|
36 * (If gnuserv came bundled with your emacs, the README file is probably
|
|
37 * ../etc/gnuserv.README relative to the directory containing this file)
|
|
38 */
|
|
39
|
|
40 #if 0
|
|
41 /* Hand-munged RCS header */
|
|
42 static char rcsid [] = "!Header: gnuclient.c,v 2.2 95/12/12 01:39:21 wing nene !";
|
|
43 #endif
|
|
44
|
|
45 #include "gnuserv.h"
|
|
46 #include "getopt.h"
|
|
47
|
|
48 #include <stdio.h>
|
|
49 #include <stdlib.h>
|
149
|
50 #ifdef HAVE_STRING_H
|
0
|
51 #include <string.h>
|
149
|
52 #endif /* HAVE_STRING_H */
|
0
|
53 #include <sys/types.h>
|
149
|
54 #ifdef HAVE_UNISTD_H
|
0
|
55 #include <unistd.h>
|
149
|
56 #endif /* HAVE_UNISTD_H */
|
|
57 #include <signal.h>
|
|
58
|
0
|
59
|
|
60 #if !defined(SYSV_IPC) && !defined(UNIX_DOMAIN_SOCKETS) && \
|
|
61 !defined(INTERNET_DOMAIN_SOCKETS)
|
78
|
62 int
|
|
63 main (int argc, char *argv[])
|
0
|
64 {
|
|
65 fprintf (stderr, "Sorry, the Emacs server is only "
|
|
66 "supported on systems that have\n");
|
|
67 fprintf (stderr, "Unix Domain sockets, Internet Domain "
|
|
68 "sockets or System V IPC.\n");
|
|
69 exit (1);
|
|
70 } /* main */
|
|
71 #else /* SYSV_IPC || UNIX_DOMAIN_SOCKETS || INTERNET_DOMAIN_SOCKETS */
|
|
72
|
|
73 static char cwd[MAXPATHLEN+2]; /* current working directory when calculated */
|
|
74 static char *cp = NULL; /* ptr into valid bit of cwd above */
|
|
75
|
108
|
76 static pid_t emacs_pid; /* Process id for emacs process */
|
|
77
|
149
|
78 void initialize_signals (void);
|
|
79
|
|
80 void
|
|
81 tell_emacs_to_resume (int sig)
|
108
|
82 {
|
149
|
83 char buffer[GSERV_BUFSZ+1];
|
|
84 int s; /* socket / msqid to server */
|
|
85 int connect_type; /* CONN_UNIX, CONN_INTERNET, or
|
|
86 ONN_IPC */
|
108
|
87
|
|
88 /* Why is SYSV so retarded? */
|
|
89 /* We want emacs to realize that we are resuming */
|
149
|
90 signal(SIGCONT, tell_emacs_to_resume);
|
108
|
91
|
149
|
92 connect_type = make_connection (NULL, (u_short) 0, &s);
|
108
|
93
|
149
|
94 sprintf(buffer,"(gnuserv-eval '(resume-pid-console %d))", getpid());
|
|
95 send_string(s, buffer);
|
|
96
|
108
|
97 #ifdef SYSV_IPC
|
|
98 if (connect_type == (int) CONN_IPC)
|
|
99 disconnect_from_ipc_server (s, msgp, FALSE);
|
|
100 #else /* !SYSV_IPC */
|
|
101 if (connect_type != (int) CONN_IPC)
|
|
102 disconnect_from_server (s, FALSE);
|
|
103 #endif /* !SYSV_IPC */
|
|
104 }
|
|
105
|
149
|
106 void
|
|
107 pass_signal_to_emacs (int sig)
|
108
|
108 {
|
149
|
109 if (kill (emacs_pid, sig) == -1)
|
|
110 {
|
|
111 fprintf (stderr, "gnuattach: Could not pass signal to emacs process\n");
|
|
112 exit (1);
|
|
113 }
|
|
114 initialize_signals ();
|
108
|
115 }
|
|
116
|
149
|
117 void
|
|
118 initialize_signals ()
|
108
|
119 {
|
149
|
120 /* Set up signal handler to pass relevant signals to emacs process.
|
|
121 We used to send SIGSEGV, SIGBUS, SIGPIPE, SIGILL and others to
|
|
122 Emacs, but I think it's better not to. I can see no reason why
|
|
123 Emacs should SIGSEGV whenever gnuclient SIGSEGV-s, etc. */
|
|
124 signal (SIGHUP, pass_signal_to_emacs);
|
|
125 signal (SIGQUIT, pass_signal_to_emacs);
|
|
126 signal (SIGINT, pass_signal_to_emacs);
|
151
|
127 #ifdef SIGWINCH
|
|
128 signal (SIGWINCH, pass_signal_to_emacs);
|
|
129 #endif
|
108
|
130
|
|
131 /* We want emacs to realize that we are resuming */
|
149
|
132 signal (SIGCONT, tell_emacs_to_resume);
|
108
|
133 }
|
|
134
|
0
|
135
|
|
136 /*
|
|
137 get_current_working_directory -- return the cwd.
|
|
138 */
|
|
139 static char *
|
|
140 get_current_working_directory (void)
|
|
141 {
|
|
142 if (cp == NULL)
|
|
143 { /* haven't calculated it yet */
|
|
144 #ifdef BSD
|
|
145 if (getwd (cwd) == 0)
|
|
146 #else /* !BSD */
|
|
147 if (getcwd (cwd,MAXPATHLEN) == NULL)
|
|
148 #endif /* !BSD */
|
|
149 {
|
|
150 perror (progname);
|
|
151 fprintf (stderr, "%s: unable to get current working directory\n",
|
|
152 progname);
|
|
153 exit (1);
|
|
154 } /* if */
|
|
155
|
|
156 /* on some systems, cwd can look like '@machine/' ... */
|
|
157 /* ignore everything before the first '/' */
|
|
158 for (cp = cwd; *cp && *cp != '/'; ++cp)
|
|
159 ;
|
|
160
|
|
161 } /* if */
|
|
162
|
|
163 return cp;
|
|
164
|
|
165 } /* get_current_working_directory */
|
|
166
|
|
167
|
|
168 /*
|
|
169 filename_expand -- try to convert the given filename into a fully-qualified
|
|
170 pathname.
|
|
171 */
|
|
172 static void
|
|
173 filename_expand (char *fullpath, char *filename)
|
|
174 /* fullpath - returned full pathname */
|
|
175 /* filename - filename to expand */
|
|
176 {
|
|
177 int len;
|
|
178
|
|
179 fullpath[0] = '\0';
|
|
180
|
|
181 if (filename[0] && filename[0] != '/')
|
|
182 { /* relative filename */
|
|
183 strcat (fullpath, get_current_working_directory ());
|
|
184 len = strlen (fullpath);
|
|
185
|
|
186 if (len > 0 && fullpath[len-1] == '/') /* trailing slash already? */
|
|
187 ; /* yep */
|
|
188 else
|
|
189 strcat (fullpath, "/"); /* nope, append trailing slash */
|
|
190 } /* if */
|
|
191
|
|
192 strcat (fullpath,filename);
|
|
193
|
|
194 } /* filename_expand */
|
|
195
|
151
|
196 /* Encase the string in quotes, escape all the backslashes and quotes
|
|
197 in string. */
|
|
198 char *
|
|
199 clean_string (CONST char *s)
|
|
200 {
|
|
201 int i = 0;
|
|
202 char *p, *res;
|
|
203
|
|
204 for (p = s; *p; p++, i++)
|
|
205 {
|
|
206 if (*p == '\\' || *p == '\"')
|
|
207 ++i;
|
|
208 else if (*p == '\004')
|
|
209 i += 3;
|
|
210 }
|
|
211 p = res = (char *)malloc (i + 2 + 1);
|
|
212 *p++ = '\"';
|
|
213 for (; *s; p++, s++)
|
|
214 {
|
|
215 switch (*s)
|
|
216 {
|
|
217 case '\\':
|
|
218 *p++ = '\\';
|
|
219 *p = '\\';
|
|
220 break;
|
|
221 case '\"':
|
|
222 *p++ = '\\';
|
|
223 *p = '\"';
|
|
224 break;
|
|
225 case '\004':
|
|
226 *p++ = '\\';
|
|
227 *p++ = 'C';
|
|
228 *p++ = '-';
|
|
229 *p = 'd';
|
|
230 break;
|
|
231 default:
|
|
232 *p = *s;
|
|
233 }
|
|
234 }
|
|
235 *p++ = '\"';
|
|
236 *p = '\0';
|
|
237 return res;
|
|
238 }
|
|
239
|
|
240 #define GET_ARGUMENT(var, desc) do { \
|
|
241 if (*(p + 1)) (var) = p + 1; \
|
|
242 else \
|
|
243 { \
|
|
244 if (!argv[++i]) \
|
|
245 { \
|
|
246 fprintf (stderr, "%s: `%s' must be followed by an argument\n", \
|
|
247 progname, desc); \
|
|
248 exit (1); \
|
|
249 } \
|
|
250 (var) = argv[i]; \
|
|
251 } \
|
|
252 over = 1; \
|
|
253 } while (0)
|
|
254
|
|
255
|
78
|
256 int
|
|
257 main (int argc, char *argv[])
|
0
|
258 {
|
151
|
259 int starting_line = 1; /* line to start editing at */
|
|
260 char command[MAXPATHLEN+50]; /* emacs command buffer */
|
|
261 char fullpath[MAXPATHLEN+1]; /* full pathname to file */
|
|
262 char *eval_form = NULL; /* form to evaluate with `-eval' */
|
|
263 char *eval_function = NULL; /* function to evaluate with `-f' */
|
|
264 char *load_library = NULL; /* library to load */
|
|
265 int quick = 0; /* quick edit, don't wait for user to
|
|
266 finish */
|
|
267 int batch = 0; /* batch mode */
|
|
268 int view = 0; /* view only. */
|
|
269 int nofiles = 0;
|
|
270 int errflg = 0; /* option error */
|
|
271 int c; /* char from getopt */
|
|
272 int s; /* socket / msqid to server */
|
|
273 int connect_type; /* CONN_UNIX, CONN_INTERNET, or
|
|
274 * CONN_IPC */
|
149
|
275 int suppress_windows_system = 0;
|
|
276 char *display;
|
0
|
277 #ifdef INTERNET_DOMAIN_SOCKETS
|
151
|
278 char *hostarg = NULL; /* remote hostname */
|
|
279 char *remotearg;
|
|
280 char thishost[HOSTNAMSZ]; /* this hostname */
|
|
281 char remotepath[MAXPATHLEN+1]; /* remote pathname */
|
|
282 char *path;
|
|
283 int rflg = 0; /* pathname given on cmdline */
|
|
284 char *portarg;
|
|
285 u_short port = 0; /* port to server */
|
0
|
286 #endif /* INTERNET_DOMAIN_SOCKETS */
|
|
287 #ifdef SYSV_IPC
|
151
|
288 struct msgbuf *msgp; /* message */
|
0
|
289 #endif /* SYSV_IPC */
|
|
290 char *tty;
|
151
|
291 char buffer[GSERV_BUFSZ + 1]; /* buffer to read pid */
|
|
292 char result[GSERV_BUFSZ + 1];
|
|
293 int i;
|
0
|
294
|
|
295 #ifdef INTERNET_DOMAIN_SOCKETS
|
|
296 memset (remotepath, 0, sizeof (remotepath));
|
|
297 #endif /* INTERNET_DOMAIN_SOCKETS */
|
|
298
|
151
|
299 progname = strrchr (argv[0], '/');
|
|
300 if (progname)
|
|
301 ++progname;
|
|
302 else
|
|
303 progname = argv[0];
|
0
|
304
|
149
|
305 display = getenv ("DISPLAY");
|
|
306 if (!display)
|
|
307 suppress_windows_system = 1;
|
|
308
|
151
|
309 for (i = 1; argv[i] && !errflg; i++)
|
|
310 {
|
|
311 if (*argv[i] != '-')
|
0
|
312 break;
|
151
|
313 if (!strcmp (argv[i], "-batch"))
|
|
314 batch = 1;
|
|
315 else if (!strcmp (argv[i], "-eval"))
|
|
316 {
|
|
317 if (!argv[++i])
|
|
318 {
|
|
319 fprintf (stderr, "%s: `-eval' must be followed by an argument\n",
|
|
320 progname);
|
|
321 exit (1);
|
|
322 }
|
|
323 eval_form = argv[i];
|
|
324 }
|
|
325 else if (!strcmp (argv[i], "-display"))
|
|
326 {
|
|
327 suppress_windows_system = 0;
|
|
328 if (!argv[++i])
|
|
329 {
|
|
330 fprintf (stderr, "%s: `-display' must be followed by an argument\n",
|
|
331 progname);
|
|
332 exit (1);
|
|
333 }
|
|
334 display = argv[i];
|
|
335 }
|
|
336 else if (!strcmp (argv[i], "-nw"))
|
|
337 suppress_windows_system = 1;
|
|
338 else
|
|
339 {
|
|
340 /* Iterate over one-letter options. */
|
|
341 char *p;
|
|
342 int over = 0;
|
|
343 for (p = argv[i] + 1; *p && !over; p++)
|
|
344 {
|
|
345 switch (*p)
|
|
346 {
|
|
347 case 'q':
|
|
348 quick = 1;
|
|
349 break;
|
|
350 case 'v':
|
|
351 view = 1;
|
|
352 break;
|
|
353 case 'f':
|
|
354 GET_ARGUMENT (eval_function, "-f");
|
|
355 break;
|
|
356 case 'l':
|
|
357 GET_ARGUMENT (load_library, "-l");
|
|
358 break;
|
0
|
359 #ifdef INTERNET_DOMAIN_SOCKETS
|
151
|
360 case 'h':
|
|
361 GET_ARGUMENT (hostarg, "-h");
|
|
362 break;
|
|
363 case 'p':
|
|
364 GET_ARGUMENT (portarg, "-p");
|
|
365 port = atoi (portarg);
|
|
366 break;
|
|
367 case 'r':
|
|
368 GET_ARGUMENT (remotearg, "-r");
|
|
369 strcpy (remotepath, remotearg);
|
|
370 rflg = 1;
|
|
371 break;
|
0
|
372 #endif /* INTERNET_DOMAIN_SOCKETS */
|
151
|
373 default:
|
|
374 errflg = 1;
|
|
375 }
|
|
376 } /* for */
|
|
377 } /* else */
|
|
378 } /* for */
|
0
|
379
|
|
380 if (errflg)
|
|
381 {
|
|
382 fprintf (stderr,
|
|
383 #ifdef INTERNET_DOMAIN_SOCKETS
|
151
|
384 "usage: %s [-nw] [-q] [-v] [-l library] [-f function] [-eval expr]\n"
|
|
385 " [-h host] [-p port] [-r file-name] [[+line] file] ...\n",
|
|
386 #else /* !INTERNET_DOMAIN_SOCKETS */
|
|
387 "usage: %s [-nw] [-q] [-v] [-l library] [-f function] [-eval expr] "
|
0
|
388 "[[+line] path] ...\n",
|
|
389 #endif /* !INTERNET_DOMAIN_SOCKETS */
|
|
390 progname);
|
|
391 exit (1);
|
151
|
392 }
|
|
393 if (batch && argv[i])
|
0
|
394 {
|
151
|
395 fprintf (stderr, "%s: Cannot specify `-batch' with file names\n",
|
149
|
396 progname);
|
|
397 exit (1);
|
|
398 }
|
151
|
399 *result = '\0';
|
|
400 if (eval_function || eval_form || load_library)
|
|
401 {
|
|
402 #if defined(INTERNET_DOMAIN_SOCKETS)
|
|
403 connect_type = make_connection (hostarg, port, &s);
|
|
404 #else
|
|
405 connect_type = make_connection (NULL, (u_short) 0, &s);
|
|
406 #endif
|
|
407 sprintf (command, "(gnuserv-eval%s '(progn ", quick ? "-quickly" : "");
|
|
408 send_string (s, command);
|
|
409 if (load_library)
|
|
410 {
|
|
411 sprintf (command, " (load-library %s)", clean_string (load_library));
|
|
412 send_string (s, command);
|
|
413 }
|
|
414 if (eval_form)
|
|
415 {
|
|
416 sprintf (command, " %s", eval_form);
|
|
417 send_string (s, command);
|
|
418 }
|
|
419 if (eval_function)
|
|
420 {
|
|
421 sprintf (command, " (%s)", eval_function);
|
|
422 send_string (s, command);
|
|
423 }
|
|
424 send_string (s, "))");
|
|
425 send_string (s, EOT_STR);
|
|
426 if (read_line (s, result) == 0)
|
|
427 {
|
|
428 fprintf (stderr, "%s: Could not read\n", progname);
|
|
429 exit (1);
|
|
430 }
|
|
431 } /* eval_function || eval_form || load_library */
|
|
432 else if (batch)
|
|
433 {
|
|
434 fprintf (stderr, "%s: `-batch' requires an evaluation\n",
|
|
435 progname);
|
|
436 exit (1);
|
|
437 }
|
|
438
|
|
439 if (!batch)
|
|
440 {
|
|
441 if (suppress_windows_system)
|
|
442 {
|
|
443 tty = ttyname (0);
|
|
444 if (!tty)
|
|
445 {
|
|
446 fprintf (stderr, "%s: Not connected to a tty", progname);
|
|
447 exit (1);
|
|
448 }
|
|
449 }
|
|
450
|
|
451 #if defined(INTERNET_DOMAIN_SOCKETS)
|
|
452 connect_type = make_connection (hostarg, port, &s);
|
|
453 #else
|
|
454 connect_type = make_connection (NULL, (u_short) 0, &s);
|
|
455 #endif
|
|
456
|
|
457 send_string (s, "(gnuserv-eval '(emacs-pid))");
|
|
458 send_string (s, EOT_STR);
|
|
459
|
|
460 if (read_line (s, buffer) == 0)
|
|
461 {
|
|
462 fprintf (stderr, "%s: Could not establish emacs procces id\n",
|
|
463 progname);
|
|
464 exit (1);
|
|
465 }
|
|
466 /* Don't do disconnect_from_server becasue we have already read
|
|
467 data, and disconnect doesn't do anything else. */
|
|
468 #ifndef INTERNET_DOMAIN_SOCKETS
|
|
469 if (connect_type == (int) CONN_IPC)
|
|
470 disconnect_from_ipc_server (s, msgp, FALSE);
|
108
|
471 #endif /* !SYSV_IPC */
|
|
472
|
151
|
473 emacs_pid = (pid_t)atol(buffer);
|
|
474 initialize_signals();
|
108
|
475
|
151
|
476 #if defined(INTERNET_DOMAIN_SOCKETS)
|
|
477 connect_type = make_connection (hostarg, port, &s);
|
0
|
478 #else
|
151
|
479 connect_type = make_connection (NULL, (u_short) 0, &s);
|
0
|
480 #endif
|
|
481
|
|
482 #ifdef INTERNET_DOMAIN_SOCKETS
|
151
|
483 if (connect_type == (int) CONN_INTERNET)
|
|
484 {
|
|
485 char *ptr;
|
|
486 gethostname (thishost, HOSTNAMSZ);
|
|
487 if (!rflg)
|
|
488 { /* attempt to generate a path
|
0
|
489 * to this machine */
|
151
|
490 if ((ptr = getenv ("GNU_NODE")) != NULL)
|
|
491 /* user specified a path */
|
|
492 strcpy (remotepath, ptr);
|
|
493 }
|
0
|
494 #if 0 /* This is really bogus... re-enable it if you must have it! */
|
|
495 #if defined (hp9000s300) || defined (hp9000s800)
|
151
|
496 else if (strcmp (thishost,hostarg))
|
|
497 { /* try /net/thishost */
|
|
498 strcpy (remotepath, "/net/"); /* (this fails using internet
|
|
499 addresses) */
|
|
500 strcat (remotepath, thishost);
|
|
501 }
|
0
|
502 #endif
|
|
503 #endif
|
151
|
504 }
|
|
505 else
|
|
506 { /* same machines, no need for path */
|
|
507 remotepath[0] = '\0'; /* default is the empty path */
|
|
508 }
|
0
|
509 #endif /* INTERNET_DOMAIN_SOCKETS */
|
|
510
|
|
511 #ifdef SYSV_IPC
|
151
|
512 if ((msgp = (struct msgbuf *)
|
|
513 malloc (sizeof *msgp + GSERV_BUFSZ)) == NULL)
|
|
514 {
|
|
515 fprintf (stderr, "%s: not enough memory for message buffer\n", progname);
|
|
516 exit (1);
|
|
517 } /* if */
|
0
|
518
|
151
|
519 msgp->mtext[0] = '\0'; /* ready for later strcats */
|
0
|
520 #endif /* SYSV_IPC */
|
|
521
|
151
|
522 if (suppress_windows_system)
|
149
|
523 {
|
151
|
524 char *term = getenv ("TERM");
|
|
525 if (!term)
|
|
526 {
|
|
527 fprintf (stderr, "%s: unknown terminal type\n", progname);
|
|
528 exit (1);
|
|
529 }
|
|
530 sprintf (command, "(gnuserv-edit-files '(tty %s %s %d) '(",
|
|
531 clean_string (tty), clean_string (term), getpid ());
|
149
|
532 }
|
151
|
533 else /* !suppress_windows_system */
|
|
534 {
|
|
535 sprintf (command, "(gnuserv-edit-files '(x %s) '(",
|
|
536 clean_string (display));
|
|
537 } /* !suppress_windows_system */
|
|
538 send_string (s, command);
|
149
|
539
|
151
|
540 if (!argv[i])
|
|
541 nofiles = 1;
|
0
|
542
|
151
|
543 for (; argv[i]; i++)
|
0
|
544 {
|
151
|
545 if (i < argc - 1 && *argv[i] == '+')
|
|
546 starting_line = atoi (argv[i++]);
|
|
547 else
|
|
548 starting_line = 1;
|
|
549 /* If the last argument is +something, treat it as a file. */
|
|
550 if (i == argc)
|
|
551 {
|
|
552 starting_line = 1;
|
|
553 --i;
|
|
554 }
|
|
555 filename_expand (fullpath, argv[i]);
|
0
|
556 #ifdef INTERNET_DOMAIN_SOCKETS
|
151
|
557 path = malloc (strlen (remotepath) + strlen (fullpath) + 1);
|
|
558 sprintf (path, "%s%s", remotepath, fullpath);
|
|
559 #else
|
|
560 path = malloc (strlen (fullpath));
|
|
561 strcpy (path, fullpath);
|
0
|
562 #endif
|
151
|
563 sprintf (command, "(%d . %s)", starting_line, clean_string (path));
|
|
564 send_string (s, command);
|
|
565 free (path);
|
|
566 } /* for */
|
|
567
|
|
568 sprintf (command, ")%s%s",
|
|
569 (quick || (nofiles && !suppress_windows_system)) ? " 'quick" : "",
|
|
570 view ? " 'view" : "");
|
149
|
571 send_string (s, command);
|
151
|
572 send_string (s, ")");
|
0
|
573
|
|
574 #ifdef SYSV_IPC
|
151
|
575 if (connect_type == (int) CONN_IPC)
|
|
576 disconnect_from_ipc_server (s, msgp, FALSE);
|
0
|
577 #else /* !SYSV_IPC */
|
151
|
578 if (connect_type != (int) CONN_IPC)
|
|
579 disconnect_from_server (s, FALSE);
|
0
|
580 #endif /* !SYSV_IPC */
|
151
|
581 } /* not batch */
|
|
582
|
|
583 if (batch && !quick)
|
|
584 printf ("%s\n", result);
|
0
|
585
|
78
|
586 return 0;
|
0
|
587
|
|
588 } /* main */
|
|
589
|
|
590 #endif /* SYSV_IPC || UNIX_DOMAIN_SOCKETS || INTERNET_DOMAIN_SOCKETS */
|