sbase/logname.c

30 lines
378 B
C
Raw Normal View History

2014-10-16 17:15:16 -04:00
/* See LICENSE file for copyright and license details. */
#include <stdio.h>
#include <unistd.h>
2014-10-16 17:15:16 -04:00
#include "util.h"
static void
usage(void)
{
eprintf("usage: %s\n", argv0);
}
2014-10-16 17:15:16 -04:00
int
main(int argc, char *argv[])
{
char *login;
argv0 = argv[0], argc--, argv++;
if (argc)
usage();
2014-10-16 17:15:16 -04:00
if ((login = getlogin()))
puts(login);
2014-10-16 17:15:16 -04:00
else
eprintf("no login name\n");
2014-10-16 17:15:16 -04:00
return 0;
}