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 \ kill.c \
link.c \ link.c \
ln.c \ ln.c \
logname.c \
ls.c \ ls.c \
md5sum.c \ md5sum.c \
mkdir.c \ mkdir.c \

1
README
View File

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

1
TODO
View File

@ -13,7 +13,6 @@ find
getconf getconf
join join
logger logger
logname
od od
patch patch
pathchk 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;
}