diff options
author | Tyler Murphy <tylerm@tylerm.dev> | 2023-05-06 00:39:44 -0400 |
---|---|---|
committer | Tyler Murphy <tylerm@tylerm.dev> | 2023-05-06 00:39:44 -0400 |
commit | d8f2c10b7108fff6b7e437291093a1cadc15ab9f (patch) | |
tree | 3fc50a19d6fbb9c94a8fe147cd2a6c4ba7f59b8d /src/commands/whoami.c | |
parent | ansii c (diff) | |
download | lazysphere-d8f2c10b7108fff6b7e437291093a1cadc15ab9f.tar.gz lazysphere-d8f2c10b7108fff6b7e437291093a1cadc15ab9f.tar.bz2 lazysphere-d8f2c10b7108fff6b7e437291093a1cadc15ab9f.zip |
refactor
Diffstat (limited to 'src/commands/whoami.c')
-rw-r--r-- | src/commands/whoami.c | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/src/commands/whoami.c b/src/commands/whoami.c deleted file mode 100644 index 7fd7c85..0000000 --- a/src/commands/whoami.c +++ /dev/null @@ -1,27 +0,0 @@ -#include "../command.h" - -#include <pwd.h> - -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) { - - uid_t usr; - struct passwd* passwd; - - parse_help(argc, argv, help); - - usr = getuid(); - passwd = getpwuid(usr); - - if (passwd == NULL) { - printf("\x1b[1;91myou do not exist.\n"); - } else { - printf("%s\n", passwd->pw_name); - } - return EXIT_SUCCESS; -} |