comparison lib-src/etags.c @ 11990:1e5d25c997ca

* etags.c (etags_getcwd): Undo the /bin/pwd change. It may raise compatibility problems.
author Francesco Potortì <pot@gnu.org>
date Mon, 29 May 1995 12:40:25 +0000
parents b95403bfc657
children e550e0d13e83
comparison
equal deleted inserted replaced
11989:0deb4505c0f0 11990:1e5d25c997ca
30 #endif 30 #endif
31 * 31 *
32 * Francesco Potorti` (pot@cnuce.cnr.it) is the current maintainer. 32 * Francesco Potorti` (pot@cnuce.cnr.it) is the current maintainer.
33 */ 33 */
34 34
35 char pot_etags_version[] = "@(#) pot revision number is 11.28"; 35 char pot_etags_version[] = "@(#) pot revision number is 11.29";
36 36
37 #define TRUE 1 37 #define TRUE 1
38 #define FALSE 0 38 #define FALSE 0
39 #ifndef DEBUG 39 #ifndef DEBUG
40 # define DEBUG FALSE 40 # define DEBUG FALSE
3659 3659
3660 /* Does the same work as the system V getcwd, but does not need to 3660 /* Does the same work as the system V getcwd, but does not need to
3661 guess buffer size in advance. */ 3661 guess buffer size in advance. */
3662 char * 3662 char *
3663 etags_getcwd () 3663 etags_getcwd ()
3664 {
3665 #ifdef DOS_NT 3664 #ifdef DOS_NT
3665 {
3666 char *p, path[MAXPATHLEN + 1]; /* Fixed size is safe on MSDOS. */ 3666 char *p, path[MAXPATHLEN + 1]; /* Fixed size is safe on MSDOS. */
3667 3667
3668 getwd (path); 3668 getwd (path);
3669 p = path; 3669 p = path;
3670 while (*p) 3670 while (*p)
3672 *p++ = '/'; 3672 *p++ = '/';
3673 else 3673 else
3674 *p++ = tolower (*p); 3674 *p++ = tolower (*p);
3675 3675
3676 return strdup (path); 3676 return strdup (path);
3677 #else /* not DOS_NT */ 3677 }
3678 #if HAVE_GETCWD 3678 #elif HAVE_GETCWD /* not DOS_NT */
3679 {
3679 int bufsize = 200; 3680 int bufsize = 200;
3680 char *path = xnew (bufsize, char); 3681 char *path = xnew (bufsize, char);
3681 3682
3682 while (getcwd (path, bufsize) == NULL) 3683 while (getcwd (path, bufsize) == NULL)
3683 { 3684 {
3686 bufsize *= 2; 3687 bufsize *= 2;
3687 path = xnew (bufsize, char); 3688 path = xnew (bufsize, char);
3688 } 3689 }
3689 3690
3690 return path; 3691 return path;
3692 }
3691 #else /* not DOS_NT and not HAVE_GETCWD */ 3693 #else /* not DOS_NT and not HAVE_GETCWD */
3694 {
3692 struct linebuffer path; 3695 struct linebuffer path;
3693 FILE *pipe; 3696 FILE *pipe;
3694 3697
3695 initbuffer (&path); 3698 initbuffer (&path);
3696 pipe = (FILE *) popen ("/bin/pwd 2>/dev/null", "r"); 3699 pipe = (FILE *) popen ("pwd 2>/dev/null", "r");
3697 if (pipe == NULL || readline_internal (&path, pipe) == 0) 3700 if (pipe == NULL || readline_internal (&path, pipe) == 0)
3698 pfatal ("/bin/pwd"); 3701 pfatal ("pwd");
3699 pclose (pipe); 3702 pclose (pipe);
3700 3703
3701 return path.buffer; 3704 return path.buffer;
3702 #endif /* not HAVE_GETCWD */ 3705 }
3703 #endif /* not DOS_NT */ 3706 #endif /* not DOS_NT and not HAVE_GETCWD */
3704 }
3705 3707
3706 /* Return a newly allocated string containing the filename 3708 /* Return a newly allocated string containing the filename
3707 of FILE relative to the absolute directory DIR (which 3709 of FILE relative to the absolute directory DIR (which
3708 should end with a slash). */ 3710 should end with a slash). */
3709 char * 3711 char *