A
download whoami.c
Language: C
License: GPL
Copyright: (C) 2000 Edward Betts .
LOC: 17
Project Info
callisto - Unofficial firmware for the Lin...uter.(callisto)
Server: Google
Type: svn
...listo\trunk\router\busybox\
   adjtimex.c
   applets.c
   applets.h
   ar.c
   ash.c
   basename.c
   busybox.c
   busybox.h
   busybox.mkll
   busybox.sh
   busybox.spec
   busyboxold.h
   cat.c
   chgrp.c
   chmod.c
   chmod_chown_chgrp.c
   chown.c
   chroot.c
   chvt.c
   clear.c
   cmdedit.c
   cmdedit.h
   cmp.c
   Config.h
   Config.h.Hurd
   cp.c
   cp_mv.c
   cpio.c
   cut.c
   date.c
   dc.c
   dd.c
   deallocvt.c
   df.c
   dirname.c
   dmesg.c
   dos2unix.c
   dpkg.c
   dpkg_deb.c
   du.c
   dumpkmap.c
   dutmp.c
   echo.c
   env.c
   expr.c
   fbset.c
   fdflush.c
   find.c
   free.c
   freeramdisk.c
   fsck_minix.c
   getopt.c
   grep.c
   gunzip.c
   gzip.c
   halt.c
   head.c
   hostid.c
   hostname.c
   hush.c
   id.c
   ifconfig.c
   init.c
   insmod.c
   install.sh
   interface.c
   kill.c
   klogd.c
   ktab.c
   lash.c
   length.c
   ln.c
   loadacm.c
   loadfont.c
   loadkmap.c
   logger.c
   login.c
   logname.c
   logread.c
   ls.c
   lsmod.c
   makedevs.c
   md5sum.c
   messages.c
   mk_loop_h.sh
   mkdir.c
   mkfifo.c
   mkfs_minix.c
   mknod.c
   mkswap.c
   mktemp.c
   modprobe.c
   more.c
   mount.c
   msh.c
   mt.c
   mtab.c
   mv.c
   nc.c
   nfsmount.c
   nfsmount.h
   nslookup.c
   pidof.c
   ping.c
   pivot_root.c
   poweroff.c
   printf.c
   pristine_setup.sh
   ps.c
   pwd.c
   rdate.c
   readlink.c
   real_loop.h
   reboot.c
   renice.c
   reset.c
   rm.c
   rmdir.c
   rmmod.c
   route.c
   rpm2cpio.c
   rpmunpack.c
   sed.c
   setkeycodes.c
   sh.c
   sleep.c
   sort.c
   stdbool.h
   stty.c
   swaponoff.c
   sync.c
   syslog.c
   syslogd.c
   syslogd.c-0326
   syslogd525.c
   syslogd526.c
   syslogd527.c
   syslogdold.c
   tail.c
   tar.c
   tee.c
   telnet.c
   telnetd.c
   test.c
   tftp.c
   touch.c
   tr.c
   traceroute.c
   true_false.c
   tty.c
   umount.c
   uname.c
   uniq.c
   unix2dos.c
   update.c
   uptime.c
   usage.c
   usage.h
   usleep.c
   utility.c
   uudecode.c
   uuencode.c
   vi.c
   watchdog.c
   wc.c
   wget.c
   which.c
   whoami.c
   xargs.c
   yes.c

/* vi: set sw=4 ts=4: */
/*
 * Mini whoami implementation for busybox
 *
 * Copyright (C) 2000  Edward Betts <edward@debian.org>.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 *
 */

/* getopt not needed */

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "busybox.h"

extern int whoami_main(int argc, char **argv)
{
	char user[9];
	uid_t uid = geteuid();

	if (argc > 1)
		show_usage();

	my_getpwuid(user, uid);
	if (*user) {
		puts(user);
		return EXIT_SUCCESS;
	}
	error_msg_and_die("cannot find username for UID %u", (unsigned) uid);
}

About Koders | Resources | Downloads | Support | Black Duck | Terms of Service | DMCA | Privacy Policy | Contact Us