who would’ve thought proper ^C handling be so hard?
This commit is contained in:
parent
8caee45c60
commit
5aa7842d33
4
lex.c
4
lex.c
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.169 2012/10/22 20:19:13 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.170 2012/10/30 20:49:41 tg Exp $");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* states while lexing word
|
* states while lexing word
|
||||||
|
@ -108,7 +108,7 @@ void yyskiputf8bom(void);
|
||||||
|
|
||||||
static int backslash_skip;
|
static int backslash_skip;
|
||||||
static int ignore_backslash_newline;
|
static int ignore_backslash_newline;
|
||||||
static struct sretrace_info *retrace_info;
|
struct sretrace_info *retrace_info = NULL;
|
||||||
int subshell_nesting_type = 0;
|
int subshell_nesting_type = 0;
|
||||||
|
|
||||||
/* optimised getsc_bn() */
|
/* optimised getsc_bn() */
|
||||||
|
|
7
main.c
7
main.c
|
@ -34,7 +34,7 @@
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.236 2012/10/30 20:13:19 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.237 2012/10/30 20:49:42 tg Exp $");
|
||||||
|
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
|
|
||||||
|
@ -794,7 +794,9 @@ shell(Source * volatile s, volatile bool toplevel)
|
||||||
* needs FMONITOR set (not FTALKING/SF_TTY)...
|
* needs FMONITOR set (not FTALKING/SF_TTY)...
|
||||||
*/
|
*/
|
||||||
/* toss any input we have so far */
|
/* toss any input we have so far */
|
||||||
|
yyrecursive_pop(true);
|
||||||
s->start = s->str = null;
|
s->start = s->str = null;
|
||||||
|
retrace_info = NULL;
|
||||||
herep = heres;
|
herep = heres;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -939,8 +941,7 @@ quitenv(struct shf *shf)
|
||||||
char *cp;
|
char *cp;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
while (e->yyrecursive_statep)
|
yyrecursive_pop(true);
|
||||||
yyrecursive_pop();
|
|
||||||
if (ep->oenv && ep->oenv->loc != ep->loc)
|
if (ep->oenv && ep->oenv->loc != ep->loc)
|
||||||
popblock();
|
popblock();
|
||||||
if (ep->savefd != NULL) {
|
if (ep->savefd != NULL) {
|
||||||
|
|
7
sh.h
7
sh.h
|
@ -157,7 +157,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTERN
|
#ifdef EXTERN
|
||||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.599 2012/10/30 20:13:20 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.600 2012/10/30 20:49:43 tg Exp $");
|
||||||
#endif
|
#endif
|
||||||
#define MKSH_VERSION "R40 2012/10/30"
|
#define MKSH_VERSION "R40 2012/10/30"
|
||||||
|
|
||||||
|
@ -646,8 +646,11 @@ enum sh_flag {
|
||||||
#define kshlongjmp siglongjmp
|
#define kshlongjmp siglongjmp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
struct sretrace_info;
|
||||||
struct yyrecursive_state;
|
struct yyrecursive_state;
|
||||||
|
|
||||||
|
extern struct sretrace_info *retrace_info;
|
||||||
|
|
||||||
extern struct env {
|
extern struct env {
|
||||||
ALLOC_ITEM alloc_INT; /* internal, do not touch */
|
ALLOC_ITEM alloc_INT; /* internal, do not touch */
|
||||||
Area area; /* temporary allocation area */
|
Area area; /* temporary allocation area */
|
||||||
|
@ -1933,7 +1936,7 @@ void initkeywords(void);
|
||||||
struct op *compile(Source *, bool);
|
struct op *compile(Source *, bool);
|
||||||
bool parse_usec(const char *, struct timeval *);
|
bool parse_usec(const char *, struct timeval *);
|
||||||
char *yyrecursive(int);
|
char *yyrecursive(int);
|
||||||
void yyrecursive_pop(void);
|
void yyrecursive_pop(bool);
|
||||||
/* tree.c */
|
/* tree.c */
|
||||||
void fptreef(struct shf *, int, const char *, ...);
|
void fptreef(struct shf *, int, const char *, ...);
|
||||||
char *snptreef(char *, ssize_t, const char *, ...);
|
char *snptreef(char *, ssize_t, const char *, ...);
|
||||||
|
|
13
syn.c
13
syn.c
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.83 2012/10/30 20:07:15 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/syn.c,v 1.84 2012/10/30 20:49:44 tg Exp $");
|
||||||
|
|
||||||
extern int subshell_nesting_type;
|
extern int subshell_nesting_type;
|
||||||
extern void yyskiputf8bom(void);
|
extern void yyskiputf8bom(void);
|
||||||
|
@ -1162,7 +1162,7 @@ yyrecursive(int subtype MKSH_A_UNUSED)
|
||||||
e->yyrecursive_statep = ys;
|
e->yyrecursive_statep = ys;
|
||||||
/* we use TPAREN as a helper container here */
|
/* we use TPAREN as a helper container here */
|
||||||
t = nested(TPAREN, stok, etok);
|
t = nested(TPAREN, stok, etok);
|
||||||
yyrecursive_pop();
|
yyrecursive_pop(false);
|
||||||
|
|
||||||
/* t->left because nested(TPAREN, ...) hides our goodies there */
|
/* t->left because nested(TPAREN, ...) hides our goodies there */
|
||||||
cp = snptreef(NULL, 0, "%T", t->left);
|
cp = snptreef(NULL, 0, "%T", t->left);
|
||||||
|
@ -1172,10 +1172,13 @@ yyrecursive(int subtype MKSH_A_UNUSED)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
yyrecursive_pop(void)
|
yyrecursive_pop(bool popall)
|
||||||
{
|
{
|
||||||
struct yyrecursive_state *ys = e->yyrecursive_statep;
|
struct yyrecursive_state *ys;
|
||||||
|
|
||||||
|
popnext:
|
||||||
|
if (!(ys = e->yyrecursive_statep))
|
||||||
|
return;
|
||||||
e->yyrecursive_statep = ys->next;
|
e->yyrecursive_statep = ys->next;
|
||||||
|
|
||||||
sALIAS = ys->old_salias;
|
sALIAS = ys->old_salias;
|
||||||
|
@ -1186,4 +1189,6 @@ yyrecursive_pop(void)
|
||||||
subshell_nesting_type = ys->old_nesting_type;
|
subshell_nesting_type = ys->old_nesting_type;
|
||||||
|
|
||||||
afree(ys, ATEMP);
|
afree(ys, ATEMP);
|
||||||
|
if (popall)
|
||||||
|
goto popnext;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue