about summary refs log tree commit diff
path: root/Src/options.c
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2015-11-01 18:12:40 +0000
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2015-11-01 18:12:40 +0000
commitba36967b575ca57ebde3349e62c190ca69b73832 (patch)
treebb1d3f998cd6a6e4f7d72aabd028fd4435c26772 /Src/options.c
parentfa59375e36e1718e060048ba7efd7346b3c8e94a (diff)
downloadzsh-ba36967b575ca57ebde3349e62c190ca69b73832.tar.gz
zsh-ba36967b575ca57ebde3349e62c190ca69b73832.tar.xz
zsh-ba36967b575ca57ebde3349e62c190ca69b73832.zip
37038: add -l option to emulate to list options in emulations
Diffstat (limited to 'Src/options.c')
-rw-r--r--Src/options.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/Src/options.c b/Src/options.c
index 3bf9f39a4..2678626c7 100644
--- a/Src/options.c
+++ b/Src/options.c
@@ -902,3 +902,33 @@ printoptionlist_printequiv(int optno)
     optno *= (isneg ? -1 : 1);
     printf("  equivalent to --%s%s\n", isneg ? "no-" : "", optns[optno-1].node.nam);
 }
+
+/**/
+static char *print_emulate_opts;
+
+/**/
+static void
+print_emulate_option(HashNode hn, int fully)
+{
+    Optname on = (Optname) hn;
+
+    if (!(on->node.flags & OPT_ALIAS) &&
+	((fully && !(on->node.flags & OPT_SPECIAL)) ||
+	 (on->node.flags & OPT_EMULATE)))
+    {
+	if (!print_emulate_opts[on->optno])
+	    fputs("no", stdout);
+	puts(on->node.nam);
+    }
+}
+
+/*
+ * List the settings of options associated with an emulation
+ */
+
+/**/
+void list_emulate_options(char *cmdopts, int fully)
+{
+    print_emulate_opts = cmdopts;
+    scanhashtable(optiontab, 1, 0, 0, print_emulate_option, fully);
+}