micro-utils/coreutils/logname.c

17 lines
249 B
C
Raw Normal View History

2023-10-24 13:59:42 +03:00
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
int main(void) {
char *p = getlogin();
if (p != NULL) {
puts(p);
return 0;
}
fprintf(stderr, "logname: %s\n", strerror(errno));
return 1;
}