Dr. Werner Fink 2013-10-25 14:09:12 +00:00 committed by Git OBS Bridge
parent d46caeedf7
commit 485ac3a597
7 changed files with 574 additions and 844 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Oct 25 14:07:57 UTC 2013 - werner@suse.de
- Add missing sfsetbuf() in patch ksh93-fdstatus.dif
- Rework patch ksh93-dttree-crash.dif
- Rework patch ksh93-uninitialized.dif
-------------------------------------------------------------------
Tue Oct 22 11:58:21 UTC 2013 - werner@suse.de

View File

@ -542,7 +542,9 @@ fi
sed -ri '/^L[[:blank:]]/a \t 8000' pty.sh
sed -ri 's/(SECONDS[[:blank:]]*>[[:blank:]]*)([[:digit:]]+)/\18/' signal.sh
unset ${!LESS*}
grep -E '^(model name|flags)[[:blank:]]*:' /proc/cpuinfo | sort -ur
printf '\033[1m'
grep -E '^(model name|flags)[[:blank:]]*:' /proc/cpuinfo | sort -ur | fold -s
printf '\033(B\033[m'
${SHELL} shtests
result=$(${SHELL} -k -c 'd=`/bin/echo x y=z`; echo $d x y=z')
test "$result" = 'x x' || exit 1
@ -581,7 +583,9 @@ fi
fi
LANG=POSIX
exec 3>&-
printf '\033[1m'
uniq -c ${TMPDIR:-/tmp}/log
printf '\033(B\033[m'
killall -q -s 9 ${SHELL} || true
popd
%endif

View File

@ -38,13 +38,13 @@
+ tty.c_cc[VMIN] = CMIN;
+#ifdef B115200
+ cfsetispeed(&tty, B115200);
+ cfsetispeed(&tty, B115200);
+ cfsetospeed(&tty, B115200);
+#elif defined(B57600)
+ cfsetispeed(&tty, B57600);
+ cfsetispeed(&tty, B57600);
+ cfsetospeed(&tty, B57600);
+#elif defined(B38400)
+ cfsetispeed(&tty, B38400);
+ cfsetispeed(&tty, B38400);
+ cfsetospeed(&tty, B38400);
+#endif
+ ttyp = &tty;
#ifdef TIOCGWINSZ

View File

@ -1,45 +1,392 @@
--- src/cmd/ksh93/sh/xec.c
+++ src/cmd/ksh93/sh/xec.c 2013-02-01 16:22:50.000000000 +0000
@@ -2741,11 +2741,6 @@ int sh_exec(register const Shnode_t *t,
slp = (struct slnod*)np->nvenv;
sh_funstaks(slp->slchild,-1);
stakdelete(slp->slptr);
- if(shp->funload)
- {
- free((void*)np->nvalue.rp);
- np->nvalue.rp = 0;
- }
if(rp->sdict)
{
Namval_t *mp, *nq;
@@ -2759,6 +2754,12 @@ int sh_exec(register const Shnode_t *t,
dtclose(rp->sdict);
rp->sdict = 0;
--- src/cmd/ksh93/bltins/typeset.c
+++ src/cmd/ksh93/bltins/typeset.c 2013-10-25 13:20:42.799733785 +0000
@@ -579,7 +579,7 @@ static int setall(char **argv,regist
np = sh_fsearch(shp,name,NV_ADD|HASH_NOSCOPE);
else
#endif /* SHOPT_NAMESPACE */
- np = nv_open(name,sh_subfuntree(1),NV_NOARRAY|NV_IDENT|NV_NOSCOPE);
+ np = nv_open(name,sh_subfuntree(shp,1),NV_NOARRAY|NV_IDENT|NV_NOSCOPE);
}
+ if(shp->funload)
+ {
+ if(!shp->fpathdict)
+ free((void*)np->nvalue.rp);
+ np->nvalue.rp = 0;
+ }
}
if(!np->nvalue.rp)
{
@@ -2769,7 +2770,7 @@ int sh_exec(register const Shnode_t *t,
{
static Dtdisc_t _Rpdisc =
else
{
- offsetof(struct Ufunction,fname), -1, sizeof(struct Ufunction)
+ offsetof(struct Ufunction,fname), -1, sizeof(struct Ufunction)
};
struct functnod *fp;
struct comnod *ac = t->funct.functargs;
@@ -2796,8 +2797,10 @@ int sh_exec(register const Shnode_t *t,
rp->np = np;
@@ -1168,14 +1168,14 @@ static int unall(int argc, char **argv,
{
name = sh_optunalias;
if(shp->subshell)
- troot = sh_subaliastree(0);
+ troot = sh_subaliastree(shp,0);
}
else
name = sh_optunset;
while(r = optget(argv,name)) switch(r)
{
case 'f':
- troot = sh_subfuntree(1);
+ troot = sh_subfuntree(shp,1);
break;
case 'a':
all=1;
--- src/cmd/ksh93/include/defs.h
+++ src/cmd/ksh93/include/defs.h 2013-10-25 13:20:42.799733785 +0000
@@ -423,10 +423,10 @@ extern void sh_printopts(Shopt_t,int,Sh
extern int sh_readline(Shell_t*,char**,volatile int,int,ssize_t,long);
extern Sfio_t *sh_sfeval(char*[]);
extern void sh_setmatch(Shell_t*,const char*,int,int,int[],int);
-extern Dt_t *sh_subaliastree(int);
+extern Dt_t *sh_subaliastree(Shell_t*,int);
extern void sh_scope(Shell_t*, struct argnod*, int);
extern Namval_t *sh_scoped(Shell_t*, Namval_t*);
-extern Dt_t *sh_subfuntree(int);
+extern Dt_t *sh_subfuntree(Shell_t*,int);
extern void sh_subjobcheck(pid_t);
extern int sh_subsavefd(int);
extern void sh_subtmpfile(Shell_t*);
--- src/cmd/ksh93/sh/arith.c
+++ src/cmd/ksh93/sh/arith.c 2013-10-25 13:20:42.799733785 +0000
@@ -180,7 +180,10 @@ static Namval_t *scope(register Namval_t
{
ap = nv_arrayptr(np);
if(ap && !ap->table)
+ {
ap->table = dtopen(&_Nvdisc,Dtoset);
+ dtuserdata(ap->table,shp,1);
+ }
if(ap && ap->table && (nq=nv_search(nv_getsub(np),ap->table,NV_ADD)))
nq->nvenv = (char*)np;
if(nq && nv_isnull(nq))
--- src/cmd/ksh93/sh/array.c
+++ src/cmd/ksh93/sh/array.c 2013-10-25 13:20:42.800733693 +0000
@@ -79,6 +79,7 @@ struct assoc_array
static Namarr_t *array_scope(Namval_t *np, Namarr_t *ap, int flags)
{
+ Shell_t *shp = sh_getinterp();
Namarr_t *aq;
#if SHOPT_FIXEDARRAY
struct fixed_array *fp;
@@ -95,6 +96,7 @@ static Namarr_t *array_scope(Namval_t *n
if(is_associative(aq))
{
aq->scope = (void*)dtopen(&_Nvdisc,Dtoset);
+ dtuserdata(aq->scope,shp,1);
dtview((Dt_t*)aq->scope,aq->table);
aq->table = (Dt_t*)aq->scope;
return(aq);
@@ -271,6 +273,7 @@ int nv_arrayisset(Namval_t *np, Namarr_t
*/
static Namval_t *array_find(Namval_t *np,Namarr_t *arp, int flag)
{
+ Shell_t *shp=sh_getinterp();
register struct index_array *ap = (struct index_array*)arp;
register union Value *up;
Namval_t *mp;
@@ -373,7 +376,10 @@ static Namval_t *array_find(Namval_t *np
{
char *cp;
if(!ap->header.table)
+ {
ap->header.table = dtopen(&_Nvdisc,Dtoset);
+ dtuserdata(ap->header.table,shp,1);
+ }
sfprintf(sh.strbuf,"%d",ap->cur);
cp = sfstruse(sh.strbuf);
mp = nv_search(cp, ap->header.table, NV_ADD);
@@ -402,6 +408,7 @@ static Namval_t *array_find(Namval_t *np
#if SHOPT_TYPEDEF
int nv_arraysettype(Namval_t *np, Namval_t *tp, const char *sub, int flags)
{
+ Shell_t *shp = sh_getinterp();
Namval_t *nq;
char *av[2];
int rdonly = nv_isattr(np,NV_RDONLY);
@@ -410,7 +417,10 @@ int nv_arraysettype(Namval_t *np, Namval
av[1] = 0;
sh.last_table = 0;
if(!ap->table)
+ {
ap->table = dtopen(&_Nvdisc,Dtoset);
+ dtuserdata(ap->table,shp,1);
+ }
if(nq = nv_search(sub, ap->table, NV_ADD))
{
if(!nq->nvfun && nq->nvalue.cp && *nq->nvalue.cp==0)
@@ -485,6 +495,7 @@ static Namfun_t *array_clone(Namval_t *n
if(ap->table)
{
ap->table = dtopen(&_Nvdisc,Dtoset);
+ dtuserdata(ap->table,shp,1);
if(ap->scope && !(flags&NV_COMVAR))
{
ap->scope = ap->table;
@@ -854,7 +865,9 @@ static struct index_array *array_grow(Na
np->nvalue.cp=0;
if(nv_hasdisc(np,&array_disc) || (nv_type(np) && nv_isvtree(np)))
{
+ Shell_t *shp = sh_getinterp();
ap->header.table = dtopen(&_Nvdisc,Dtoset);
+ dtuserdata(ap->header.table,shp,1);
mp = nv_search("0", ap->header.table,NV_ADD);
if(mp && nv_isnull(mp))
{
@@ -1169,6 +1182,7 @@ int nv_nextsub(Namval_t *np)
*/
Namval_t *nv_putsub(Namval_t *np,register char *sp,register long mode)
{
+ Shell_t *shp = sh_getinterp();
register struct index_array *ap = (struct index_array*)nv_arrayptr(np);
register int size = (mode&ARRAY_MASK);
#if SHOPT_FIXEDARRAY
@@ -1180,7 +1194,6 @@ Namval_t *nv_putsub(Namval_t *np,registe
{
if(sp)
{
- Shell_t *shp = sh_getinterp();
if(ap && ap->xp && !strmatch(sp,"+([0-9])"))
{
Namval_t *mp = nv_namptr(ap->xp,0);
@@ -1258,7 +1271,10 @@ Namval_t *nv_putsub(Namval_t *np,registe
char *cp;
Namval_t *mp;
if(!ap->header.table)
+ {
ap->header.table = dtopen(&_Nvdisc,Dtoset);
+ dtuserdata(ap->header.table,shp,1);
+ }
sfprintf(sh.strbuf,"%d",ap->cur);
cp = sfstruse(sh.strbuf);
mp = nv_search(cp, ap->header.table, NV_ADD);
@@ -1666,6 +1682,7 @@ int nv_aimax(register Namval_t* np)
*/
void *nv_associative(register Namval_t *np,const char *sp,int mode)
{
+ Shell_t *shp = sh_getinterp();
register struct assoc_array *ap = (struct assoc_array*)nv_arrayptr(np);
register int type;
switch(mode)
@@ -1674,6 +1691,7 @@ void *nv_associative(register Namval_t *
if(ap = (struct assoc_array*)calloc(1,sizeof(struct assoc_array)))
{
ap->header.table = dtopen(&_Nvdisc,Dtoset);
+ dtuserdata(ap->header.table,shp,1);
ap->cur = 0;
ap->pos = 0;
ap->header.hdr.disc = &array_disc;
@@ -1742,7 +1760,6 @@ void *nv_associative(register Namval_t *
case NV_ANAME:
if(ap->cur)
{
- Shell_t *shp = sh_getinterp();
if(!shp->instance && nv_isnull(ap->cur))
return(NIL(void*));
return((void*)ap->cur->nvname);
--- src/cmd/ksh93/sh/init.c
+++ src/cmd/ksh93/sh/init.c 2013-10-25 13:20:42.800733693 +0000
@@ -1909,9 +1909,13 @@ static Init_t *nv_init(Shell_t *shp)
(OPTINDNOD)->nvalue.lp = (&shp->st.optindex);
/* set up the seconds clock */
shp->alias_tree = inittree(shp,shtab_aliases);
+ dtuserdata(shp->alias_tree,shp,1);
shp->track_tree = dtopen(&_Nvdisc,Dtset);
+ dtuserdata(shp->track_tree,shp,1);
shp->bltin_tree = inittree(shp,(const struct shtable2*)shtab_builtins);
+ dtuserdata(shp->bltin_tree,shp,1);
shp->fun_tree = dtopen(&_Nvdisc,Dtoset);
+ dtuserdata(shp->fun_tree,shp,1);
dtview(shp->fun_tree,shp->bltin_tree);
nv_mount(DOTSHNOD, "type", shp->typedict=dtopen(&_Nvdisc,Dtoset));
nv_adddisc(DOTSHNOD, shdiscnames, (Namval_t**)0);
@@ -1954,6 +1958,7 @@ static Dt_t *inittree(Shell_t *shp,const
nbltins = n;
}
base_treep = treep = dtopen(&_Nvdisc,Dtoset);
+ dtuserdata(treep,shp,1);
treep->user = (void*)shp;
for(tp=name_vals;*tp->sh_name;tp++,np++)
{
--- src/cmd/ksh93/sh/macro.c
+++ src/cmd/ksh93/sh/macro.c 2013-10-25 13:20:42.801733601 +0000
@@ -2742,7 +2742,10 @@ static char *sh_tilde(Shell_t *shp,regis
skip:
#endif /* _WINIX */
if(!logins_tree)
+ {
logins_tree = dtopen(&_Nvdisc,Dtbag);
+ dtuserdata(logins_tree,shp,1);
+ }
if(np=nv_search(string,logins_tree,NV_ADD))
{
c = shp->subshell;
--- src/cmd/ksh93/sh/name.c
+++ src/cmd/ksh93/sh/name.c 2013-10-25 13:20:42.802733508 +0000
@@ -821,6 +821,7 @@ Namval_t *nv_create(const char *name, D
{
Dt_t *dp = dtview(shp->var_tree,(Dt_t*)0);
rp->sdict = dtopen(&_Nvdisc,Dtoset);
+ dtuserdata(rp->sdict,shp,1);
dtview(rp->sdict,dp);
dtview(shp->var_tree,rp->sdict);
}
@@ -1170,7 +1171,10 @@ Namval_t *nv_create(const char *name, D
ap = nv_arrayptr(np);
}
if(n && ap && !ap->table)
+ {
ap->table = dtopen(&_Nvdisc,Dtoset);
+ dtuserdata(ap->table,shp,1);
+ }
if(ap && ap->table && (nq=nv_search(sub,ap->table,n)))
nq->nvenv = (char*)np;
if(nq && nv_isnull(nq))
@@ -1391,7 +1395,7 @@ Namval_t *nv_open(const char *name, Dt_t
while((c= *(unsigned char*)cp++) && (c!='=') && (c!='/') &&
(c>=0x200 || !(c=sh_lexstates[ST_NORM][c]) || c==S_EPAT || c==S_COLON));
if(shp->subshell && c=='=')
- root = sh_subaliastree(1);
+ root = sh_subaliastree(shp,1);
if(c= *--cp)
*cp = 0;
np = nv_search(name, root, (flags&NV_NOADD)?0:NV_ADD);
@@ -2350,6 +2354,7 @@ void sh_scope(Shell_t *shp, struct argno
newroot = nv_dict(shp->namespace);
#endif /* SHOPT_NAMESPACE */
newscope = dtopen(&_Nvdisc,Dtoset);
+ dtuserdata(newscope,shp,1);
if(envlist)
{
dtview(newscope,(Dt_t*)shp->var_tree);
@@ -3334,7 +3339,10 @@ int nv_rename(register Namval_t *np, int
if(ap=nv_arrayptr(np))
{
if(!ap->table)
+ {
ap->table = dtopen(&_Nvdisc,Dtoset);
+ dtuserdata(ap->table,shp,1);
+ }
if(ap->table)
mp = nv_search(nv_getsub(np),ap->table,NV_ADD);
nv_arraychild(np,mp,0);
--- src/cmd/ksh93/sh/nvdisc.c
+++ src/cmd/ksh93/sh/nvdisc.c 2013-10-25 13:20:42.802733508 +0000
@@ -246,6 +246,7 @@ static void chktfree(register Namval_t *
*/
static void assign(Namval_t *np,const char* val,int flags,Namfun_t *handle)
{
+ Shell_t *shp = sh_getinterp();
int type = (flags&NV_APPEND)?APPEND:ASSIGN;
register struct vardisc *vp = (struct vardisc*)handle;
register Namval_t *nq = vp->disc[type];
@@ -330,7 +331,7 @@ static void assign(Namval_t *np,const ch
}
else if(!nq || !isblocked(bp,type))
{
- Dt_t *root = sh_subfuntree(1);
+ Dt_t *root = sh_subfuntree(shp,1);
int n;
Namarr_t *ap;
block(bp,type);
@@ -1296,6 +1297,7 @@ static Namfun_t *clone_table(Namval_t* n
Dt_t *oroot=tp->dict,*nroot=dtopen(&_Nvdisc,Dtoset);
if(!nroot)
return(0);
+ dtuserdata(nroot,dtuserdata(oroot,0,0),1);
memcpy((void*)ntp,(void*)fp,sizeof(struct table));
ntp->dict = nroot;
ntp->parent = nv_lastdict();
@@ -1493,6 +1495,6 @@ Namval_t *sh_fsearch(Shell_t *shp, const
sfputr(stkp,nv_name(shp->namespace),'.');
sfputr(stkp,fname,0);
fname = stkptr(stkp,offset);
- return(nv_search(fname,sh_subfuntree(add&NV_ADD),add));
+ return(nv_search(fname,sh_subfuntree(shp,add&NV_ADD),add));
}
#endif /* SHOPT_NAMESPACE */
--- src/cmd/ksh93/sh/path.c
+++ src/cmd/ksh93/sh/path.c 2013-10-25 13:20:42.803733416 +0000
@@ -592,7 +592,7 @@ static void funload(Shell_t *shp,int fno
pname = path_fullname(shp,stakptr(PATH_OFFSET));
if(shp->fpathdict && (rp = dtmatch(shp->fpathdict,(void*)pname)))
{
- Dt_t *funtree = sh_subfuntree(1);
+ Dt_t *funtree = sh_subfuntree(shp,1);
while(1)
{
rpfirst = dtprev(shp->fpathdict,rp);
@@ -868,13 +868,13 @@ Pathcomp_t *path_absolute(Shell_t *shp,r
if(isfun && f>=0 && (cp = strrchr(name,'.')))
{
*cp = 0;
- if(nv_open(name,sh_subfuntree(1),NV_NOARRAY|NV_IDENT|NV_NOSCOPE))
+ if(nv_open(name,sh_subfuntree(shp,1),NV_NOARRAY|NV_IDENT|NV_NOSCOPE))
f = -1;
*cp = '.';
}
if(isfun && f>=0)
{
- nv_onattr(nv_open(name,sh_subfuntree(1),NV_NOARRAY|NV_IDENT|NV_NOSCOPE),NV_LTOU|NV_FUNCTION);
+ nv_onattr(nv_open(name,sh_subfuntree(shp,1),NV_NOARRAY|NV_IDENT|NV_NOSCOPE),NV_LTOU|NV_FUNCTION);
funload(shp,f,name);
close(f);
f = -1;
--- src/cmd/ksh93/sh/subshell.c
+++ src/cmd/ksh93/sh/subshell.c 2013-10-25 13:20:42.803733416 +0000
@@ -379,7 +379,7 @@ static void nv_restore(struct subshell *
* return pointer to alias tree
* create new one if in a subshell and one doesn't exist and create is non-zero
*/
-Dt_t *sh_subaliastree(int create)
+Dt_t *sh_subaliastree(Shell_t *shp,int create)
{
register struct subshell *sp = subshell_data;
if(!sp || sp->shp->curenv==0)
@@ -387,6 +387,7 @@ Dt_t *sh_subaliastree(int create)
if(!sp->salias && create)
{
sp->salias = dtopen(&_Nvdisc,Dtoset);
+ dtuserdata(sp->salias,shp,1);
dtview(sp->salias,sp->shp->alias_tree);
sp->shp->alias_tree = sp->salias;
}
@@ -397,7 +398,7 @@ Dt_t *sh_subaliastree(int create)
* return pointer to function tree
* create new one if in a subshell and one doesn't exist and create is non-zero
*/
-Dt_t *sh_subfuntree(int create)
+Dt_t *sh_subfuntree(Shell_t *shp,int create)
{
register struct subshell *sp = subshell_data;
if(!sp || sp->shp->curenv==0)
@@ -405,6 +406,7 @@ Dt_t *sh_subfuntree(int create)
if(!sp->sfun && create)
{
sp->sfun = dtopen(&_Nvdisc,Dtoset);
+ dtuserdata(sp->sfun,shp,1);
dtview(sp->sfun,sp->shp->fun_tree);
sp->shp->fun_tree = sp->sfun;
}
--- src/cmd/ksh93/sh/xec.c
+++ src/cmd/ksh93/sh/xec.c 2013-10-25 13:20:42.804733324 +0000
@@ -2688,6 +2688,7 @@ int sh_exec(register const Shnode_t *t,
else
{
root = dtopen(&_Nvdisc,Dtoset);
+ dtuserdata(root,shp,1);
nv_mount(np, (char*)0, root);
np->nvalue.cp = Empty;
dtview(root,shp->var_base);
@@ -2729,7 +2730,7 @@ int sh_exec(register const Shnode_t *t,
np = sh_fsearch(shp,fname,NV_ADD|HASH_NOSCOPE);
if(!np)
#endif /* SHOPT_NAMESPACE */
- np = nv_open(fname,sh_subfuntree(1),NV_NOASSIGN|NV_NOARRAY|NV_VARNAME|NV_NOSCOPE);
+ np = nv_open(fname,sh_subfuntree(shp,1),NV_NOASSIGN|NV_NOARRAY|NV_VARNAME|NV_NOSCOPE);
if(npv)
{
if(!shp->mktype)
@@ -2799,7 +2800,10 @@ int sh_exec(register const Shnode_t *t,
if(!shp->fpathdict)
shp->fpathdict = dtopen(&_Rpdisc,Dtobag);
- if(shp->fpathdict)
+ if(shp->fpathdict) {
if(shp->fpathdict)
+ {
+ dtuserdata(shp->fpathdict,shp,1);
dtinsert(shp->fpathdict,rp);
+ }
@ -47,7 +394,7 @@
}
else
--- src/lib/libast/Mamfile
+++ src/lib/libast/Mamfile 2013-01-30 10:01:13.000000000 +0000
+++ src/lib/libast/Mamfile 2013-10-25 13:20:42.806733139 +0000
@@ -3969,6 +3969,14 @@ meta dtopen.o %.c>%.o cdt/dtopen.c dtope
prev cdt/dtopen.c
exec - ${CC} ${mam_cc_FLAGS} ${CCFLAGS} -I. -Icdt -Icomp -Iinclude -Istd -I${INSTALLROOT}/include/ast -D_PACKAGE_ast -c cdt/dtopen.c
@ -87,8 +434,30 @@
exec - ${AR} rc libast.a _sfputu.o clearerr.o fclose.o fdopen.o feof.o ferror.o fflush.o fgetc.o fgetpos.o fgets.o fileno.o fopen.o fprintf.o fpurge.o fputc.o fputs.o fread.o freopen.o fscanf.o fseek.o fseeko.o fsetpos.o ftell.o ftello.o fwrite.o flockfile.o ftrylockfile.o funlockfile.o getc.o getchar.o getw.o pclose.o popen.o printf.o putc.o putchar.o puts.o putw.o rewind.o scanf.o setbuf.o setbuffer.o setlinebuf.o setvbuf.o snprintf.o sprintf.o sscanf.o asprintf.o vasprintf.o tmpfile.o ungetc.o vfprintf.o vfscanf.o vprintf.o vscanf.o vsnprintf.o vsprintf.o vsscanf.o _doprnt.o _doscan.o _filbuf.o _flsbuf.o _stdfun.o _stdopen.o _stdprintf.o _stdscanf.o _stdsprnt.o _stdvbuf.o _stdvsnprnt.o _stdvsprnt.o _stdvsscn.o fgetwc.o fwprintf.o putwchar.o vfwscanf.o wprintf.o fgetws.o fwscanf.o swprintf.o vswprintf.o wscanf.o fputwc.o getwc.o swscanf.o vswscanf.o fputws.o getwchar.o ungetwc.o vwprintf.o fwide.o putwc.o vfwprintf.o vwscanf.o stdio_c99.o fcloseall.o fmemopen.o getdelim.o getline.o frexp.o frexpl.o astcopy.o
exec - ${AR} rc libast.a astconf.o astdynamic.o astlicense.o astquery.o astwinsize.o conftab.o aststatic.o getopt.o getoptl.o aso.o asolock.o asometh.o asorelax.o aso-sem.o aso-fcntl.o vmbest.o vmclear.o vmclose.o vmdcheap.o vmdebug.o vmdisc.o vmexit.o vmlast.o vmopen.o vmpool.o vmprivate.o vmprofile.o vmregion.o vmsegment.o vmset.o vmstat.o vmstrdup.o vmtrace.o vmwalk.o vmmopen.o malloc.o vmgetmem.o a64l.o acosh.o asinh.o atanh.o cbrt.o crypt.o erf.o err.o exp.o exp__E.o expm1.o gamma.o getpass.o lgamma.o log.o log1p.o log__L.o rand48.o random.o rcmd.o rint.o support.o sfstrtmp.o spawn.o
exec - (ranlib libast.a) >/dev/null 2>&1 || true
--- src/lib/libast/cdt/cdtlib.h
+++ src/lib/libast/cdt/cdtlib.h 2013-10-25 13:20:42.807733047 +0000
@@ -58,9 +58,9 @@
/* This struct holds private method data created on DT_OPEN */
struct _dtdata_s
{ unsigned int lock; /* general dictionary lock */
- Dtuser_t user; /* application's data */
unsigned int type; /* method type, control flags */
ssize_t size; /* number of objects */
+ Dtuser_t user; /* application's data */
Dt_t dict; /* when DT_INDATA is requested */
};
@@ -123,7 +123,7 @@ typedef struct _dtlib_s
#endif /* _BLD_cdt */
/* these macros lock/unlock dictionaries. DTRETURN substitutes for "return" */
-#define DTSETLOCK(dt) (((dt)->data->type&DT_SHARE) ? asolock(&(dt)->data->lock,1,ASO_SPINLOCK) : 0 )
+#define DTSETLOCK(dt) (((dt)->data->type&DT_SHARE) ? asolock(&(dt)->data->lock,1,ASO_LOCK) : 0 )
#define DTCLRLOCK(dt) (((dt)->data->type&DT_SHARE) ? asolock(&(dt)->data->lock,1,ASO_UNLOCK) : 0 )
#define DTRETURN(ob,rv) do { (ob) = (rv); goto dt_return; } while(0)
#define DTERROR(dt, mesg) (!((dt)->disc && (dt)->disc->eventf) ? 0 : \
--- src/lib/libast/cdt/dtcomp.c
+++ src/lib/libast/cdt/dtcomp.c 2012-12-20 10:29:45.000000000 +0000
+++ src/lib/libast/cdt/dtcomp.c 2013-10-25 13:20:42.807733047 +0000
@@ -52,9 +52,3 @@ extern ssize_t dtsize(Dt_t* d)
{
return (ssize_t)(*(_DT(d)->searchf))((d),(Void_t*)(0),DT_STAT);
@ -100,7 +469,7 @@
- return (ssize_t)(*(_DT(d)->searchf))((d),(Void_t*)(0),DT_STAT);
-}
--- src/lib/libast/cdt/dthash.c
+++ src/lib/libast/cdt/dthash.c 2012-12-20 10:29:45.000000000 +0000
+++ src/lib/libast/cdt/dthash.c 2013-10-25 13:20:42.807733047 +0000
@@ -52,11 +52,13 @@ static int htable(Dt_t* dt)
if((n = hash->tblz) > 0 && (hash->type&H_FIXED) )
return 0; /* fixed size table */
@ -190,7 +559,7 @@
do_insert: /* inserting a new object */
--- src/lib/libast/cdt/dtlist.c
+++ src/lib/libast/cdt/dtlist.c 2012-12-20 10:29:45.000000000 +0000
+++ src/lib/libast/cdt/dtlist.c 2013-10-25 13:20:42.807733047 +0000
@@ -142,9 +142,9 @@ int type;
}
@ -234,7 +603,7 @@
if(type&(DT_DELETE|DT_DETACH|DT_REMOVE))
--- src/lib/libast/cdt/dtopen.c
+++ src/lib/libast/cdt/dtopen.c 2012-12-20 10:29:45.000000000 +0000
+++ src/lib/libast/cdt/dtopen.c 2013-10-25 13:20:42.808732955 +0000
@@ -153,25 +153,3 @@ void _dtfree(Dt_t* dt, Dtlink_t* l, int
if(disc->link < 0) /* free holder */
(void)(*dt->memoryf)(dt, (Void_t*)l, 0, disc);
@ -262,7 +631,7 @@
- }
-}
--- src/lib/libast/cdt/dtstat.c
+++ src/lib/libast/cdt/dtstat.c 2012-12-20 10:29:45.000000000 +0000
+++ src/lib/libast/cdt/dtstat.c 2013-10-25 13:20:42.808732955 +0000
@@ -0,0 +1,54 @@
+/***********************************************************************
+* *
@ -319,7 +688,7 @@
+ return sz;
+}
--- src/lib/libast/cdt/dtstrhash.c
+++ src/lib/libast/cdt/dtstrhash.c 2012-12-20 10:29:45.000000000 +0000
+++ src/lib/libast/cdt/dtstrhash.c 2013-10-25 13:20:42.808732955 +0000
@@ -22,40 +22,38 @@
#include "dthdr.h"
@ -380,7 +749,7 @@
+ return h;
}
--- src/lib/libast/cdt/dttree.c
+++ src/lib/libast/cdt/dttree.c 2012-12-20 10:29:45.000000000 +0000
+++ src/lib/libast/cdt/dttree.c 2013-10-25 13:20:42.808732955 +0000
@@ -545,7 +545,14 @@ int type;
}
else goto no_root;
@ -449,7 +818,7 @@
if(!(root = _dtmake(dt, obj, type)) )
{ obj = NIL(Void_t*);
--- src/lib/libast/cdt/dtuser.c
+++ src/lib/libast/cdt/dtuser.c 2012-12-20 10:29:45.000000000 +0000
+++ src/lib/libast/cdt/dtuser.c 2013-10-25 13:20:42.808732955 +0000
@@ -0,0 +1,59 @@
+/***********************************************************************
+* *
@ -510,30 +879,8 @@
+ return 0;
+ else return (*dt->disc->eventf)(dt, DT_ANNOUNCE|DT_USER|flags, data, dt->disc);
+}
--- src/lib/libast/cdt/cdtlib.h
+++ src/lib/libast/cdt/cdtlib.h 2013-10-09 10:14:11.000000000 +0000
@@ -58,9 +58,9 @@
/* This struct holds private method data created on DT_OPEN */
struct _dtdata_s
{ unsigned int lock; /* general dictionary lock */
- Dtuser_t user; /* application's data */
unsigned int type; /* method type, control flags */
ssize_t size; /* number of objects */
+ Dtuser_t user; /* application's data */
Dt_t dict; /* when DT_INDATA is requested */
};
@@ -123,7 +123,7 @@ typedef struct _dtlib_s
#endif /* _BLD_cdt */
/* these macros lock/unlock dictionaries. DTRETURN substitutes for "return" */
-#define DTSETLOCK(dt) (((dt)->data->type&DT_SHARE) ? asolock(&(dt)->data->lock,1,ASO_SPINLOCK) : 0 )
+#define DTSETLOCK(dt) (((dt)->data->type&DT_SHARE) ? asolock(&(dt)->data->lock,1,ASO_LOCK) : 0 )
#define DTCLRLOCK(dt) (((dt)->data->type&DT_SHARE) ? asolock(&(dt)->data->lock,1,ASO_UNLOCK) : 0 )
#define DTRETURN(ob,rv) do { (ob) = (rv); goto dt_return; } while(0)
#define DTERROR(dt, mesg) (!((dt)->disc && (dt)->disc->eventf) ? 0 : \
--- src/lib/libast/include/cdt.h
+++ src/lib/libast/include/cdt.h 2012-12-20 10:29:45.000000000 +0000
+++ src/lib/libast/include/cdt.h 2013-10-25 13:20:42.809732863 +0000
@@ -164,6 +164,7 @@ struct _dtstat_s
ssize_t msize; /* max #defined elts in below arrays */
ssize_t lsize[DT_MAXSIZE]; /* #objects by level */

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
--- src/cmd/builtin/pty.c
+++ src/cmd/builtin/pty.c 2013-10-10 11:38:40.722736462 +0000
+++ src/cmd/builtin/pty.c 2013-10-25 13:30:22.019295258 +0000
@@ -503,7 +503,7 @@ masterline(Sfio_t* mp, Sfio_t* lp, char*
char* t;
ssize_t n;
@ -19,7 +19,7 @@
}
master->vm = vm;
--- src/cmd/ksh93/edit/edit.c
+++ src/cmd/ksh93/edit/edit.c 2013-09-16 13:04:37.000000000 +0000
+++ src/cmd/ksh93/edit/edit.c 2013-10-25 13:30:22.020295166 +0000
@@ -1414,12 +1414,12 @@ int ed_internal(const char *src, genchar
int ed_external(const genchar *src, char *dest)
{
@ -44,7 +44,7 @@
{
/* copy the character as is */
--- src/cmd/ksh93/sh/init.c
+++ src/cmd/ksh93/sh/init.c 2013-10-10 10:44:39.762735998 +0000
+++ src/cmd/ksh93/sh/init.c 2013-10-25 13:30:22.020295166 +0000
@@ -1264,7 +1264,7 @@ Shell_t *sh_init(register int argc,regis
static int beenhere;
Shell_t *shp;
@ -64,7 +64,7 @@
n++;
np = (Namval_t*)calloc(n,sizeof(Namval_t));
--- src/cmd/ksh93/sh/macro.c
+++ src/cmd/ksh93/sh/macro.c 2013-10-18 09:26:43.677203216 +0200
+++ src/cmd/ksh93/sh/macro.c 2013-10-25 13:30:22.021295073 +0000
@@ -1794,7 +1794,7 @@ retry2:
register int d = (mode=='@'?' ':mp->ifs);
regoff_t match[2*(MATCH_MAX+1)];
@ -75,8 +75,8 @@
{
if(!v)
--- src/cmd/ksh93/sh/name.c
+++ src/cmd/ksh93/sh/name.c 2013-10-10 12:41:07.278235928 +0000
@@ -1354,7 +1354,7 @@ Namval_t *nv_open(const char *name, Dt_t
+++ src/cmd/ksh93/sh/name.c 2013-10-25 13:30:22.022294981 +0000
@@ -1344,7 +1344,7 @@ Namval_t *nv_open(const char *name, Dt_t
const char *msg = e_varname;
char *fname = 0;
int offset = staktell();
@ -85,7 +85,7 @@
#if NVCACHE
struct Cache_entry *xp;
#endif
@@ -1830,7 +1830,7 @@ void nv_putval(register Namval_t *np, co
@@ -1820,7 +1820,7 @@ void nv_putval(register Namval_t *np, co
else
{
const char *tofree=0;
@ -95,7 +95,7 @@
char buff[PATH_MAX];
#endif /* _lib_pathnative */
--- src/cmd/ksh93/sh/nvdisc.c
+++ src/cmd/ksh93/sh/nvdisc.c 2013-10-10 10:28:44.682236529 +0000
+++ src/cmd/ksh93/sh/nvdisc.c 2013-10-25 13:30:22.022294981 +0000
@@ -449,7 +449,7 @@ static Sfdouble_t lookupn(Namval_t *np,
char *nv_setdisc(register Namval_t* np,register const char *event,Namval_t *action,register Namfun_t *fp)
{
@ -115,17 +115,8 @@
if(vp && vp->fun.disc->putval!=assign)
vp = 0;
--- src/cmd/ksh93/sh/nvtree.c
+++ src/cmd/ksh93/sh/nvtree.c 2013-10-10 10:47:16.246316669 +0000
@@ -146,7 +146,7 @@ void *nv_diropen(Namval_t *np,const char
{
const char *last;
char *next;
- size_t c,len=strlen(name);
+ size_t c=0,len=strlen(name);
struct nvdir *save, *dp = new_of(struct nvdir,len+1);
Namval_t *nq=0,fake;
Namfun_t *nfp=0;
@@ -586,7 +586,7 @@ void nv_outnode(Namval_t *np, Sfio_t* ou
+++ src/cmd/ksh93/sh/nvtree.c 2013-10-25 13:30:22.023294889 +0000
@@ -583,7 +583,7 @@ void nv_outnode(Namval_t *np, Sfio_t* ou
char *fmtq,*ep,*xp;
Namval_t *mp;
Namarr_t *ap = nv_arrayptr(np);
@ -134,7 +125,7 @@
int saveI = Indent;
Indent = indent;
if(ap)
@@ -699,7 +699,7 @@ void nv_outnode(Namval_t *np, Sfio_t* ou
@@ -696,7 +696,7 @@ void nv_outnode(Namval_t *np, Sfio_t* ou
static void outval(char *name, const char *vname, struct Walk *wp)
{
@ -144,7 +135,7 @@
int isarray=0, special=0,mode=0;
if(*name!='.' || vname[strlen(vname)-1]==']')
--- src/cmd/ksh93/sh/nvtype.c
+++ src/cmd/ksh93/sh/nvtype.c 2013-10-10 12:33:08.394735609 +0000
+++ src/cmd/ksh93/sh/nvtype.c 2013-10-25 13:30:22.023294889 +0000
@@ -854,9 +854,10 @@ void nv_newtype(Namval_t *mp)
Namval_t *nv_mktype(Namval_t **nodes, int numnodes)
{
@ -166,7 +157,7 @@
for(nnodes=1,i=1; i <numnodes; i++)
{
np=nodes[i];
@@ -1101,7 +1102,6 @@ Namval_t *nv_mktype(Namval_t **nodes, in
@@ -1100,7 +1102,6 @@ Namval_t *nv_mktype(Namval_t **nodes, in
nv_disc(nq, &pp->childfun.fun, NV_LAST);
if(tp = (Namtype_t*)nv_hasdisc(nq, &type_disc))
tp->strsize = -tp->strsize;
@ -175,7 +166,7 @@
{
Namval_t *nr = nv_namptr(dp->nodes,r);
--- src/cmd/ksh93/sh/parse.c
+++ src/cmd/ksh93/sh/parse.c 2013-10-10 12:48:37.786235751 +0000
+++ src/cmd/ksh93/sh/parse.c 2013-10-25 13:30:22.024294796 +0000
@@ -301,7 +301,7 @@ static Shnode_t *getanode(Lex_t *lp, str
*/
static Shnode_t *makelist(Lex_t *lexp, int type, Shnode_t *l, Shnode_t *r)
@ -204,8 +195,8 @@
if(ac->comset || (ac->comtyp&COMSCAN))
errormsg(SH_DICT,ERROR_exit(3),e_lexsyntax4,lexp->sh->inlineno);
--- src/cmd/ksh93/sh/xec.c
+++ src/cmd/ksh93/sh/xec.c 2013-10-10 11:14:41.530735559 +0000
@@ -1505,7 +1505,7 @@ int sh_exec(register const Shnode_t *t,
+++ src/cmd/ksh93/sh/xec.c 2013-10-25 13:30:22.025294704 +0000
@@ -1507,7 +1507,7 @@ int sh_exec(register const Shnode_t *t,
Namval_t node;
#endif /* SHOPT_NAMESPACE */
struct Namref nr;
@ -214,7 +205,7 @@
register struct slnod *slp;
if(!np->nvalue.ip)
{
@@ -1910,8 +1910,8 @@ int sh_exec(register const Shnode_t *t,
@@ -1916,8 +1916,8 @@ int sh_exec(register const Shnode_t *t,
* don't create a new process, just
* save and restore io-streams
*/
@ -225,7 +216,7 @@
int simple = (t->fork.forktre->tre.tretyp&COMMSK)==TCOM;
struct checkpt *buffp = (struct checkpt*)stkalloc(shp->stk,sizeof(struct checkpt));
#if SHOPT_COSHELL
@@ -2403,7 +2403,7 @@ int sh_exec(register const Shnode_t *t,
@@ -2409,7 +2409,7 @@ int sh_exec(register const Shnode_t *t,
Shnode_t *tt = t->wh.whtre;
#if SHOPT_FILESCAN
Sfio_t *iop=0;
@ -234,7 +225,7 @@
#endif /*SHOPT_FILESCAN*/
#if SHOPT_OPTIMIZE
int jmpval = ((struct checkpt*)shp->jmplist)->mode;
@@ -2872,7 +2872,7 @@ int sh_exec(register const Shnode_t *t,
@@ -2877,7 +2877,7 @@ int sh_exec(register const Shnode_t *t,
else
{
register int traceon=0;
@ -243,7 +234,7 @@
register char *trap;
char *argv[6];
n = type>>TSHIFT;
@@ -2906,7 +2906,7 @@ int sh_exec(register const Shnode_t *t,
@@ -2911,7 +2911,7 @@ int sh_exec(register const Shnode_t *t,
}
else if(type&TBINARY)
{
@ -252,7 +243,7 @@
int pattern = 0;
if(trap || traceon)
op = (char*)(shtab_testops+(n&037)-1)->sh_name;
@@ -3371,7 +3371,7 @@ int sh_funscope(int argn, char *argv[],i
@@ -3376,7 +3376,7 @@ int sh_funscope(int argn, char *argv[],i
int jmpval;
volatile int r = 0;
int n;
@ -261,7 +252,7 @@
struct funenv *fp = 0;
struct checkpt *buffp = (struct checkpt*)stkalloc(shp->stk,sizeof(struct checkpt));
Namval_t *nspace = shp->namespace;
@@ -3487,10 +3487,10 @@ int sh_funscope(int argn, char *argv[],i
@@ -3492,10 +3492,10 @@ int sh_funscope(int argn, char *argv[],i
shp->st = *prevscope;
shp->topscope = (Shscope_t*)prevscope;
nv_getval(sh_scoped(shp,IFSNOD));
@ -274,7 +265,7 @@
stakset(savstak,0);
shp->options = options;
shp->last_root = last_root;
@@ -3579,11 +3579,11 @@ static void sh_funct(Shell_t *shp,Namval
@@ -3584,11 +3584,11 @@ static void sh_funct(Shell_t *shp,Namval
int sh_fun(Namval_t *np, Namval_t *nq, char *argv[])
{
Shell_t *shp = sh_getinterp();
@ -289,7 +280,7 @@
int n=0;
char *av[3];
--- src/lib/libast/sfio/sfstrtof.h
+++ src/lib/libast/sfio/sfstrtof.h 2013-10-10 10:03:43.826235847 +0000
+++ src/lib/libast/sfio/sfstrtof.h 2013-10-25 13:30:22.025294704 +0000
@@ -211,8 +211,8 @@ S2F_function(str, end) char* str; char**
int decimal = 0;
int thousand = 0;
@ -302,7 +293,7 @@
S2F_number p;
S2F_part_t parts[16];
--- src/lib/libast/sfio/sftable.c
+++ src/lib/libast/sfio/sftable.c 2013-10-10 10:08:26.026235628 +0000
+++ src/lib/libast/sfio/sftable.c 2013-10-25 13:30:22.026294612 +0000
@@ -53,7 +53,7 @@ int type; /* >0: scanf, =0: printf, -1:
#endif
{
@ -313,7 +304,7 @@
int v, n, skip, dollar, decimal, thousand;
Sffmt_t savft;
--- src/lib/libast/sfio/sfvprintf.c
+++ src/lib/libast/sfio/sfvprintf.c 2013-10-10 10:12:04.314277467 +0000
+++ src/lib/libast/sfio/sfvprintf.c 2013-10-25 13:30:22.026294612 +0000
@@ -101,7 +101,7 @@ char* form; /* format to use */
va_list args; /* arg list if !argf */
#endif
@ -333,7 +324,7 @@
SFMBDCL(mbs) /* state of some string */
#ifdef mbwidth
--- src/lib/libast/string/stropt.c
+++ src/lib/libast/string/stropt.c 2013-10-10 10:01:38.546735312 +0000
+++ src/lib/libast/string/stropt.c 2013-10-25 13:30:22.033293966 +0000
@@ -60,13 +60,13 @@ stropt(const char* as, const void* tab,
register char* v;
register char* t;
@ -351,7 +342,7 @@
if (!as) n = 0;
else if (!(x = s = strdup(as))) n = -1;
--- src/lib/libast/string/strtoi.h
+++ src/lib/libast/string/strtoi.h 2013-10-10 10:06:02.038735810 +0000
+++ src/lib/libast/string/strtoi.h 2013-10-25 13:30:22.027294520 +0000
@@ -230,13 +230,13 @@ S2I_function(a, e, base) const char* a;
#endif
register S2I_unumber n;

View File

@ -56,8 +56,16 @@ int main(int argc, char* argv[])
errno = 0;
}
if (tcgetattr(0, &o) < 0) {
#ifdef B115200
cfsetispeed(&o, B115200);
cfsetospeed(&o, B115200);
#elif defined(B57600)
cfsetispeed(&o, B57600);
cfsetospeed(&o, B57600);
#elif defined(B38400)
cfsetispeed(&o, B38400);
cfsetospeed(&o, B38400);
#endif
}
o.c_iflag = TTYDEF_IFLAG;
@ -66,7 +74,13 @@ int main(int argc, char* argv[])
# ifdef CBAUD
o.c_lflag &= ~CBAUD;
# endif
#ifdef B115200
o.c_cflag = B115200;
#elif defined(B57600)
o.c_cflag = B57600;
#elif defined(B38400)
o.c_cflag = B38400;
#endif
o.c_cflag |= TTYDEF_CFLAG;
/* Sane setting, allow eight bit characters, no carriage return delay