summaryrefslogtreecommitdiff
path: root/bf.c
diff options
context:
space:
mode:
Diffstat (limited to 'bf.c')
-rw-r--r--bf.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/bf.c b/bf.c
index be6c9f0..6689c19 100644
--- a/bf.c
+++ b/bf.c
@@ -58,6 +58,20 @@ freecells(Cell *c)
}
}
+void
+dumpcells(Cell *c)
+{
+ while (c->prev)
+ c = c->prev;
+
+ while (c) {
+ printf("0x%-4.2x", c->value);
+ c = c->next;
+ }
+
+ printf("\n");
+}
+
char *
readprog(char *fname)
{
@@ -150,8 +164,9 @@ main(int argc, char **argv)
break;
}
- free(prog);
+ dumpcells(data);
freecells(data);
+ free(prog);
return 0;
}