- Con *ws = NULL;
- Con *output = NULL;
-
- /* first look for a workspace with this name */
- TAILQ_FOREACH(output, &(croot->nodes_head), nodes) {
- GREP_FIRST(ws, output_get_content(output), !strcasecmp(child->name, name));
- }
-
- /* if the name is plain digits, we interpret this as a "workspace number"
- * command */
- if (!ws && name_is_digits(name)) {
- long parsed_num = ws_name_to_number(name);
- TAILQ_FOREACH(output, &(croot->nodes_head), nodes) {
- GREP_FIRST(ws, output_get_content(output),
- child->num == parsed_num);
- }
- }
-
- /* if no workspace was found, make a new one */
- if (!ws)
- ws = workspace_get(name, NULL);