summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin/mv/cp.c56
-rw-r--r--bin/mv/mv.c32
-rw-r--r--bin/mv/rm.c33
3 files changed, 19 insertions, 102 deletions
diff --git a/bin/mv/cp.c b/bin/mv/cp.c
index 79e8d593037..d14f9fe05c4 100644
--- a/bin/mv/cp.c
+++ b/bin/mv/cp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cp.c,v 1.1 2015/11/17 17:24:26 tedu Exp $ */
+/* $OpenBSD: cp.c,v 1.2 2015/11/17 18:34:00 tedu Exp $ */
/* $NetBSD: cp.c,v 1.14 1995/09/07 06:14:51 jtc Exp $ */
/*
@@ -113,57 +113,11 @@ cpmain(int argc, char *argv[])
int Hflag, Lflag, Pflag, ch, fts_options, r;
char *target;
- (void)setlocale(LC_ALL, "");
-
Hflag = Lflag = Pflag = Rflag = 0;
- while ((ch = getopt(argc, argv, "HLPRfipr")) != -1)
- switch (ch) {
- case 'H':
- Hflag = 1;
- Lflag = Pflag = 0;
- break;
- case 'L':
- Lflag = 1;
- Hflag = Pflag = 0;
- break;
- case 'P':
- Pflag = 1;
- Hflag = Lflag = 0;
- break;
- case 'R':
- Rflag = 1;
- break;
- case 'f':
- fflag = 1;
- iflag = 0;
- break;
- case 'i':
- iflag = isatty(STDIN_FILENO);
- fflag = 0;
- break;
- case 'p':
- pflag = 1;
- break;
- case 'r':
- rflag = 1;
- break;
- default:
- usage();
- break;
- }
- argc -= optind;
- argv += optind;
-
- /*
- * Unfortunately, -R will use mkfifo & mknod;
- * -p will use fchown, fchmod, lchown, fchflags..
- */
- if (Rflag == 0 && pflag == 0)
- if (pledge("stdio rpath wpath cpath fattr", NULL) == -1)
- err(1, "pledge");
- if (argc < 2)
- usage();
+ Rflag = 1;
+ Pflag = 1;
+ pflag = 1;
fts_options = FTS_NOCHDIR | FTS_PHYSICAL;
if (rflag) {
@@ -479,7 +433,7 @@ copy(char *argv[], enum op type, int fts_options)
}
-/* $OpenBSD: cp.c,v 1.1 2015/11/17 17:24:26 tedu Exp $ */
+/* $OpenBSD: cp.c,v 1.2 2015/11/17 18:34:00 tedu Exp $ */
/* $NetBSD: utils.c,v 1.6 1997/02/26 14:40:51 cgd Exp $ */
/*-
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);
}
diff --git a/bin/mv/rm.c b/bin/mv/rm.c
index 92a90bc093a..eac120f4519 100644
--- a/bin/mv/rm.c
+++ b/bin/mv/rm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rm.c,v 1.1 2015/11/17 17:24:26 tedu Exp $ */
+/* $OpenBSD: rm.c,v 1.2 2015/11/17 18:34:00 tedu Exp $ */
/* $NetBSD: rm.c,v 1.19 1995/09/07 06:48:50 jtc Exp $ */
/*-
@@ -79,35 +79,10 @@ rmmain(int argc, char *argv[])
{
int ch, rflag;
- setlocale(LC_ALL, "");
-
Pflag = rflag = 0;
- while ((ch = getopt(argc, argv, "dfiPRr")) != -1) {
- switch(ch) {
- case 'd':
- dflag = 1;
- break;
- case 'f':
- fflag = 1;
- iflag = 0;
- break;
- case 'i':
- fflag = 0;
- iflag = 1;
- break;
- case 'P':
- Pflag = 1;
- break;
- case 'R':
- case 'r': /* Compatibility. */
- rflag = 1;
- break;
- default:
- usage();
- }
- }
- argc -= optind;
- argv += optind;
+
+ fflag = 1;
+ rflag = 1;
if (Pflag) {
if (pledge("stdio rpath wpath cpath", NULL) == -1)