o style(9) fixes

- Reordered #includes
  - Only include <sys/types.h>, not it and <sys/cdefs.h>
o style.Makefile(5) fixes
  - No SRCS= line when only one src file with same name as program
o Use warn()/errx() instead of fprintf()
  - Integrated patch from Philippe Charnier <charnier@xp11.frmug.org>

Approved by:	jeff (mentor)
This commit is contained in:
Sean Kelly 2003-07-03 03:37:04 +00:00
parent 7af822eb30
commit bc8b08782b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=117185
2 changed files with 11 additions and 17 deletions

View File

@ -1,8 +1,7 @@
# $FreeBSD$
PROG= watchdogd
SRCS= watchdogd.c
MAN= watchdogd.8
WARNS= 6
PROG= watchdogd
MAN= watchdogd.8
WARNS= 6
.include <bsd.prog.mk>

View File

@ -28,24 +28,21 @@
* Software watchdog daemon.
*/
#include <sys/cdefs.h>
#include <sys/types.h>
__FBSDID("$FreeBSD$");
#include <sys/types.h>
#include <sys/errno.h>
#include <sys/sysctl.h>
#include <sys/time.h>
#include <sys/rtprio.h>
#include <sys/stat.h>
#include <sys/sysctl.h>
#include <sys/time.h>
#include <err.h>
#include <paths.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sysexits.h>
#include <unistd.h>
#include <signal.h>
static void parseargs(int, char *[]);
static void sighandler(int);
@ -82,7 +79,7 @@ main(int argc, char *argv[])
err(EX_OSERR, "rtprio");
if (watchdog_init() == -1)
exit(EX_SOFTWARE);
errx(EX_SOFTWARE, "unable to initialize watchdog");
if (watchdog_onoff(1) == -1)
exit(EX_SOFTWARE);
@ -133,8 +130,7 @@ watchdog_init()
error = sysctlnametomib("debug.watchdog.reset", reset_mib,
&reset_miblen);
if (error == -1) {
fprintf(stderr, "Could not find reset OID: %s\n",
strerror(errno));
warn("could not find reset OID");
return (error);
}
return watchdog_tickle();
@ -189,9 +185,8 @@ watchdog_onoff(int onoff)
error = sysctl(mib, len, NULL, NULL, &onoff, sizeof(onoff));
if (error == -1) {
fprintf(stderr, "Could not %s watchdog: %s\n",
(onoff > 0) ? "enable" : "disable",
strerror(errno));
warn("could not %s watchdog",
(onoff > 0) ? "enable" : "disable");
return (error);
}
return (0);