diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2014-10-26 12:33:50 +0400 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2014-10-26 12:33:50 +0400 |
commit | 47e6e7c84f008a53061e661f31ae96629bc694ef (patch) | |
tree | 648a07f3b5b9d67ce19b0fd72e8caa1175c98f1a /qa/src/getconfig.c | |
download | pcp-debian.tar.gz |
Debian 3.9.10debian/3.9.10debian
Diffstat (limited to 'qa/src/getconfig.c')
-rw-r--r-- | qa/src/getconfig.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/qa/src/getconfig.c b/qa/src/getconfig.c new file mode 100644 index 0000000..03f959e --- /dev/null +++ b/qa/src/getconfig.c @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2011 Ken McDonell. All Rights Reserved. + */ + +/* + * Check pmConfig() + */ + +#include <pcp/pmapi.h> +#include <pcp/impl.h> + +int +main(int argc, char *argv[]) +{ + int c; + int sts; + int errflag = 0; + char *usage = "[-D debug] configvar ..."; + + __pmSetProgname(argv[0]); + + while ((c = getopt(argc, argv, "D:")) != EOF) { + switch (c) { + + case 'D': /* debug flag */ + sts = __pmParseDebug(optarg); + if (sts < 0) { + fprintf(stderr, "%s: unrecognized debug flag specification (%s)\n", + pmProgname, optarg); + errflag++; + } + else + pmDebug |= sts; + break; + + case '?': + default: + errflag++; + break; + } + } + + if (errflag || optind >= argc) { + fprintf(stderr, "Usage: %s %s\n", pmProgname, usage); + exit(1); + } + + while (optind < argc) { + printf("%s -> ", argv[optind]); + printf("%s\n", pmGetConfig(argv[optind])); + optind++; + } + + exit(0); +} |