summaryrefslogtreecommitdiff
path: root/bin/mv/mv.c
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2015-11-17 18:34:01 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2015-11-17 18:34:01 +0000
commitab9a5832268cd2342a8d54b541215f474b3a6fa2 (patch)
tree1adf261f333b98a1ad58aa0ac90dedc89ef25e48 /bin/mv/mv.c
parent5bf29a1d179747ee1ef4958d2a4f40fd06488deb (diff)
remove getopt() from the nested cp and rm mains
Diffstat (limited to 'bin/mv/mv.c')
-rw-r--r--bin/mv/mv.c32
1 files changed, 10 insertions, 22 deletions
diff --git a/bin/mv/mv.c b/bin/mv/mv.c
index 4a6ed139d77..b96ab827481 100644
--- a/bin/mv/mv.c
+++ b/bin/mv/mv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mv.c,v 1.42 2015/11/17 17:24:26 tedu Exp $ */
+/* $OpenBSD: mv.c,v 1.43 2015/11/17 18:34:00 tedu Exp $ */
/* $NetBSD: mv.c,v 1.9 1995/03/21 09:06:52 cgd Exp $ */
/*
@@ -347,31 +347,19 @@ err: if (unlink(to))
int
mvcopy(char *from, char *to)
{
- char *argv[6];
-
- argv[0] = "cp";
- argv[1] = "-PRp";
- argv[2] = "--";
- argv[3] = from;
- argv[4] = to;
- argv[5] = NULL;
-
- optind = 1;
- optreset = 1;
- if (cpmain(5, argv)) {
+ char *argv[3];
+
+ argv[0] = from;
+ argv[1] = to;
+ argv[2] = NULL;
+ if (cpmain(2, argv)) {
warn("cp failed");
_exit(1);
}
- argv[0] = "rm";
- argv[1] = "-rf";
- argv[2] = "--";
- argv[3] = from;
- argv[4] = NULL;
-
- optind = 1;
- optreset = 1;
- if (rmmain(4, argv)) {
+ argv[0] = from;
+ argv[1] = NULL;
+ if (rmmain(1, argv)) {
warn("rm failed");
_exit(1);
}