xref: /csrg-svn/old/whoami/whoami.c (revision 21591)
1*21591Sdist /*
2*21591Sdist  * Copyright (c) 1980 Regents of the University of California.
3*21591Sdist  * All rights reserved.  The Berkeley software License Agreement
4*21591Sdist  * specifies the terms and conditions for redistribution.
5*21591Sdist  */
6*21591Sdist 
7*21591Sdist #ifndef lint
8*21591Sdist char copyright[] =
9*21591Sdist "@(#) Copyright (c) 1980 Regents of the University of California.\n\
10*21591Sdist  All rights reserved.\n";
11*21591Sdist #endif not lint
12*21591Sdist 
13*21591Sdist #ifndef lint
14*21591Sdist static char sccsid[] = "@(#)whoami.c	5.1 (Berkeley) 05/31/85";
15*21591Sdist #endif not lint
16*21591Sdist 
171167Sbill #include <pwd.h>
181167Sbill /*
191167Sbill  * whoami
201167Sbill  */
211167Sbill struct	passwd *getpwuid();
221167Sbill 
231167Sbill main()
241167Sbill {
251167Sbill 	register struct passwd *pp;
261167Sbill 
2717422Sralph 	pp = getpwuid(geteuid());
281167Sbill 	if (pp == 0) {
291167Sbill 		printf("Intruder alert.\n");
301167Sbill 		exit(1);
311167Sbill 	}
321167Sbill 	printf("%s\n", pp->pw_name);
331167Sbill 	exit(0);
341167Sbill }
35