comparison lib-src/gnuclient.c @ 464:5aa1854ad537 r21-2-47

Import from CVS: tag r21-2-47
author cvs
date Mon, 13 Aug 2007 11:45:51 +0200
parents 0784d089fdc9
children 7039e6323819
comparison
equal deleted inserted replaced
463:a158004111cd 464:5aa1854ad537
46 * 46 *
47 * (If gnuserv came bundled with your emacs, the README file is probably 47 * (If gnuserv came bundled with your emacs, the README file is probably
48 * ../etc/gnuserv.README relative to the directory containing this file) 48 * ../etc/gnuserv.README relative to the directory containing this file)
49 */ 49 */
50 50
51 #ifdef CYGWIN
52 extern void cygwin_conv_to_posix_path(const char *path, char *posix_path);
53 #endif
54
51 #include "gnuserv.h" 55 #include "gnuserv.h"
52 56
53 char gnuserv_version[] = "gnuclient version " GNUSERV_VERSION; 57 char gnuserv_version[] = "gnuclient version " GNUSERV_VERSION;
54 58
55 #include "getopt.h" 59 #include "getopt.h"
187 static void 191 static void
188 filename_expand (char *fullpath, char *filename) 192 filename_expand (char *fullpath, char *filename)
189 /* fullpath - returned full pathname */ 193 /* fullpath - returned full pathname */
190 /* filename - filename to expand */ 194 /* filename - filename to expand */
191 { 195 {
196 #ifdef CYGWIN
197 char cygwinFilename[MAXPATHLEN+1];
198 #endif
199
192 int len; 200 int len;
193
194 fullpath[0] = '\0'; 201 fullpath[0] = '\0';
202
203 #ifdef CYGWIN
204 /*
205 If we're in cygwin, just convert it and let the unix stuff handle it.
206 */
207 cygwin_conv_to_posix_path(filename, cygwinFilename);
208 filename = cygwinFilename;
209 #endif
195 210
196 if (filename[0] && filename[0] == '/') 211 if (filename[0] && filename[0] == '/')
197 { 212 {
198 /* Absolute (unix-style) pathname. Do nothing */ 213 /* Absolute (unix-style) pathname. Do nothing */
199 strcat (fullpath, filename); 214 strcat (fullpath, filename);
200 } 215 }
201 #ifdef CYGWIN
202 else if (filename[0] && filename[0] == '\\' &&
203 filename[1] && filename[1] == '\\')
204 {
205 /* This path includes the server name (something like
206 "\\server\path"), so we assume it's absolute. Do nothing to
207 it. */
208 strcat (fullpath, filename);
209 }
210 else if (filename[0] &&
211 filename[1] && filename[1] == ':' &&
212 filename[2] && filename[2] == '\\')
213 {
214 /* Absolute pathname with drive letter. Convert "<drive>:"
215 to "//<drive>/". */
216 strcat (fullpath, "//");
217 strncat (fullpath, filename, 1);
218 strcat (fullpath, &filename[2]);
219 }
220 #endif
221 else 216 else
222 { 217 {
223 /* Assume relative Unix style path. Get the current directory 218 /* Assume relative Unix style path. Get the current directory
224 and prepend it. FIXME: need to fix the case of DOS paths like 219 and prepend it. FIXME: need to fix the case of DOS paths like
225 "\foo", where we need to get the current drive. */ 220 "\foo", where we need to get the current drive. */