aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-07-11 22:43:01 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-07-11 22:43:01 +0200
commit0db23b586fb4e9a88586511da862e191965d1522 (patch)
tree27f0721bae7fc6aaed2b79842add12595b4c2f4e
parentde1d7cd15a6792deca7b1d5f2ee1bf84d9751980 (diff)
downloadre-name-0db23b586fb4e9a88586511da862e191965d1522.tar.gz
name.c: Support file names beginning with dash
-rw-r--r--name.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/name.c b/name.c
index e74cd31..bf12277 100644
--- a/name.c
+++ b/name.c
@@ -86,11 +86,11 @@ usage: fprintf(stderr, "usage: %s [-x]\n", name);
* If the -x flag is given, they are executed too.
*/
for(i = 0; i < j; i++){
- escape(froms[i], &tmp); printf("mv '%s'", tmp);
+ escape(froms[i], &tmp); printf("mv -- '%s'", tmp);
escape(tos[i], &tmp); printf(" '%s'\n", tmp);
if(xflag){
if(!fork()){
- execl("/bin/mv", "mv", froms[i], tos[i], NULL);
+ execl("/bin/mv", "mv", "--", froms[i], tos[i], NULL);
err(1, "execl");
}
if(wait(&s), s){