XEmacs 21.4.9 "Informed Management".
[chise/xemacs-chise.git.1] / lib-src / gnuclient.c
index d4c1630..aaec46a 100644 (file)
@@ -48,6 +48,10 @@ Boston, MA 02111-1307, USA.
  * ../etc/gnuserv.README relative to the directory containing this file)
  */
 
+#ifdef  CYGWIN
+extern void cygwin_conv_to_posix_path(const char *path, char *posix_path);
+#endif
+
 #include "gnuserv.h"
 
 char gnuserv_version[] = "gnuclient version " GNUSERV_VERSION;
@@ -189,35 +193,26 @@ filename_expand (char *fullpath, char *filename)
   /* fullpath - returned full pathname */
   /* filename - filename to expand */
 {
-  int len;
+#ifdef  CYGWIN
+  char cygwinFilename[MAXPATHLEN+1];
+#endif
 
+  int len;
   fullpath[0] = '\0';
 
+#ifdef  CYGWIN
+  /*
+    If we're in cygwin, just convert it and let the unix stuff handle it.
+  */
+  cygwin_conv_to_posix_path(filename, cygwinFilename);
+  filename = cygwinFilename;
+#endif
+
   if (filename[0] && filename[0] == '/')
      {
        /* Absolute (unix-style) pathname.  Do nothing */
        strcat (fullpath, filename);
      }
-#ifdef  CYGWIN
-  else if (filename[0] && filename[0] == '\\' &&
-           filename[1] && filename[1] == '\\')
-    {
-      /* This path includes the server name (something like
-         "\\server\path"), so we assume it's absolute.  Do nothing to
-         it. */
-      strcat (fullpath, filename);
-    }
-  else if (filename[0] &&
-           filename[1] && filename[1] == ':' &&
-           filename[2] && filename[2] == '\\')
-    {
-      /* Absolute pathname with drive letter.  Convert "<drive>:"
-         to "//<drive>/". */
-      strcat (fullpath, "//");
-      strncat (fullpath, filename, 1);
-      strcat (fullpath, &filename[2]);
-    }
-#endif
   else
     {
       /* Assume relative Unix style path.  Get the current directory
@@ -334,11 +329,11 @@ main (int argc, char *argv[])
   char *remotearg;
   char thishost[HOSTNAMSZ];    /* this hostname */
   char remotepath[MAXPATHLEN+1]; /* remote pathname */
-  char *path;
   int rflg = 0;                        /* pathname given on cmdline */
   char *portarg;
   unsigned short port = 0;     /* port to server */
 #endif /* INTERNET_DOMAIN_SOCKETS */
+  char *path;                   /* used indiscriminately */
 #ifdef SYSV_IPC
   struct msgbuf *msgp;         /* message */
 #endif /* SYSV_IPC */
@@ -475,13 +470,14 @@ main (int argc, char *argv[])
               progname);
       exit (1);
     }
+#if defined(INTERNET_DOMAIN_SOCKETS)
   if (suppress_windows_system && hostarg)
     {
       fprintf (stderr, "%s: Remote editing is available only on X\n",
               progname);
       exit (1);
     }
-
+#endif
   *result = '\0';
   if (eval_function || eval_form || load_library)
     {
@@ -573,7 +569,7 @@ main (int argc, char *argv[])
            }
       /* Don't do disconnect_from_server because we have already read
         data, and disconnect doesn't do anything else. */
-#ifndef INTERNET_DOMAIN_SOCKETS
+#ifdef SYSV_IPC
          if (connect_type == (int) CONN_IPC)
            disconnect_from_ipc_server (s, msgp, FALSE);
 #endif /* !SYSV_IPC */
@@ -641,9 +637,17 @@ main (int argc, char *argv[])
        }
       else /* !suppress_windows_system */
        {
-         if (display)
+         if (0)
+           ;
+#ifdef HAVE_X_WINDOWS
+         else if (display)
            sprintf (command, "(gnuserv-edit-files '(x %s) '(",
                     clean_string (display));
+#endif
+#ifdef HAVE_GTK
+         else if (display)
+           strcpy (command, "(gnuserv-edit-files '(gtk nil) '(");
+#endif
 #ifdef HAVE_MS_WINDOWS
          else
            sprintf (command, "(gnuserv-edit-files '(mswindows nil) '(");