mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-15 04:32:24 +00:00
This removes #ifdefs checking for the existence of SH_PLUGIN_VERSION (version check for dynamically loaded builtins) and the SFIO identifiers SF_BUFCONST, SF_CLOSING, SF_APPENDWR, SF_ATEXIT, all of which are defined by the bundled libast.
This commit is contained in:
parent
c7242de16f
commit
0b814b53bd
8 changed files with 18 additions and 80 deletions
|
@ -1027,7 +1027,7 @@ int b_builtin(int argc,char *argv[],Shbltin_t *context)
|
|||
Stk_t *stkp;
|
||||
void *library=0;
|
||||
char *errmsg;
|
||||
#ifdef SH_PLUGIN_VERSION
|
||||
#if SHOPT_DYNAMIC
|
||||
unsigned long ver;
|
||||
int list = 0;
|
||||
char path[1024];
|
||||
|
@ -1055,7 +1055,7 @@ int b_builtin(int argc,char *argv[],Shbltin_t *context)
|
|||
#endif /* SHOPT_DYNAMIC */
|
||||
break;
|
||||
case 'l':
|
||||
#ifdef SH_PLUGIN_VERSION
|
||||
#if SHOPT_DYNAMIC
|
||||
list = 1;
|
||||
#endif
|
||||
break;
|
||||
|
@ -1083,7 +1083,6 @@ int b_builtin(int argc,char *argv[],Shbltin_t *context)
|
|||
#if SHOPT_DYNAMIC
|
||||
if(arg)
|
||||
{
|
||||
#ifdef SH_PLUGIN_VERSION
|
||||
if(!(library = dllplugin(SH_ID, arg, NiL, SH_PLUGIN_VERSION, &ver, RTLD_LAZY, path, sizeof(path))))
|
||||
{
|
||||
errormsg(SH_DICT,ERROR_exit(0),"%s: %s",arg,dllerror(0));
|
||||
|
@ -1091,13 +1090,6 @@ int b_builtin(int argc,char *argv[],Shbltin_t *context)
|
|||
}
|
||||
if(list)
|
||||
sfprintf(sfstdout, "%s %08lu %s\n", arg, ver, path);
|
||||
#else
|
||||
if(!(library = dllplug(SH_ID,arg,NIL(char*),RTLD_LAZY,NIL(char*),0)))
|
||||
{
|
||||
errormsg(SH_DICT,ERROR_exit(0),"%s: %s",arg,dlerror());
|
||||
return(1);
|
||||
}
|
||||
#endif
|
||||
sh_addlib(tdata.sh,library,arg,NiL);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -110,14 +110,8 @@ static History_t* hist_trim(History_t*, int);
|
|||
static int hist_nearend(History_t*,Sfio_t*, off_t);
|
||||
static int hist_check(int);
|
||||
static int hist_clean(int);
|
||||
#ifdef SF_BUFCONST
|
||||
static ssize_t hist_write(Sfio_t*, const void*, size_t, Sfdisc_t*);
|
||||
static int hist_exceptf(Sfio_t*, int, void*, Sfdisc_t*);
|
||||
#else
|
||||
static int hist_write(Sfio_t*, const void*, int, Sfdisc_t*);
|
||||
static int hist_exceptf(Sfio_t*, int, Sfdisc_t*);
|
||||
#endif
|
||||
|
||||
static ssize_t hist_write(Sfio_t*, const void*, size_t, Sfdisc_t*);
|
||||
static int hist_exceptf(Sfio_t*, int, void*, Sfdisc_t*);
|
||||
|
||||
static int histinit;
|
||||
static mode_t histmode;
|
||||
|
@ -788,11 +782,7 @@ void hist_flush(register History_t *hp)
|
|||
* a zero byte. Line sequencing is added as required
|
||||
*/
|
||||
|
||||
#ifdef SF_BUFCONST
|
||||
static ssize_t hist_write(Sfio_t *iop,const void *buff,register size_t insize,Sfdisc_t* handle)
|
||||
#else
|
||||
static int hist_write(Sfio_t *iop,const void *buff,register int insize,Sfdisc_t* handle)
|
||||
#endif
|
||||
{
|
||||
register History_t *hp = (History_t*)handle;
|
||||
register char *bufptr = ((char*)buff)+insize;
|
||||
|
@ -1174,14 +1164,11 @@ done:
|
|||
/*
|
||||
* Handle history file exceptions
|
||||
*/
|
||||
#ifdef SF_BUFCONST
|
||||
static int hist_exceptf(Sfio_t* fp, int type, void *data, Sfdisc_t *handle)
|
||||
#else
|
||||
static int hist_exceptf(Sfio_t* fp, int type, Sfdisc_t *handle)
|
||||
#endif
|
||||
{
|
||||
register int newfd,oldfd;
|
||||
History_t *hp = (History_t*)handle;
|
||||
NOT_USED(data);
|
||||
if(type==SF_WRITE)
|
||||
{
|
||||
if(errno==ENOSPC || hp->histwfail++ >= 10)
|
||||
|
|
|
@ -32,13 +32,6 @@
|
|||
#endif /* IOBSIZE */
|
||||
#define IOMAXTRY 20
|
||||
|
||||
#ifndef SF_CLOSING
|
||||
#define SF_CLOSING SF_CLOSE
|
||||
#endif
|
||||
#ifndef SF_APPENDWR
|
||||
#define SF_APPENDWR SF_APPEND
|
||||
#endif
|
||||
|
||||
/* used for output of shell errors */
|
||||
#define ERRIO 2
|
||||
|
||||
|
|
|
@ -2386,13 +2386,11 @@ static int subexcept(Sfio_t* sp,register int mode, void *data, Sfdisc_t* handle)
|
|||
free((void*)disp);
|
||||
return(0);
|
||||
}
|
||||
#ifdef SF_ATEXIT
|
||||
else if (mode==SF_ATEXIT)
|
||||
{
|
||||
sfdisc(sp, SF_POPDISC);
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
else if(mode==SF_READ)
|
||||
return(0);
|
||||
return(-1);
|
||||
|
|
|
@ -123,11 +123,7 @@ struct lexdata
|
|||
#define poplevel(lp) (lp->lexd.lastc=lp->lexd.lex_match[--lp->lexd.level])
|
||||
|
||||
static char *fmttoken(Lex_t*, int, char*);
|
||||
#ifdef SF_BUFCONST
|
||||
static int alias_exceptf(Sfio_t*, int, void*, Sfdisc_t*);
|
||||
#else
|
||||
static int alias_exceptf(Sfio_t*, int, Sfdisc_t*);
|
||||
#endif
|
||||
static int alias_exceptf(Sfio_t*, int, void*, Sfdisc_t*);
|
||||
static void setupalias(Lex_t*,const char*, Namval_t*);
|
||||
static int comsub(Lex_t*,int);
|
||||
static void nested_here(Lex_t*);
|
||||
|
@ -2414,22 +2410,12 @@ struct alias
|
|||
/*
|
||||
* This code gets called whenever an end of string is found with alias
|
||||
*/
|
||||
|
||||
#ifndef SF_ATEXIT
|
||||
# define SF_ATEXIT 0
|
||||
#endif
|
||||
/*
|
||||
* This code gets called whenever an end of string is found with alias
|
||||
*/
|
||||
#ifdef SF_BUFCONST
|
||||
static int alias_exceptf(Sfio_t *iop,int type,void *data, Sfdisc_t *handle)
|
||||
#else
|
||||
static int alias_exceptf(Sfio_t *iop,int type,Sfdisc_t *handle)
|
||||
#endif
|
||||
{
|
||||
register struct alias *ap = (struct alias*)handle;
|
||||
register Namval_t *np;
|
||||
register Lex_t *lp;
|
||||
NOT_USED(data);
|
||||
if(type==0 || type==SF_ATEXIT || !ap)
|
||||
return(0);
|
||||
lp = ap->lp;
|
||||
|
@ -2448,7 +2434,7 @@ static int alias_exceptf(Sfio_t *iop,int type,Sfdisc_t *handle)
|
|||
}
|
||||
if(ap->nextc)
|
||||
{
|
||||
/* if last character is a blank, then next work can be alias */
|
||||
/* if last character is a blank, then next word can be alias */
|
||||
register int c = fcpeek(-1);
|
||||
if(isblank(c))
|
||||
lp->aliasok = 1;
|
||||
|
|
|
@ -108,10 +108,6 @@ struct adata
|
|||
char nv_local = 0;
|
||||
static void(*nullscan)(Namval_t*,void*);
|
||||
|
||||
#if ( SFIO_VERSION <= 20010201L )
|
||||
# define _data data
|
||||
#endif
|
||||
|
||||
/* ======== name value pair routines ======== */
|
||||
|
||||
#include "shnodes.h"
|
||||
|
|
|
@ -46,12 +46,6 @@
|
|||
|
||||
#define HERE_MEM SF_BUFSIZE /* size of here-docs kept in memory */
|
||||
|
||||
#if CDT_VERSION < 20111111L
|
||||
#define hash nvlink.hl._hash
|
||||
#else
|
||||
#define hash nvlink.lh.__hash
|
||||
#endif
|
||||
|
||||
/* These routines are local to this module */
|
||||
|
||||
static Shnode_t *makeparent(Lex_t*, int, Shnode_t*);
|
||||
|
@ -1999,6 +1993,15 @@ static Shnode_t *test_primary(Lex_t *lexp)
|
|||
}
|
||||
|
||||
#if SHOPT_KIA
|
||||
/*
|
||||
* ksh is currently compiled with -D_API_ast=20100309, which sets CDT_VERSION to 20100309 in src/lib/libast/include/cdt.h
|
||||
* which enables a legacy Cdt API also used elsewhere in ksh. Do not remove this version check as it is not yet obsolete.
|
||||
*/
|
||||
#if CDT_VERSION < 20111111L
|
||||
#define hash nvlink.hl._hash
|
||||
#else
|
||||
#define hash nvlink.lh.__hash
|
||||
#endif
|
||||
/*
|
||||
* return an entity checksum
|
||||
* The entity is created if it doesn't exist
|
||||
|
@ -2035,6 +2038,7 @@ unsigned long kiaentity(Lex_t *lexp,const char *name,int len,int type,int first,
|
|||
}
|
||||
return(np->hash);
|
||||
}
|
||||
#undef hash
|
||||
|
||||
static void kia_add(register Namval_t *np, void *data)
|
||||
{
|
||||
|
|
|
@ -851,26 +851,8 @@ Pathcomp_t *path_absolute(Shell_t *shp,register const char *name, Pathcomp_t *pp
|
|||
shp->bltin_dir = 0;
|
||||
return(oldpp);
|
||||
}
|
||||
#ifdef SH_PLUGIN_VERSION
|
||||
if (dll = dllplugin(SH_ID, stakptr(m), NiL, SH_PLUGIN_VERSION, NiL, RTLD_LAZY, NiL, 0))
|
||||
sh_addlib(shp,dll,stakptr(m),oldpp);
|
||||
#else
|
||||
if (dll = dllplug(SH_ID, stakptr(m), NiL, RTLD_LAZY, NiL, 0))
|
||||
{
|
||||
/*
|
||||
* this detects the 2007-05-11 builtin context change and also
|
||||
* the 2008-03-30 opt_info.num change that hit libcmd::b_head
|
||||
*/
|
||||
|
||||
if (libcmd && !dlllook(dll, "b_pids"))
|
||||
{
|
||||
dlclose(dll);
|
||||
dll = 0;
|
||||
}
|
||||
else
|
||||
sh_addlib(shp,dll,stakptr(m),oldpp);
|
||||
}
|
||||
#endif
|
||||
if(dll &&
|
||||
(addr=(Shbltin_f)dlllook(dll,stakptr(n))) &&
|
||||
(!(np = sh_addbuiltin(stakptr(PATH_OFFSET),NiL,NiL)) || np->nvalue.bfp!=(Nambfp_f)addr) &&
|
||||
|
|
Loading…
Reference in a new issue