1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-13 19:52:20 +00:00

Disable SHOPT_KIA (ksh -R) by default

SHOPT_KIA enables the -R option that generates a cross-reference
database from a script. However, no tool to analyse this database
is shipped or seems to be available anywhere (in spite of multiple
people looking for one), and the format is very opaque. No usage
examples are known or findable on the internet. This seems like it
should not be compiled in by default, although we'll keep the code
in case some way to use it is found.

src/cmd/ksh93/SHOPT.sh:
- Disable SHOPT_KIA by default by removing the default 1 value.

src/cmd/ksh93/sh/args.c, src/cmd/ksh93/sh/parse.c:
- Fix a couple of preprocessor logic bugs that made it impossible
  to compile ksh without SHOPT_KIA.

src/cmd/ksh93/data/builtins.c:
- Fix typo in -R doc in ksh --man (in case SHOPT_KIA is enabled).

src/cmd/ksh93/sh.1:
- Since sh.1 is not generated dynamically, remove the -R doc.
This commit is contained in:
Martijn Dekker 2021-01-23 17:50:12 +00:00
parent 0a9c6fd771
commit d2cc520883
5 changed files with 5 additions and 18 deletions

View file

@ -20,7 +20,7 @@ SHOPT ESH=1 # emacs/gmacs edit mode
SHOPT FILESCAN=1 # fast file scan
SHOPT FIXEDARRAY=1 # fixed dimension indexed array
SHOPT HISTEXPAND=1 # csh-style history file expansions
SHOPT KIA=1 # shell information database generation
SHOPT KIA= # ksh -R <outfile> <script> generates cross-ref database from script
SHOPT MULTIBYTE=1 # multibyte character handling
SHOPT NAMESPACE=1 # allow namespaces
SHOPT OLDTERMIO= # support both TCGETA and TCGETS

View file

@ -1538,7 +1538,7 @@ USAGE_LICENSE
#endif
#if SHOPT_KIA
"[R]:[file?Do not execute the script, but create a cross reference database "
"in \afile\a that can be used a separate shell script browser. The "
"in \afile\a that can be used in a separate shell script browser. The "
"-R option requires a script to be specified as the first operand.]"
#endif /* SHOPT_KIA */
#if SHOPT_REGRESS

View file

@ -41,8 +41,6 @@ ksh93, rksh93, pfksh93 \- KornShell, a standard/restricted command and programmi
[
.B \(+-abcefhiklmnoprstuvxBCDEGHP
] [
.B \-R
file ] [
.B \(+-o
option ] .\|.\|. [
.B \-
@ -60,8 +58,6 @@ option ] .\|.\|. [
[
.B \(+-abcefhiklmnopstuvxBCDEGH
] [
.B \-R
file ] [
.B \(+-o
option ] .\|.\|. [
.B \-
@ -8275,17 +8271,6 @@ or
.B \-o profile
is present, the shell is a profile shell (see
.IR pfexec (1)).
.TP
.BI \-R " filename\^"
The
.B \-R
.I filename\^
option is used
to generate a cross reference database
that can be used by a separate utility
to find definitions and references for variables and commands.
The filename argument specifies the generated database. A script file must be
provided on the command line as well.
.PP
The remaining options and arguments are described under the
.B set

View file

@ -117,7 +117,9 @@ int sh_argopts(int argc,register char *argv[], void *context)
Shell_t *shp = (Shell_t*)context;
register int n,o;
register Arg_t *ap = (Arg_t*)(shp->arg_context);
#if SHOPT_KIA
Lex_t *lp = (Lex_t*)(shp->lex_context);
#endif
Shopt_t newflags;
int setflag=0, action=0, trace=(int)sh_isoption(SH_XTRACE);
Namval_t *np = NIL(Namval_t*);

View file

@ -39,6 +39,7 @@
#include "shlex.h"
#include "history.h"
#include "builtins.h"
#include "path.h"
#include "test.h"
#include "history.h"
#include "version.h"
@ -93,7 +94,6 @@ static struct argnod *label_last;
#define getnode(type) ((Shnode_t*)stakalloc(sizeof(struct type)))
#if SHOPT_KIA
#include "path.h"
/*
* write out entities for each item in the list
* type=='V' for variable assignment lists