aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2023-06-22 17:11:51 +1000
committerSteve Bennett <steveb@workware.net.au>2023-07-06 10:18:55 +1000
commitd765fc5bfd0643d4af928e538715beb32c2111db (patch)
tree086fa1847a64399ea0356cdaef588fb009e393c7
parent8f88179f90cdcbc775d52c7fa6b6f31943b8e322 (diff)
downloadjimtcl-d765fc5bfd0643d4af928e538715beb32c2111db.zip
jimtcl-d765fc5bfd0643d4af928e538715beb32c2111db.tar.gz
jimtcl-d765fc5bfd0643d4af928e538715beb32c2111db.tar.bz2
aio: fix autocomplete for socket
The checks for -ipv6, -async broke 'socket -commands' Signed-off-by: Steve Bennett <steveb@workware.net.au>
-rw-r--r--jim-aio.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/jim-aio.c b/jim-aio.c
index e3d0e96..093457f 100644
--- a/jim-aio.c
+++ b/jim-aio.c
@@ -2537,6 +2537,9 @@ static int JimAioSockCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
int async = 0;
int flags = 0;
+ if (argc == 2 && Jim_CompareStringImmediate(interp, argv[1], "-commands")) {
+ return Jim_CheckShowCommands(interp, argv[1], socktypes);
+ }
while (argc > 1 && Jim_String(argv[1])[0] == '-') {
static const char * const options[] = { "-async", "-ipv6", "-noclose", NULL };
@@ -2571,12 +2574,14 @@ static int JimAioSockCommand(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
if (argc < 2) {
wrongargs:
- Jim_WrongNumArgs(interp, 1, &argv0, "?-async? ?-ipv6? type ?address?");
+ Jim_WrongNumArgs(interp, 1, &argv0, "?-async? ?-ipv6? socktype ?address?");
return JIM_ERR;
}
- if (Jim_GetEnum(interp, argv[1], socktypes, &socktype, "socket type", JIM_ERRMSG) != JIM_OK)
- return Jim_CheckShowCommands(interp, argv[1], socktypes);
+ if (Jim_GetEnum(interp, argv[1], socktypes, &socktype, "socktype", JIM_ERRMSG) != JIM_OK) {
+ /* No need to check for -commands here since we did it above */
+ return JIM_ERR;
+ }
Jim_SetEmptyResult(interp);