diff options
author | Oliver Kiddle <opk@users.sourceforge.net> | 2003-05-15 09:39:55 +0000 |
---|---|---|
committer | Oliver Kiddle <opk@users.sourceforge.net> | 2003-05-15 09:39:55 +0000 |
commit | 09c5818b393a14d693e5b7424b23e0a155bcaa60 (patch) | |
tree | 6f41349b550108e06522fe506545f186e35595d9 /Src/options.c | |
parent | 4e309d2cddb7b8e1ee7c57320ba4a87162e943bf (diff) | |
download | zsh-09c5818b393a14d693e5b7424b23e0a155bcaa60.tar.gz zsh-09c5818b393a14d693e5b7424b23e0a155bcaa60.tar.xz zsh-09c5818b393a14d693e5b7424b23e0a155bcaa60.zip |
18530: print option states with `set -o' or `set +o'
Diffstat (limited to 'Src/options.c')
-rw-r--r-- | Src/options.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Src/options.c b/Src/options.c index f206d0ab3..8cc8f2a8e 100644 --- a/Src/options.c +++ b/Src/options.c @@ -710,6 +710,33 @@ dashgetfn(Param pm) return buf; } +/* print options for set -o/+o */ + +/**/ +void +printoptionstates(int hadplus) +{ + scanhashtable(optiontab, 1, 0, OPT_ALIAS, printoptionnodestate, hadplus); +} + +/**/ +static void +printoptionnodestate(HashNode hn, int hadplus) +{ + Optname on = (Optname) hn; + int optno = on->optno; + + if (hadplus) { + if (defset(on) != isset(optno)) + printf("set -o %s%s\n", defset(on) ? "no" : "", on->nam); + } else { + if (defset(on)) + printf("no%-19s %s\n", on->nam, isset(optno) ? "off" : "on"); + else + printf("%-21s %s\n", on->nam, isset(optno) ? "on" : "off"); + } +} + /* Print option list for --help */ /**/ |