Index: sbin/sysctl/sysctl.8
===================================================================
RCS file: /cvs/src/sbin/sysctl/sysctl.8,v
retrieving revision 1.214
diff -u -p -u -p -r1.214 sysctl.8
--- sbin/sysctl/sysctl.8 16 Feb 2018 07:27:07 -0000 1.214
+++ sbin/sysctl/sysctl.8 19 Feb 2018 17:10:19 -0000
@@ -68,6 +68,8 @@ flag; for the table values, the name of
List all the currently available string or integer values.
This is the default, if no parameters are given to
.Nm .
+.It Fl F
+Print temperature fields in Fahrenheit rather than Celsius.
.It Fl n
Suppress printing of the field name, only output the field value.
Useful for setting shell variables.
Index: sbin/sysctl/sysctl.c
===================================================================
RCS file: /cvs/src/sbin/sysctl/sysctl.c,v
retrieving revision 1.230
diff -u -p -u -p -r1.230 sysctl.c
--- sbin/sysctl/sysctl.c 16 Feb 2018 07:27:07 -0000 1.230
+++ sbin/sysctl/sysctl.c 19 Feb 2018 17:10:19 -0000
@@ -158,7 +158,7 @@ struct list secondlevel[] = {
{ 0, 0 }, /* CTL_VFS */
};
-int Aflag, aflag, nflag, qflag;
+int Aflag, aflag, Fflag, nflag, qflag;
/*
* Variables requiring special processing.
@@ -221,7 +221,7 @@ main(int argc, char *argv[])
{
int ch, lvl1;
- while ((ch = getopt(argc, argv, "Aanqw")) != -1) {
+ while ((ch = getopt(argc, argv, "AaFnqw")) != -1) {
switch (ch) {
case 'A':
@@ -232,6 +232,10 @@ main(int argc, char *argv[])
aflag = 1;
break;
+ case 'F':
+ Fflag = 1;
+ break;
+
case 'n':
nflag = 1;
break;
@@ -2561,8 +2565,12 @@ print_sensor(struct sensor *s)
else {
switch (s->type) {
case SENSOR_TEMP:
- printf("%.2f degC",
- (s->value - 273150000) / 1000000.0);
+ if (Fflag)
+ printf("%.2f degF",
+ (s->value * 1.8 - 459670000) / 1000000.0);
+ else
+ printf("%.2f degC",
+ (s->value - 273150000) / 1000000.0);
break;
case SENSOR_FANRPM:
printf("%lld RPM", s->value);