Compile dtksh on FreeBSD
dtksh can be now compiled on FreeBSD. Work in progress. Needs a real Korn shell to bootstrap as $(KSHELL). KSHELL is set by default to /usr/local/bin/ksh93 (generic POSIX shell may not work) Tested on: FreeBSD 9.0-BETA1 #0 r224912M amd64 Known issues: xvmstat: * sleep does not work well (SIGSTOP is delivered) xpong: * xpong: line 220: ball1x = max_x * 2.2 / 3 : arithmetic syntax error * dtksh is rebuilt uncondtionally every time make is invoked
This commit is contained in:
committed by
Jon Trulson
parent
441a25b361
commit
d3206f4514
@@ -134,7 +134,7 @@ static __V_ *time_add __PARAM__((struct tevent *item, __V_ *list), (item, list))
|
||||
tp->next = item;
|
||||
}
|
||||
tp = item;
|
||||
tp->timeout = (__V_*)timeradd(tp->milli,tp->flags&R_FLAG,trap_timeout,(__V_*)tp);
|
||||
tp->timeout = (__V_*)kshtimeradd(tp->milli,tp->flags&R_FLAG,trap_timeout,(__V_*)tp);
|
||||
return(list);
|
||||
}
|
||||
|
||||
|
||||
@@ -271,7 +271,7 @@ int sh_readline __PARAM__((char **names, int fd, int flags,long timeout), (names
|
||||
jmpval = sigsetjmp(buff.buff,0);
|
||||
if(jmpval)
|
||||
goto done;
|
||||
timeslot = (__V_*)timeradd(timeout,0,timedout,(__V_*)iop);
|
||||
timeslot = (__V_*)kshtimeradd(timeout,0,timedout,(__V_*)iop);
|
||||
}
|
||||
if(!(cp = (unsigned char*)sfgetr(iop,delim,0)))
|
||||
cp = (unsigned char*)sfgetr(iop,delim,-1);
|
||||
|
||||
@@ -157,7 +157,7 @@ unsigned sleep __PARAM__((unsigned sec), (sec)) __OTORP__(unsigned sec;){
|
||||
__V_ *tp;
|
||||
expired = 0;
|
||||
sh.lastsig = 0;
|
||||
tp = (__V_*)timeradd(1000*sec, 0, completed, (__V_*)0);
|
||||
tp = (__V_*)kshtimeradd(1000*sec, 0, completed, (__V_*)0);
|
||||
do
|
||||
{
|
||||
pause();
|
||||
|
||||
@@ -372,7 +372,7 @@ retry:
|
||||
#ifdef KSHELL
|
||||
(HISTCUR)->nvalue.lp = (&hp->histind);
|
||||
#endif /* KSHELL */
|
||||
timeradd(1000L*(HIST_RECENT-30), 1, hist_touch, (__V_*)hp->histname);
|
||||
kshtimeradd(1000L*(HIST_RECENT-30), 1, hist_touch, (__V_*)hp->histname);
|
||||
#ifdef SHOPT_ACCTFILE
|
||||
if(sh_isstate(SH_INTERACTIVE))
|
||||
acctinit();
|
||||
|
||||
@@ -124,7 +124,6 @@
|
||||
|
||||
#define MAXCHAR MAXLINE-2 /* max char per line */
|
||||
|
||||
#undef isblank
|
||||
#ifdef SHOPT_MULTIBYTE
|
||||
static int bigvi;
|
||||
# define gencpy(a,b) ed_gencpy(a,b)
|
||||
@@ -134,14 +133,14 @@
|
||||
# define is_print(c) ((c&~STRIP) || isprint(c))
|
||||
static int isalph __PROTO__((int));
|
||||
static int ismetach __PROTO__((int));
|
||||
static int isblank __PROTO__((int));
|
||||
static int kshisblank __PROTO__((int));
|
||||
# include "lexstates.h"
|
||||
#else
|
||||
# define gencpy(a,b) strcpy((char*)(a),(char*)(b))
|
||||
# define genncpy(a,b,n) strncpy((char*)(a),(char*)(b),n)
|
||||
# define genlen(str) strlen(str)
|
||||
# define isalph(v) ((_c=virtual[v])=='_'||isalnum(_c))
|
||||
# define isblank(v) isspace(virtual[v])
|
||||
# define kshisblank(v) isspace(virtual[v])
|
||||
# define ismetach(v) ismeta(virtual[v])
|
||||
# define digit(c) isdigit(c)
|
||||
# define is_print(c) isprint(c)
|
||||
@@ -220,7 +219,7 @@ static char paren_chars[] = "([{)]}"; /* for % command */
|
||||
|
||||
#ifdef FIORDCHK
|
||||
static clock_t typeahead; /* typeahead occurred */
|
||||
extern __MANGLE__ int ioctl __PROTO__((int, int, ...));
|
||||
extern __MANGLE__ int ioctl __PROTO__((int, unsigned long, ...));
|
||||
#else
|
||||
static int typeahead; /* typeahead occurred */
|
||||
#endif /* FIORDCHK */
|
||||
@@ -680,7 +679,7 @@ static void backword __PARAM__((int nwords, register int cmd), (nwords, cmd)) __
|
||||
register int tcur_virt = cur_virt;
|
||||
while( nwords-- && tcur_virt > first_virt )
|
||||
{
|
||||
if( !isblank(tcur_virt) && isblank(tcur_virt-1)
|
||||
if( !kshisblank(tcur_virt) && kshisblank(tcur_virt-1)
|
||||
&& tcur_virt>first_virt )
|
||||
--tcur_virt;
|
||||
else if(cmd != 'B')
|
||||
@@ -690,11 +689,11 @@ static void backword __PARAM__((int nwords, register int cmd), (nwords, cmd)) __
|
||||
if((!cur && last) || (cur && !last))
|
||||
--tcur_virt;
|
||||
}
|
||||
while( isblank(tcur_virt) && tcur_virt>=first_virt )
|
||||
while( kshisblank(tcur_virt) && tcur_virt>=first_virt )
|
||||
--tcur_virt;
|
||||
if( cmd == 'B' )
|
||||
{
|
||||
while( !isblank(tcur_virt) && tcur_virt>=first_virt )
|
||||
while( !kshisblank(tcur_virt) && tcur_virt>=first_virt )
|
||||
--tcur_virt;
|
||||
}
|
||||
else
|
||||
@@ -703,7 +702,7 @@ static void backword __PARAM__((int nwords, register int cmd), (nwords, cmd)) __
|
||||
while( isalph(tcur_virt) && tcur_virt>=first_virt )
|
||||
--tcur_virt;
|
||||
else
|
||||
while( !isalph(tcur_virt) && !isblank(tcur_virt)
|
||||
while( !isalph(tcur_virt) && !kshisblank(tcur_virt)
|
||||
&& tcur_virt>=first_virt )
|
||||
--tcur_virt;
|
||||
}
|
||||
@@ -1185,7 +1184,7 @@ static int delmotion __PARAM__((int motion, int mode), (motion, mode)) __OTORP__
|
||||
{
|
||||
/*** called by change operation, user really expects ***/
|
||||
/* the effect of the eE commands, so back up to end of word */
|
||||
while( end>begin && isblank(end-1) )
|
||||
while( end>begin && kshisblank(end-1) )
|
||||
--end;
|
||||
if( end == begin )
|
||||
++end;
|
||||
@@ -1220,13 +1219,13 @@ static void endword __PARAM__((int nwords, register int cmd), (nwords, cmd)) __O
|
||||
register int tcur_virt = cur_virt;
|
||||
while( nwords-- )
|
||||
{
|
||||
if( !isblank(tcur_virt) && tcur_virt<=last_virt )
|
||||
if( !kshisblank(tcur_virt) && tcur_virt<=last_virt )
|
||||
++tcur_virt;
|
||||
while( isblank(tcur_virt) && tcur_virt<=last_virt )
|
||||
while( kshisblank(tcur_virt) && tcur_virt<=last_virt )
|
||||
++tcur_virt;
|
||||
if( cmd == 'E' )
|
||||
{
|
||||
while( !isblank(tcur_virt) && tcur_virt<=last_virt )
|
||||
while( !kshisblank(tcur_virt) && tcur_virt<=last_virt )
|
||||
++tcur_virt;
|
||||
}
|
||||
else
|
||||
@@ -1235,7 +1234,7 @@ static void endword __PARAM__((int nwords, register int cmd), (nwords, cmd)) __O
|
||||
while( isalph(tcur_virt) && tcur_virt<=last_virt )
|
||||
++tcur_virt;
|
||||
else
|
||||
while( !isalph(tcur_virt) && !isblank(tcur_virt)
|
||||
while( !isalph(tcur_virt) && !kshisblank(tcur_virt)
|
||||
&& tcur_virt<=last_virt )
|
||||
++tcur_virt;
|
||||
}
|
||||
@@ -1258,7 +1257,7 @@ static void forward __PARAM__((register int nwords, int cmd), (nwords, cmd)) __O
|
||||
{
|
||||
if( cmd == 'W' )
|
||||
{
|
||||
while( !isblank(tcur_virt) && tcur_virt < last_virt )
|
||||
while( !kshisblank(tcur_virt) && tcur_virt < last_virt )
|
||||
++tcur_virt;
|
||||
}
|
||||
else
|
||||
@@ -1270,12 +1269,12 @@ static void forward __PARAM__((register int nwords, int cmd), (nwords, cmd)) __O
|
||||
}
|
||||
else
|
||||
{
|
||||
while( !isalph(tcur_virt) && !isblank(tcur_virt)
|
||||
while( !isalph(tcur_virt) && !kshisblank(tcur_virt)
|
||||
&& tcur_virt < last_virt )
|
||||
++tcur_virt;
|
||||
}
|
||||
}
|
||||
while( isblank(tcur_virt) && tcur_virt < last_virt )
|
||||
while( kshisblank(tcur_virt) && tcur_virt < last_virt )
|
||||
++tcur_virt;
|
||||
}
|
||||
cur_virt = tcur_virt;
|
||||
@@ -2528,7 +2527,7 @@ yankeol:
|
||||
}
|
||||
|
||||
|
||||
static int isblank __PARAM__((register int c), (c)) __OTORP__(register int c;){
|
||||
static int kshisblank __PARAM__((register int c), (c)) __OTORP__(register int c;){
|
||||
register int v = virtual[c];
|
||||
return((v&~STRIP)==0 && isspace(v));
|
||||
}
|
||||
|
||||
@@ -176,7 +176,7 @@ extern __MANGLE__ void sh_siginit __PROTO__((void));
|
||||
extern __MANGLE__ void sh_sigtrap __PROTO__((int));
|
||||
extern __MANGLE__ void sh_sigreset __PROTO__((int));
|
||||
extern __MANGLE__ void sh_timetraps __PROTO__((void));
|
||||
extern __MANGLE__ __V_ *timeradd __PROTO__((unsigned long,int ,void (*)(__V_*),__V_*));
|
||||
extern __MANGLE__ __V_ *kshtimeradd __PROTO__((unsigned long,int ,void (*)(__V_*),__V_*));
|
||||
extern __MANGLE__ void timerdel __PROTO__((__V_*));
|
||||
|
||||
extern __MANGLE__ const char e_alarm[];
|
||||
|
||||
@@ -964,7 +964,7 @@ static int slowread __PARAM__((Sfio_t *iop,__V_ *buff,register int size,Sfdisc_t
|
||||
if(io_prompt(sh.nextprompt)<0 && errno==EIO)
|
||||
return(0);
|
||||
if(sh.timeout)
|
||||
timeout = (__V_*)timeradd(sh_isstate(SH_GRACE)?1000L*TGRACE:1000L*sh.timeout,0,time_grace,NIL(__V_*));
|
||||
timeout = (__V_*)kshtimeradd(sh_isstate(SH_GRACE)?1000L*TGRACE:1000L*sh.timeout,0,time_grace,NIL(__V_*));
|
||||
# ifdef SHOPT_ESH
|
||||
if(sh_isoption(SH_EMACS|SH_GMACS))
|
||||
readf = ed_emacsread;
|
||||
|
||||
@@ -236,7 +236,7 @@ static void oldalrm __PARAM__((__V_ *handle), (handle)) __OTORP__(__V_ *handle;)
|
||||
(*fn)(SIGALRM);
|
||||
}
|
||||
|
||||
__V_ *timeradd __PARAM__((unsigned long msec,int flags,void (*action)(__V_*),__V_ *handle), (msec, flags, action, handle)) __OTORP__(unsigned long msec;int flags;void (*action)();__V_ *handle;){
|
||||
__V_ *kshtimeradd __PARAM__((unsigned long msec,int flags,void (*action)(__V_*),__V_ *handle), (msec, flags, action, handle)) __OTORP__(unsigned long msec;int flags;void (*action)();__V_ *handle;){
|
||||
register Timer_t *tp;
|
||||
double t;
|
||||
Handler_t fn;
|
||||
@@ -260,7 +260,7 @@ __V_ *timeradd __PARAM__((unsigned long msec,int flags,void (*action)(__V_*),__V
|
||||
if(hp)
|
||||
{
|
||||
*hp = fn;
|
||||
timeradd((long)(1000*t), 0, oldalrm, (__V_*)hp);
|
||||
kshtimeradd((long)(1000*t), 0, oldalrm, (__V_*)hp);
|
||||
}
|
||||
}
|
||||
tp = tptop;
|
||||
|
||||
@@ -1322,7 +1322,7 @@ pid_t _sh_fork __PARAM__((register pid_t parent,int flags,int *jobid), (parent,
|
||||
error(ERROR_system(ERROR_NOEXEC),e_nofork);
|
||||
}
|
||||
sh_sigcheck();
|
||||
timeout = (__V_*)timeradd(forkcnt, 0, timed_out, NIL(__V_*));
|
||||
timeout = (__V_*)kshtimeradd(forkcnt, 0, timed_out, NIL(__V_*));
|
||||
job_wait((pid_t)-1);
|
||||
if(timeout)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user