From 49ae4835747d8cc676fcff9dc32744a839a8fd00 Mon Sep 17 00:00:00 2001 From: Johnothan King Date: Wed, 5 Aug 2020 14:18:22 -0700 Subject: [PATCH] Make liblist an extern to fix dtksh compile (#108) The liblist variable needs to be an extern for dtksh to build. Quote from CDE developer Chase: we use an old function that no longer appears in kornshell, sh_getliblist, it seems to be replaced by the function sh_getlib, which is fine, but it seems to return a "Shbltin_f" type, which I can't seem to find any information on what it is. We need the void pointer dlsym provides for some widget init stuff, I tried making liblist an extern, but it kept giving me an error about libcomp_t being undefined. src/cmd/ksh93/bltins/typeset.c, src/cmd/ksh93/include/shell.h: - Fix the compiler error reported above by moving the type definition for Libcomp_t to shell.h. - Make liblist an extern since findsym.c in dtksh needs it to build. The old sh_getliblist function doesn't need to be reintroduced since the only purpose it served was to workaround the problem of liblist being a static variable. Now that liblist is an extern, dtksh fsym can use liblist directly to avoid sh_getliblist. dtksh findsym.c: https://sourceforge.net/p/cdesktopenv/code/ci/2.3.2/tree/cde/programs/dtksh/findsym.c --- src/cmd/ksh93/bltins/typeset.c | 11 +---------- src/cmd/ksh93/include/shell.h | 11 +++++++++++ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/cmd/ksh93/bltins/typeset.c b/src/cmd/ksh93/bltins/typeset.c index d9175068f..82cc7386e 100644 --- a/src/cmd/ksh93/bltins/typeset.c +++ b/src/cmd/ksh93/bltins/typeset.c @@ -904,18 +904,9 @@ static int setall(char **argv,register int flag,Dt_t *troot,struct tdata *tp typedef void (*Libinit_f)(int,void*); -typedef struct Libcomp_s -{ - void* dll; - char* lib; - dev_t dev; - ino_t ino; - unsigned int attr; -} Libcomp_t; - #define GROWLIB 4 -static Libcomp_t *liblist; +Libcomp_t *liblist; static int nlib; static int maxlib; diff --git a/src/cmd/ksh93/include/shell.h b/src/cmd/ksh93/include/shell.h index 0c02da388..269ab363f 100644 --- a/src/cmd/ksh93/include/shell.h +++ b/src/cmd/ksh93/include/shell.h @@ -150,6 +150,17 @@ struct Shell_s #endif /* _SH_PRIVATE */ }; +/* used for builtins */ +typedef struct Libcomp_s +{ + void* dll; + char* lib; + dev_t dev; + ino_t ino; + unsigned int attr; +} Libcomp_t; +extern Libcomp_t *liblist; + /* flags for sh_parse */ #define SH_NL 1 /* Treat new-lines as ; */ #define SH_EOF 2 /* EOF causes syntax error */