From 8f0d56bfe43787ae3c2908e2e7859ae1a58f04fa Mon Sep 17 00:00:00 2001
From: Joel Grunbaum <joelgrun@gmail.com>
Date: Mon, 23 May 2022 13:48:49 +0000
Subject: [PATCH] fixup formatting

---
 slist.c |    6 +++---
 main.c  |   29 +++++++++++++++--------------
 slist.h |    2 +-
 3 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/main.c b/main.c
index 340187f..780bb36 100644
--- a/main.c
+++ b/main.c
@@ -57,7 +57,7 @@
 			printf(
 				"\t-t <number>\tspecify the number of hostnames to be tested, "
 				"capped at 50 + number manually added\n\t\t\tdefaults to test "
-			    "all "
+				"all "
 				"available\n");
 			printf(
 				"\t-n <number>\tspecify the number of tests to perform on each "
@@ -116,7 +116,7 @@
 	struct dns_list* dns = (struct dns_list*)in;
 	dns->time.tv_sec = 0;
 	dns->time.tv_nsec = 0;
-    dns->errors = 0;
+	dns->errors = 0;
 	for (int i = 0; i < num_tests; i++) {
 		struct hosts_list* curr = hosts;
 		while (curr) {
@@ -127,18 +127,19 @@
 			for (int j = 0; j < 3 && run.tv_sec == -1; j++) {
 				run = resolve(buf, curr->server, dns->server, T_A);
 			}
-			if (run.tv_sec == -1) { // if test has failed 3 times, set time taken
-			                      // to 3s as penalty
-                dns->errors++;
-            } else {
-                dns->time.tv_sec += run.tv_sec;
-                dns->time.tv_nsec += run.tv_nsec;
-                if (dns->time.tv_nsec >=
-                    1000000000) { // nanoseconds have overflowed into seconds
-                    dns->time.tv_sec += 1;
-                    dns->time.tv_nsec -= 1000000000;
-                }
-            }
+			if (run.tv_sec ==
+			    -1) { // if test has failed 3 times, set time taken
+					  // to 3s as penalty
+				dns->errors++;
+			} else {
+				dns->time.tv_sec += run.tv_sec;
+				dns->time.tv_nsec += run.tv_nsec;
+				if (dns->time.tv_nsec >=
+				    1000000000) { // nanoseconds have overflowed into seconds
+					dns->time.tv_sec += 1;
+					dns->time.tv_nsec -= 1000000000;
+				}
+			}
 			tests_done++;
 			curr = curr->next;
 		}
diff --git a/slist.c b/slist.c
index db2e935..5deefc9 100644
--- a/slist.c
+++ b/slist.c
@@ -115,9 +115,9 @@
 
 int comp_times(struct dns_list* a, struct dns_list* b)
 {
-    if (a->errors != b->errors) {
-        return a->errors > b->errors;
-    } else if (a->time.tv_sec == b->time.tv_sec) {
+	if (a->errors != b->errors) {
+		return a->errors > b->errors;
+	} else if (a->time.tv_sec == b->time.tv_sec) {
 		if (a->time.tv_nsec >= b->time.tv_nsec)
 			return 1;
 		else
diff --git a/slist.h b/slist.h
index 0d0c89a..38224d1 100644
--- a/slist.h
+++ b/slist.h
@@ -8,7 +8,7 @@
 struct dns_list {
 	char* server;
 	struct timespec time;
-    int errors;
+	int errors;
 	struct dns_list* next;
 };
 

--
Gitblit v1.10.0