diff 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
line wrap: on
line diff
--- a/lib-src/gnuclient.c	Fri Mar 08 13:33:14 2002 +0000
+++ b/lib-src/gnuclient.c	Wed Mar 13 08:54:06 2002 +0000
@@ -58,21 +58,8 @@
 
 #include "getopt.h"
 
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
 #include <sysfile.h>
 
-#ifdef HAVE_STRING_H
-#include <string.h>
-#endif /* HAVE_STRING_H */
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif /* HAVE_UNISTD_H */
-
-#include <signal.h>
-
 #if !defined(SYSV_IPC) && !defined(UNIX_DOMAIN_SOCKETS) && \
     !defined(INTERNET_DOMAIN_SOCKETS)
 int
@@ -86,7 +73,7 @@
 } /* main */
 #else /* SYSV_IPC || UNIX_DOMAIN_SOCKETS || INTERNET_DOMAIN_SOCKETS */
 
-static char cwd[MAXPATHLEN+2];	/* current working directory when calculated */
+static char cwd[PATH_MAX+2];	/* current working directory when calculated */
 static char *cp = NULL;		/* ptr into valid bit of cwd above */
 
 static pid_t emacs_pid;			/* Process id for emacs process */
@@ -161,7 +148,7 @@
   if (cp == NULL)
     {				/* haven't calculated it yet */
 #ifdef HAVE_GETCWD
-      if (getcwd (cwd,MAXPATHLEN) == NULL)
+      if (getcwd (cwd,PATH_MAX) == NULL)
 #else
       if (getwd (cwd) == 0)
 #endif /* HAVE_GETCWD */
@@ -194,7 +181,7 @@
   /* filename - filename to expand */
 {
 #ifdef  CYGWIN
-  char cygwinFilename[MAXPATHLEN+1];
+  char cygwinFilename[PATH_MAX+1];
   extern void cygwin_conv_to_posix_path(const char *, char *);
 #endif
 
@@ -309,8 +296,8 @@
 main (int argc, char *argv[])
 {
   int starting_line = 1;	/* line to start editing at */
-  char command[MAXPATHLEN+50];	/* emacs command buffer */
-  char fullpath[MAXPATHLEN+1];	/* full pathname to file */
+  char command[PATH_MAX+50];	/* emacs command buffer */
+  char fullpath[PATH_MAX+1];	/* full pathname to file */
   char *eval_form = NULL;	/* form to evaluate with `-eval' */
   char *eval_function = NULL;	/* function to evaluate with `-f' */
   char *load_library = NULL;	/* library to load */
@@ -329,7 +316,7 @@
   char *hostarg = NULL;		/* remote hostname */
   char *remotearg;
   char thishost[HOSTNAMSZ];	/* this hostname */
-  char remotepath[MAXPATHLEN+1]; /* remote pathname */
+  char remotepath[PATH_MAX+1]; /* remote pathname */
   char *path;
   int rflg = 0;			/* pathname given on cmdline */
   char *portarg;
@@ -353,12 +340,19 @@
   else
     progname = argv[0];
 
+#ifdef WIN32_NATIVE
+  tmpdir = getenv ("TEMP");
+  if (!tmpdir)
+    tmpdir = getenv ("TMP");
+  if (!tmpdir)
+    tmpdir = "c:\\";
+#else
 #ifdef USE_TMPDIR
   tmpdir = getenv ("TMPDIR");
 #endif
   if (!tmpdir)
     tmpdir = "/tmp";
-
+#endif /* WIN32_NATIVE */
   display = getenv ("DISPLAY");
   if (display)
     display = my_strdup (display);