summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1a9c26b)
raw | patch | inline | side by side (parent: 1a9c26b)
author | Sebastian Harl <sh@tokkee.org> | |
Sat, 7 Aug 2010 07:16:50 +0000 (09:16 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Sat, 7 Aug 2010 07:16:50 +0000 (09:16 +0200) |
src/collectd-flush.c | patch | blob | history |
diff --git a/src/collectd-flush.c b/src/collectd-flush.c
index 71457e41f6bba448510dfc43e07600dc9280ad92..165c073adc8714c5bd49121d4da5c33537d2c366 100644 (file)
--- a/src/collectd-flush.c
+++ b/src/collectd-flush.c
return 0;
}
-void usage (const char *name) {
- fprintf (stderr, "Usage: %s [options]\n"
+static void exit_usage (const char *name, int status) {
+ fprintf ((status == 0) ? stdout : stderr, "Usage: %s [options]\n"
"\n"
"Valid options are:\n"
" -h, --help Display this help message.\n"
" Examples: uptime/uptime\n"
" somehost/cpu-0/cpu-wait\n"
" -t, --timeout=<timeout> Only flush values older than this timeout.\n", name);
+ exit (status);
}
/*
* Count how many occurences there are of a char in a string.
*/
-int charoccurences (const char *str, char chr) {
+static int charoccurences (const char *str, char chr) {
int count = 0;
while (*str != '\0') {
if (*str == chr) {
timeout = atoi (optarg);
break;
case 'h':
- usage (argv[0]);
- return 0;
+ exit_usage (argv[0], 0);
default:
- usage (argv[0]);
- return 1;
+ exit_usage (argv[0], 1);
}
}
return flush(address, plugin, ident_str, timeout);
}
+
+/* vim: set sw=2 ts=2 tw=78 expandtab : */
+