1 /* Remove directory entries.
3 Copyright (C) 1998, 2000, 2002, 2003, 2004, 2005, 2006 Free
4 Software Foundation, Inc.
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)
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.
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. */
27 /* If true, ignore nonexistent files. */
28 bool ignore_missing_files
;
30 /* If true, query the user about whether to remove each file. */
33 /* If true, recursively remove directories. */
36 /* Pointer to the device and inode numbers of `/', when --recursive
37 and preserving `/'. Otherwise NULL. */
38 struct dev_ino
*root_dev_ino
;
40 /* If nonzero, stdin is a tty. */
43 /* If true, display the name of each file removed. */
46 /* If true, treat the failure by the rm function to restore the
47 current working directory as a fatal error. I.e., if this field
48 is true and the rm function cannot restore cwd, it must exit with
49 a nonzero status. Some applications require that the rm function
50 restore cwd (e.g., mv) and some others do not (e.g., rm,
52 bool require_restore_cwd
;
57 /* These must be listed in order of increasing seriousness. */
64 # define VALID_STATUS(S) \
65 ((S) == RM_OK || (S) == RM_USER_DECLINED || (S) == RM_ERROR)
67 # define UPDATE_STATUS(S, New_value) \
70 if ((New_value) == RM_ERROR \
71 || ((New_value) == RM_USER_DECLINED && (S) == RM_OK)) \
76 enum RM_status
rm (size_t n_files
, char const *const *file
,
77 struct rm_options
const *x
);