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. */
|
|
|
|
|
RM_OK = 1,
|
|
|
|
|
RM_USER_DECLINED,
|
|
|
|
|
RM_ERROR
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#define VALID_STATUS(S) \
|
|
|
|
|
((S) == RM_OK || (S) == RM_USER_DECLINED || (S) == RM_ERROR)
|
|
|
|
|
|
|
|
|
|
struct File_spec
|
|
|
|
|
{
|
|
|
|
|
char *filename;
|
|
|
|
|
unsigned int have_filetype_mode:1;
|
|
|
|
|
unsigned int have_full_mode:1;
|
2000-05-20 09:23:41 +00:00
|
|
|
unsigned int have_device:1;
|
1998-01-22 08:14:17 +00:00
|
|
|
mode_t mode;
|
2000-05-20 09:23:41 +00:00
|
|
|
ino_t st_ino;
|
|
|
|
|
dev_t st_dev;
|
1998-01-22 08:14:17 +00:00
|
|
|
};
|
|
|
|
|
|
2002-03-08 16:46:26 +00:00
|
|
|
struct dev_ino
|
|
|
|
|
{
|
|
|
|
|
ino_t st_ino;
|
|
|
|
|
dev_t st_dev;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum RM_status rm PARAMS ((struct File_spec *fs,
|
|
|
|
|
int user_specified_name,
|
|
|
|
|
struct rm_options const *x,
|
|
|
|
|
struct dev_ino const *cwd_dev_ino));
|
1998-01-22 08:14:17 +00:00
|
|
|
void fspec_init_file PARAMS ((struct File_spec *fs, const char *filename));
|
2002-04-25 16:31:41 +00:00
|
|
|
void remove_init PARAMS ((void));
|
1998-01-22 08:14:17 +00:00
|
|
|
void remove_fini PARAMS ((void));
|