nevermind just found the elusive "q"
On 04/21/16 22:10, Edgar Pettijohn wrote:
While playing with dc discovered you can't control-c to get out.
Probably not the best way, but here goes.
Index: dc.c
===================================================================
RCS file: /cvs/src/usr.bin/dc/dc.c,v
retrieving revision 1.17
diff -u -p -u -r1.17 dc.c
--- dc.c 3 Nov 2015 04:58:58 -0000 1.17
+++ dc.c 22 Apr 2016 03:07:35 -0000
@@ -19,6 +19,7 @@
#include <sys/stat.h>
#include <err.h>
#include <errno.h>
+#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -37,6 +38,12 @@ usage(void)
exit(1);
}
+void
+onintr(int signo)
+{
+ _exit(1);
+}
+
int
dc_main(int argc, char *argv[])
{
@@ -109,6 +116,9 @@ dc_main(int argc, char *argv[])
if (pledge("stdio", NULL) == -1)
err(1, "pledge");
+
+ (void)signal(SIGINT, onintr);
+ (void)signal(SIGQUIT, onintr);
src_setstream(&src, stdin);
reset_bmachine(&src);
Index: extern.h
===================================================================
RCS file: /cvs/src/usr.bin/dc/extern.h,v
retrieving revision 1.5
diff -u -p -u -r1.5 extern.h
--- extern.h 10 Oct 2015 19:28:54 -0000 1.5
+++ extern.h 22 Apr 2016 03:08:01 -0000
@@ -61,4 +61,6 @@ void frame_assign(struct stack *, size_
struct value * frame_retrieve(const struct stack *, size_t);
/* void frame_free(struct stack *); */
+/* dc.c */
int dc_main(int, char **);
+void onintr(int signo);