aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src/emacsclient.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 /lib-src/emacsclient.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 'lib-src/emacsclient.c')
-rw-r--r--lib-src/emacsclient.c23
1 files changed, 2 insertions, 21 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 78079b5cf69..021ac6eb247 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -88,10 +88,7 @@ char *w32_getenv (char *);
88 88
89 89
90 90
91char *getenv (const char *), *getwd (char *); 91char *getenv (const char *);
92#ifdef HAVE_GETCWD
93char *(getcwd) (char *, size_t);
94#endif
95 92
96#ifndef VERSION 93#ifndef VERSION
97#define VERSION "unspecified" 94#define VERSION "unspecified"
@@ -223,7 +220,7 @@ get_current_dir_name (void)
223 char *buf; 220 char *buf;
224 const char *pwd; 221 const char *pwd;
225 struct stat dotstat, pwdstat; 222 struct stat dotstat, pwdstat;
226 /* If PWD is accurate, use it instead of calling getwd. PWD is 223 /* If PWD is accurate, use it instead of calling getcwd. PWD is
227 sometimes a nicer name, and using it may avoid a fatal error if a 224 sometimes a nicer name, and using it may avoid a fatal error if a
228 parent directory is searchable but not readable. */ 225 parent directory is searchable but not readable. */
229 if ((pwd = egetenv ("PWD")) != 0 226 if ((pwd = egetenv ("PWD")) != 0
@@ -240,7 +237,6 @@ get_current_dir_name (void)
240 buf = (char *) xmalloc (strlen (pwd) + 1); 237 buf = (char *) xmalloc (strlen (pwd) + 1);
241 strcpy (buf, pwd); 238 strcpy (buf, pwd);
242 } 239 }
243#ifdef HAVE_GETCWD
244 else 240 else
245 { 241 {
246 size_t buf_size = 1024; 242 size_t buf_size = 1024;
@@ -267,20 +263,6 @@ get_current_dir_name (void)
267 } 263 }
268 } 264 }
269 } 265 }
270#else
271 else
272 {
273 /* We need MAXPATHLEN here. */
274 buf = (char *) xmalloc (MAXPATHLEN + 1);
275 if (getwd (buf) == NULL)
276 {
277 int tmp_errno = errno;
278 free (buf);
279 errno = tmp_errno;
280 return NULL;
281 }
282 }
283#endif
284 return buf; 266 return buf;
285} 267}
286#endif 268#endif
@@ -1592,7 +1574,6 @@ main (int argc, char **argv)
1592 cwd = get_current_dir_name (); 1574 cwd = get_current_dir_name ();
1593 if (cwd == 0) 1575 if (cwd == 0)
1594 { 1576 {
1595 /* getwd puts message in STRING if it fails. */
1596 message (TRUE, "%s: %s\n", progname, 1577 message (TRUE, "%s: %s\n", progname,
1597 "Cannot get current working directory"); 1578 "Cannot get current working directory");
1598 fail (); 1579 fail ();