some steps towards building with tcc
This commit is contained in:
		
							
								
								
									
										4
									
								
								Build.sh
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								Build.sh
									
									
									
									
									
								
							| @@ -1,5 +1,5 @@ | |||||||
| #!/bin/sh | #!/bin/sh | ||||||
| # $MirOS: src/bin/mksh/Build.sh,v 1.248 2007/07/31 10:17:52 tg Exp $ | # $MirOS: src/bin/mksh/Build.sh,v 1.249 2007/07/31 10:42:14 tg Exp $ | ||||||
| #- | #- | ||||||
| # Environment used: CC CFLAGS CPPFLAGS LDFLAGS LIBS NOWARN NROFF TARGET_OS | # Environment used: CC CFLAGS CPPFLAGS LDFLAGS LIBS NOWARN NROFF TARGET_OS | ||||||
| # CPPFLAGS recognised:	MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NEED_MKNOD MKSH_NOPWNAM | # CPPFLAGS recognised:	MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NEED_MKNOD MKSH_NOPWNAM | ||||||
| @@ -419,7 +419,7 @@ ac_testn couldbe_tcc '!' compiler_known 0 'if this could be tcc' <<-EOF | |||||||
| EOF | EOF | ||||||
| if test $HAVE_COULDBE_TCC = 1; then | if test $HAVE_COULDBE_TCC = 1; then | ||||||
| 	ct=tcc | 	ct=tcc | ||||||
| 	CPP=cpp | 	CPP='cpp -D__TINYC__' | ||||||
| fi | fi | ||||||
| ac_testn compiler_fails '' 'if the compiler does not fail correctly' <<-EOF | ac_testn compiler_fails '' 'if the compiler does not fail correctly' <<-EOF | ||||||
| 	int main(void) { return (thiswillneverbedefinedIhope()); } | 	int main(void) { return (thiswillneverbedefinedIhope()); } | ||||||
|   | |||||||
							
								
								
									
										7
									
								
								edit.c
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								edit.c
									
									
									
									
									
								
							| @@ -5,7 +5,7 @@ | |||||||
|  |  | ||||||
| #include "sh.h" | #include "sh.h" | ||||||
|  |  | ||||||
| __RCSID("$MirOS: src/bin/mksh/edit.c,v 1.107 2007/07/22 13:38:25 tg Exp $"); | __RCSID("$MirOS: src/bin/mksh/edit.c,v 1.108 2007/07/31 10:42:14 tg Exp $"); | ||||||
|  |  | ||||||
| /* tty driver characters we are interested in */ | /* tty driver characters we are interested in */ | ||||||
| typedef struct { | typedef struct { | ||||||
| @@ -515,8 +515,9 @@ x_cf_glob(int flags, const char *buf, int buflen, int pos, int *startp, | |||||||
| 	if (len == 0 && is_command) | 	if (len == 0 && is_command) | ||||||
| 		return 0; | 		return 0; | ||||||
|  |  | ||||||
| 	nwords = (is_command ? x_command_glob : x_file_glob)(flags, | 	nwords = is_command ? | ||||||
| 	    buf + *startp, len, &words); | 	    x_command_glob(flags, buf + *startp, len, &words) : | ||||||
|  | 	    x_file_glob(flags, buf + *startp, len, &words); | ||||||
| 	if (nwords == 0) { | 	if (nwords == 0) { | ||||||
| 		*wordsp = NULL; | 		*wordsp = NULL; | ||||||
| 		return 0; | 		return 0; | ||||||
|   | |||||||
							
								
								
									
										7
									
								
								eval.c
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								eval.c
									
									
									
									
									
								
							| @@ -2,7 +2,7 @@ | |||||||
|  |  | ||||||
| #include "sh.h" | #include "sh.h" | ||||||
|  |  | ||||||
| __RCSID("$MirOS: src/bin/mksh/eval.c,v 1.33 2007/07/06 02:39:36 tg Exp $"); | __RCSID("$MirOS: src/bin/mksh/eval.c,v 1.34 2007/07/31 10:42:15 tg Exp $"); | ||||||
|  |  | ||||||
| #ifdef MKSH_SMALL | #ifdef MKSH_SMALL | ||||||
| #define MKSH_NOPWNAM | #define MKSH_NOPWNAM | ||||||
| @@ -98,11 +98,12 @@ char * | |||||||
| evalstr(const char *cp, int f) | evalstr(const char *cp, int f) | ||||||
| { | { | ||||||
| 	XPtrV w; | 	XPtrV w; | ||||||
| 	char *dp; | 	char *dp = null; | ||||||
|  |  | ||||||
| 	XPinit(w, 1); | 	XPinit(w, 1); | ||||||
| 	expand(cp, &w, f); | 	expand(cp, &w, f); | ||||||
| 	dp = (XPsize(w) == 0) ? null : (char*) *XPptrv(w); | 	if (XPsize(w)) | ||||||
|  | 		dp = *XPptrv(w); | ||||||
| 	XPfree(w); | 	XPfree(w); | ||||||
| 	return (dp); | 	return (dp); | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										16
									
								
								histrap.c
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								histrap.c
									
									
									
									
									
								
							| @@ -3,7 +3,7 @@ | |||||||
|  |  | ||||||
| #include "sh.h" | #include "sh.h" | ||||||
|  |  | ||||||
| __RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.53 2007/07/22 14:01:49 tg Exp $"); | __RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.54 2007/07/31 10:42:15 tg Exp $"); | ||||||
|  |  | ||||||
| Trap sigtraps[NSIG + 1]; | Trap sigtraps[NSIG + 1]; | ||||||
| static struct sigaction Sigact_ign; | static struct sigaction Sigact_ign; | ||||||
| @@ -1055,14 +1055,20 @@ gettrap(const char *name, int igncase) | |||||||
| { | { | ||||||
| 	int n = NSIG + 1; | 	int n = NSIG + 1; | ||||||
| 	Trap *p; | 	Trap *p; | ||||||
|  | 	const char *n2; | ||||||
|  | 	int (*cmpfunc)(const char *, const char *); | ||||||
|  |  | ||||||
| 	if (ksh_isdigit(*name)) { | 	if (ksh_isdigit(*name)) { | ||||||
| 		if (getn(name, &n) && 0 <= n && n < NSIG) | 		if (getn(name, &n) && 0 <= n && n < NSIG) | ||||||
| 			return (&sigtraps[n]); | 			return (&sigtraps[n]); | ||||||
| 	} else for (p = sigtraps; --n >= 0; p++) | 		else | ||||||
| 		if (!(igncase ? strcasecmp : strcmp)(p->name, name) || | 			return (NULL); | ||||||
| 		   (!strncasecmp(name, "SIG", 3) && | 	} | ||||||
| 		    !(igncase ? strcasecmp : strcmp)(p->name, name + 3))) |  | ||||||
|  | 	n2 = strncasecmp(name, "SIG", 3) ? NULL : name + 3; | ||||||
|  | 	cmpfunc = igncase ? strcasecmp : strcmp; | ||||||
|  | 	for (p = sigtraps; --n >= 0; p++) | ||||||
|  | 		if (!cmpfunc(p->name, name) || (n2 && !cmpfunc(p->name, n2))) | ||||||
| 			return (p); | 			return (p); | ||||||
| 	return (NULL); | 	return (NULL); | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user