summaryrefslogtreecommitdiffstats
path: root/cgram
diff options
context:
space:
mode:
authorrillig <rillig@NetBSD.org>2021-04-25 20:14:29 +0000
committerCameron Katri <me@cameronkatri.com>2021-04-28 16:38:48 -0400
commitdd31685baaeeabf86d840ca1d26e6ab2d63da2e3 (patch)
tree423fc3da864a304626ecebd5e990723c7b569d32 /cgram
parentb9f9ac402c70812f3d5c026df36818b288af2aab (diff)
downloadbsdgames-darwin-dd31685baaeeabf86d840ca1d26e6ab2d63da2e3.tar.gz
bsdgames-darwin-dd31685baaeeabf86d840ca1d26e6ab2d63da2e3.tar.zst
bsdgames-darwin-dd31685baaeeabf86d840ca1d26e6ab2d63da2e3.zip
cgram: conform to lint's strict bool mode, KNF
Diffstat (limited to 'cgram')
-rw-r--r--cgram/cgram.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/cgram/cgram.c b/cgram/cgram.c
index 1708afb9..77c56a54 100644
--- a/cgram/cgram.c
+++ b/cgram/cgram.c
@@ -1,4 +1,4 @@
-/* $NetBSD: cgram.c,v 1.18 2021/04/22 14:57:36 wiz Exp $ */
+/* $NetBSD: cgram.c,v 1.19 2021/04/25 20:14:29 rillig Exp $ */
/*-
* Copyright (c) 2013, 2021 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.c,v 1.18 2021/04/22 14:57:36 wiz Exp $");
+__RCSID("$NetBSD: cgram.c,v 1.19 2021/04/25 20:14:29 rillig Exp $");
#endif
#include <assert.h>
@@ -216,7 +216,9 @@ char_at_cursor(void)
return lines.v[cursor_y].s[cursor_x];
}
-static void getquote(FILE *f) {
+static void
+getquote(FILE *f)
+{
struct string line;
string_init(&line);
@@ -255,7 +257,7 @@ readfile(const char *name)
getquote(f);
if (fclose(f) != 0)
- exit(1);
+ err(1, "%s", name);
}
@@ -558,7 +560,7 @@ init(const char *filename)
stringarray_init(&lines);
stringarray_init(&sollines);
srandom((unsigned int)time(NULL));
- if (filename) {
+ if (filename != NULL) {
readfile(filename);
} else {
readquote();