some steps towards building with tcc

This commit is contained in:
tg 2007-07-31 10:42:15 +00:00
parent 9884efef00
commit 809c1446b2
4 changed files with 21 additions and 13 deletions

View File

@ -1,5 +1,5 @@
#!/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
# 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
if test $HAVE_COULDBE_TCC = 1; then
ct=tcc
CPP=cpp
CPP='cpp -D__TINYC__'
fi
ac_testn compiler_fails '' 'if the compiler does not fail correctly' <<-EOF
int main(void) { return (thiswillneverbedefinedIhope()); }

7
edit.c
View File

@ -5,7 +5,7 @@
#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 */
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)
return 0;
nwords = (is_command ? x_command_glob : x_file_glob)(flags,
buf + *startp, len, &words);
nwords = is_command ?
x_command_glob(flags, buf + *startp, len, &words) :
x_file_glob(flags, buf + *startp, len, &words);
if (nwords == 0) {
*wordsp = NULL;
return 0;

7
eval.c
View File

@ -2,7 +2,7 @@
#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
#define MKSH_NOPWNAM
@ -98,11 +98,12 @@ char *
evalstr(const char *cp, int f)
{
XPtrV w;
char *dp;
char *dp = null;
XPinit(w, 1);
expand(cp, &w, f);
dp = (XPsize(w) == 0) ? null : (char*) *XPptrv(w);
if (XPsize(w))
dp = *XPptrv(w);
XPfree(w);
return (dp);
}

View File

@ -3,7 +3,7 @@
#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];
static struct sigaction Sigact_ign;
@ -1055,14 +1055,20 @@ gettrap(const char *name, int igncase)
{
int n = NSIG + 1;
Trap *p;
const char *n2;
int (*cmpfunc)(const char *, const char *);
if (ksh_isdigit(*name)) {
if (getn(name, &n) && 0 <= n && n < NSIG)
return (&sigtraps[n]);
} else for (p = sigtraps; --n >= 0; p++)
if (!(igncase ? strcasecmp : strcmp)(p->name, name) ||
(!strncasecmp(name, "SIG", 3) &&
!(igncase ? strcasecmp : strcmp)(p->name, name + 3)))
else
return (NULL);
}
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 (NULL);
}