Skip to content

Commit

Permalink
Merge pull request #100 from mariux64/honor-server-prerequisites
Browse files Browse the repository at this point in the history
Honor server prerequisites
  • Loading branch information
donald authored Apr 15, 2021
2 parents 5bff524 + 50e80e6 commit c593fb5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MXQ_VERSION_MAJOR = 0
MXQ_VERSION_MINOR = 27
MXQ_VERSION_PATCH = 1
MXQ_VERSION_PATCH = 2
MXQ_VERSION_EXTRA = "beta"
MXQ_VERSIONDATE = 2021

Expand Down
16 changes: 16 additions & 0 deletions mxqd_control.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,22 @@ static int server_is_qualified(struct mxq_server *server, struct mxq_group *grou
if (parser_context.result == 0)
return 0; // evaluated to false
}
if (*server->daemon.prerequisites != 0) {
if (*group->tags == 0) {
return 0;
}
_mx_cleanup_(keywordset_free_byref) struct keywordset *kws = keywordset_new(group->tags);
struct parser_context parser_context = {
.input = server->daemon.prerequisites,
.tags = kws,
.pos = 0,
.result = 0,
};
if (yyparse(&parser_context))
return 0; // syntax error in expression
if (parser_context.result == 0)
return 0; // evaluated to false
}
return (1);
}

Expand Down

0 comments on commit c593fb5

Please sign in to comment.