From ed0fac07042c2788ae27970e78d4cbb3c7ff9dae Mon Sep 17 00:00:00 2001 From: charnier Date: Mon, 5 Jan 1998 07:19:15 +0000 Subject: Use err(3). Change Synopsis to SYNOPSIS (needed for macro expansion) and add SEE ALSO. --- usr.sbin/procctl/procctl.c | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) (limited to 'usr.sbin/procctl/procctl.c') diff --git a/usr.sbin/procctl/procctl.c b/usr.sbin/procctl/procctl.c index 679f903..ade673d 100644 --- a/usr.sbin/procctl/procctl.c +++ b/usr.sbin/procctl/procctl.c @@ -30,6 +30,11 @@ * */ +#ifndef lint +static const char rcsid[] = + "$Id$"; +#endif /* not lint */ + /* * procctl -- clear the event mask, and continue, any specified processes. * This is largely an example of how to use the procfs interface; however, @@ -38,26 +43,22 @@ * procfs code, almost certainly; however, this program will still be useful * for some annoying circumstances.) */ -/* - * $Id: procctl.c,v 1.2 1997/12/13 03:13:49 sef Exp $ - */ +#include +#include +#include +#include #include #include #include -#include -#include -#include -#include +#include #include #include +int main(int ac, char **av) { int fd; int i; - unsigned int mask; - char **command; - struct procfs_status pfs; for (i = 1; i < ac; i++) { char buf[32]; @@ -67,18 +68,13 @@ main(int ac, char **av) { if (fd == -1) { if (errno == ENOENT) continue; - fprintf(stderr, "%s: cannot open pid %s: %s\n", - av[0], av[i], strerror(errno)); + warn("cannot open pid %s", av[i]); continue; } - if (ioctl(fd, PIOCBIC, ~0) == -1) { - fprintf(stderr, "%s: cannot clear process %s's event mask: %s\n", - av[0], av[i], strerror(errno)); - } - if (ioctl(fd, PIOCCONT, 0) == -1 && errno != EINVAL) { - fprintf(stderr, "%s: cannot continue process %s: %s\n", - av[0], av[i], strerror(errno)); - } + if (ioctl(fd, PIOCBIC, ~0) == -1) + warn("cannot clear process %s's event mask", av[i]); + if (ioctl(fd, PIOCCONT, 0) == -1 && errno != EINVAL) + warn("cannot continue process %s", av[i]); close(fd); } return 0; -- cgit v1.1