summaryrefslogtreecommitdiff
path: root/lib/xgetcwd.c
AgeCommit message (Collapse)Author
2004-11-25David MacKenzie's old code was removed, so givePaul Eggert
credit only to Jim Meyering and adjust the copyright dates. Do not include <limits.h>, <stdio.h>, <sys/types.h>, <stdlib.h>, <unistd.h>, "pathmax.h". Instead, include "xgetcwd.h" (first) and "getcwd.h". (INITIAL_BUFFER_SIZE): Remove. (xgetcwd): Rely on getcwd, since we now depend on a reliable one.
2004-11-17Include <limits.h>, for PATH_MAX.Paul Eggert
(xgetcwd): Set errno correctly when failing. Work around Solaris 9 bug: getcwd sets errno==ERANGE even though the failure is actually due to a PATH_MAX problem.
2004-08-02Update copyright.Paul Eggert
2004-08-02(errno): Remove decl; we now assume C89 or better.Paul Eggert
2003-09-11Include <stdlib.h> unconditionally.Jim Meyering
2003-03-04Improve comment.Jim Meyering
2003-01-10Include xgetcwd.h.Jim Meyering
2001-09-04Revert some of the previous change; intead,Jim Meyering
fix the HAVE_GETCWD_NULL code to behave more like the !HAVE_GETCWD_NULL code used to. Include "xalloc.h". (xgetcwd): Do not return NULL when memory is exhausted; instead, invoke xalloc_die.
2001-09-03Fix the !HAVE_GETCWD_NULL code to behave moreJim Meyering
like the HAVE_GETCWD_NULL code. Include pathmax.h if not HAVE_GETCWD. Do not include xalloc.h. (INITIAL_BUFFER_SIZE): New symbol. Do not use xmalloc / xrealloc, since the caller is responsible for handling errors. Preserve errno around `free' during failure. Do not overrun buffer when using getwd.
2001-09-03(xgetcwd): Use HAVE_GETCWD_NULL, not (defined __GLIBC__ && __GLIBC__ >= 2),Jim Meyering
to decide whether to use getcwd (NULL, 0).
2001-09-01fix typoJim Meyering
2001-08-31(xgetcwd): Reorganize to avoid some duplication.Jim Meyering
Use an initial, malloc'd, buffer of length 128 rather than a statically allocated one of length 1024.
2001-08-31Don't include pathmax.h.Jim Meyering
Include stdlib.h and unistd.h if available. Include xalloc.h. (xmalloc, xstrdup, free): Remove decls. (xgetcwd): Don't assume sizes fit in unsigned. Check for overflow when computing sizes. Simplify reallocation code.
2001-08-12(xgetcwd) [defined __GLIBC__ && __GLIBC__ >= 2]:Jim Meyering
Simply `return getcwd (NULL, 0);'. [! (defined __GLIBC__ && __GLIBC__ >= 2)]: Use 1300 as initial value for length, not PATH_MAX.
2000-06-21(xgetcwd): If the required pathname length is smallerJim Meyering
than 1024, return a memory chunk of least possible size, instead of size PATH_MAX + 2. In the loop, increment the size proportionally. Use free/xmalloc instead of xrealloc to avoid copying for very long paths.
1996-11-04libitizeJim Meyering
1996-10-29.Jim Meyering
1996-07-15indent cpp-directivesJim Meyering
1996-07-15update FSF address in copyrightJim Meyering
1994-04-28Initial revisionJim Meyering