*/
#include "busybox.h"
-#include <stdio.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <signal.h>
#define OPT_FOREGROUND 0x01
#define OPT_TIMER 0x02
int watchdog_main(int argc, char **argv)
{
- unsigned long opts;
- unsigned long timer_duration = 30; /* Userspace timer duration, in seconds */
+ unsigned opts;
+ unsigned timer_duration = 30; /* Userspace timer duration, in seconds */
char *t_arg;
- opts = bb_getopt_ulflags(argc, argv, "Ft:", &t_arg);
+ opts = getopt32(argc, argv, "Ft:", &t_arg);
if (opts & OPT_TIMER)
- timer_duration = bb_xgetlarg(t_arg, 10, 0, INT_MAX);
+ timer_duration = xatou(t_arg);
/* We're only interested in the watchdog device .. */
if (optind < argc - 1 || argc == 1)
if (!(opts & OPT_FOREGROUND))
vfork_daemon_rexec(0, 1, argc, argv, "-F");
#else
- bb_xdaemon(0, 1);
+ xdaemon(0, 1);
#endif
signal(SIGHUP, watchdog_shutdown);
signal(SIGINT, watchdog_shutdown);
- fd = bb_xopen(argv[argc - 1], O_WRONLY);
+ fd = xopen(argv[argc - 1], O_WRONLY);
while (1) {
/*