Allow assign to output

Implements the "assign" part of issue #2764.
This commit is contained in:
Orestis Floros
2017-09-16 20:54:44 +03:00
parent 45d1e51857
commit a35854ddf4
7 changed files with 166 additions and 4 deletions

View File

@ -377,6 +377,20 @@ CFGFUN(color, const char *colorclass, const char *border, const char *background
#undef APPLY_COLORS
}
CFGFUN(assign_output, const char *output) {
if (match_is_empty(current_match)) {
ELOG("Match is empty, ignoring this assignment\n");
return;
}
DLOG("New assignment, using above criteria, to output \"%s\".\n", output);
Assignment *assignment = scalloc(1, sizeof(Assignment));
match_copy(&(assignment->match), current_match);
assignment->type = A_TO_OUTPUT;
assignment->dest.output = sstrdup(output);
TAILQ_INSERT_TAIL(&assignments, assignment, assignments);
}
CFGFUN(assign, const char *workspace, bool is_number) {
if (match_is_empty(current_match)) {
ELOG("Match is empty, ignoring this assignment\n");