summaryrefslogtreecommitdiffstats
path: root/sys-utils/wdctl.c
diff options
context:
space:
mode:
authorSami Kerola2012-04-19 21:10:54 +0200
committerKarel Zak2012-05-03 15:00:07 +0200
commit33a0de92e9c441797f00e8b5c0cc3a7c2d3e515c (patch)
tree58dd109741988fc82afb104fa5335295f61aa8c3 /sys-utils/wdctl.c
parentfdisk: fix fdiskdoslabel.c global variables (diff)
downloadkernel-qcow2-util-linux-33a0de92e9c441797f00e8b5c0cc3a7c2d3e515c.tar.gz
kernel-qcow2-util-linux-33a0de92e9c441797f00e8b5c0cc3a7c2d3e515c.tar.xz
kernel-qcow2-util-linux-33a0de92e9c441797f00e8b5c0cc3a7c2d3e515c.zip
wdctl: align with other util-linux commands
* Add watchdog device path to pathnames.h * Check output stream status at exit. * Adjust usage() notation to follow howto file. * Retire numeric return value. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'sys-utils/wdctl.c')
-rw-r--r--sys-utils/wdctl.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sys-utils/wdctl.c b/sys-utils/wdctl.c
index 179aff207..4c6f87442 100644
--- a/sys-utils/wdctl.c
+++ b/sys-utils/wdctl.c
@@ -28,6 +28,8 @@
#include "nls.h"
#include "c.h"
+#include "closestream.h"
+#include "pathnames.h"
static const struct {
uint32_t flag;
@@ -55,7 +57,8 @@ static void usage(int status)
_(" %s [options]\n"), program_invocation_short_name);
fputs(USAGE_OPTIONS, out);
- fputs(_(" -d, --device= device to use (/dev/watchdog)\n"), out);
+ fprintf(out,
+ _(" -d, --device <path> device to use (default is %s)\n"), _PATH_WATCHDOG_DEV);
fputs(USAGE_SEPARATOR, out);
fputs(USAGE_HELP, out);
@@ -94,12 +97,13 @@ int main(int argc, char *argv[])
};
int c, status, sec, fd;
- const char *device = "/dev/watchdog";
+ const char *device = _PATH_WATCHDOG_DEV;
struct watchdog_info ident;
setlocale(LC_MESSAGES, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
+ atexit(close_stdout);
while((c = getopt_long(argc, argv, "hVd:", longopts, NULL)) != -1) {
@@ -176,5 +180,5 @@ int main(int argc, char *argv[])
close(fd);
- return 0;
+ return EXIT_SUCCESS;
}