#undef getcwd before including system headers.
[coreutils.git] / src / remove.h
blobbeaac27fdb8e58a6d48ee5c5d4a4094de31a27f1
1 #ifndef REMOVE_H
2 # define REMOVE_H
4 struct rm_options
6 /* If nonzero, ignore nonexistent files. */
7 int ignore_missing_files;
9 /* If nonzero, query the user about whether to remove each file. */
10 int interactive;
12 /* If nonzero, recursively remove directories. */
13 int recursive;
15 /* If nonzero, stdin is a tty. */
16 int stdin_tty;
18 /* If nonzero, remove directories with unlink instead of rmdir, and don't
19 require a directory to be empty before trying to unlink it.
20 Only works for the super-user. */
21 int unlink_dirs;
23 /* If nonzero, display the name of each file removed. */
24 int verbose;
27 enum RM_status
29 /* These must be listed in order of increasing seriousness. */
30 RM_OK = 2,
31 RM_USER_DECLINED,
32 RM_ERROR,
33 RM_NONEMPTY_DIR
36 # define VALID_STATUS(S) \
37 ((S) == RM_OK || (S) == RM_USER_DECLINED || (S) == RM_ERROR)
39 # define UPDATE_STATUS(S, New_value) \
40 do \
41 { \
42 if ((New_value) == RM_ERROR \
43 || ((New_value) == RM_USER_DECLINED && (S) == RM_OK)) \
44 (S) = (New_value); \
45 } \
46 while (0)
48 enum RM_status rm (size_t n_files, char const *const *file,
49 struct rm_options const *x);
51 #endif