diff options
author | Jim Meyering <jim@meyering.net> | 2004-11-28 20:49:14 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2004-11-28 20:49:14 +0000 |
commit | 30df68dfe2f069998759238a4ef640858cf89328 (patch) | |
tree | 3d8dffb1299ac6527c44641d2a0c221a72f2cf1a /lib/chdir.h | |
parent | c373cdcf61dca8568c1b163c1ac2ad2325d93453 (diff) | |
download | coreutils-30df68dfe2f069998759238a4ef640858cf89328.tar.xz |
This is a robust version of chdir, in that it can handle directory
names longer than PATH_MAX.
Diffstat (limited to 'lib/chdir.h')
-rw-r--r-- | lib/chdir.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/chdir.h b/lib/chdir.h new file mode 100644 index 000000000..ee7cfba21 --- /dev/null +++ b/lib/chdir.h @@ -0,0 +1,36 @@ +/* provide a chdir function that tries not to fail due to ENAMETOOLONG + Copyright (C) 2004 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +/* Written by Jim Meyering. */ + +/* Include the headers that might declare chdir so that they will not + cause confusion if included after this file. */ + +#include <unistd.h> + +/* If necessary, systematically rename identifiers so that they do not + collide with the system function. Renaming avoids problems with + some compilers and linkers. */ + +#ifdef __CHDIR_PREFIX +# undef chdir +# define __CHDIR_CONCAT(x, y) x ## y +# define __CHDIR_XCONCAT(x, y) __CHDIR_CONCAT (x, y) +# define __CHDIR_ID(y) __CHDIR_XCONCAT (__CHDIR_PREFIX, y) +# define chdir __CHDIR_ID (chdir) +int chdir (char const *dir); +#endif |