aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32.c
diff options
context:
space:
mode:
authorPaul Eggert2012-11-21 13:06:52 -0800
committerPaul Eggert2012-11-21 13:06:52 -0800
commit9239d970523919dfcf7437f728f4976b3a9467f3 (patch)
treeb9fd9fb6de02ad291a462a8387cb04d3972114e5 /src/w32.c
parent954bba56c62e4e0637a933cf21626a55b873e144 (diff)
downloademacs-9239d970523919dfcf7437f728f4976b3a9467f3.tar.gz
emacs-9239d970523919dfcf7437f728f4976b3a9467f3.zip
Assume POSIX 1003.1-1988 or later for unistd.h.
* admin/CPP-DEFINES (BROKEN_GETWD, HAVE_GETCWD, HAVE_GETWD, HAVE_SIZE_T) (HAVE_UNISTD_H): Remove. * configure.ac: Do not check for getcwd or getwd. * lib-src/emacsclient.c (getcwd): Remove decl. (get_current_dir_name): Assume getcwd exists. * lib-src/etags.c (HAVE_GETCWD): Remove. (getcwd): Remove decl. (NO_LONG_OPTIONS): Remove this. All uses removed. Emacs always has GNU getopt. (etags_getcwd): Assume getcwd exists. * lib-src/movemail.c (F_OK, X_OK, W_OK, R_OK): Remove. * nt/config.nt (HAVE_GETCWD): Remove. * src/alloc.c: Assume unistd.h exists. * src/fileio.c (Fexpand_file_name) [DOS_NT]: Use getcwd, not getwd. * src/sysdep.c (get_current_dir_name): Assume getcwd exists. (getwd) [USG]: Remove; no longer needed. (sys_subshell) [DOS_NT]: Use getcwd, not getwd. * src/w32.c (getcwd): Rename from getwd, and switch to getcwd's API. * src/w32.h (getcwd): Remove decl. Fixes: debbugs:12945
Diffstat (limited to 'src/w32.c')
-rw-r--r--src/w32.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/w32.c b/src/w32.c
index b51022c6001..da778eb8541 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -908,8 +908,18 @@ static char startup_dir[MAXPATHLEN];
908 908
909/* Get the current working directory. */ 909/* Get the current working directory. */
910char * 910char *
911getwd (char *dir) 911getcwd (char *dir, size_t dirsize)
912{ 912{
913 if (!dirsize)
914 {
915 errno = EINVAL;
916 return NULL;
917 }
918 if (dirsize <= strlen (startup_dir))
919 {
920 errno = ERANGE;
921 return NULL;
922 }
913#if 0 923#if 0
914 if (GetCurrentDirectory (MAXPATHLEN, dir) > 0) 924 if (GetCurrentDirectory (MAXPATHLEN, dir) > 0)
915 return dir; 925 return dir;
@@ -1825,7 +1835,7 @@ init_environment (char ** argv)
1825 memcpy (*envp, "COMSPEC=", 8); 1835 memcpy (*envp, "COMSPEC=", 8);
1826 } 1836 }
1827 1837
1828 /* Remember the initial working directory for getwd. */ 1838 /* Remember the initial working directory for getcwd. */
1829 /* FIXME: Do we need to resolve possible symlinks in startup_dir? 1839 /* FIXME: Do we need to resolve possible symlinks in startup_dir?
1830 Does it matter anywhere in Emacs? */ 1840 Does it matter anywhere in Emacs? */
1831 if (!GetCurrentDirectory (MAXPATHLEN, startup_dir)) 1841 if (!GetCurrentDirectory (MAXPATHLEN, startup_dir))