search for: recursive_rm

Displaying 1 result from an estimated 1 matches for "recursive_rm".

Did you mean: recursive_
2004 Sep 05
1
[PATCH] simple rm command
...16 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> +#include <dirent.h> + +#include <linux/limits.h> + +static char *progname; +static int f_opt, r_opt; + +static int recursive_rm(const char *path); + +static int unlink_direntry(const char *p) +{ + struct stat sb; + int ret; + + if (lstat(p, &sb) < 0) { + ret = 1; + if (!f_opt) + perror(p); + goto out; + } + + if (S_ISDIR(sb.st_mode) && r_opt) + ret = recursive_rm(p); + else { + if (unlink(p) < 0) {...