commit fbc3d2b11f52754309998077a50a757278671759
parent 2b8ceea120b0fb3679e919420bae4c7cbcb7e654
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Tue, 11 May 2021 02:29:44 +0200
some code simplifications
Diffstat:
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/smu.c b/smu.c
@@ -701,30 +701,27 @@ main(int argc, char *argv[])
char *buffer = NULL;
int s, i;
unsigned long len, bsize;
- FILE *source = stdin;
if (pledge("stdio", NULL) == -1)
eprint("pledge");
for (i = 1; i < argc; i++) {
if (!strcmp("-v", argv[i]))
- eprint("simple markup %s\n",VERSION);
+ eprint("smu v%s\n", VERSION);
else if (!strcmp("-n", argv[i]))
nohtml = 1;
- else if (argv[i][0] != '-' || !strcmp("-h", argv[i]))
- usage(argv);
else
usage(argv);
}
bsize = 2 * BUFSIZ;
buffer = ereallocz(buffer, bsize);
len = 0;
- while ((s = fread(buffer + len, 1, BUFSIZ, source))) {
+ while ((s = fread(buffer + len, 1, BUFSIZ, stdin))) {
len += s;
if (BUFSIZ + len + 1 > bsize) {
bsize += BUFSIZ;
if (!(buffer = realloc(buffer, bsize)))
- eprint("realloc failed.");
+ eprint("realloc");
}
}
buffer[len] = '\0';