about summary refs log tree commit diff
path: root/Src/prompt.c
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2006-07-09 14:47:22 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2006-07-09 14:47:22 +0000
commit9d5f320f386701f9dec3d57a3326700563f87c23 (patch)
tree72de961a2e7ff51a5399a463d11287d182ccd2b5 /Src/prompt.c
parent59bbc0cfc53ce5871252c1541a087509bde89fdf (diff)
downloadzsh-9d5f320f386701f9dec3d57a3326700563f87c23.tar.gz
zsh-9d5f320f386701f9dec3d57a3326700563f87c23.tar.xz
zsh-9d5f320f386701f9dec3d57a3326700563f87c23.zip
22542: deoverenthuse cmdpopping
Diffstat (limited to 'Src/prompt.c')
-rw-r--r--Src/prompt.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/Src/prompt.c b/Src/prompt.c
index be7dc672c..facf777f0 100644
--- a/Src/prompt.c
+++ b/Src/prompt.c
@@ -31,7 +31,7 @@
 #include "prompt.pro"
 
 /* text attribute mask */
- 
+
 /**/
 unsigned txtattrmask;
 
@@ -41,7 +41,7 @@ unsigned txtattrmask;
 mod_export unsigned txtchange;
 
 /* the command stack for use with %_ in prompts */
- 
+
 /**/
 unsigned char *cmdstack;
 /**/
@@ -59,7 +59,7 @@ static char *cmdnames[CS_COUNT] = {
     "cmdsubst", "mathsubst", "elif-then", "heredoc",
     "heredocd", "brace",     "braceparam", "always",
 };
- 
+
 /* The buffer into which an expanded and metafied prompt is being written, *
  * and its size.                                                           */
 
@@ -1304,3 +1304,22 @@ prompttrunc(int arg, int truncchar, int doprint, int endchar)
     }
     return 1;
 }
+
+/**/
+void
+cmdpush(int cmdtok)
+{
+    if (cmdsp >= 0 && cmdsp < CMDSTACKSZ)
+	cmdstack[cmdsp++] = (unsigned char)cmdtok;
+}
+
+/**/
+void
+cmdpop(void)
+{
+    if (cmdsp <= 0) {
+	DPUTS(1, "BUG: cmdstack empty");
+	fflush(stderr);
+    } else
+	cmdsp--;
+}