Skip to content

Commit

Permalink
Fix .tcl server add/remove arg parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelortmann committed Dec 18, 2024
1 parent 0f5599e commit 80bca41
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/mod/server.mod/tclserv.c
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,10 @@ static int tcl_server STDVAR {

BADARGS(2, 5, " subcommand ?host ?port? ?password?");
if (!strcmp(argv[1], "add")) {
if (argc < 3) {
Tcl_SetResult(irp, "Subcommand add needs at least a server host", TCL_STATIC);
return TCL_ERROR;
}
ret = add_server(argv[2], argc >= 4 && argv[3] ? argv[3] : "", argc >= 5 && argv[4] ? argv[4] : "");
if (!ret) {
server = Tcl_NewListObj(0, NULL);
Expand All @@ -599,6 +603,10 @@ static int tcl_server STDVAR {
Tcl_SetObjResult(irp, server);
}
} else if (!strcmp(argv[1], "remove")) {
if (argc < 3) {
Tcl_SetResult(irp, "Subcommand remove needs at least a server host", TCL_STATIC);
return TCL_ERROR;
}
ret = del_server(argv[2], argc >= 4 && argv[3] ? argv[3] : "");
} else if (!strcmp(argv[1], "list")) {
Tcl_Obj *servers = Tcl_NewListObj(0, NULL);
Expand Down

0 comments on commit 80bca41

Please sign in to comment.