X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/halibut/blobdiff_plain/7cf305b7b9110585d31cdaad8de89411c688a465..7136a6c7f094fa423c48ec319748c4fd7e1fa645:/misc.c diff --git a/misc.c b/misc.c index c4ac72f..0de6c2a 100644 --- a/misc.c +++ b/misc.c @@ -41,6 +41,13 @@ void *stk_pop(stack s) { return NULL; } +void *stk_top(stack s) { + if (s->sp > 0) + return s->data[s->sp-1]; + else + return NULL; +} + /* * Small routines to amalgamate a string from an input source. */