logo

utils-std

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

cmd/logname: Use puts instead of printf

Diffstat:

Mcmd/logname.c8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/cmd/logname.c b/cmd/logname.c @@ -3,7 +3,7 @@ // SPDX-License-Identifier: MPL-2.0 #define _POSIX_C_SOURCE 200809L -#include <stdio.h> // printf, perror +#include <stdio.h> // fputs, perror #include <stdlib.h> // getenv int @@ -13,13 +13,13 @@ main(void) char *logname = getenv("LOGNAME"); if(logname == NULL) { - fprintf(stderr, "logname: Error $LOGNAME isn't set (didn't login?)\n"); + fputs("logname: Error $LOGNAME isn't set (didn't login?)\n", stderr); return 1; } - if(printf("%s\n", logname) < 0) + if(puts(logname) < 0) { - perror("logname: printf"); + perror("logname: puts"); return 1; }