Add logname(1)

This commit is contained in:
Brandon Mulcahy 2014-10-16 17:15:16 -04:00 committed by sin
parent 314885836c
commit 7a73da6864
5 changed files with 30 additions and 1 deletions

View File

@ -59,6 +59,7 @@ SRC = \
kill.c \
link.c \
ln.c \
logname.c \
ls.c \
md5sum.c \
mkdir.c \

1
README
View File

@ -36,6 +36,7 @@ hostname
kill
link
ln
logname
ls
md5sum
mkdir

1
TODO
View File

@ -13,7 +13,6 @@ find
getconf
join
logger
logname
od
patch
pathchk

8
logname.1 Normal file
View File

@ -0,0 +1,8 @@
.TH LOGNAME 1 sbase\-VERSION
.SH NAME
logname \- return the user's login name
.SH SYNOPSIS
.B logname
.SH DESCRIPTION
.B logname
prints the login name of the current user.

20
logname.c Normal file
View File

@ -0,0 +1,20 @@
/* See LICENSE file for copyright and license details. */
#include <stdio.h>
#include <unistd.h>
#include "util.h"
int
main(int argc, char *argv[])
{
char *login;
argv0 = argv[0];
if (argc != 1)
eprintf("usage: %s\n", argv0);
if ((login = getlogin()))
printf("%s\n", login);
else
eprintf("%s: no login name\n", argv0);
return 0;
}