about summary refs log tree commit diff stats
path: root/main.c
diff options
context:
space:
mode:
authorDaniel <steew0x8@protonmail.com>2021-11-07 00:06:58 +0100
committerDaniel <steew0x8@protonmail.com>2021-11-07 00:06:58 +0100
commit65b783d28ec01e8ed4ee8de0ae3180f6850a5a5b (patch)
tree6f2f10ed496fb26c628ad43496c85437aecca6ba /main.c
parent87b3c38991df6587d6ee720ddbfd2f3eb78d926c (diff)
downloadrpncalc-65b783d28ec01e8ed4ee8de0ae3180f6850a5a5b.tar.gz
fix list and error without message
Diffstat (limited to 'main.c')
-rw-r--r--main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/main.c b/main.c
index 9484a5f..c369290 100644
--- a/main.c
+++ b/main.c
@@ -37,7 +37,7 @@ int main() {
     fprintf(s.defout, s.prompt, s.command_count, s.last_op);
     s.last_op = 0;
     char *endptr = NULL;
-    if (s.stk.count == STACK_SIZE) err(1, "exceeded stk size");
+    if (s.stk.count == STACK_SIZE) errx(1, "exceeded stk size");
     fgets(buf, BUF_SIZE, s.defbuf);
     buf[strcspn(buf, "\n")] = 0;
     double interpreted = strtod(buf, &endptr);
@@ -77,7 +77,7 @@ int main() {
 	  free (s.sorted);
 	  exit(0);
 	} else if (strcmp(buf, "list") == 0) {
-	  for (int i = 0; s.sorted[i].name != 0; i++) {
+	  for (int i = 0; i < s.numel; i++) {
 	    fprintf(s.defout, "[%s]\t->\t%s\n", s.sorted[i].name, s.sorted[i].description);
 	    continue;
 	  }