From 64600ae55ded957a22e9df5a8ccef151335aaf10 Mon Sep 17 00:00:00 2001
From: Jon Lund Steffensen <jonlst@gmail.com>
Date: Thu, 12 Oct 2017 12:36:36 -0700
Subject: Fix missing checks and verbose output

Rearrange checks and verbose output in main() to bring back checks
that were accidentally left out when time-based adjustments were
enabled. This includes the output indicating the daytime/night
temperatures and the check that the temperatures are valid.
---
 src/redshift.c | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)

(limited to 'src/redshift.c')

diff --git a/src/redshift.c b/src/redshift.c
index efe21bd..4774b7e 100644
--- a/src/redshift.c
+++ b/src/redshift.c
@@ -1760,15 +1760,28 @@ main(int argc, char *argv[])
 			}
 		}
 
-		if (verbose) {
-			printf(_("Temperatures: %dK at day, %dK at night\n"),
-			       scheme.day.temperature,
-			       scheme.night.temperature);
+		/* Solar elevations */
+		if (scheme.high < scheme.low) {
+			fprintf(stderr,
+				_("High transition elevation cannot be lower than"
+				  " the low transition elevation.\n"));
+			exit(EXIT_FAILURE);
+		}
 
+		if (verbose) {
 			/* TRANSLATORS: Append degree symbols if possible. */
 			printf(_("Solar elevations: day above %.1f, night below %.1f\n"),
 			       scheme.high, scheme.low);
 		}
+	}
+
+	if (mode != PROGRAM_MODE_RESET &&
+	    mode != PROGRAM_MODE_MANUAL) {
+		if (verbose) {
+			printf(_("Temperatures: %dK at day, %dK at night\n"),
+			       scheme.day.temperature,
+			       scheme.night.temperature);
+		}
 
 		/* Color temperature */
 		if (scheme.day.temperature < MIN_TEMP ||
@@ -1780,14 +1793,6 @@ main(int argc, char *argv[])
 				MIN_TEMP, MAX_TEMP);
 			exit(EXIT_FAILURE);
 		}
-
-		/* Solar elevations */
-		if (scheme.high < scheme.low) {
-			fprintf(stderr,
-				_("High transition elevation cannot be lower than"
-				  " the low transition elevation.\n"));
-			exit(EXIT_FAILURE);
-		}
 	}
 
 	if (mode == PROGRAM_MODE_MANUAL) {
-- 
cgit v1.2.3-70-g09d2