aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/fm.c17
-rw-r--r--src/fm.h1
2 files changed, 18 insertions, 0 deletions
diff --git a/src/fm.c b/src/fm.c
index 1af1586..06a980c 100644
--- a/src/fm.c
+++ b/src/fm.c
@@ -586,3 +586,20 @@ fm_rename(fm_info *info)
return 0;
}
+/*
+ REATURN VALUE:
+ -1: error
+ -2: cancel
+ */
+int
+fm_rm(const char *path)
+{
+ if (!path) {
+ return -1;
+ }
+
+ if (y_or_n("Delete it?"))
+ return (remove(path) == 0) ? 0 : -1;
+ else
+ return -2;
+}
diff --git a/src/fm.h b/src/fm.h
index 239c6b9..06c065e 100644
--- a/src/fm.h
+++ b/src/fm.h
@@ -70,4 +70,5 @@ void get_permission(mode_t mode, char *str);
int new_dir(fm_info *info);
+int fm_rm(const char *path);
#endif /* SF_FM_H */