Mercurial > hg > octave-kai > gnulib-hg
annotate lib/mkdir-p.h @ 7312:796e1837ac66
* lib/dirchownmod.c: Don't include fcntl.h; no longer needed.
(dirchownmod): New arg FD. All callers changed.
Use FD rather than opening the directory ourself, as opening is
now the caller's responsibility.
* lib/dirchownmod.h: Likewise.
* lib/mkancesdirs.c: Include <sys/types.h>, for portability to older
hosts that require <sys/types.h> before <sys/stat.h>. Include
fcntl.h, savewd.h, and unistd.h, not dirname.h and stat-macros.h.
(test_dir): Remove.
(mkancesdirs): Return length of prefix of FILE that has already
been made, or -2 if there is a child doing the work. Redo
algorithm so that it is O(N) rather than O(N**2). Optimize away
".", and treat ".." specially since it might stray back into
already-created areas. Use a subprocess if necessary. New arg
WD; all users changed. MAKE_DIR function should now return 1
if it creates a directory that is not readable. Return -2 if
a child process is spun off.
* lib/mkancesdirs.h: Include <stddef.h>, for ptrdiff_t.
Adjust signature to match code.
* lib/mkdir-p.c: Include dirname.h, for IS_ABSOLUTE_FILE_NAME.
(make_dir_parents): Use a subprocess if necessary. New arg WD;
all users changed.
* lib/savewd.c, lib/savewd.h: New files.
* m4/savewd.m4: New file.
* modules/mkancesdirs (Depends-on): Add fcntl.
* modules/savewd: New file.
* MODULES.html.sh (File system functions): Add savewd.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Sat, 16 Sep 2006 19:58:25 +0000 |
parents | bbdf9204a185 |
children | 77a75e20049c |
rev | line source |
---|---|
5907 | 1 /* mkdir-p.h -- Ensure that a directory and its parents exist. |
2 | |
7312
796e1837ac66
* lib/dirchownmod.c: Don't include fcntl.h; no longer needed.
Paul Eggert <eggert@cs.ucla.edu>
parents:
6969
diff
changeset
|
3 Copyright (C) 1994, 1995, 1996, 1997, 2000, 2003, 2004, 2005, 2006 |
796e1837ac66
* lib/dirchownmod.c: Don't include fcntl.h; no longer needed.
Paul Eggert <eggert@cs.ucla.edu>
parents:
6969
diff
changeset
|
4 Free Software Foundation, Inc. |
5907 | 5 |
6 This program is free software; you can redistribute it and/or modify | |
7 it under the terms of the GNU General Public License as published by | |
8 the Free Software Foundation; either version 2, or (at your option) | |
9 any later version. | |
10 | |
11 This program is distributed in the hope that it will be useful, | |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 GNU General Public License for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
17 along with this program; if not, write to the Free Software Foundation, | |
18 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ | |
19 | |
6969 | 20 /* Written by Paul Eggert, David MacKenzie, and Jim Meyering. */ |
5907 | 21 |
22 #include <stdbool.h> | |
23 #include <sys/types.h> | |
24 | |
7312
796e1837ac66
* lib/dirchownmod.c: Don't include fcntl.h; no longer needed.
Paul Eggert <eggert@cs.ucla.edu>
parents:
6969
diff
changeset
|
25 struct savewd; |
6969 | 26 bool make_dir_parents (char *dir, |
7312
796e1837ac66
* lib/dirchownmod.c: Don't include fcntl.h; no longer needed.
Paul Eggert <eggert@cs.ucla.edu>
parents:
6969
diff
changeset
|
27 struct savewd *wd, |
6969 | 28 int (*make_ancestor) (char const *, void *), |
29 void *options, | |
5907 | 30 mode_t mode, |
6969 | 31 void (*announce) (char const *, void *), |
32 mode_t mode_bits, | |
5907 | 33 uid_t owner, |
34 gid_t group, | |
6969 | 35 bool preserve_existing); |