home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Distributions / ucb / spencer_2bsd.tar.gz / 2bsd.tar / src / whoami.c < prev    next >
C/C++ Source or Header  |  1980-02-17  |  317b  |  21 lines

  1. /* Copyright (c) 1979 Regents of the University of California */
  2. #include <retrofit.h>
  3. #include <pwd.h>
  4. /*
  5.  * whoami
  6.  */
  7. struct    passwd *getpwuid();
  8.  
  9. main()
  10. {
  11.     register struct passwd *pp;
  12.  
  13.     pp = getpwuid(getuid());
  14.     if (pp == 0) {
  15.         printf("Intruder alert.\n");
  16.         exit(1);
  17.     }
  18.     printf("%s\n", pp->pw_name);
  19.     exit(0);
  20. }
  21.