repo.or.cz
/
minix.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
forget difference between big and small commands - obsolete with vm.
[minix.git]
/
commands
/
simple
/
whoami.c
blob
99ec440cb1b39c89de27f1a287fc6f382684ba29
1
/* whoami - print the current user name Author: Terrence W. Holm */
2
3
#include <sys/types.h>
4
#include <pwd.h>
5
#include <stdlib.h>
6
#include <unistd.h>
7
#include <stdio.h>
8
9
_PROTOTYPE
(
int
main
, (
void
));
10
11
int
main
()
12
{
13
struct
passwd
*
pw_entry
;
14
15
pw_entry
=
getpwuid
(
geteuid
());
16
if
(
pw_entry
==
NULL
)
exit
(
1
);
17
puts
(
pw_entry
->
pw_name
);
18
return
(
0
);
19
}