logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git/
commit: 9d668e252cbab3008acc6eaa04b0ca3aec01d27c
parent a1f0e9ecb24eb123841bc05e45bab3a4d9fac966
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sat, 13 Dec 2025 17:44:27 +0100

cmd/mv: print usage information on usage error

Diffstat:

Mcmd/mv.c6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/cmd/mv.c b/cmd/mv.c @@ -350,8 +350,7 @@ do_renameat(struct named_fd srcdir, case ENOTDIR: if(opt_T) { - fprintf( - stderr, "mv: error: Failed moving '%s' to '%s': %s\n", src, dest, strerror(errno)); + fprintf(stderr, "mv: error: Failed moving '%s' to '%s': %s\n", src, dest, strerror(errno)); return -1; } @@ -519,12 +518,14 @@ main(int argc, char *argv[]) if(destdir.fd != AT_FDCWD) { fprintf(stderr, "mv: error: Cannot pass both -t and -T\n"); + usage(); return 1; } if(argc != 2) { fprintf(stderr, "mv: error: Option -T passed but got %d arguments instead of 2\n", argc); + usage(); return 1; } } @@ -534,6 +535,7 @@ main(int argc, char *argv[]) if(argc <= 1) { fprintf(stderr, "mv: error: Not enough operands, %d given, expect >= 2\n", argc); + usage(); return 1; }