mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
'#if 0' cleanup
This removes various blocks of uncommented experimental code that was disabled using '#if 0' or '#if 1 ... #else' directives. It's hard or impossible to figure out what the thoughts behind them might have been, and we can really do without those distractions.
This commit is contained in:
parent
f8feed1bd2
commit
42301639d6
17 changed files with 4 additions and 227 deletions
|
@ -70,11 +70,6 @@ USAGE_LICENSE
|
||||||
"with the \bfunction\b reserved word, the specified variables "
|
"with the \bfunction\b reserved word, the specified variables "
|
||||||
"will have function static scope. Otherwise, the variable is "
|
"will have function static scope. Otherwise, the variable is "
|
||||||
"unset prior to processing the assignment list.]"
|
"unset prior to processing the assignment list.]"
|
||||||
#if 0
|
|
||||||
"[p?Causes the output to be in a form of \b\f?\f\b commands that can be "
|
|
||||||
"used as input to the shell to recreate the current type of "
|
|
||||||
"these variables.]"
|
|
||||||
#endif
|
|
||||||
"\n"
|
"\n"
|
||||||
"\n[name[=value]...]\n"
|
"\n[name[=value]...]\n"
|
||||||
"\n"
|
"\n"
|
||||||
|
@ -103,11 +98,7 @@ static int enuminfo(Opt_t* op, Sfio_t *out, const char *str, Optdisc_t *fp)
|
||||||
np = *(Namval_t**)(fp+1);
|
np = *(Namval_t**)(fp+1);
|
||||||
ep = (struct Enum*)np->nvfun;
|
ep = (struct Enum*)np->nvfun;
|
||||||
if(strcmp(str,"default")==0)
|
if(strcmp(str,"default")==0)
|
||||||
#if 0
|
|
||||||
sfprintf(out,"\b%s\b%c",ep->values[0],0);
|
|
||||||
#else
|
|
||||||
sfprintf(out,"\b%s\b",ep->values[0]);
|
sfprintf(out,"\b%s\b",ep->values[0]);
|
||||||
#endif
|
|
||||||
else if(strcmp(str,"case")==0)
|
else if(strcmp(str,"case")==0)
|
||||||
{
|
{
|
||||||
if(ep->iflag)
|
if(ep->iflag)
|
||||||
|
|
|
@ -227,10 +227,8 @@ static int waitnotify(int fd, long timeout, int rw)
|
||||||
if(service_list[file_list[i]])
|
if(service_list[file_list[i]])
|
||||||
*pstream++ = sh_fd2sfio(file_list[i]);
|
*pstream++ = sh_fd2sfio(file_list[i]);
|
||||||
}
|
}
|
||||||
#if 1
|
|
||||||
for(i=0; i < pstream-poll_list; i++)
|
for(i=0; i < pstream-poll_list; i++)
|
||||||
sfset(poll_list[i],SF_WRITE,0);
|
sfset(poll_list[i],SF_WRITE,0);
|
||||||
#endif
|
|
||||||
nready = ready = 0;
|
nready = ready = 0;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -246,10 +244,8 @@ static int waitnotify(int fd, long timeout, int rw)
|
||||||
sfprintf(sfstderr," %d",sffileno(poll_list[i]));
|
sfprintf(sfstderr," %d",sffileno(poll_list[i]));
|
||||||
sfputc(sfstderr,'\n');
|
sfputc(sfstderr,'\n');
|
||||||
#endif
|
#endif
|
||||||
#if 1
|
|
||||||
for(i=0; i < pstream-poll_list; i++)
|
for(i=0; i < pstream-poll_list; i++)
|
||||||
sfset(poll_list[i],SF_WRITE,1);
|
sfset(poll_list[i],SF_WRITE,1);
|
||||||
#endif
|
|
||||||
if(nready<=0)
|
if(nready<=0)
|
||||||
return(errno? -1: 0);
|
return(errno? -1: 0);
|
||||||
if(special && poll_list[0]==special)
|
if(special && poll_list[0]==special)
|
||||||
|
|
|
@ -538,11 +538,7 @@ static char *fmthtml(const char *string, int flags)
|
||||||
return(stakptr(offset));
|
return(stakptr(offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 1
|
|
||||||
static ssize_t fmtbase64(Sfio_t *iop, char *string, int alt)
|
static ssize_t fmtbase64(Sfio_t *iop, char *string, int alt)
|
||||||
#else
|
|
||||||
static void *fmtbase64(char *string, ssize_t *sz, int alt)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
char *cp;
|
char *cp;
|
||||||
Sfdouble_t d;
|
Sfdouble_t d;
|
||||||
|
@ -595,16 +591,9 @@ static void *fmtbase64(char *string, ssize_t *sz, int alt)
|
||||||
number.i = (int)d;
|
number.i = (int)d;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if 1
|
|
||||||
return(sfwrite(iop, (void*)&number, size));
|
return(sfwrite(iop, (void*)&number, size));
|
||||||
#else
|
|
||||||
if(sz)
|
|
||||||
*sz = size;
|
|
||||||
return((void*)&number);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
if(nv_isattr(np,NV_BINARY))
|
if(nv_isattr(np,NV_BINARY))
|
||||||
#if 1
|
|
||||||
{
|
{
|
||||||
Namfun_t *fp;
|
Namfun_t *fp;
|
||||||
for(fp=np->nvfun; fp;fp=fp->next)
|
for(fp=np->nvfun; fp;fp=fp->next)
|
||||||
|
@ -651,17 +640,6 @@ static void *fmtbase64(char *string, ssize_t *sz, int alt)
|
||||||
size = strlen(cp);
|
size = strlen(cp);
|
||||||
return(sfwrite(iop,cp,size));
|
return(sfwrite(iop,cp,size));
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
nv_onattr(np,NV_RAW);
|
|
||||||
cp = nv_getval(np);
|
|
||||||
if(nv_isattr(np,NV_BINARY))
|
|
||||||
nv_offattr(np,NV_RAW);
|
|
||||||
if((size = nv_size(np))==0)
|
|
||||||
size = strlen(cp);
|
|
||||||
if(sz)
|
|
||||||
*sz = size;
|
|
||||||
return((void*)cp);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int varname(const char *str, int n)
|
static int varname(const char *str, int n)
|
||||||
|
|
|
@ -1784,12 +1784,8 @@ USAGE_LICENSE
|
||||||
"[+?\btypeset\b is built in to the shell as a declaration command so that "
|
"[+?\btypeset\b is built in to the shell as a declaration command so that "
|
||||||
"field splitting and pathname expansion are not performed on "
|
"field splitting and pathname expansion are not performed on "
|
||||||
"the arguments. Tilde expansion occurs on \avalue\a.]"
|
"the arguments. Tilde expansion occurs on \avalue\a.]"
|
||||||
#if 1
|
|
||||||
"[a]:?[type?Indexed array. This is the default. If \b[\b\atype\a\b]]\b is "
|
"[a]:?[type?Indexed array. This is the default. If \b[\b\atype\a\b]]\b is "
|
||||||
"specified, each subscript is interpreted as a value of type \atype\a.]"
|
"specified, each subscript is interpreted as a value of type \atype\a.]"
|
||||||
#else
|
|
||||||
"[a?Indexed array. this is the default.]"
|
|
||||||
#endif
|
|
||||||
"[b?Each \aname\a may contain binary data. Its value is the mime "
|
"[b?Each \aname\a may contain binary data. Its value is the mime "
|
||||||
"base64 encoding of the data. It can be used with \b-Z\b, "
|
"base64 encoding of the data. It can be used with \b-Z\b, "
|
||||||
"to specify fixed sized fields.]"
|
"to specify fixed sized fields.]"
|
||||||
|
|
|
@ -133,17 +133,6 @@ typedef struct _shlex_
|
||||||
|
|
||||||
#define SH_COMPASSIGN 010 /* allow compound assignments only */
|
#define SH_COMPASSIGN 010 /* allow compound assignments only */
|
||||||
|
|
||||||
#if 0
|
|
||||||
typedef struct _shlex_
|
|
||||||
{
|
|
||||||
struct shlex_t _shlex;
|
|
||||||
#ifdef _SHLEX_PRIVATE
|
|
||||||
_SHLEX_PRIVATE
|
|
||||||
#endif
|
|
||||||
} Lex_t;
|
|
||||||
|
|
||||||
#define shlex (((Lex_t*)(sh.lex_context))->_shlex)
|
|
||||||
#endif
|
|
||||||
extern const char e_unexpected[];
|
extern const char e_unexpected[];
|
||||||
extern const char e_unmatched[];
|
extern const char e_unmatched[];
|
||||||
extern const char e_endoffile[];
|
extern const char e_endoffile[];
|
||||||
|
|
|
@ -490,11 +490,6 @@ static Sfdouble_t arith(const char **ptr, struct lval *lvalue, int type, Sfdoubl
|
||||||
|
|
||||||
case MESSAGE:
|
case MESSAGE:
|
||||||
sfsync(NIL(Sfio_t*));
|
sfsync(NIL(Sfio_t*));
|
||||||
#if 0
|
|
||||||
if(warn)
|
|
||||||
errormsg(SH_DICT,ERROR_warn(0),lvalue->value,*ptr);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
if(lvalue->emode&ARITH_COMP)
|
if(lvalue->emode&ARITH_COMP)
|
||||||
return(-1);
|
return(-1);
|
||||||
|
|
||||||
|
|
|
@ -1207,22 +1207,6 @@ Namval_t *nv_putsub(Namval_t *np,register char *sp,register long mode)
|
||||||
}
|
}
|
||||||
ap->header.nelem &= ~ARRAY_UNDEF;
|
ap->header.nelem &= ~ARRAY_UNDEF;
|
||||||
ap->header.nelem |= (mode&(ARRAY_SCAN|ARRAY_NOCHILD|ARRAY_UNDEF|ARRAY_NOSCOPE));
|
ap->header.nelem |= (mode&(ARRAY_SCAN|ARRAY_NOCHILD|ARRAY_UNDEF|ARRAY_NOSCOPE));
|
||||||
#if 0
|
|
||||||
if(array_isbit(ap->bits,oldsize,ARRAY_CHILD))
|
|
||||||
mp = ap->val[oldsize].np;
|
|
||||||
if(size != oldsize && mp->nvalue.cp)
|
|
||||||
{
|
|
||||||
Namfun_t *nfp;
|
|
||||||
for(nfp=np->nvfun; nfp; nfp=nfp->next)
|
|
||||||
{
|
|
||||||
if(nfp->disc && nfp->disc->readf)
|
|
||||||
{
|
|
||||||
(*nfp->disc->readf)(mp,(Sfio_t*)0,0,nfp);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
ap->cur = size;
|
ap->cur = size;
|
||||||
if((mode&ARRAY_SCAN) && (ap->cur--,!nv_nextsub(np)))
|
if((mode&ARRAY_SCAN) && (ap->cur--,!nv_nextsub(np)))
|
||||||
np = 0;
|
np = 0;
|
||||||
|
|
|
@ -348,10 +348,6 @@ static void put_restricted(register Namval_t* np,const char *val,int flags,Namfu
|
||||||
if(mp && (val=nv_getval(mp)))
|
if(mp && (val=nv_getval(mp)))
|
||||||
nv_putval(mp,val,NV_RDONLY);
|
nv_putval(mp,val,NV_RDONLY);
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
sfprintf(sfstderr,"%d: name=%s val=%s\n",getpid(),name,val);
|
|
||||||
path_dump((Pathcomp_t*)shp->pathlist);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -812,9 +812,6 @@ static void copyto(register Mac_t *mp,int endch, int newquote)
|
||||||
if(n==S_COLON && mp->assign==2 && *cp=='~' && endch==0 && !mp->quote &&!mp->lit)
|
if(n==S_COLON && mp->assign==2 && *cp=='~' && endch==0 && !mp->quote &&!mp->lit)
|
||||||
tilde = stktell(stkp)+(c+1);
|
tilde = stktell(stkp)+(c+1);
|
||||||
else if(n==S_SLASH && mp->pattern==2)
|
else if(n==S_SLASH && mp->pattern==2)
|
||||||
#if 0
|
|
||||||
goto pattern;
|
|
||||||
#else
|
|
||||||
{
|
{
|
||||||
if(mp->quote || mp->lit)
|
if(mp->quote || mp->lit)
|
||||||
goto pattern;
|
goto pattern;
|
||||||
|
@ -827,7 +824,6 @@ static void copyto(register Mac_t *mp,int endch, int newquote)
|
||||||
sfwrite(stkp,first,cp-first);
|
sfwrite(stkp,first,cp-first);
|
||||||
first=cp;
|
first=cp;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
case S_DOT:
|
case S_DOT:
|
||||||
if(*cp=='.' && mp->subcopy==1)
|
if(*cp=='.' && mp->subcopy==1)
|
||||||
|
|
|
@ -1052,9 +1052,6 @@ Namval_t *nv_create(const char *name, Dt_t *root, int flags, Namfun_t *dp)
|
||||||
#if SHOPT_FIXEDARRAY
|
#if SHOPT_FIXEDARRAY
|
||||||
Namarr_t *ap = nv_arrayptr(np);
|
Namarr_t *ap = nv_arrayptr(np);
|
||||||
#endif /* SHOPT_FIXEDARRAY */
|
#endif /* SHOPT_FIXEDARRAY */
|
||||||
#if 0
|
|
||||||
int scan = ap?(ap->nelem&ARRAY_SCAN):0;
|
|
||||||
#endif
|
|
||||||
n = mode|nv_isarray(np);
|
n = mode|nv_isarray(np);
|
||||||
if(!mode && (flags&NV_ARRAY) && ((c=sp[1])=='*' || c=='@') && sp[2]==']')
|
if(!mode && (flags&NV_ARRAY) && ((c=sp[1])=='*' || c=='@') && sp[2]==']')
|
||||||
{
|
{
|
||||||
|
@ -1078,10 +1075,6 @@ Namval_t *nv_create(const char *name, Dt_t *root, int flags, Namfun_t *dp)
|
||||||
flags &= ~NV_ARRAY;
|
flags &= ~NV_ARRAY;
|
||||||
|
|
||||||
#endif /* SHOPT_FIXEDARRAY */
|
#endif /* SHOPT_FIXEDARRAY */
|
||||||
#if 0
|
|
||||||
if(scan)
|
|
||||||
nv_putsub(np,NIL(char*),ARRAY_SCAN);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
cp = sp;
|
cp = sp;
|
||||||
|
@ -1307,13 +1300,6 @@ void nv_delete(Namval_t* np, Dt_t *root, int flags)
|
||||||
free((void*)np);
|
free((void*)np);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sfprintf(sfstderr,"%s not deleted\n",nv_name(np));
|
|
||||||
sfsync(sfstderr);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2644,7 +2630,6 @@ Namval_t *sh_scoped(Shell_t *shp, register Namval_t *np)
|
||||||
return(dtsearch(shp->var_tree,np));
|
return(dtsearch(shp->var_tree,np));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 1
|
|
||||||
/*
|
/*
|
||||||
* return space separated list of names of variables in given tree
|
* return space separated list of names of variables in given tree
|
||||||
*/
|
*/
|
||||||
|
@ -2674,7 +2659,6 @@ static char *tableval(Dt_t *root)
|
||||||
dtview(root,base);
|
dtview(root,base);
|
||||||
return((char*)out->_data);
|
return((char*)out->_data);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if SHOPT_OPTIMIZE
|
#if SHOPT_OPTIMIZE
|
||||||
struct optimize
|
struct optimize
|
||||||
|
@ -3164,12 +3148,7 @@ char *sh_getenv(const char *name)
|
||||||
Shell_t *shp = sh_getinterp();
|
Shell_t *shp = sh_getinterp();
|
||||||
register Namval_t *np;
|
register Namval_t *np;
|
||||||
if(!shp->var_tree)
|
if(!shp->var_tree)
|
||||||
{
|
|
||||||
#if 0
|
|
||||||
if(name[0] == 'P' && name[1] == 'A' && name[2] == 'T' && name[3] == 'H' && name[4] == 0 || name[0] == 'L' && ((name[1] == 'C' || name[1] == 'D') && name[2] == '_' || name[1] == 'A' && name[1] == 'N') || name[0] == 'V' && name[1] == 'P' && name[2] == 'A' && name[3] == 'T' && name[4] == 'H' && name[5] == 0 || name[0] == '_' && name[1] == 'R' && name[2] == 'L' && name[3] == 'D' || name[0] == '_' && name[1] == 'A' && name[2] == 'S' && name[3] == 'T' && name[4] == '_')
|
|
||||||
#endif
|
|
||||||
return(oldgetenv(name));
|
return(oldgetenv(name));
|
||||||
}
|
|
||||||
else if((np = nv_search(name,shp->var_tree,0)) && nv_isattr(np,NV_EXPORT))
|
else if((np = nv_search(name,shp->var_tree,0)) && nv_isattr(np,NV_EXPORT))
|
||||||
return(nv_getval(np));
|
return(nv_getval(np));
|
||||||
return(0);
|
return(0);
|
||||||
|
@ -3655,11 +3634,7 @@ char *nv_name(register Namval_t *np)
|
||||||
return(sfstruse(shp->strbuf));
|
return(sfstruse(shp->strbuf));
|
||||||
}
|
}
|
||||||
if(nv_istable(np))
|
if(nv_istable(np))
|
||||||
#if 1
|
|
||||||
shp->last_table = nv_parent(np);
|
shp->last_table = nv_parent(np);
|
||||||
#else
|
|
||||||
shp->last_table = nv_create(np,0, NV_LAST,(Namfun_t*)0);
|
|
||||||
#endif
|
|
||||||
else if(!nv_isref(np))
|
else if(!nv_isref(np))
|
||||||
{
|
{
|
||||||
for(fp= np->nvfun ; fp; fp=fp->next)
|
for(fp= np->nvfun ; fp; fp=fp->next)
|
||||||
|
|
|
@ -1415,16 +1415,8 @@ Dt_t *nv_dict(Namval_t* np)
|
||||||
if(tp)
|
if(tp)
|
||||||
return(tp->dict);
|
return(tp->dict);
|
||||||
np = shp->last_table;
|
np = shp->last_table;
|
||||||
while(np)
|
if(np && (tp = (struct table*)nv_hasdisc(np,&table_disc)))
|
||||||
{
|
|
||||||
if(tp = (struct table*)nv_hasdisc(np,&table_disc))
|
|
||||||
return(tp->dict);
|
return(tp->dict);
|
||||||
#if 0
|
|
||||||
np = nv_create(np,(const char*)0, NV_FIRST, (Namfun_t*)0);
|
|
||||||
#else
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
return(shp->var_tree);
|
return(shp->var_tree);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,6 @@ void *nv_diropen(Namval_t *np,const char *name)
|
||||||
dp->data[len] = 0;
|
dp->data[len] = 0;
|
||||||
dp->len = len;
|
dp->len = len;
|
||||||
dp->root = sh.last_root?sh.last_root:sh.var_tree;
|
dp->root = sh.last_root?sh.last_root:sh.var_tree;
|
||||||
#if 1
|
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
dp->table = sh.last_table;
|
dp->table = sh.last_table;
|
||||||
|
@ -176,11 +175,6 @@ void *nv_diropen(Namval_t *np,const char *name)
|
||||||
dp->root = nv_dict(np);
|
dp->root = nv_dict(np);
|
||||||
name = next+1;
|
name = next+1;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
dp->table = sh.last_table;
|
|
||||||
sh.last_table = 0;
|
|
||||||
last = dp->data;
|
|
||||||
#endif
|
|
||||||
if(*name)
|
if(*name)
|
||||||
{
|
{
|
||||||
fake.nvname = (char*)name;
|
fake.nvname = (char*)name;
|
||||||
|
@ -282,28 +276,14 @@ char *nv_dirnext(void *dir)
|
||||||
{
|
{
|
||||||
while(np=dp->hp)
|
while(np=dp->hp)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
char *sptr;
|
|
||||||
#endif
|
|
||||||
if(nv_isarray(np))
|
if(nv_isarray(np))
|
||||||
nv_putsub(np,(char*)0, ARRAY_UNDEF);
|
nv_putsub(np,(char*)0, ARRAY_UNDEF);
|
||||||
dp->hp = nextnode(dp);
|
dp->hp = nextnode(dp);
|
||||||
if(nv_isnull(np) && !nv_isarray(np) && !nv_isattr(np,NV_INTEGER))
|
if(nv_isnull(np) && !nv_isarray(np) && !nv_isattr(np,NV_INTEGER))
|
||||||
continue;
|
continue;
|
||||||
last_table = sh.last_table;
|
last_table = sh.last_table;
|
||||||
#if 0
|
|
||||||
if(dp->table && dp->otable && !nv_isattr(dp->table,NV_MINIMAL))
|
|
||||||
{
|
|
||||||
sptr = dp->table->nvenv;
|
|
||||||
dp->table->nvenv = (char*)dp->otable;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
sh.last_table = dp->table;
|
sh.last_table = dp->table;
|
||||||
cp = nv_name(np);
|
cp = nv_name(np);
|
||||||
#if 0
|
|
||||||
if(dp->table && dp->otable && !nv_isattr(dp->table,NV_MINIMAL))
|
|
||||||
dp->table->nvenv = sptr;
|
|
||||||
#endif
|
|
||||||
if(dp->nextnode && !dp->hp && (nq = (Namval_t*)dp->table))
|
if(dp->nextnode && !dp->hp && (nq = (Namval_t*)dp->table))
|
||||||
{
|
{
|
||||||
Namarr_t *ap = nv_arrayptr(nq);
|
Namarr_t *ap = nv_arrayptr(nq);
|
||||||
|
@ -342,11 +322,6 @@ char *nv_dirnext(void *dir)
|
||||||
memcpy(dp->data,cp,len+1);
|
memcpy(dp->data,cp,len+1);
|
||||||
if(nfp && np->nvfun)
|
if(nfp && np->nvfun)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
Namarr_t *ap = nv_arrayptr(np);
|
|
||||||
if(ap && (ap->nelem&ARRAY_UNDEF))
|
|
||||||
nv_putsub(np,(char*)0,ARRAY_SCAN);
|
|
||||||
#endif
|
|
||||||
dp->nextnode = nfp->disc->nextf;
|
dp->nextnode = nfp->disc->nextf;
|
||||||
dp->otable = dp->table;
|
dp->otable = dp->table;
|
||||||
dp->table = np;
|
dp->table = np;
|
||||||
|
|
|
@ -99,16 +99,6 @@ struct Namtype
|
||||||
unsigned short nref;
|
unsigned short nref;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if 0
|
|
||||||
struct type
|
|
||||||
{
|
|
||||||
Namtype_t hdr;
|
|
||||||
unsigned short ndisc;
|
|
||||||
unsigned short current;
|
|
||||||
unsigned short nref;
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char _cSfdouble_t;
|
char _cSfdouble_t;
|
||||||
|
@ -148,9 +138,6 @@ static const Namdisc_t type_disc =
|
||||||
0,
|
0,
|
||||||
next_type,
|
next_type,
|
||||||
0,
|
0,
|
||||||
#if 0
|
|
||||||
read_type
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
size_t nv_datasize(Namval_t *np, size_t *offset)
|
size_t nv_datasize(Namval_t *np, size_t *offset)
|
||||||
|
@ -329,13 +316,8 @@ static int fixnode(Namtype_t *dp, Namtype_t *pp, int i, struct Namref *nrp,int f
|
||||||
if(fp)
|
if(fp)
|
||||||
nv_disc(np, fp, NV_LAST);
|
nv_disc(np, fp, NV_LAST);
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
if(nq->nvalue.cp >= pp->data && nq->nvalue.cp < (char*)pp +pp->fun.dsize)
|
|
||||||
nq->nvalue.cp = dp->data + (nq->nvalue.cp-pp->data);
|
|
||||||
#else
|
|
||||||
if(data >= pp->data && data < (char*)pp +pp->fun.dsize)
|
if(data >= pp->data && data < (char*)pp +pp->fun.dsize)
|
||||||
nq->nvalue.cp = dp->data + (data-pp->data);
|
nq->nvalue.cp = dp->data + (data-pp->data);
|
||||||
#endif
|
|
||||||
else if(!nq->nvfun && pp->childfun.ttype!=pp->childfun.ptype)
|
else if(!nq->nvfun && pp->childfun.ttype!=pp->childfun.ptype)
|
||||||
{
|
{
|
||||||
Namval_t *nr = nv_namptr( pp->childfun.ttype->nodes,i);
|
Namval_t *nr = nv_namptr( pp->childfun.ttype->nodes,i);
|
||||||
|
@ -390,17 +372,10 @@ static Namfun_t *clone_type(Namval_t* np, Namval_t *mp, int flags, Namfun_t *fp)
|
||||||
memset((void*)nrp,0,pp->nref*sizeof(struct Namref));
|
memset((void*)nrp,0,pp->nref*sizeof(struct Namref));
|
||||||
}
|
}
|
||||||
memcpy((void*)dp,(void*)pp,size);
|
memcpy((void*)dp,(void*)pp,size);
|
||||||
#if 0
|
|
||||||
dp->parent = nv_lastdict();
|
|
||||||
#else
|
|
||||||
dp->parent = mp;
|
dp->parent = mp;
|
||||||
#endif
|
|
||||||
dp->fun.nofree = (flags&NV_RDONLY?1:0);
|
dp->fun.nofree = (flags&NV_RDONLY?1:0);
|
||||||
dp->np = mp;
|
dp->np = mp;
|
||||||
dp->childfun.ptype = dp;
|
dp->childfun.ptype = dp;
|
||||||
#if 0
|
|
||||||
dp->childfun.ttype = (Namtype_t*)nv_hasdisc(dp->fun.type,&type_disc);
|
|
||||||
#endif
|
|
||||||
dp->nodes = (char*)(dp+1);
|
dp->nodes = (char*)(dp+1);
|
||||||
dp->data = (char*)dp + (pp->data - (char*)pp);
|
dp->data = (char*)dp + (pp->data - (char*)pp);
|
||||||
for(i=dp->numnodes; --i >= 0; )
|
for(i=dp->numnodes; --i >= 0; )
|
||||||
|
@ -1097,7 +1072,6 @@ Namval_t *nv_mktype(Namval_t **nodes, int numnodes)
|
||||||
nv_disc(nq, &pp->childfun.fun, NV_LAST);
|
nv_disc(nq, &pp->childfun.fun, NV_LAST);
|
||||||
if(tp = (Namtype_t*)nv_hasdisc(nq, &type_disc))
|
if(tp = (Namtype_t*)nv_hasdisc(nq, &type_disc))
|
||||||
tp->strsize = -tp->strsize;
|
tp->strsize = -tp->strsize;
|
||||||
else sfprintf(sfstderr,"tp==NULL\n");
|
|
||||||
for(r=0; r < dp->numnodes; r++)
|
for(r=0; r < dp->numnodes; r++)
|
||||||
{
|
{
|
||||||
Namval_t *nr = nv_namptr(dp->nodes,r);
|
Namval_t *nr = nv_namptr(dp->nodes,r);
|
||||||
|
@ -1182,11 +1156,7 @@ else sfprintf(sfstderr,"tp==NULL\n");
|
||||||
if(!nq->nvalue.cp && nq->nvfun== &pp->childfun.fun)
|
if(!nq->nvalue.cp && nq->nvfun== &pp->childfun.fun)
|
||||||
nq->nvalue.cp = Empty;
|
nq->nvalue.cp = Empty;
|
||||||
np->nvalue.cp = 0;
|
np->nvalue.cp = 0;
|
||||||
#if 0
|
|
||||||
offset += dsize;
|
|
||||||
#else
|
|
||||||
offset += (dsize?dsize:4);
|
offset += (dsize?dsize:4);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
k++;
|
k++;
|
||||||
skip:
|
skip:
|
||||||
|
@ -1426,10 +1396,6 @@ Fields_t foo[]=
|
||||||
FIELD(time,a),
|
FIELD(time,a),
|
||||||
FIELD(time,m),
|
FIELD(time,m),
|
||||||
FIELD(time,c),
|
FIELD(time,c),
|
||||||
#if 0
|
|
||||||
FIELD(blksize,),
|
|
||||||
FIELD(blocks,),
|
|
||||||
#endif
|
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1572,10 +1572,6 @@ static Shnode_t *simple(Lex_t *lexp,int flag, struct ionod *io)
|
||||||
writedefs(lexp,argp,line,0,NIL(struct argnod*));
|
writedefs(lexp,argp,line,0,NIL(struct argnod*));
|
||||||
else if(argp && strcmp(argp->argval,"read")==0)
|
else if(argp && strcmp(argp->argval,"read")==0)
|
||||||
writedefs(lexp,argp,line,0,NIL(struct argnod*));
|
writedefs(lexp,argp,line,0,NIL(struct argnod*));
|
||||||
#if 0
|
|
||||||
else if(argp && strcmp(argp->argval,"unset")==0)
|
|
||||||
writedefs(lexp,argp,line,'u',NIL(struct argnod*));
|
|
||||||
#endif
|
|
||||||
else if(argp && *argp->argval=='.' && argp->argval[1]==0 && (argp=argp->argnxt.ap))
|
else if(argp && *argp->argval=='.' && argp->argval[1]==0 && (argp=argp->argnxt.ap))
|
||||||
{
|
{
|
||||||
r = kiaentity(lexp,sh_argstr(argp),-1,'p',0,0,lexp->script,'d',0,"");
|
r = kiaentity(lexp,sh_argstr(argp),-1,'p',0,0,lexp->script,'d',0,"");
|
||||||
|
|
|
@ -355,19 +355,6 @@ static char *path_lib(Shell_t *shp,Pathcomp_t *pp, char *path)
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
void path_dump(register Pathcomp_t *pp)
|
|
||||||
{
|
|
||||||
sfprintf(sfstderr,"dump\n");
|
|
||||||
while(pp)
|
|
||||||
{
|
|
||||||
sfprintf(sfstderr,"pp=%x dev=%d ino=%d len=%d flags=%o name=%.*s\n",
|
|
||||||
pp,pp->dev,pp->ino,pp->len,pp->flags,pp->len,pp->name);
|
|
||||||
pp = pp->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* check for duplicate directories on PATH
|
* check for duplicate directories on PATH
|
||||||
*/
|
*/
|
||||||
|
@ -1705,9 +1692,6 @@ void path_newdir(Shell_t *shp,Pathcomp_t *first)
|
||||||
pp->next = next;
|
pp->next = next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
path_dump(first);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Pathcomp_t *path_unsetfpath(Shell_t *shp)
|
Pathcomp_t *path_unsetfpath(Shell_t *shp)
|
||||||
|
|
|
@ -194,23 +194,6 @@ static struct argnod *r_arg(Shell_t *shp)
|
||||||
ap->argval[l] = 0;
|
ap->argval[l] = 0;
|
||||||
ap->argchn.cp = 0;
|
ap->argchn.cp = 0;
|
||||||
ap->argflag = sfgetc(infile);
|
ap->argflag = sfgetc(infile);
|
||||||
#if 0
|
|
||||||
if((ap->argflag&ARG_MESSAGE) && *ap->argval)
|
|
||||||
{
|
|
||||||
/* replace international messages */
|
|
||||||
sh_endword(shp,1);
|
|
||||||
ap->argflag &= ~ARG_MESSAGE;
|
|
||||||
if(!(ap->argflag&(ARG_MAC|ARG_EXP)))
|
|
||||||
ap = sh_endword(shp,0);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ap = (struct argnod*)stkfreeze(stkp,0);
|
|
||||||
if(ap->argflag==0)
|
|
||||||
ap->argflag = ARG_RAW;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
ap = (struct argnod*)stkfreeze(stkp,0);
|
ap = (struct argnod*)stkfreeze(stkp,0);
|
||||||
if(*ap->argval==0 && (ap->argflag&ARG_EXP))
|
if(*ap->argval==0 && (ap->argflag&ARG_EXP))
|
||||||
ap->argchn.ap = (struct argnod*)r_tree(shp);
|
ap->argchn.ap = (struct argnod*)r_tree(shp);
|
||||||
|
|
|
@ -1143,10 +1143,6 @@ int sh_exec(register const Shnode_t *t, int flags)
|
||||||
flgs |= NV_IDENT;
|
flgs |= NV_IDENT;
|
||||||
else
|
else
|
||||||
flgs |= NV_VARNAME;
|
flgs |= NV_VARNAME;
|
||||||
#if 0
|
|
||||||
if(OPTIMIZE)
|
|
||||||
flgs |= NV_TAGGED;
|
|
||||||
#endif
|
|
||||||
nv_setlist(argp,flgs,tp);
|
nv_setlist(argp,flgs,tp);
|
||||||
if(np==shp->typeinit)
|
if(np==shp->typeinit)
|
||||||
shp->typeinit = 0;
|
shp->typeinit = 0;
|
||||||
|
@ -1414,10 +1410,6 @@ int sh_exec(register const Shnode_t *t, int flags)
|
||||||
shp->redir0 = 0;
|
shp->redir0 = 0;
|
||||||
if(jmpval)
|
if(jmpval)
|
||||||
siglongjmp(*shp->jmplist,jmpval);
|
siglongjmp(*shp->jmplist,jmpval);
|
||||||
#if 0
|
|
||||||
if(flgs&NV_STATIC)
|
|
||||||
((Shnode_t*)t)->com.comset = 0;
|
|
||||||
#endif
|
|
||||||
if(shp->exitval >=0)
|
if(shp->exitval >=0)
|
||||||
goto setexit;
|
goto setexit;
|
||||||
np = 0;
|
np = 0;
|
||||||
|
@ -3060,9 +3052,6 @@ int sh_funscope(int argn, char *argv[],int(*fun)(void*),void *arg,int execflg)
|
||||||
shp->glob_options = shp->options;
|
shp->glob_options = shp->options;
|
||||||
else
|
else
|
||||||
shp->options = shp->glob_options;
|
shp->options = shp->glob_options;
|
||||||
#if 0
|
|
||||||
shp->st.lineno = error_info.line;
|
|
||||||
#endif
|
|
||||||
*prevscope = shp->st;
|
*prevscope = shp->st;
|
||||||
sh_offoption(SH_ERREXIT);
|
sh_offoption(SH_ERREXIT);
|
||||||
shp->st.prevst = prevscope;
|
shp->st.prevst = prevscope;
|
||||||
|
@ -3240,11 +3229,7 @@ static void sh_funct(Shell_t *shp,Namval_t *np,int argn, char *argv[],struct arg
|
||||||
SH_LEVELNOD->nvalue.s = lp->maxlevel;
|
SH_LEVELNOD->nvalue.s = lp->maxlevel;
|
||||||
shp->last_root = nv_dict(DOTSHNOD);
|
shp->last_root = nv_dict(DOTSHNOD);
|
||||||
shp->comsub = comsub;
|
shp->comsub = comsub;
|
||||||
#if 0
|
|
||||||
nv_putval(SH_FUNNAMENOD,shp->st.funname,NV_NOFREE);
|
|
||||||
#else
|
|
||||||
nv_putval(SH_FUNNAMENOD,fname,NV_NOFREE);
|
nv_putval(SH_FUNNAMENOD,fname,NV_NOFREE);
|
||||||
#endif
|
|
||||||
nv_putval(SH_PATHNAMENOD,shp->st.filename,NV_NOFREE);
|
nv_putval(SH_PATHNAMENOD,shp->st.filename,NV_NOFREE);
|
||||||
shp->pipepid = pipepid;
|
shp->pipepid = pipepid;
|
||||||
np->nvalue.rp->running -= 2;
|
np->nvalue.rp->running -= 2;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue