From eaca074e5fee695fcf08a9b21687e3f01df107ae Mon Sep 17 00:00:00 2001 From: kdx Date: Sat, 14 Jan 2023 12:40:07 +0100 Subject: simplify --- getln.c | 3 --- main.c | 1 - sloth.c | 5 ++--- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/getln.c b/getln.c index 1b994e9..74c981b 100644 --- a/getln.c +++ b/getln.c @@ -24,9 +24,6 @@ char *getln(FILE *stream) } memset(buf + size - 1024, 0, 1024); getln_held = NULL; - /* If input is a TTY, display a prompt. */ - if (isatty(fileno(stdin))) - fputs("> ", stdout); /* Read until either end of file or end of line. */ for (;;) { if (fgets(buf + size - 1024, 1023, stream) == NULL) diff --git a/main.c b/main.c index ffb4516..ad9036c 100644 --- a/main.c +++ b/main.c @@ -14,7 +14,6 @@ int main(int argc, char **argv) /* Read stdin line by line until exhaustion. */ char *line = NULL; while ((line = getln(stdin)) != NULL) { - printf("%s", line); err = sloth_push(sloth, line[0]); if (err != NULL) { fprintf(stderr, "%s\n", err); diff --git a/sloth.c b/sloth.c index 7f76017..8314b79 100644 --- a/sloth.c +++ b/sloth.c @@ -40,8 +40,7 @@ SlothError sloth_push(Sloth *ctx, SlothByte v) void sloth_inspect_stack(const Sloth *ctx) { - printf("size: %lu\n", ctx->stack_size); - printf("capacity: %lu\n", ctx->stack_capacity); + printf("<%lu> ", ctx->stack_size); for (size_t i = 0; i < ctx->stack_size; i++) - printf("%08lx: %d\n", i, ctx->stack[i]); + printf("%d ", ctx->stack[i]); } -- cgit v1.2.3