mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-02-15 04:32:24 +00:00
Remove legacy code for older libast versions
Since ksh 93u+m comes bundled with libast 20111111, there's no need to support older versions, so this is another cleanup opportunity. src/cmd/ksh93/include/defs.h: - Throw an #error if AST_VERSION is undefined or < 20111111. (Note that _AST_VERSION is the same as AST_VERSION, but the latter is newer and preferred; see src/lib/libast/features/api) All other changed files: - Remove legacy code for versions older than the currently used versions, which are: _AST_VERSION 20111111 ERROR_VERSION 20100309 GLOB_VERSION 20060717 OPT_VERSION 20070319 SFIO_VERSION 20090915 VMALLOC_VERSION 20110808
This commit is contained in:
parent
8d7f616e75
commit
f9c127e39e
14 changed files with 6 additions and 81 deletions
|
@ -243,11 +243,7 @@ int b_print(int argc, char *argv[], Shbltin_t *context)
|
|||
break;
|
||||
case ':':
|
||||
/* The following is for backward compatibility */
|
||||
#if OPT_VERSION >= 19990123
|
||||
if(strcmp(opt_info.name,"-R")==0)
|
||||
#else
|
||||
if(strcmp(opt_info.option,"-R")==0)
|
||||
#endif
|
||||
{
|
||||
rflag = 1;
|
||||
if(error_info.errors==0)
|
||||
|
|
|
@ -1043,11 +1043,7 @@ int b_builtin(int argc,char *argv[],Shbltin_t *context)
|
|||
if(list)
|
||||
sfprintf(sfstdout, "%s %08lu %s\n", arg, ver, path);
|
||||
#else
|
||||
#if (_AST_VERSION>=20040404)
|
||||
if(!(library = dllplug(SH_ID,arg,NIL(char*),RTLD_LAZY,NIL(char*),0)))
|
||||
#else
|
||||
if(!(library = dllfind(arg,NIL(char*),RTLD_LAZY,NIL(char*),0)))
|
||||
#endif
|
||||
{
|
||||
errormsg(SH_DICT,ERROR_exit(0),"%s: %s",arg,dlerror());
|
||||
return(1);
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
#define defs_h_defined
|
||||
|
||||
#include <ast.h>
|
||||
#if !defined(AST_VERSION) || AST_VERSION < 20111111L
|
||||
#error libast version 20111111 or later is required
|
||||
#endif
|
||||
#if !SHOPT_MULTIBYTE
|
||||
/* disable multibyte without need for further '#if SHOPT_MULTIBYTE' */
|
||||
# undef mbwide
|
||||
|
|
|
@ -98,11 +98,7 @@ struct checkpt
|
|||
int topfd;
|
||||
int mode;
|
||||
struct openlist *olist;
|
||||
#if (ERROR_VERSION >= 20030214L)
|
||||
Error_context_t err;
|
||||
#else
|
||||
struct errorcontext err;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define sh_pushcontext(shp,bp,n)( (bp)->mode=(n) , (bp)->olist=0, \
|
||||
|
|
|
@ -118,14 +118,9 @@ extern struct jobs job;
|
|||
#ifdef vmlocked
|
||||
#define vmbusy() vmlocked(Vmregion)
|
||||
#else
|
||||
#if VMALLOC_VERSION >= 20070911L
|
||||
#define vmbusy() (vmstat(0,0)!=0)
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#ifndef vmbusy
|
||||
#define vmbusy() 0
|
||||
#endif
|
||||
|
||||
#define job_lock() (job.in_critical++)
|
||||
#define job_unlock() \
|
||||
|
|
|
@ -29,9 +29,7 @@
|
|||
#include <ast.h>
|
||||
#include <math.h>
|
||||
#include "defs.h"
|
||||
#if _AST_VERSION >= 20030127L
|
||||
# include <ast_float.h>
|
||||
#endif
|
||||
#include <ast_float.h>
|
||||
|
||||
#if _ast_fltmax_double
|
||||
#define LDBL_LLONG_MAX DBL_LLONG_MAX
|
||||
|
|
|
@ -74,7 +74,6 @@
|
|||
|
||||
static struct glob *membase;
|
||||
|
||||
#if GLOB_VERSION >= 20010916L
|
||||
static char *nextdir(glob_t *gp, char *dir)
|
||||
{
|
||||
Shell_t *shp = sh_getinterp();
|
||||
|
@ -88,7 +87,6 @@ static char *nextdir(glob_t *gp, char *dir)
|
|||
return(pp->name);
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
|
||||
int path_expand(Shell_t *shp,const char *pattern, struct argnod **arghead)
|
||||
{
|
||||
|
@ -108,9 +106,7 @@ int path_expand(Shell_t *shp,const char *pattern, struct argnod **arghead)
|
|||
#if KSHELL
|
||||
extra += scantree(shp->alias_tree,pattern,arghead);
|
||||
extra += scantree(shp->fun_tree,pattern,arghead);
|
||||
# if GLOB_VERSION >= 20010916L
|
||||
gp->gl_nextdir = nextdir;
|
||||
# endif
|
||||
#endif /* KSHELL */
|
||||
flags |= GLOB_COMPLETE;
|
||||
flags &= ~GLOB_NOCHECK;
|
||||
|
|
|
@ -45,7 +45,7 @@ static int cursig = -1;
|
|||
#if !_std_malloc
|
||||
# include <vmalloc.h>
|
||||
#endif
|
||||
#if defined(VMFL) && (VMALLOC_VERSION>=20031205L)
|
||||
#if defined(VMFL)
|
||||
/*
|
||||
* This exception handler is called after vmalloc() unlocks the region
|
||||
*/
|
||||
|
@ -154,7 +154,7 @@ void sh_fault(register int sig)
|
|||
shp->trapnote |= SH_SIGSET;
|
||||
if(sig <= shp->gd->sigmax)
|
||||
shp->sigflag[sig] |= SH_SIGSET;
|
||||
#if defined(VMFL) && (VMALLOC_VERSION>=20031205L)
|
||||
#if defined(VMFL)
|
||||
if(abortsig(sig))
|
||||
{
|
||||
/* abort inside malloc, process when malloc returns */
|
||||
|
|
|
@ -361,19 +361,11 @@ static void put_cdpath(register Namval_t* np,const char *val,int flags,Namfun_t
|
|||
* This function needs to be modified to handle international
|
||||
* error message translations
|
||||
*/
|
||||
#if ERROR_VERSION >= 20000101L
|
||||
static char* msg_translate(const char* catalog, const char* message)
|
||||
{
|
||||
NOT_USED(catalog);
|
||||
return((char*)message);
|
||||
}
|
||||
#else
|
||||
static char* msg_translate(const char* message, int type)
|
||||
{
|
||||
NOT_USED(type);
|
||||
return((char*)message);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Trap for LC_ALL, LC_CTYPE, LC_MESSAGES, LC_COLLATE and LANG */
|
||||
static void put_lang(Namval_t* np,const char *val,int flags,Namfun_t *fp)
|
||||
|
@ -467,10 +459,6 @@ static void put_cdpath(register Namval_t* np,const char *val,int flags,Namfun_t
|
|||
sh_lexstates[ST_BRACE]=(char*)sh_lexrstates[ST_BRACE];
|
||||
}
|
||||
}
|
||||
#if ERROR_VERSION < 20000101L
|
||||
if(type==LC_ALL || type==LC_MESSAGES)
|
||||
error_info.translate = msg_translate;
|
||||
#endif
|
||||
}
|
||||
#endif /* _hdr_locale */
|
||||
|
||||
|
@ -1243,9 +1231,7 @@ Shell_t *sh_init(register int argc,register char *argv[], Shinit_f userinit)
|
|||
shp->stk = stkstd;
|
||||
sfsetbuf(shp->strbuf,(char*)0,64);
|
||||
sh_onstate(SH_INIT);
|
||||
#if ERROR_VERSION >= 20000102L
|
||||
error_info.catalog = e_dict;
|
||||
#endif
|
||||
#if SHOPT_REGRESS
|
||||
{
|
||||
Opt_t* nopt;
|
||||
|
@ -1325,17 +1311,8 @@ Shell_t *sh_init(register int argc,register char *argv[], Shinit_f userinit)
|
|||
char *cp=nv_getval(L_ARGNOD);
|
||||
char buff[PATH_MAX+1];
|
||||
shp->gd->shpath = 0;
|
||||
#if _AST_VERSION >= 20090202L
|
||||
if((n = pathprog(NiL, buff, sizeof(buff))) > 0 && n <= sizeof(buff))
|
||||
shp->gd->shpath = strdup(buff);
|
||||
#else
|
||||
sfprintf(shp->strbuf,"/proc/%d/exe",getpid());
|
||||
if((n=readlink(sfstruse(shp->strbuf),buff,sizeof(buff)-1))>0)
|
||||
{
|
||||
buff[n] = 0;
|
||||
shp->gd->shpath = strdup(buff);
|
||||
}
|
||||
#endif
|
||||
else if((cp && (sh_type(cp)&SH_TYPE_SH)) || (argc>0 && strchr(cp= *argv,'/')))
|
||||
{
|
||||
if(*cp=='/')
|
||||
|
@ -1472,11 +1449,9 @@ Shell_t *sh_init(register int argc,register char *argv[], Shinit_f userinit)
|
|||
shp->bltindata.shtrap = sh_trap;
|
||||
shp->bltindata.shexit = sh_exit;
|
||||
shp->bltindata.shbltin = sh_addbuiltin;
|
||||
#if _AST_VERSION >= 20080617L
|
||||
shp->bltindata.shgetenv = sh_getenv;
|
||||
shp->bltindata.shsetenv = sh_setenviron;
|
||||
astintercept(&shp->bltindata,1);
|
||||
#endif
|
||||
#if 0
|
||||
#define NV_MKINTTYPE(x,y,z) nv_mkinttype(#x,sizeof(x),(x)-1<0,(y),(Namdisc_t*)z);
|
||||
NV_MKINTTYPE(pid_t,"process id",0);
|
||||
|
|
|
@ -2263,15 +2263,7 @@ struct argnod *sh_endword(Shell_t *shp,int mode)
|
|||
break;
|
||||
}
|
||||
*--dp = 0;
|
||||
#if ERROR_VERSION >= 20000317L
|
||||
msg = ERROR_translate(0,error_info.id,0,ep);
|
||||
#else
|
||||
# if ERROR_VERSION >= 20000101L
|
||||
msg = ERROR_translate(error_info.id,ep);
|
||||
# else
|
||||
msg = ERROR_translate(ep,2);
|
||||
# endif
|
||||
#endif
|
||||
n = strlen(msg);
|
||||
dp = ep+n;
|
||||
if(sp-dp <= 1)
|
||||
|
|
|
@ -1864,7 +1864,6 @@ void nv_putval(register Namval_t *np, const char *string, int flags)
|
|||
if(sp==up->cp && !(flags&NV_APPEND))
|
||||
return;
|
||||
dot = strlen(sp);
|
||||
#if (_AST_VERSION>=20030127L)
|
||||
if(nv_isattr(np,NV_BINARY))
|
||||
{
|
||||
int oldsize = (flags&NV_APPEND)?nv_size(np):0;
|
||||
|
@ -1899,7 +1898,6 @@ void nv_putval(register Namval_t *np, const char *string, int flags)
|
|||
return;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if(size==0 && nv_isattr(np,NV_HOST)!=NV_HOST &&nv_isattr(np,NV_LJUST|NV_RJUST|NV_ZFILL))
|
||||
nv_setsize(np,size=dot);
|
||||
|
@ -2809,7 +2807,6 @@ char *nv_getval(register Namval_t *np)
|
|||
return(fmtbase(ll,numeric, numeric&&numeric!=10));
|
||||
}
|
||||
done:
|
||||
#if (_AST_VERSION>=20030127L)
|
||||
/*
|
||||
* if NV_RAW flag is on, return pointer to binary data
|
||||
* otherwise, base64 encode the data and return this string
|
||||
|
@ -2823,7 +2820,6 @@ done:
|
|||
*ep = 0;
|
||||
return(cp);
|
||||
}
|
||||
#endif
|
||||
if(!nv_isattr(np,NV_LJUST|NV_RJUST) && (numeric=nv_size(np)) && up->cp && up->cp[numeric])
|
||||
{
|
||||
char *cp = getbuf(numeric+1);
|
||||
|
|
|
@ -830,11 +830,7 @@ Pathcomp_t *path_absolute(Shell_t *shp,register const char *name, Pathcomp_t *pp
|
|||
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 (_AST_VERSION>=20040404)
|
||||
if (dll = dllplug(SH_ID, stakptr(m), NiL, RTLD_LAZY, NiL, 0))
|
||||
#else
|
||||
if (dll = dllfind(stakptr(m), NiL, RTLD_LAZY, NiL, 0))
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
* this detects the 2007-05-11 builtin context change and also
|
||||
|
|
|
@ -703,15 +703,7 @@ char *sh_fmtqf(const char *string, int single, int fold)
|
|||
|
||||
const char *_sh_translate(const char *message)
|
||||
{
|
||||
#if ERROR_VERSION >= 20000317L
|
||||
return(ERROR_translate(0,0,e_dict,message));
|
||||
#else
|
||||
#if ERROR_VERSION >= 20000101L
|
||||
return(ERROR_translate(e_dict,message));
|
||||
#else
|
||||
return(ERROR_translate(message,1));
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -750,9 +742,7 @@ char *sh_checkid(char *str, char *last)
|
|||
return(last);
|
||||
}
|
||||
|
||||
#if _AST_VERSION <= 20000317L
|
||||
char *fmtident(const char *string)
|
||||
{
|
||||
return((char*)string);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -72,11 +72,7 @@ static struct subshell
|
|||
struct Link *svar; /* save shell variable table */
|
||||
Dt_t *sfun; /* function scope for subshell */
|
||||
Pathcomp_t *pathlist; /* for PATH variable */
|
||||
#if (ERROR_VERSION >= 20030214L)
|
||||
struct Error_context_s *errcontext;
|
||||
#else
|
||||
struct errorcontext *errcontext;
|
||||
#endif
|
||||
Shopt_t options;/* save shell options */
|
||||
pid_t subpid; /* child process id */
|
||||
Sfio_t* saveout;/*saved standard output */
|
||||
|
|
Loading…
Reference in a new issue