Refactor uname(1) code and manpage

remove stdlib.h-include which was there for no reason and clear
up the manpage.
This commit is contained in:
FRIGN 2015-02-07 22:15:56 +01:00
parent 018d60c6bf
commit 28b4b25076
3 changed files with 13 additions and 13 deletions

2
README
View File

@ -72,7 +72,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support,
#* tr yes none #* tr yes none
=* true yes none =* true yes none
=* tty yes none =* tty yes none
= uname yes none =* uname yes none
# unexpand yes none # unexpand yes none
= uniq no -f, -s = uniq no -f, -s
= unlink yes none = unlink yes none

16
uname.1
View File

@ -9,12 +9,10 @@
.Op Fl amnrsv .Op Fl amnrsv
.Sh DESCRIPTION .Sh DESCRIPTION
.Nm .Nm
prints system information. If no flags are given, writes system information to stdout. If no flags are given,
.Nm .Nm
will print only the implies
name of the operating system as .Fl s .
.Fl s
would.
.Sh OPTIONS .Sh OPTIONS
.Bl -tag -width Ds .Bl -tag -width Ds
.It Fl a .It Fl a
@ -22,7 +20,7 @@ Print all the information below.
.It Fl m .It Fl m
Print the machine's architecture. Print the machine's architecture.
.It Fl n .It Fl n
Print the system's network name. Print the system's network node hostname.
.It Fl r .It Fl r
Print the operating system's release name. Print the operating system's release name.
.It Fl s .It Fl s
@ -32,3 +30,9 @@ Print the operating system's version name.
.El .El
.Sh SEE ALSO .Sh SEE ALSO
.Xr uname 2 .Xr uname 2
.Sh STANDARDS
The
.Nm
utility is compliant with the
.St -p1003.1-2008
specification.

View File

@ -1,6 +1,5 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <sys/utsname.h> #include <sys/utsname.h>
#include <unistd.h> #include <unistd.h>
@ -15,12 +14,8 @@ usage(void)
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
int mflag = 0;
int nflag = 0;
int rflag = 0;
int sflag = 0;
int vflag = 0;
struct utsname u; struct utsname u;
int mflag = 0, nflag = 0, rflag = 0, sflag = 0, vflag = 0;
ARGBEGIN { ARGBEGIN {
case 'a': case 'a':
@ -44,6 +39,7 @@ main(int argc, char *argv[])
default: default:
usage(); usage();
} ARGEND; } ARGEND;
if (uname(&u) < 0) if (uname(&u) < 0)
eprintf("uname:"); eprintf("uname:");