diff options
Diffstat (limited to 'usr.bin/dc/bcode.c')
-rw-r--r-- | usr.bin/dc/bcode.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/usr.bin/dc/bcode.c b/usr.bin/dc/bcode.c index 1e416967b75..8e50c1e8037 100644 --- a/usr.bin/dc/bcode.c +++ b/usr.bin/dc/bcode.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bcode.c,v 1.49 2016/03/27 15:55:13 otto Exp $ */ +/* $OpenBSD: bcode.c,v 1.50 2017/02/23 06:40:17 otto Exp $ */ /* * Copyright (c) 2003, Otto Moerbeek <otto@drijf.net> @@ -67,6 +67,7 @@ static __inline struct number *pop_number(void); static __inline char *pop_string(void); static __inline void clear_stack(void); static __inline void print_tos(void); +static void print_err(void); static void pop_print(void); static void pop_printn(void); static __inline void print_stack(void); @@ -195,6 +196,7 @@ static const struct jump_entry jump_table_data[] = { { 'a', to_ascii }, { 'c', clear_stack }, { 'd', dup }, + { 'e', print_err }, { 'f', print_stack }, { 'i', set_ibase }, { 'k', set_scale }, @@ -497,6 +499,18 @@ print_tos(void) } static void +print_err(void) +{ + struct value *value = tos(); + if (value != NULL) { + print_value(stderr, value, "", bmachine.obase); + (void)putc('\n', stderr); + } + else + warnx("stack empty"); +} + +static void pop_print(void) { struct value *value = pop(); |