comparison lib-src/gnuclient.c @ 373:6240c7796c7a r21-2b2

Import from CVS: tag r21-2b2
author cvs
date Mon, 13 Aug 2007 11:04:06 +0200
parents cc15677e0335
children a300bb07d72d
comparison
equal deleted inserted replaced
372:49e1ed2d7ed8 373:6240c7796c7a
177 { 177 {
178 int len; 178 int len;
179 179
180 fullpath[0] = '\0'; 180 fullpath[0] = '\0';
181 181
182 if (filename[0] && filename[0] != '/') 182 if (filename[0] && filename[0] == '/')
183 { /* relative filename */ 183 {
184 /* Absolute (unix-style) pathname. Do nothing */
185 strcat (fullpath, filename);
186 }
187 #ifdef __CYGWIN32__
188 else if (filename[0] && filename[0] == '\\' &&
189 filename[1] && filename[1] == '\\')
190 {
191 /* This path includes the server name (something like
192 "\\server\path"), so we assume it's absolute. Do nothing to
193 it. */
194 strcat (fullpath, filename);
195 }
196 else if (filename[0] &&
197 filename[1] && filename[1] == ':' &&
198 filename[2] && filename[2] == '\\')
199 {
200 /* Absolute pathname with drive letter. Convert "<drive>:"
201 to "//<drive>/". */
202 strcat (fullpath, "//");
203 strncat (fullpath, filename, 1);
204 strcat (fullpath, &filename[2]);
205 }
206 #endif
207 else
208 {
209 /* Assume relative Unix style path. Get the current directory
210 and prepend it. FIXME: need to fix the case of DOS paths like
211 "\foo", where we need to get the current drive. */
212
184 strcat (fullpath, get_current_working_directory ()); 213 strcat (fullpath, get_current_working_directory ());
185 len = strlen (fullpath); 214 len = strlen (fullpath);
186 215
187 if (len > 0 && fullpath[len-1] == '/') /* trailing slash already? */ 216 if (len > 0 && fullpath[len-1] == '/') /* trailing slash already? */
188 ; /* yep */ 217 ; /* yep */
189 else 218 else
190 strcat (fullpath, "/"); /* nope, append trailing slash */ 219 strcat (fullpath, "/"); /* nope, append trailing slash */
191 } /* if */ 220 }
192
193 strcat (fullpath,filename);
194
195 } /* filename_expand */ 221 } /* filename_expand */
196 222
197 /* Encase the string in quotes, escape all the backslashes and quotes 223 /* Encase the string in quotes, escape all the backslashes and quotes
198 in string. */ 224 in string. */
199 static char * 225 static char *