#include "../command.h" #include static void help(void) { printf("Usage: whoami\n\n"); printf("Print the username associated with the current effective user id\n"); exit(EXIT_SUCCESS); } COMMAND(whoami) { parse_help(argc, argv, help); uid_t usr = getuid(); struct passwd* passwd = getpwuid(usr); if (passwd == NULL) { printf("\x1b[1;91myou do not exist.\n"); } else { printf("%s\n", passwd->pw_name); } return EXIT_SUCCESS; }