Implement getlogin(3)

This commit is contained in:
2023-05-26 09:49:31 +02:00
parent b37c4c5eb7
commit 9d0cae9372

View File

@@ -7,8 +7,12 @@
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
char *getlogin(void) {
return getenv("USER");
}
int getlogin_r(char *buf, size_t bufsize) { int getlogin_r(char *buf, size_t bufsize) {
strncpy(buf, getenv("USER"), bufsize); strncpy(buf, getlogin(), bufsize);
return 0; return 0;
} }