Skip to content

Commit

Permalink
aio: fix autocomplete for socket
Browse files Browse the repository at this point in the history
The checks for -ipv6, -async broke 'socket -commands'

Signed-off-by: Steve Bennett <steveb@workware.net.au>
  • Loading branch information
msteveb committed Jul 6, 2023
1 parent 8f88179 commit d765fc5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions jim-aio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit d765fc5

Please sign in to comment.