logo

utils-std

Collection of commonly available Unix tools
commit: d7530e55805db419eb967c4b5ddfbfae354f8be6
parent 484957644ce1e80381233dcac9be3ed7e59c7a01
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sun, 19 May 2024 03:40:49 +0200

cmd/basename: Use puts instead of printf

Diffstat:

Mcmd/basename.c6+++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/cmd/basename.c b/cmd/basename.c @@ -6,7 +6,7 @@ #include <assert.h> // assert() #include <libgen.h> // basename() -#include <stdio.h> // fprintf(), puts(), perror() +#include <stdio.h> // puts(), perror() #include <string.h> // strlen(), strncmp() static char * @@ -41,7 +41,7 @@ main(int argc, char *argv[]) switch(argc) { case 1: - ret = printf(".\n"); + ret = puts("."); break; case 2: ret = puts(basename(argv[1])); @@ -50,7 +50,7 @@ main(int argc, char *argv[]) ret = puts(suffix_basename(argv[1], argv[2])); break; default: - fprintf(stderr, "usage: basename string [suffix]\n"); + fputs("usage: basename string [suffix]\n", stderr); return 1; }