X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fxemacs-chise.git.1;a=blobdiff_plain;f=lib-src%2Fgnuclient.c;h=2b1e5d7561c0aa3856d0b0a499bc799a9fa73af2;hp=6d96b475c5b7a298969fee2981e35dc773fc4d02;hb=3062d425fac0473eb5aa2efc0bb002f6ce0cb028;hpb=a1655b870904de973c366d85ebdc8adde4ef5e1e diff --git a/lib-src/gnuclient.c b/lib-src/gnuclient.c index 6d96b47..2b1e5d7 100644 --- a/lib-src/gnuclient.c +++ b/lib-src/gnuclient.c @@ -27,6 +27,17 @@ Boston, MA 02111-1307, USA. Please mail bugs and suggestions to the XEmacs maintainer. */ +/* #### This file should be a windows-mode, not console-mode program under + Windows. (i.e. its entry point should be WinMain.) gnuattach functionality, + to the extent it's used at all, should be retrieved using a script that + calls the i.exe wrapper program, to obtain stdio handles. + + #### For that matter, both the functionality of gnuclient and gnuserv + should be merged into XEmacs itself using a -remote arg, just like + Netscape and other modern programs. + + --ben */ + /* * This file incorporates new features added by Bob Weiner , * Darrell Kindred and Arup Mukherjee . @@ -37,18 +48,15 @@ Boston, MA 02111-1307, USA. * ../etc/gnuserv.README relative to the directory containing this file) */ -#if 0 -/* Hand-munged RCS header */ -static char rcsid [] = "!Header: gnuclient.c,v 2.2 95/12/12 01:39:21 wing nene !"; -#endif - #include "gnuserv.h" + +char gnuserv_version[] = "gnuclient version " GNUSERV_VERSION; + #include "getopt.h" #include #include #include -#define DONT_ENCAPSULATE #include #ifdef HAVE_STRING_H @@ -95,7 +103,7 @@ tell_emacs_to_resume (int sig) signal(SIGCONT, tell_emacs_to_resume); #endif - connect_type = make_connection (NULL, (u_short) 0, &s); + connect_type = make_connection (NULL, 0, &s); sprintf(buffer,"(gnuserv-eval '(resume-pid-console %d))", (int)getpid()); send_string(s, buffer); @@ -148,11 +156,11 @@ get_current_working_directory (void) { if (cp == NULL) { /* haven't calculated it yet */ -#ifdef BSD - if (getwd (cwd) == 0) -#else /* !BSD */ +#ifdef HAVE_GETCWD if (getcwd (cwd,MAXPATHLEN) == NULL) -#endif /* !BSD */ +#else + if (getwd (cwd) == 0) +#endif /* HAVE_GETCWD */ { perror (progname); fprintf (stderr, "%s: unable to get current working directory\n", @@ -190,7 +198,7 @@ filename_expand (char *fullpath, char *filename) /* Absolute (unix-style) pathname. Do nothing */ strcat (fullpath, filename); } -#ifdef __CYGWIN32__ +#ifdef CYGWIN else if (filename[0] && filename[0] == '\\' && filename[1] && filename[1] == '\\') { @@ -215,7 +223,7 @@ filename_expand (char *fullpath, char *filename) /* Assume relative Unix style path. Get the current directory and prepend it. FIXME: need to fix the case of DOS paths like "\foo", where we need to get the current drive. */ - + strcat (fullpath, get_current_working_directory ()); len = strlen (fullpath); @@ -329,7 +337,7 @@ main (int argc, char *argv[]) char *path; int rflg = 0; /* pathname given on cmdline */ char *portarg; - u_short port = 0; /* port to server */ + unsigned short port = 0; /* port to server */ #endif /* INTERNET_DOMAIN_SOCKETS */ #ifdef SYSV_IPC struct msgbuf *msgp; /* message */ @@ -451,11 +459,11 @@ main (int argc, char *argv[]) { fprintf (stderr, #ifdef INTERNET_DOMAIN_SOCKETS - "usage: %s [-nw] [-display display] [-q] [-v] [-l library]\n" + "Usage: %s [-nw] [-display display] [-q] [-v] [-l library]\n" " [-batch] [-f function] [-eval form]\n" " [-h host] [-p port] [-r remote-path] [[+line] file] ...\n", #else /* !INTERNET_DOMAIN_SOCKETS */ - "usage: %s [-nw] [-q] [-v] [-l library] [-f function] [-eval form] " + "Usage: %s [-nw] [-q] [-v] [-l library] [-f function] [-eval form] " "[[+line] path] ...\n", #endif /* !INTERNET_DOMAIN_SOCKETS */ progname); @@ -480,7 +488,7 @@ main (int argc, char *argv[]) #if defined(INTERNET_DOMAIN_SOCKETS) connect_type = make_connection (hostarg, port, &s); #else - connect_type = make_connection (NULL, (u_short) 0, &s); + connect_type = make_connection (NULL, 0, &s); #endif sprintf (command, "(gnuserv-eval%s '(progn ", quick ? "-quickly" : ""); send_string (s, command); @@ -518,7 +526,7 @@ main (int argc, char *argv[]) #if defined(INTERNET_DOMAIN_SOCKETS) connect_type = make_connection (hostarg, port, &s); #else - connect_type = make_connection (NULL, (u_short) 0, &s); + connect_type = make_connection (NULL, 0, &s); #endif sprintf (command, "(gnuserv-eval%s '(progn ", quick ? "-quickly" : ""); send_string (s, command); @@ -552,7 +560,7 @@ main (int argc, char *argv[]) #if defined(INTERNET_DOMAIN_SOCKETS) connect_type = make_connection (hostarg, port, &s); #else - connect_type = make_connection (NULL, (u_short) 0, &s); + connect_type = make_connection (NULL, 0, &s); #endif send_string (s, "(gnuserv-eval '(emacs-pid))"); send_string (s, EOT_STR); @@ -563,7 +571,7 @@ main (int argc, char *argv[]) progname); exit (1); } - /* Don't do disconnect_from_server becasue we have already read + /* Don't do disconnect_from_server because we have already read data, and disconnect doesn't do anything else. */ #ifndef INTERNET_DOMAIN_SOCKETS if (connect_type == (int) CONN_IPC) @@ -577,7 +585,7 @@ main (int argc, char *argv[]) #if defined(INTERNET_DOMAIN_SOCKETS) connect_type = make_connection (hostarg, port, &s); #else - connect_type = make_connection (NULL, (u_short) 0, &s); + connect_type = make_connection (NULL, 0, &s); #endif #ifdef INTERNET_DOMAIN_SOCKETS @@ -633,9 +641,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) '(");