17 lines
249 B
C
17 lines
249 B
C
#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;
|
|
}
|