comparison lib-src/gnuclient.c @ 771:943eaba38521

[xemacs-hg @ 2002-03-13 08:51:24 by ben] The big ben-mule-21-5 check-in! Various files were added and deleted. See CHANGES-ben-mule. There are still some test suite failures. No crashes, though. Many of the failures have to do with problems in the test suite itself rather than in the actual code. I'll be addressing these in the next day or so -- none of the test suite failures are at all critical. Meanwhile I'll be trying to address the biggest issues -- i.e. build or run failures, which will almost certainly happen on various platforms. All comments should be sent to ben@xemacs.org -- use a Cc: if necessary when sending to mailing lists. There will be pre- and post- tags, something like pre-ben-mule-21-5-merge-in, and post-ben-mule-21-5-merge-in.
author ben
date Wed, 13 Mar 2002 08:54:06 +0000
parents 7039e6323819
children dfee0026a079
comparison
equal deleted inserted replaced
770:336a418893b5 771:943eaba38521
56 56
57 char gnuserv_version[] = "gnuclient version " GNUSERV_VERSION; 57 char gnuserv_version[] = "gnuclient version " GNUSERV_VERSION;
58 58
59 #include "getopt.h" 59 #include "getopt.h"
60 60
61 #include <stdio.h>
62 #include <stdlib.h>
63 #include <sys/types.h>
64 #include <sysfile.h> 61 #include <sysfile.h>
65
66 #ifdef HAVE_STRING_H
67 #include <string.h>
68 #endif /* HAVE_STRING_H */
69
70 #ifdef HAVE_UNISTD_H
71 #include <unistd.h>
72 #endif /* HAVE_UNISTD_H */
73
74 #include <signal.h>
75 62
76 #if !defined(SYSV_IPC) && !defined(UNIX_DOMAIN_SOCKETS) && \ 63 #if !defined(SYSV_IPC) && !defined(UNIX_DOMAIN_SOCKETS) && \
77 !defined(INTERNET_DOMAIN_SOCKETS) 64 !defined(INTERNET_DOMAIN_SOCKETS)
78 int 65 int
79 main (int argc, char *argv[]) 66 main (int argc, char *argv[])
84 "sockets or System V IPC.\n"); 71 "sockets or System V IPC.\n");
85 exit (1); 72 exit (1);
86 } /* main */ 73 } /* main */
87 #else /* SYSV_IPC || UNIX_DOMAIN_SOCKETS || INTERNET_DOMAIN_SOCKETS */ 74 #else /* SYSV_IPC || UNIX_DOMAIN_SOCKETS || INTERNET_DOMAIN_SOCKETS */
88 75
89 static char cwd[MAXPATHLEN+2]; /* current working directory when calculated */ 76 static char cwd[PATH_MAX+2]; /* current working directory when calculated */
90 static char *cp = NULL; /* ptr into valid bit of cwd above */ 77 static char *cp = NULL; /* ptr into valid bit of cwd above */
91 78
92 static pid_t emacs_pid; /* Process id for emacs process */ 79 static pid_t emacs_pid; /* Process id for emacs process */
93 80
94 void initialize_signals (void); 81 void initialize_signals (void);
159 get_current_working_directory (void) 146 get_current_working_directory (void)
160 { 147 {
161 if (cp == NULL) 148 if (cp == NULL)
162 { /* haven't calculated it yet */ 149 { /* haven't calculated it yet */
163 #ifdef HAVE_GETCWD 150 #ifdef HAVE_GETCWD
164 if (getcwd (cwd,MAXPATHLEN) == NULL) 151 if (getcwd (cwd,PATH_MAX) == NULL)
165 #else 152 #else
166 if (getwd (cwd) == 0) 153 if (getwd (cwd) == 0)
167 #endif /* HAVE_GETCWD */ 154 #endif /* HAVE_GETCWD */
168 { 155 {
169 perror (progname); 156 perror (progname);
192 filename_expand (char *fullpath, char *filename) 179 filename_expand (char *fullpath, char *filename)
193 /* fullpath - returned full pathname */ 180 /* fullpath - returned full pathname */
194 /* filename - filename to expand */ 181 /* filename - filename to expand */
195 { 182 {
196 #ifdef CYGWIN 183 #ifdef CYGWIN
197 char cygwinFilename[MAXPATHLEN+1]; 184 char cygwinFilename[PATH_MAX+1];
198 extern void cygwin_conv_to_posix_path(const char *, char *); 185 extern void cygwin_conv_to_posix_path(const char *, char *);
199 #endif 186 #endif
200 187
201 int len; 188 int len;
202 fullpath[0] = '\0'; 189 fullpath[0] = '\0';
307 294
308 int 295 int
309 main (int argc, char *argv[]) 296 main (int argc, char *argv[])
310 { 297 {
311 int starting_line = 1; /* line to start editing at */ 298 int starting_line = 1; /* line to start editing at */
312 char command[MAXPATHLEN+50]; /* emacs command buffer */ 299 char command[PATH_MAX+50]; /* emacs command buffer */
313 char fullpath[MAXPATHLEN+1]; /* full pathname to file */ 300 char fullpath[PATH_MAX+1]; /* full pathname to file */
314 char *eval_form = NULL; /* form to evaluate with `-eval' */ 301 char *eval_form = NULL; /* form to evaluate with `-eval' */
315 char *eval_function = NULL; /* function to evaluate with `-f' */ 302 char *eval_function = NULL; /* function to evaluate with `-f' */
316 char *load_library = NULL; /* library to load */ 303 char *load_library = NULL; /* library to load */
317 int quick = 0; /* quick edit, don't wait for user to 304 int quick = 0; /* quick edit, don't wait for user to
318 finish */ 305 finish */
327 char *display = NULL; 314 char *display = NULL;
328 #ifdef INTERNET_DOMAIN_SOCKETS 315 #ifdef INTERNET_DOMAIN_SOCKETS
329 char *hostarg = NULL; /* remote hostname */ 316 char *hostarg = NULL; /* remote hostname */
330 char *remotearg; 317 char *remotearg;
331 char thishost[HOSTNAMSZ]; /* this hostname */ 318 char thishost[HOSTNAMSZ]; /* this hostname */
332 char remotepath[MAXPATHLEN+1]; /* remote pathname */ 319 char remotepath[PATH_MAX+1]; /* remote pathname */
333 char *path; 320 char *path;
334 int rflg = 0; /* pathname given on cmdline */ 321 int rflg = 0; /* pathname given on cmdline */
335 char *portarg; 322 char *portarg;
336 unsigned short port = 0; /* port to server */ 323 unsigned short port = 0; /* port to server */
337 #endif /* INTERNET_DOMAIN_SOCKETS */ 324 #endif /* INTERNET_DOMAIN_SOCKETS */
351 if (progname) 338 if (progname)
352 ++progname; 339 ++progname;
353 else 340 else
354 progname = argv[0]; 341 progname = argv[0];
355 342
343 #ifdef WIN32_NATIVE
344 tmpdir = getenv ("TEMP");
345 if (!tmpdir)
346 tmpdir = getenv ("TMP");
347 if (!tmpdir)
348 tmpdir = "c:\\";
349 #else
356 #ifdef USE_TMPDIR 350 #ifdef USE_TMPDIR
357 tmpdir = getenv ("TMPDIR"); 351 tmpdir = getenv ("TMPDIR");
358 #endif 352 #endif
359 if (!tmpdir) 353 if (!tmpdir)
360 tmpdir = "/tmp"; 354 tmpdir = "/tmp";
361 355 #endif /* WIN32_NATIVE */
362 display = getenv ("DISPLAY"); 356 display = getenv ("DISPLAY");
363 if (display) 357 if (display)
364 display = my_strdup (display); 358 display = my_strdup (display);
365 #ifndef HAVE_MS_WINDOWS 359 #ifndef HAVE_MS_WINDOWS
366 else 360 else