diff options
Diffstat (limited to 'usr.sbin/rndcontrol/rndcontrol.c')
-rw-r--r-- | usr.sbin/rndcontrol/rndcontrol.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/usr.sbin/rndcontrol/rndcontrol.c b/usr.sbin/rndcontrol/rndcontrol.c index a03225c..581bb0e 100644 --- a/usr.sbin/rndcontrol/rndcontrol.c +++ b/usr.sbin/rndcontrol/rndcontrol.c @@ -29,22 +29,26 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $Id: rndcontrol.c,v 1.7 1997/03/11 15:56:09 peter Exp $ - * */ +#ifndef lint +static const char rcsid[] = + "$Id$"; +#endif /* not lint */ + +#include <err.h> +#include <stdio.h> #include <stdlib.h> #include <unistd.h> -#include <stdio.h> #include <fcntl.h> #include <sys/ioctl.h> -#include <sys/errno.h> #include <machine/random.h> -void usage(char *myname) +static void +usage() { - fprintf(stderr, "usage: %s [ [-q ] [-s N | -c M]... ]\n", myname); + fprintf(stderr, "usage: rndcontrol [-q] [-s irq_no] [-c irq_no]\n"); + exit(1); } int @@ -57,7 +61,7 @@ main(int argc, char *argv[]) fd = open("/dev/random", O_RDONLY, 0); if (fd == -1) { - perror("/dev/random"); + warn("/dev/random"); return (1); } else { @@ -72,7 +76,7 @@ main(int argc, char *argv[]) printf("%s: setting irq %d\n", argv[0], irq); result = ioctl(fd, MEM_SETIRQ, (char *)&irq); if (result == -1) { - perror(argv[0]); + warn("%s", argv[0]); return (1); } break; @@ -82,23 +86,22 @@ main(int argc, char *argv[]) printf("%s: clearing irq %d\n", argv[0], irq); result = ioctl(fd, MEM_CLEARIRQ, (char *)&irq); if (result == -1) { - perror(argv[0]); + warn("%s", argv[0]); return (1); } break; case '?': default: - usage(argv[0]); - return (1); + usage(); } } if (verbose) { result = ioctl(fd, MEM_RETURNIRQ, (char *)&irq); if (result == -1) { - perror(argv[0]); + warn("%s", argv[0]); return (1); } - printf("%s: Interrupts in use:", argv[0]); + printf("%s: interrupts in use:", argv[0]); for (i = 0; i < 16; i++) if (irq & (1 << i)) printf(" %d", i); @@ -108,7 +111,7 @@ main(int argc, char *argv[]) argv += optind; if (argc) { - fprintf(stderr, "%s: Unknown argument(s):", argv[-optind]); + fprintf(stderr, "%s: unknown argument(s): ", argv[-optind]); for (i = 0; i < argc; i++) fprintf(stderr, " %s", argv[i]); fprintf(stderr, "\n"); |