From 74b0152d2792ba02515fd178efb4e50f7c8d10ac Mon Sep 17 00:00:00 2001 From: HOLZSCHUCH Nicolas Date: Fri, 22 Mar 2024 18:29:18 +0100 Subject: [PATCH] Editing basename, dirname for ssh-copy-id --- shell_cmds/basename/basename.c | 8 +++++--- shell_cmds/dirname/dirname.c | 9 ++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/shell_cmds/basename/basename.c b/shell_cmds/basename/basename.c index 559a3859..c42ccf9b 100644 --- a/shell_cmds/basename/basename.c +++ b/shell_cmds/basename/basename.c @@ -52,11 +52,13 @@ static char sccsid[] = "@(#)basename.c 8.4 (Berkeley) 5/4/95"; #include #include #include +#include "ios_error.h" +#define usage basename_usage void usage(void); int -main(int argc, char **argv) +basename_main(int argc, char **argv) { char *p, *q, *suffix; size_t suffixlen; @@ -103,7 +105,7 @@ main(int argc, char **argv) strcmp(suffix, q) == 0) *q = '\0'; argv++; - (void)printf("%s\n", p); + (void)fprintf(thread_stdout, "%s\n", p); } exit(0); } @@ -112,7 +114,7 @@ void usage(void) { - (void)fprintf(stderr, + (void)fprintf(thread_stderr, "usage: basename string [suffix]\n" " basename [-a] [-s suffix] string [...]\n"); exit(1); diff --git a/shell_cmds/dirname/dirname.c b/shell_cmds/dirname/dirname.c index 3a303ef5..864aed80 100644 --- a/shell_cmds/dirname/dirname.c +++ b/shell_cmds/dirname/dirname.c @@ -48,11 +48,14 @@ static const char sccsid[] = "@(#)dirname.c 8.4 (Berkeley) 5/4/95"; #include #include #include +#include "ios_error.h" + +#define usage dirname_usage void usage(void); int -main(int argc, char **argv) +dirname_main(int argc, char **argv) { char *p; int ch; @@ -71,7 +74,7 @@ main(int argc, char **argv) if ((p = dirname(*argv)) == NULL) err(1, "%s", *argv); - (void)printf("%s\n", p); + (void)fprintf(thread_stdout,"%s\n", p); exit(0); } @@ -79,6 +82,6 @@ void usage(void) { - (void)fprintf(stderr, "usage: dirname path\n"); + (void)fprintf(thread_stderr, "usage: dirname path\n"); exit(1); }