2003-01-04 09:53:20 +00:00
|
|
|
#ifndef REMOVE_H
|
|
|
|
|
# define REMOVE_H
|
1998-01-22 08:14:17 +00:00
|
|
|
|
|
|
|
|
struct rm_options
|
|
|
|
|
{
|
2000-10-16 08:10:58 +00:00
|
|
|
/* If nonzero, ignore nonexistent files. */
|
1998-01-22 08:14:17 +00:00
|
|
|
int ignore_missing_files;
|
|
|
|
|
|
|
|
|
|
/* If nonzero, query the user about whether to remove each file. */
|
|
|
|
|
int interactive;
|
|
|
|
|
|
|
|
|
|
/* If nonzero, recursively remove directories. */
|
|
|
|
|
int recursive;
|
|
|
|
|
|
|
|
|
|
/* If nonzero, stdin is a tty. */
|
|
|
|
|
int stdin_tty;
|
|
|
|
|
|
|
|
|
|
/* If nonzero, remove directories with unlink instead of rmdir, and don't
|
|
|
|
|
require a directory to be empty before trying to unlink it.
|
|
|
|
|
Only works for the super-user. */
|
|
|
|
|
int unlink_dirs;
|
|
|
|
|
|
|
|
|
|
/* If nonzero, display the name of each file removed. */
|
|
|
|
|
int verbose;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum RM_status
|
|
|
|
|
{
|
|
|
|
|
/* These must be listed in order of increasing seriousness. */
|
2002-06-02 21:28:41 +00:00
|
|
|
RM_OK = 2,
|
1998-01-22 08:14:17 +00:00
|
|
|
RM_USER_DECLINED,
|
2002-06-02 21:28:41 +00:00
|
|
|
RM_ERROR,
|
|
|
|
|
RM_NONEMPTY_DIR
|
1998-01-22 08:14:17 +00:00
|
|
|
};
|
|
|
|
|
|
2003-01-04 09:53:20 +00:00
|
|
|
# define VALID_STATUS(S) \
|
1998-01-22 08:14:17 +00:00
|
|
|
((S) == RM_OK || (S) == RM_USER_DECLINED || (S) == RM_ERROR)
|
|
|
|
|
|
2003-01-04 09:53:20 +00:00
|
|
|
# define UPDATE_STATUS(S, New_value) \
|
2002-06-02 21:28:41 +00:00
|
|
|
do \
|
|
|
|
|
{ \
|
|
|
|
|
if ((New_value) == RM_ERROR \
|
|
|
|
|
|| ((New_value) == RM_USER_DECLINED && (S) == RM_OK)) \
|
|
|
|
|
(S) = (New_value); \
|
|
|
|
|
} \
|
|
|
|
|
while (0)
|
1998-01-22 08:14:17 +00:00
|
|
|
|
2003-01-04 10:32:21 +00:00
|
|
|
enum RM_status rm (size_t n_files, char const *const *file,
|
|
|
|
|
struct rm_options const *x);
|
2003-01-04 09:53:20 +00:00
|
|
|
|
|
|
|
|
#endif
|