comparison src/buffer.c @ 163:0132846995bd r20-3b8

Import from CVS: tag r20-3b8
author cvs
date Mon, 13 Aug 2007 09:43:35 +0200
parents 2af401a6ecca
children 85ec50267440
comparison
equal deleted inserted replaced
162:4de2936b4e77 163:0132846995bd
2825 2825
2826 buf[0] = 0; 2826 buf[0] = 0;
2827 2827
2828 Fset_buffer (Fget_buffer_create (QSscratch)); 2828 Fset_buffer (Fget_buffer_create (QSscratch));
2829 2829
2830 /* If PWD is accurate, use it instead of calling getwd. This is faster 2830 /* If PWD is accurate, use it instead of calling getcwd. This is faster
2831 when PWD is right, and may avoid a fatal error. */ 2831 when PWD is right, and may avoid a fatal error. */
2832 if ((pwd = getenv ("PWD")) != 0 && IS_DIRECTORY_SEP (*pwd) 2832 if ((pwd = getenv ("PWD")) != 0 && IS_DIRECTORY_SEP (*pwd)
2833 && stat (pwd, &pwdstat) == 0 2833 && stat (pwd, &pwdstat) == 0
2834 && stat (".", &dotstat) == 0 2834 && stat (".", &dotstat) == 0
2835 && dotstat.st_ino == pwdstat.st_ino 2835 && dotstat.st_ino == pwdstat.st_ino
2836 && dotstat.st_dev == pwdstat.st_dev 2836 && dotstat.st_dev == pwdstat.st_dev
2837 && (int) strlen (pwd) < MAXPATHLEN) 2837 && (int) strlen (pwd) < MAXPATHLEN)
2838 strcpy (buf, pwd); 2838 strcpy (buf, pwd);
2839 else if (getwd (buf) == 0) 2839 else if (getcwd (buf, MAXPATHLEN) == NULL)
2840 fatal ("`getwd' failed: errno %d\n", errno); 2840 fatal ("`getcwd' failed: %s\n", strerror (errno));
2841 2841
2842 #ifndef VMS 2842 #ifndef VMS
2843 /* Maybe this should really use some standard subroutine 2843 /* Maybe this should really use some standard subroutine
2844 whose definition is filename syntax dependent. */ 2844 whose definition is filename syntax dependent. */
2845 rc = strlen (buf); 2845 rc = strlen (buf);