about summary refs log tree commit diff
path: root/Src/Zle/zle_thingy.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/Zle/zle_thingy.c')
-rw-r--r--Src/Zle/zle_thingy.c41
1 files changed, 11 insertions, 30 deletions
diff --git a/Src/Zle/zle_thingy.c b/Src/Zle/zle_thingy.c
index cf01f2fc1..2950d55d9 100644
--- a/Src/Zle/zle_thingy.c
+++ b/Src/Zle/zle_thingy.c
@@ -318,10 +318,9 @@ deletezlefunction(Widget w)
 /*
  * The available operations are:
  *
- *   -l   list widgets/test for existence
+ *   -l   list user-defined widgets (no arguments)
  *   -D   delete widget names
  *   -A   link the two named widgets (2 arguments)
- *   -C   create completion widget (3 arguments)
  *   -N   create new user-defined widget (1 or 2 arguments)
  *        invoke a widget (1 argument)
  */
@@ -335,7 +334,7 @@ bin_zle(char *name, char **args, char *ops, int func)
 	int (*func) _((char *, char **, char *, char));
 	int min, max;
     } const opns[] = {
-	{ 'l', bin_zle_list, 0, -1 },
+	{ 'l', bin_zle_list, 0,  0 },
 	{ 'D', bin_zle_del,  1, -1 },
 	{ 'A', bin_zle_link, 2,  2 },
 	{ 'N', bin_zle_new,  1,  2 },
@@ -374,21 +373,8 @@ bin_zle(char *name, char **args, char *ops, int func)
 static int
 bin_zle_list(char *name, char **args, char *ops, char func)
 {
-    if (!*args) {
-	scanhashtable(thingytab, 1, 0, DISABLED, scanlistwidgets,
-		      (ops['a'] ? -1 : ops['L']));
-	return 0;
-    } else {
-	int ret = 0;
-	Thingy t;
-
-	for (; *args && !ret; args++) {
-	    if (!(t = (Thingy) thingytab->getnode2(thingytab, *args)) ||
-		(!ops['a'] && (t->widget->flags & WIDGET_INT)))
-		ret = 1;
-	}
-	return ret;
-    }
+    scanhashtable(thingytab, 1, 0, DISABLED, scanlistwidgets, ops['L']);
+    return 0;
 }
 
 /**/
@@ -419,10 +405,6 @@ scanlistwidgets(HashNode hn, int list)
     Thingy t = (Thingy) hn;
     Widget w = t->widget;
 
-    if(list < 0) {
-	printf("%s\n", hn->nam);
-	return;
-    }
     if(w->flags & WIDGET_INT)
 	return;
     if(list) {
@@ -554,7 +536,6 @@ bin_zle_call(char *name, char **args, char *ops, char func)
     Thingy t;
     struct modifier modsave;
     int ret, saveflag = 0;
-    char *wname = *args++;
 
     if(!zleactive || incompctlfunc || incompfunc) {
 	zerrnam(name, "widgets can only be called when ZLE is active",
@@ -562,12 +543,6 @@ bin_zle_call(char *name, char **args, char *ops, char func)
 	return 1;
     }
 
-    if (!wname) {
-	zwarnnam(name, "wrong number of arguments", NULL, 0);
-	if (saveflag)
-	    zmod = modsave;
-	return 1;
-    }
     while (*args && **args == '-') {
 	char *num;
 	if (!args[0][1] || args[0][1] == '-') {
@@ -602,8 +577,14 @@ bin_zle_call(char *name, char **args, char *ops, char func)
 	}
 	args++;
     }
+    if (!args[0]) {
+	zwarnnam(name, "wrong number of arguments", NULL, 0);
+	if (saveflag)
+	    zmod = modsave;
+	return 1;
+    }
 
-    t = rthingy(wname);
+    t = rthingy(*args++);
     PERMALLOC {
         ret = execzlefunc(t, args);
     } LASTALLOC;