Skip to content

Commit

Permalink
uname: add an usage text
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Durlej committed Feb 13, 2018
1 parent 7445e3a commit e69c11a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions cmd/acex-bin/uname.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <gitver.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <errno.h>
Expand Down Expand Up @@ -77,11 +78,29 @@ static void procopt(int argc, char **argv)
}
}

static void usage(void)
{
printf("\nUsage: uname [-1adilqCD] [FILE...]\n"
"Print system information.\n\n"
" -a equivalent to -snrvm flags\n"
" -s print the operating system name\n"
" -n print the hostname\n"
" -r print the operating system version\n"
" -v print the operating system build date\n"
" -m print the processor type\n"
" -g print the source code version\n\n"
);
exit(0);
}

int main(int argc, char **argv)
{
struct utsname u;
char *s = "";

if (argc == 2 && !strcmp(argv[1], "--help"))
usage();

if (uname(&u))
err(errno, "utsname");
if (argc < 2)
Expand Down

0 comments on commit e69c11a

Please sign in to comment.