Module Name:    src
Committed By:   jruoho
Date:           Thu Aug 26 05:25:57 UTC 2010

Modified Files:
        src/usr.sbin/envstat: envstat.c

Log Message:
Use <paths.h>. Remove trailing white space.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/usr.sbin/envstat/envstat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/envstat/envstat.c
diff -u src/usr.sbin/envstat/envstat.c:1.78 src/usr.sbin/envstat/envstat.c:1.79
--- src/usr.sbin/envstat/envstat.c:1.78	Sun Aug  1 15:39:52 2010
+++ src/usr.sbin/envstat/envstat.c	Thu Aug 26 05:25:57 2010
@@ -1,4 +1,4 @@
-/* $NetBSD: envstat.c,v 1.78 2010/08/01 15:39:52 mlelstv Exp $ */
+/* $NetBSD: envstat.c,v 1.79 2010/08/26 05:25:57 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -27,7 +27,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: envstat.c,v 1.78 2010/08/01 15:39:52 mlelstv Exp $");
+__RCSID("$NetBSD: envstat.c,v 1.79 2010/08/26 05:25:57 jruoho Exp $");
 #endif /* not lint */
 
 #include <stdio.h>
@@ -38,6 +38,7 @@
 #include <fcntl.h>
 #include <err.h>
 #include <errno.h>
+#include <paths.h>
 #include <syslog.h>
 #include <sys/envsys.h>
 #include <sys/types.h>
@@ -46,8 +47,6 @@
 
 #include "envstat.h"
 
-#define _PATH_DEV_SYSMON	"/dev/sysmon"
-
 #define ENVSYS_DFLAG	0x00000001	/* list registered devices */
 #define ENVSYS_FFLAG	0x00000002	/* show temp in farenheit */
 #define ENVSYS_LFLAG	0x00000004	/* list sensors */
@@ -94,7 +93,7 @@
 } *dvprops_t;
 
 /* A simple queue to manage all sensors */
-static SIMPLEQ_HEAD(, envsys_sensor) sensors_list = 
+static SIMPLEQ_HEAD(, envsys_sensor) sensors_list =
     SIMPLEQ_HEAD_INITIALIZER(sensors_list);
 
 /* A simple queue to manage statistics for all sensors */
@@ -156,7 +155,7 @@
 			flags |= ENVSYS_LFLAG;
 			break;
 		case 'r':
-			/* 
+			/*
 			 * This flag is noop.. it's only here for
 			 * compatibility with the old implementation.
 			 */
@@ -208,8 +207,8 @@
 		errx(EXIT_FAILURE, "-d flag cannot be used with -s");
 
 	/* Open the device in ro mode */
-	if ((fd = open(_PATH_DEV_SYSMON, O_RDONLY)) == -1)
-		err(EXIT_FAILURE, "%s", _PATH_DEV_SYSMON);
+	if ((fd = open(_PATH_SYSMON, O_RDONLY)) == -1)
+		err(EXIT_FAILURE, "%s", _PATH_SYSMON);
 
 	/* Print dictionary in raw mode */
 	if (flags & ENVSYS_XFLAG) {
@@ -227,13 +226,13 @@
 		(void)close(fd);
 
 		/* open the fd in rw mode */
-		if ((fd = open(_PATH_DEV_SYSMON, O_RDWR)) == -1)
-			err(EXIT_FAILURE, "%s", _PATH_DEV_SYSMON);
+		if ((fd = open(_PATH_SYSMON, O_RDWR)) == -1)
+			err(EXIT_FAILURE, "%s", _PATH_SYSMON);
 
 		dict = prop_dictionary_create();
 		if (!dict)
 			err(EXIT_FAILURE, "prop_dictionary_create");
-		
+
 		rval = prop_dictionary_set_bool(dict,
 						"envsys-remove-props",
 					        true);
@@ -304,13 +303,13 @@
 	 * Close the read only descriptor and open a new one read write.
 	 */
 	(void)close(fd);
-	if ((fd = open(_PATH_DEV_SYSMON, O_RDWR)) == -1) {
+	if ((fd = open(_PATH_SYSMON, O_RDWR)) == -1) {
 		error = errno;
-		warn("%s", _PATH_DEV_SYSMON);
+		warn("%s", _PATH_SYSMON);
 		return error;
 	}
 
-	/* 
+	/*
 	 * Send our sensor properties dictionary to the kernel then.
 	 */
 	error = prop_dictionary_send_ioctl(udict, fd, ENVSYS_SETDICTIONARY);
@@ -326,7 +325,7 @@
 {
 	sensor_stats_t stats;
 
-	/* 
+	/*
 	 * If we matched a sensor by its description return it, otherwise
 	 * allocate a new one.
 	 */
@@ -418,7 +417,7 @@
 					(void)printf("%d seconds)\n",
 					    (int)edp->refresh_timo);
 			}
-			
+
 			free(edp);
 			edp = NULL;
 		}
@@ -732,14 +731,14 @@
 	if (width)
 		maxlen = width;
 
-	/* 
+	/*
 	 * Print a header at the bottom only once showing different
 	 * members if the statistics flag is set or not.
 	 *
 	 * As bonus if -s is set, only print this header every 10 iterations
 	 * to avoid redundancy... like vmstat(1).
 	 */
-	
+
 	a = "Current";
 	units = "Unit";
 	if (statistics) {

Reply via email to