From 2eea5cdf5a928f9636d975e6f4c4097200549f64 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Tue, 30 Jan 2018 00:48:16 +0100 Subject: [PATCH] Use PROGNAME for mv(1) as well --- src/mv.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/mv.c b/src/mv.c index 8bfec30..93cf4b7 100644 --- a/src/mv.c +++ b/src/mv.c @@ -27,6 +27,11 @@ #include #include +/* constants */ +#ifndef PROGNAME +# define PROGNAME "mv" +#endif + /* types */ typedef int Prefs; @@ -65,7 +70,7 @@ static int _mv(Prefs * prefs, int filec, char * filev[]) static int _mv_error(char const * message, int ret) { - fputs("mv: ", stderr); + fputs(PROGNAME ": ", stderr); perror(message); return ret; } @@ -75,7 +80,7 @@ static int _mv_confirm(char const * dst) int c; int tmp; - fprintf(stderr, "%s%s%s", "mv: ", dst, ": Overwrite? "); + fprintf(stderr, "%s%s%s", PROGNAME ": ", dst, ": Overwrite? "); if((c = fgetc(stdin)) == EOF) return 0; while(c != '\n' && (tmp = fgetc(stdin)) != EOF && tmp != '\n'); @@ -305,8 +310,8 @@ static int _mv_multiple(Prefs * prefs, int filec, char * const filev[]) /* usage */ static int _usage(void) { - fputs("Usage: mv [-fi] source_file target_file\n\ - mv [-fi] source_file... target_file\n\ + fputs("Usage: " PROGNAME " [-fi] source_file target_file\n\ + " PROGNAME " [-fi] source_file... target_file\n\ -f Do not prompt for confirmation if the destination path exists\n\ -i Prompt for confirmation if the destination path exists\n", stderr); return 1;