[hackers] [sbase] Refactor uname(1) code and manpage || FRIGN

From: <git_AT_suckless.org>
Date: Tue, 24 Mar 2015 23:53:35 +0100 (CET)

commit 28b4b25076f27643f49e3eed82c125322b859452
Author: FRIGN <dev_AT_frign.de>
Date: Sat Feb 7 22:15:56 2015 +0100

    Refactor uname(1) code and manpage
    
    remove stdlib.h-include which was there for no reason and clear
    up the manpage.

diff --git a/README b/README
index 01dccf7..8400dad 100644
--- a/README
+++ b/README
_AT_@ -72,7 +72,7 @@ The following tools are implemented ('*' == finished, '#' == UTF-8 support,
 #* tr yes none
 =* true yes none
 =* tty yes none
-= uname yes none
+=* uname yes none
 # unexpand yes none
 = uniq no -f, -s
 = unlink yes none
diff --git a/uname.1 b/uname.1
index ec007c2..8a3ace3 100644
--- a/uname.1
+++ b/uname.1
_AT_@ -9,12 +9,10 @@
 .Op Fl amnrsv
 .Sh DESCRIPTION
 .Nm
-prints system information. If no flags are given,
+writes system information to stdout. If no flags are given,
 .Nm
-will print only the
-name of the operating system as
-.Fl s
-would.
+implies
+.Fl s .
 .Sh OPTIONS
 .Bl -tag -width Ds
 .It Fl a
_AT_@ -22,7 +20,7 @@ Print all the information below.
 .It Fl m
 Print the machine's architecture.
 .It Fl n
-Print the system's network name.
+Print the system's network node hostname.
 .It Fl r
 Print the operating system's release name.
 .It Fl s
_AT_@ -32,3 +30,9 @@ Print the operating system's version name.
 .El
 .Sh SEE ALSO
 .Xr uname 2
+.Sh STANDARDS
+The
+.Nm
+utility is compliant with the
+.St -p1003.1-2008
+specification.
diff --git a/uname.c b/uname.c
index 400ba2e..827b075 100644
--- a/uname.c
+++ b/uname.c
_AT_@ -1,6 +1,5 @@
 /* See LICENSE file for copyright and license details. */
 #include <stdio.h>
-#include <stdlib.h>
 #include <sys/utsname.h>
 #include <unistd.h>
 
_AT_@ -15,12 +14,8 @@ usage(void)
 int
 main(int argc, char *argv[])
 {
- int mflag = 0;
- int nflag = 0;
- int rflag = 0;
- int sflag = 0;
- int vflag = 0;
         struct utsname u;
+ int mflag = 0, nflag = 0, rflag = 0, sflag = 0, vflag = 0;
 
         ARGBEGIN {
         case 'a':
_AT_@ -44,6 +39,7 @@ main(int argc, char *argv[])
         default:
                 usage();
         } ARGEND;
+
         if (uname(&u) < 0)
                 eprintf("uname:");
 
Received on Tue Mar 24 2015 - 23:53:35 CET

This archive was generated by hypermail 2.3.0 : Wed Mar 25 2015 - 00:08:03 CET