.
[coreutils.git] / src / remove.h
blobe4b7aad7e318172b15551c8a3b532b3a33038b38
1 #ifndef REMOVE_H
2 # define REMOVE_H
4 # include "dev-ino.h"
6 struct rm_options
8 /* If nonzero, ignore nonexistent files. */
9 int ignore_missing_files;
11 /* If nonzero, query the user about whether to remove each file. */
12 int interactive;
14 /* If nonzero, recursively remove directories. */
15 int recursive;
17 /* Pointer to the device and inode numbers of `/', when --recursive.
18 Otherwise NULL. */
19 struct dev_ino *root_dev_ino;
21 /* If nonzero, stdin is a tty. */
22 int stdin_tty;
24 /* If nonzero, remove directories with unlink instead of rmdir, and don't
25 require a directory to be empty before trying to unlink it.
26 Only works for the super-user. */
27 int unlink_dirs;
29 /* If nonzero, display the name of each file removed. */
30 int verbose;
33 enum RM_status
35 /* These must be listed in order of increasing seriousness. */
36 RM_OK = 2,
37 RM_USER_DECLINED,
38 RM_ERROR,
39 RM_NONEMPTY_DIR
42 # define VALID_STATUS(S) \
43 ((S) == RM_OK || (S) == RM_USER_DECLINED || (S) == RM_ERROR)
45 # define UPDATE_STATUS(S, New_value) \
46 do \
47 { \
48 if ((New_value) == RM_ERROR \
49 || ((New_value) == RM_USER_DECLINED && (S) == RM_OK)) \
50 (S) = (New_value); \
51 } \
52 while (0)
54 enum RM_status rm (size_t n_files, char const *const *file,
55 struct rm_options const *x);
57 #endif