From d6c02e4e0ff5c234b6b59a4e923d9d7c4fe813e3 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Thu, 10 Apr 2014 15:45:37 +0200 Subject: [PATCH] Added sysdb(1) manpage and updated sysdb help output. --- .gitignore | 4 +-- doc/Makefile.am | 19 +++++++----- doc/sysdb.1.txt | 70 ++++++++++++++++++++++++++++++++++++++++++ src/tools/sysdb/main.c | 67 +++++++++++++++++++++------------------- 4 files changed, 119 insertions(+), 41 deletions(-) create mode 100644 doc/sysdb.1.txt diff --git a/.gitignore b/.gitignore index f097f95..9f1fd8f 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,8 @@ libtool ltmain.sh # build output +doc/*.1 +doc/*.5 src/frontend/grammar.c src/frontend/grammar.h src/frontend/scanner.c @@ -44,8 +46,6 @@ src/sysdbd *.la *.lo *.o -sysdbd.1 -sysdbd.conf.5 sysdb.h # unit testing output diff --git a/doc/Makefile.am b/doc/Makefile.am index a89ea25..76d488f 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,29 +1,32 @@ SUFFIXES = .1 .5 .1.txt .5.txt EXTRA_DIST = \ + sysdb.1.txt \ sysdbd.1.txt \ sysdbd.conf.5.txt CLEANFILES = \ + sysdb.1 \ sysdbd.1 \ sysdbd.conf.5 man_MANS = \ + sysdb.1 \ sysdbd.1 \ sysdbd.conf.5 +ADOC_ATTRS = -apackage_version=$(PACKAGE_VERSION) \ + -abuild_date="$$( date --utc '+%F' )" \ + -alocalstatedir=$(localstatedir) + +sysdb.1: sysdb.1.txt ../version + sysdbd.1: sysdbd.1.txt ../version sysdbd.conf.5: sysdbd.conf.5.txt ../version .1.txt.1: - @A2X@ -d manpage -f manpage \ - -apackage_version=$(PACKAGE_VERSION) \ - -abuild_date="$$( date --utc '+%F' )" \ - $< + @A2X@ -d manpage -f manpage $(ADOC_ATTRS) $< .5.txt.5: - @A2X@ -d manpage -f manpage \ - -apackage_version=$(PACKAGE_VERSION) \ - -abuild_date="$$( date --utc '+%F' )" \ - $< + @A2X@ -d manpage -f manpage $(ADOC_ATTRS) $< diff --git a/doc/sysdb.1.txt b/doc/sysdb.1.txt new file mode 100644 index 0000000..f2838eb --- /dev/null +++ b/doc/sysdb.1.txt @@ -0,0 +1,70 @@ +sysdb(1) +======== +Sebastian "tokkee" Harl +version {package_version}, {build_date} +:doctype: manpage + +NAME +---- +sysdb - interactive client for the system management and inventory collection +service + +SYNOPSIS +-------- +*sysdb* ['options'] + +DESCRIPTION +----------- +*sysdb* is a terminal-based, interactive client program for SysDB, a +multi-backend system management and inventory collection daemon. It connects +to a running daemon and then accepts commands from the user, send them to the +server, and display the result. + +OPTIONS +------- +*sysdb* accepts the following command-line options. + +*-H* '':: + The SysDB host to connect to. May be specified as the path to a UNIX + socket opened by the daemon. Defaults to {localstatedir}/run/sysdbd.sock. + +*-U* '':: + The username used to authenticate against the server. Defaults to the + current user. + +*-h*:: + Display a usage and help summary and exit. + +*-V*:: + Display the version number and copyright information. + +EXIT CODES +---------- +*0*:: + Success. + +*1*:: + Failure (syntax or usage error). + +BUGS +---- +None known. + +SEE ALSO +-------- +*sysdbd*(1) + +AUTHOR +------ +sysdbd was written by Sebastian "tokkee" Harl . + +COPYRIGHT +--------- +Copyright (C) 2012-2014 Sebastian "tokkee" Harl + +This is free software under the terms of the BSD license, see the source for +copying conditions. There is NO WARRANTY; not even for MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. + +// vim: set tw=78 sw=4 ts=4 noexpandtab spell spelllang=en_us : + diff --git a/src/tools/sysdb/main.c b/src/tools/sysdb/main.c index 33f96c4..b20e0ca 100644 --- a/src/tools/sysdb/main.c +++ b/src/tools/sysdb/main.c @@ -78,37 +78,6 @@ # define DEFAULT_SOCKET "unix:"LOCALSTATEDIR"/run/sysdbd.sock" #endif -static void -exit_usage(char *name, int status) -{ - printf( -"Usage: %s \n" - -"\nOptions:\n" -" -h display this help and exit\n" -" -V display the version number and copyright\n" - -"\nSysDB client "SDB_CLIENT_VERSION_STRING SDB_CLIENT_VERSION_EXTRA", " -PACKAGE_URL"\n", basename(name)); - exit(status); -} /* exit_usage */ - -static void -exit_version(void) -{ - printf("SysDB version "SDB_CLIENT_VERSION_STRING - SDB_CLIENT_VERSION_EXTRA", built "BUILD_DATE"\n" - "using libsysdbclient version %s%s\n" - "Copyright (C) 2012-2014 "PACKAGE_MAINTAINER"\n" - - "\nThis is free software under the terms of the BSD license, see " - "the source for\ncopying conditions. There is NO WARRANTY; not " - "even for MERCHANTABILITY or\nFITNESS FOR A PARTICULAR " - "PURPOSE.\n", sdb_client_version_string(), - sdb_client_version_extra()); - exit(0); -} /* exit_version */ - static const char * get_current_user(void) { @@ -162,6 +131,42 @@ get_homedir(const char *username) return result->pw_dir; } /* get_homedir */ +static void +exit_usage(char *name, int status) +{ + printf( +"Usage: %s \n" + +"\nOptions:\n" +" -H HOST the host to connect to\n" +" default: "DEFAULT_SOCKET"\n" +" -U USER the username to connect as\n" +" default: %s\n" +"\n" +" -h display this help and exit\n" +" -V display the version number and copyright\n" + +"\nSysDB client "SDB_CLIENT_VERSION_STRING SDB_CLIENT_VERSION_EXTRA", " +PACKAGE_URL"\n", basename(name), get_current_user()); + exit(status); +} /* exit_usage */ + +static void +exit_version(void) +{ + printf("SysDB version "SDB_CLIENT_VERSION_STRING + SDB_CLIENT_VERSION_EXTRA", built "BUILD_DATE"\n" + "using libsysdbclient version %s%s\n" + "Copyright (C) 2012-2014 "PACKAGE_MAINTAINER"\n" + + "\nThis is free software under the terms of the BSD license, see " + "the source for\ncopying conditions. There is NO WARRANTY; not " + "even for MERCHANTABILITY or\nFITNESS FOR A PARTICULAR " + "PURPOSE.\n", sdb_client_version_string(), + sdb_client_version_extra()); + exit(0); +} /* exit_version */ + int main(int argc, char **argv) { -- 2.30.2