summary refs log tree commit diff
path: root/unscoop.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-04-02 16:29:36 -0400
committerJune McEnroe <june@causal.agency>2020-04-02 16:29:36 -0400
commitd156d07f44536bca14c847f7f5313c956a625f96 (patch)
tree805442ac51f29a9e62adf85730b4db9b173da14f /unscoop.c
parentUpdate unscoop catgirl matchers (diff)
downloadlitterbox-d156d07f44536bca14c847f7f5313c956a625f96.tar.gz
litterbox-d156d07f44536bca14c847f7f5313c956a625f96.zip
Update style
Replacing declarations followed by while loops with for loops and
generating the short option string from the long options.
Diffstat (limited to 'unscoop.c')
-rw-r--r--unscoop.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/unscoop.c b/unscoop.c
index afc42b5..6e7b362 100644
--- a/unscoop.c
+++ b/unscoop.c
@@ -305,8 +305,7 @@ int main(int argc, char *argv[]) {
 	const char *context = NULL;
 	const struct Format *format = &Formats[0];
 
-	int opt;
-	while (0 < (opt = getopt(argc, argv, "DN:c:d:f:v"))) {
+	for (int opt; 0 < (opt = getopt(argc, argv, "DN:c:d:f:v"));) {
 		switch (opt) {
 			break; case 'D': dedup = true;
 			break; case 'N': network = optarg;
@@ -391,8 +390,7 @@ int main(int argc, char *argv[]) {
 		}
 		dbRun(insertContext);
 
-		ssize_t len;
-		while (0 < (len = getline(&line, &cap, file))) {
+		for (ssize_t len; 0 < (len = getline(&line, &cap, file));) {
 			matchLine(format, regex, line);
 			sizeRead += len;
 			if (100 * sizeRead / sizeTotal != sizePercent) {