[comp.os.minix] whoami

tholm@uvicctr.UUCP (Terrence W. Holm) (05/05/88)

EFTH Minix report #5  - May 1988 -  whoami(1)


This is an implementation of whoami(1) that we
wrote for Minix. Please consider this a public
domain program.

A "man" page is included.


echo x - whoami.1
gres '^X' '' > whoami.1 << '/'
XNAME
X    whoami(1)		- who is the current effective user
X
XSYNOPSIS
X    whoami
X
XDESCRIPTION
X    The current effective user name is written to the
X    standard output stream.
X
XSEE ALSO
X    cuserid(3)
/
echo x - whoami.c
gres '^X' '' > whoami.c << '/'
X/****************************************************************/
X/*								*/
X/*	whoami(1)						*/
X/*								*/
X/*  		The login name of the current effective user	*/
X/*		is written to the standard output stream.	*/
X/*								*/
X/****************************************************************/
X/*   origination        1987-Sep-24              T. Holm	*/
X/****************************************************************/
X
X
X#include <stdio.h>
X#include <pwd.h>
X
X
Xstruct passwd *getpwuid();
X
X
X
Xmain()
X  {
X  struct passwd *pw_entry;
X
X  pw_entry = getpwuid( geteuid() );
X
X  if ( pw_entry == NULL )
X    exit( 1 );
X
X  puts( pw_entry->pw_name );
X
X  exit( 0 );
X  }
/

--------------------------------------------------------------------
               Edwin L. Froese
                  uw-beaver!ubc-vision!mprg!handel!froese

               Terrence W. Holm
                  uw-beaver!uvicctr!sirius!tholm