-/* $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.
#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>
return lines.v[cursor_y].s[cursor_x];
}
-static void getquote(FILE *f) {
+static void
+getquote(FILE *f)
+{
struct string line;
string_init(&line);
getquote(f);
if (fclose(f) != 0)
- exit(1);
+ err(1, "%s", name);
}
stringarray_init(&lines);
stringarray_init(&sollines);
srandom((unsigned int)time(NULL));
- if (filename) {
+ if (filename != NULL) {
readfile(filename);
} else {
readquote();