baddc

integer-precision dc(1)
git clone git://bvnf.space/baddc.git
Log | Files | Refs | README

commit ee7fa68c5e8710fdd97f88ce8b1e653fa7aee97c
parent 292c2f76550c274e32829e9a7f602a51b24d7b77
Author: phoebos <ben@bvnf.space>
Date:   Mon, 10 Oct 2022 18:33:08 +0100

use optind to allow -* files after --

Diffstat:
Mbaddc.c | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/baddc.c b/baddc.c @@ -202,8 +202,11 @@ int main(int argc, char **argv) { fprintf(stderr, "%c\n", ops[i].op); return 1; } + argc -= optind; + argv += optind - 1; + FILE *fp = NULL; - if (argc == 1) { + if (argc == 0) { fp = stdin; } else { fp = fopen(argv[1], "r");