diff options
| author | Richard M. Stallman | 1996-09-03 18:36:55 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1996-09-03 18:36:55 +0000 |
| commit | 6469b6d26b6a3abe42953da81726b8575469d205 (patch) | |
| tree | 9921bee2053e605ec6759eac0fccb5fef94e3ee0 /lib-src | |
| parent | 155f9a94081f59310d26c20842d107411b9df5c9 (diff) | |
| download | emacs-6469b6d26b6a3abe42953da81726b8575469d205.tar.gz emacs-6469b6d26b6a3abe42953da81726b8575469d205.zip | |
(etags_getcwd): Use getcwd if available even if MSDOS.
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/etags.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/lib-src/etags.c b/lib-src/etags.c index 35e396c3be7..536ca567f18 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c | |||
| @@ -4332,19 +4332,7 @@ concat (s1, s2, s3) | |||
| 4332 | char * | 4332 | char * |
| 4333 | etags_getcwd () | 4333 | etags_getcwd () |
| 4334 | { | 4334 | { |
| 4335 | #ifdef MSDOS | 4335 | #ifdef HAVE_GETCWD |
| 4336 | char *p, path[MAXPATHLEN + 1]; /* Fixed size is safe on MSDOS. */ | ||
| 4337 | |||
| 4338 | getwd (path); | ||
| 4339 | for (p = path; *p != '\0'; p++) | ||
| 4340 | if (*p == '\\') | ||
| 4341 | *p = '/'; | ||
| 4342 | else | ||
| 4343 | *p = lowcase (*p); | ||
| 4344 | |||
| 4345 | return strdup (path); | ||
| 4346 | #else /* not MSDOS */ | ||
| 4347 | #if HAVE_GETCWD | ||
| 4348 | int bufsize = 200; | 4336 | int bufsize = 200; |
| 4349 | char *path = xnew (bufsize, char); | 4337 | char *path = xnew (bufsize, char); |
| 4350 | 4338 | ||
| @@ -4357,7 +4345,20 @@ etags_getcwd () | |||
| 4357 | } | 4345 | } |
| 4358 | 4346 | ||
| 4359 | return path; | 4347 | return path; |
| 4360 | #else /* not MSDOS and not HAVE_GETCWD */ | 4348 | #else /* not HAVE_GETCWD */ |
| 4349 | #ifdef MSDOS | ||
| 4350 | char *p, path[MAXPATHLEN + 1]; /* Fixed size is safe on MSDOS. */ | ||
| 4351 | |||
| 4352 | getwd (path); | ||
| 4353 | |||
| 4354 | for (p = path; *p != '\0'; p++) | ||
| 4355 | if (*p == '\\') | ||
| 4356 | *p = '/'; | ||
| 4357 | else | ||
| 4358 | *p = lowcase (*p); | ||
| 4359 | |||
| 4360 | return strdup (path); | ||
| 4361 | #else /* not MSDOS */ | ||
| 4361 | struct linebuffer path; | 4362 | struct linebuffer path; |
| 4362 | FILE *pipe; | 4363 | FILE *pipe; |
| 4363 | 4364 | ||
| @@ -4368,8 +4369,8 @@ etags_getcwd () | |||
| 4368 | pclose (pipe); | 4369 | pclose (pipe); |
| 4369 | 4370 | ||
| 4370 | return path.buffer; | 4371 | return path.buffer; |
| 4371 | #endif /* not HAVE_GETCWD */ | ||
| 4372 | #endif /* not MSDOS */ | 4372 | #endif /* not MSDOS */ |
| 4373 | #endif /* not HAVE_GETCWD */ | ||
| 4373 | } | 4374 | } |
| 4374 | 4375 | ||
| 4375 | /* Return a newly allocated string containing the filename | 4376 | /* Return a newly allocated string containing the filename |