diff options
author | kdx <kikoodx@paranoici.org> | 2023-01-14 12:40:07 +0100 |
---|---|---|
committer | kdx <kikoodx@paranoici.org> | 2023-01-14 12:40:07 +0100 |
commit | eaca074e5fee695fcf08a9b21687e3f01df107ae (patch) | |
tree | 1e4e6435c31c09096d828cf01a17496e7f868456 | |
parent | ae70101ad3c97507f1ed73decd3572fc72aad55e (diff) | |
download | sloth-eaca074e5fee695fcf08a9b21687e3f01df107ae.tar.gz |
simplify
-rw-r--r-- | getln.c | 3 | ||||
-rw-r--r-- | main.c | 1 | ||||
-rw-r--r-- | sloth.c | 5 |
3 files changed, 2 insertions, 7 deletions
@@ -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) @@ -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); @@ -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]); } |