make the code to exec simple commands also available for mksh_small
This commit is contained in:
		
							
								
								
									
										6
									
								
								exec.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								exec.c
									
									
									
									
									
								
							| @@ -23,7 +23,7 @@ | |||||||
|  |  | ||||||
| #include "sh.h" | #include "sh.h" | ||||||
|  |  | ||||||
| __RCSID("$MirOS: src/bin/mksh/exec.c,v 1.128 2014/01/05 21:57:25 tg Exp $"); | __RCSID("$MirOS: src/bin/mksh/exec.c,v 1.129 2014/01/11 16:26:27 tg Exp $"); | ||||||
|  |  | ||||||
| #ifndef MKSH_DEFAULT_EXECSHELL | #ifndef MKSH_DEFAULT_EXECSHELL | ||||||
| #define MKSH_DEFAULT_EXECSHELL	"/bin/sh" | #define MKSH_DEFAULT_EXECSHELL	"/bin/sh" | ||||||
| @@ -604,19 +604,15 @@ comexec(struct op *t, struct tbl * volatile tp, const char **ap, | |||||||
| 				/* go on, use the builtin */ | 				/* go on, use the builtin */ | ||||||
| 				break; | 				break; | ||||||
| #endif | #endif | ||||||
| #if !defined(MKSH_SMALL) |  | ||||||
| 		} else if (tp->val.f == c_trap) { | 		} else if (tp->val.f == c_trap) { | ||||||
| 			t->u.evalflags &= ~DOTCOMEXEC; | 			t->u.evalflags &= ~DOTCOMEXEC; | ||||||
| 			break; | 			break; | ||||||
| #endif |  | ||||||
| 		} else | 		} else | ||||||
| 			break; | 			break; | ||||||
| 		tp = findcom(ap[0], fcflags & (FC_BI|FC_FUNC)); | 		tp = findcom(ap[0], fcflags & (FC_BI|FC_FUNC)); | ||||||
| 	} | 	} | ||||||
| #if !defined(MKSH_SMALL) |  | ||||||
| 	if (t->u.evalflags & DOTCOMEXEC) | 	if (t->u.evalflags & DOTCOMEXEC) | ||||||
| 		flags |= XEXEC; | 		flags |= XEXEC; | ||||||
| #endif |  | ||||||
| 	l_expand = e->loc; | 	l_expand = e->loc; | ||||||
| 	if (keepasn_ok && (!ap[0] || (tp && (tp->flag & KEEPASN)))) | 	if (keepasn_ok && (!ap[0] || (tp && (tp->flag & KEEPASN)))) | ||||||
| 		type_flags = 0; | 		type_flags = 0; | ||||||
|   | |||||||
							
								
								
									
										9
									
								
								main.c
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								main.c
									
									
									
									
									
								
							| @@ -34,7 +34,7 @@ | |||||||
| #include <locale.h> | #include <locale.h> | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| __RCSID("$MirOS: src/bin/mksh/main.c,v 1.275 2014/01/05 21:57:26 tg Exp $"); | __RCSID("$MirOS: src/bin/mksh/main.c,v 1.276 2014/01/11 16:26:28 tg Exp $"); | ||||||
|  |  | ||||||
| extern char **environ; | extern char **environ; | ||||||
|  |  | ||||||
| @@ -483,7 +483,6 @@ main_init(int argc, const char *argv[], Source **sp, struct block **lp) | |||||||
| 		s = pushs(SSTRINGCMDLINE, ATEMP); | 		s = pushs(SSTRINGCMDLINE, ATEMP); | ||||||
| 		if (!(s->start = s->str = argv[argi++])) | 		if (!(s->start = s->str = argv[argi++])) | ||||||
| 			errorf("%s %s", "-c", "requires an argument"); | 			errorf("%s %s", "-c", "requires an argument"); | ||||||
| #if !defined(MKSH_SMALL) |  | ||||||
| 		while (*s->str) { | 		while (*s->str) { | ||||||
| 			if (*s->str != ' ' && ctype(*s->str, C_QUOTE)) | 			if (*s->str != ' ' && ctype(*s->str, C_QUOTE)) | ||||||
| 				break; | 				break; | ||||||
| @@ -492,7 +491,6 @@ main_init(int argc, const char *argv[], Source **sp, struct block **lp) | |||||||
| 		if (!*s->str) | 		if (!*s->str) | ||||||
| 			s->flags |= SF_MAYEXEC; | 			s->flags |= SF_MAYEXEC; | ||||||
| 		s->str = s->start; | 		s->str = s->start; | ||||||
| #endif |  | ||||||
| #ifdef MKSH_MIDNIGHTBSD01ASH_COMPAT | #ifdef MKSH_MIDNIGHTBSD01ASH_COMPAT | ||||||
| 		/* compatibility to MidnightBSD 0.1 /bin/sh (kludge) */ | 		/* compatibility to MidnightBSD 0.1 /bin/sh (kludge) */ | ||||||
| 		if (Flag(FSH) && argv[argi] && !strcmp(argv[argi], "--")) | 		if (Flag(FSH) && argv[argi] && !strcmp(argv[argi], "--")) | ||||||
| @@ -873,11 +871,8 @@ shell(Source * volatile s, volatile bool toplevel) | |||||||
| 					unwind(LEXIT); | 					unwind(LEXIT); | ||||||
| 				break; | 				break; | ||||||
| 			} | 			} | ||||||
| 		} | 		} else if ((s->flags & SF_MAYEXEC) && t->type == TCOM) | ||||||
| #if !defined(MKSH_SMALL) |  | ||||||
| 		  else if ((s->flags & SF_MAYEXEC) && t->type == TCOM) |  | ||||||
| 			t->u.evalflags |= DOTCOMEXEC; | 			t->u.evalflags |= DOTCOMEXEC; | ||||||
| #endif |  | ||||||
| 		if (!Flag(FNOEXEC) || (s->flags & SF_TTY)) | 		if (!Flag(FNOEXEC) || (s->flags & SF_TTY)) | ||||||
| 			exstat = execute(t, 0, NULL) & 0xFF; | 			exstat = execute(t, 0, NULL) & 0xFF; | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										6
									
								
								sh.h
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								sh.h
									
									
									
									
									
								
							| @@ -169,7 +169,7 @@ | |||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #ifdef EXTERN | #ifdef EXTERN | ||||||
| __RCSID("$MirOS: src/bin/mksh/sh.h,v 1.682 2014/01/05 21:57:28 tg Exp $"); | __RCSID("$MirOS: src/bin/mksh/sh.h,v 1.683 2014/01/11 16:26:28 tg Exp $"); | ||||||
| #endif | #endif | ||||||
| #define MKSH_VERSION "R49 2014/01/05" | #define MKSH_VERSION "R49 2014/01/05" | ||||||
|  |  | ||||||
| @@ -1385,9 +1385,7 @@ struct ioword { | |||||||
| #define DOTEMP	BIT(8)		/* dito: in word part of ${..[%#=?]..} */ | #define DOTEMP	BIT(8)		/* dito: in word part of ${..[%#=?]..} */ | ||||||
| #define DOVACHECK BIT(9)	/* var assign check (for typeset, set, etc) */ | #define DOVACHECK BIT(9)	/* var assign check (for typeset, set, etc) */ | ||||||
| #define DOMARKDIRS BIT(10)	/* force markdirs behaviour */ | #define DOMARKDIRS BIT(10)	/* force markdirs behaviour */ | ||||||
| #if !defined(MKSH_SMALL) |  | ||||||
| #define DOTCOMEXEC BIT(11)	/* not an eval flag, used by sh -c hack */ | #define DOTCOMEXEC BIT(11)	/* not an eval flag, used by sh -c hack */ | ||||||
| #endif |  | ||||||
|  |  | ||||||
| /* | /* | ||||||
|  * The arguments of [[ .. ]] expressions are kept in t->args[] and flags |  * The arguments of [[ .. ]] expressions are kept in t->args[] and flags | ||||||
| @@ -1531,9 +1529,7 @@ struct source { | |||||||
| #define SF_ALIASEND	BIT(2)	/* faking space at end of alias */ | #define SF_ALIASEND	BIT(2)	/* faking space at end of alias */ | ||||||
| #define SF_TTY		BIT(3)	/* type == SSTDIN & it is a tty */ | #define SF_TTY		BIT(3)	/* type == SSTDIN & it is a tty */ | ||||||
| #define SF_HASALIAS	BIT(4)	/* u.tblp valid (SALIAS, SEOF) */ | #define SF_HASALIAS	BIT(4)	/* u.tblp valid (SALIAS, SEOF) */ | ||||||
| #if !defined(MKSH_SMALL) |  | ||||||
| #define SF_MAYEXEC	BIT(5)	/* special sh -c optimisation hack */ | #define SF_MAYEXEC	BIT(5)	/* special sh -c optimisation hack */ | ||||||
| #endif |  | ||||||
|  |  | ||||||
| typedef union { | typedef union { | ||||||
| 	int i; | 	int i; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user