Ok, this is a pretty major update to sh.c. I renamed all the variables and
function names to conform with the style guide. I also did a lot of work on
the if-then-alse-fi logic and added prototype (i.e. it segfaults when enabled)
line continuation support.
Furthermore, this patch includes Larry Doolittle's work on restructuring some
of the data structures that represent the job and child_program, allowing
several simplifications and fixing several bugs.
-Erik
diff --git a/shell/cmdedit.c b/shell/cmdedit.c
index c32330b..0c9bda7 100644
--- a/shell/cmdedit.c
+++ b/shell/cmdedit.c
@@ -85,6 +85,12 @@
static int history_counter = 0; /* Number of commands in history list */
static int reset_term = 0; /* Set to true if the terminal needs to be reset upon exit */
static int exithandler_set = 0; /* Set to true when atexit() has been called */
+
+
+/* Link into lash to reset context to 0
+ * on ^C and such */
+extern unsigned int shell_context;
+
struct history {
char *s;
@@ -466,20 +472,24 @@
input_backward(outputFd, &cursor);
break;
case 3:
- /* Control-c -- leave the current line,
- * and start over on the next line */
+ /* Control-c -- stop gathering input */
+
+ /* Link into lash to reset context to 0 on ^C and such */
+ shell_context = 0;
/* Go to the next line */
xwrite(outputFd, "\n", 1);
+#if 0
/* Rewrite the prompt */
xwrite(outputFd, prompt, strlen(prompt));
/* Reset the command string */
memset(command, 0, BUFSIZ);
len = cursor = 0;
+#endif
+ return;
- break;
case 4:
/* Control-d -- Delete one character, or exit
* if the len=0 and no chars to delete */