source: trunk/minix/commands/simple/whoami.c@ 11

Last change on this file since 11 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 351 bytes
Line 
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
11int 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}
Note: See TracBrowser for help on using the repository browser.