X-Git-Url: http://git.chise.org/gitweb/?p=chise%2Fxemacs-chise.git.1;a=blobdiff_plain;f=lib-src%2Fgnuclient.c;h=1954be479da4a0ce95888cd8b593b239da5c2827;hp=a89641fd1d36726820e3a3d18af46c482bbc8aa0;hb=01dc57284a79d66c5c2b141a304b52f5f8e76d61;hpb=6883ee56ec887c2c48abe5b06b5e66aa74031910 diff --git a/lib-src/gnuclient.c b/lib-src/gnuclient.c index a89641f..1954be4 100644 --- a/lib-src/gnuclient.c +++ b/lib-src/gnuclient.c @@ -48,6 +48,8 @@ static char rcsid [] = "!Header: gnuclient.c,v 2.2 95/12/12 01:39:21 wing nene ! #include #include #include +#define DONT_ENCAPSULATE +#include #ifdef HAVE_STRING_H #include @@ -89,7 +91,9 @@ tell_emacs_to_resume (int sig) /* Why is SYSV so retarded? */ /* We want emacs to realize that we are resuming */ +#ifdef SIGCONT signal(SIGCONT, tell_emacs_to_resume); +#endif connect_type = make_connection (NULL, (u_short) 0, &s); @@ -129,8 +133,10 @@ initialize_signals () signal (SIGWINCH, pass_signal_to_emacs); #endif +#ifdef SIGCONT /* We want emacs to realize that we are resuming */ signal (SIGCONT, tell_emacs_to_resume); +#endif } @@ -179,8 +185,37 @@ filename_expand (char *fullpath, char *filename) fullpath[0] = '\0'; - if (filename[0] && filename[0] != '/') - { /* relative filename */ + if (filename[0] && filename[0] == '/') + { + /* Absolute (unix-style) pathname. Do nothing */ + strcat (fullpath, filename); + } +#ifdef __CYGWIN32__ + 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 ":" + to "///". */ + strcat (fullpath, "//"); + strncat (fullpath, filename, 1); + strcat (fullpath, &filename[2]); + } +#endif + else + { + /* 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); @@ -188,10 +223,9 @@ filename_expand (char *fullpath, char *filename) ; /* yep */ else strcat (fullpath, "/"); /* nope, append trailing slash */ - } /* if */ - - strcat (fullpath,filename); - + /* Don't forget to add the filename! */ + strcat (fullpath,filename); + } } /* filename_expand */ /* Encase the string in quotes, escape all the backslashes and quotes @@ -257,14 +291,14 @@ clean_string (CONST char *s) over = 1; \ } while (0) -/* A strdup immitation. */ +/* A strdup imitation. */ static char * my_strdup (CONST char *s) { - char *new = malloc (strlen (s) + 1); - if (new) - strcpy (new, s); - return new; + char *new_s = (char *) malloc (strlen (s) + 1); + if (new_s) + strcpy (new_s, s); + return new_s; } int @@ -525,7 +559,7 @@ main (int argc, char *argv[]) if (read_line (s, buffer) == 0) { - fprintf (stderr, "%s: Could not establish Emacs procces id\n", + fprintf (stderr, "%s: Could not establish Emacs process id\n", progname); exit (1); } @@ -626,7 +660,7 @@ main (int argc, char *argv[]) } filename_expand (fullpath, argv[i]); #ifdef INTERNET_DOMAIN_SOCKETS - path = malloc (strlen (remotepath) + strlen (fullpath) + 1); + path = (char *) malloc (strlen (remotepath) + strlen (fullpath) + 1); sprintf (path, "%s%s", remotepath, fullpath); #else path = my_strdup (fullpath);