Package: wmweather
Version: 2.4.5-2
Severity: wishlist
Tags: patch

The system-wide wmweather.conf file lists metric, and since there's no
option to set imperial units, there's no way to bring up wmweather in
imperial units. Here's a patch to add such an option.

-- 
Kie ekzistas vivo, ekzistas espero.
diff -u src~/wmweather.1.in src/wmweather.1.in
--- src~/wmweather.1.in	2014-04-04 13:06:24.498062656 -0700
+++ src/wmweather.1.in	2014-04-04 13:08:10.326596205 -0700
@@ -73,6 +73,12 @@
 speed in kilometers per hour rather than miles per hour. This option can be
 toggled at runtime using a middle click.
 .TP
+.B \-i, \-\-imperial
+Display imperial values: temperatures in degrees Fahrenheit rather than degrees
+Celsius, pressure in inches of Mercury rather than hectoPascal, and wind
+speed in miles per hour rather than kilometers per hour. This option can be
+toggled at runtime using a middle click.
+.TP
 .B \-w, \-\-chill, \-W
 Display wind chill--if available--instead of dew point temperature.
 .TP
diff -u src~/wmweather.c src/wmweather.c
--- src~/wmweather.c	2014-04-04 13:06:24.498062656 -0700
+++ src/wmweather.c	2014-04-04 13:11:16.408034644 -0700
@@ -289,6 +289,8 @@
 			delay *= 60;
 		} else if (strcmp(buffer, "metric")   == 0) {
 			metric = 1;
+		} else if (strcmp(buffer, "imperial")   == 0) {
+			metric = 0;
 		} else if (strcmp(buffer, "hPa")      == 0) {
 			hPa  = 1;
 			mmHg = 0;
@@ -364,6 +366,7 @@
 		{"station",    1, NULL, 's'},
 		{"delay",      1, NULL, 'd'},
 		{"metric",     0, NULL, 'm'},
+		{"imperial",   0, NULL, 'i'},
 		{"hPa",        0, NULL, 'a'},
 		{"kPa",        0, NULL, 'k'},
 		{"mmHg",       0, NULL, 'g'},
@@ -397,7 +400,7 @@
 			mmHg   = 1;
 		}
 	while (1) {
-		if ((i = getopt_long(argc, argv, "s:d:makgbnpwWeut:x:U:chv", long_opts, NULL)) == -1)
+		if ((i = getopt_long(argc, argv, "s:d:miakgbnpwWeut:x:U:chv", long_opts, NULL)) == -1)
 			break;
 		switch (i) {
 		case 's':
@@ -429,6 +432,9 @@
 		case 'm':
 			metric = 1;
 			break;
+		case 'i':
+			metric = 0;
+			break;
 		case 'a':
 			hPa  = 1;
 			mmHg = 0;
@@ -495,6 +501,7 @@
 			printf("  -c, --compat          use version 1 monitor style, default in wmWeather,\n");
 			printf("  -d, --delay=[@]<min>  update delay, use @ for minutes past the hour,\n");
 			printf("  -m, --metric          display metric values: °C, hPa, km/h,\n");
+			printf("  -i, --imperial        display metric values: °F, mmHg, mi/h,\n");
 			printf("  -w, --chill           display wind chill instead of dew point,\n");
 			printf("  -e, --heat            display heat index instead of dew point,\n");
 			printf("  -b, --beaufort        display windspeed in Beaufort,\n");

Reply via email to