=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/dc/bcode.c,v retrieving revision 1.49 retrieving revision 1.50 diff -u -r1.49 -r1.50 --- src/usr.bin/dc/bcode.c 2016/03/27 15:55:13 1.49 +++ src/usr.bin/dc/bcode.c 2017/02/23 06:40:17 1.50 @@ -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 @@ -67,6 +67,7 @@ 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 @@ { 'a', to_ascii }, { 'c', clear_stack }, { 'd', dup }, + { 'e', print_err }, { 'f', print_stack }, { 'i', set_ibase }, { 'k', set_scale }, @@ -491,6 +493,18 @@ if (value != NULL) { print_value(stdout, value, "", bmachine.obase); (void)putchar('\n'); + } + else + warnx("stack empty"); +} + +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");