X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=logname.c;h=0924b24712628d4e644a472e2ac68ed8d4b497a7;hb=c126f8ffb6143f1455bea63dad21b2832ddb8b3c;hp=bde1752baa0e9a44bf216d2d840fe9baf1a116ad;hpb=9b7d96458175a852f71700922ca2950577b95f27;p=oweals%2Fbusybox.git diff --git a/logname.c b/logname.c index bde1752ba..0924b2471 100644 --- a/logname.c +++ b/logname.c @@ -20,25 +20,22 @@ * */ -#include "internal.h" #include - -static const char logname_usage[] = "logname\n\n" - - "Print the name of the current user.\n"; +#include +#include +#include "busybox.h" extern int logname_main(int argc, char **argv) { - char *user = xmalloc(9); + char user[9]; if (argc > 1) - usage(logname_usage); + show_usage(); my_getpwuid(user, geteuid()); - if (user) { + if (*user) { puts(user); - exit(TRUE); + return EXIT_SUCCESS; } - fprintf(stderr, "no login name\n"); - exit(FALSE); + error_msg_and_die("no login name"); }