diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2016-10-10 18:07:04 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2016-10-10 18:07:04 +0000 |
commit | 0e3b648c750af745aaab63bc5e91a3eb92ab9e2d (patch) | |
tree | 13d2a22c9d1bebaa22ecbc6a1a557e8aa6db830c /bin/mv | |
parent | 46f53e2a52aa6bf80e69501c692da4df496d3d31 (diff) |
remove some dead code that's only used in rm
Diffstat (limited to 'bin/mv')
-rw-r--r-- | bin/mv/rm.c | 70 |
1 files changed, 1 insertions, 69 deletions
diff --git a/bin/mv/rm.c b/bin/mv/rm.c index afb60b8d72e..deeb69fb8f3 100644 --- a/bin/mv/rm.c +++ b/bin/mv/rm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rm.c,v 1.7 2015/11/27 17:32:16 tedu Exp $ */ +/* $OpenBSD: rm.c,v 1.8 2016/10/10 18:07:03 tedu Exp $ */ /* $NetBSD: rm.c,v 1.19 1995/09/07 06:48:50 jtc Exp $ */ /*- @@ -52,9 +52,7 @@ extern char *__progname; static int eval, stdin_ok; -static int check(char *, char *, struct stat *); static void checkdot(char **); -static void rm_file(char **); static void rm_tree(char **); static void __dead @@ -160,72 +158,6 @@ rm_tree(char **argv) fts_close(fts); } -static void -rm_file(char **argv) -{ - struct stat sb; - int rval; - char *f; - - /* - * Remove a file. POSIX 1003.2 states that, by default, attempting - * to remove a directory is an error, so must always stat the file. - */ - while ((f = *argv++) != NULL) { - /* Assume if can't stat the file, can't unlink it. */ - if (lstat(f, &sb)) { - if (errno != ENOENT) { - warn("%s", f); - eval = 1; - } - continue; - } - - if (S_ISDIR(sb.st_mode)) { - warnx("%s: is a directory", f); - eval = 1; - continue; - } - if (S_ISDIR(sb.st_mode)) - rval = rmdir(f); - else { - rval = unlink(f); - } - if (rval && (errno != ENOENT)) { - warn("%s", f); - eval = 1; - } - } -} - -static int -check(char *path, char *name, struct stat *sp) -{ - int ch, first; - char modep[15]; - - /* - * If it's not a symbolic link and it's unwritable and we're - * talking to a terminal, ask. Symbolic links are excluded - * because their permissions are meaningless. Check stdin_ok - * first because we may not have stat'ed the file. - */ - if (!stdin_ok || S_ISLNK(sp->st_mode) || !access(name, W_OK) || - errno != EACCES) - return (1); - strmode(sp->st_mode, modep); - (void)fprintf(stderr, "override %s%s%s/%s for %s? ", - modep + 1, modep[9] == ' ' ? "" : " ", - user_from_uid(sp->st_uid, 0), - group_from_gid(sp->st_gid, 0), path); - (void)fflush(stderr); - - first = ch = getchar(); - while (ch != '\n' && ch != EOF) - ch = getchar(); - return (first == 'y' || first == 'Y'); -} - /* * POSIX.2 requires that if "." or ".." are specified as the basename * portion of an operand, a diagnostic message be written to standard |