aboutsummaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorMarvin Borner2020-11-02 21:43:12 +0100
committerMarvin Borner2020-11-02 21:43:12 +0100
commit36bd8f09d359d176a2a1ca59864838269e887c4b (patch)
treee2db7097b2d051e50079b64f6e6a8a3317d3073c /apps
parentf5764042751c94598e8d8dfd7a9f9cd0efe57f37 (diff)
Added gui exec parameter
Diffstat (limited to 'apps')
-rw-r--r--apps/exec.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/apps/exec.c b/apps/exec.c
index 305e9ef..68f9e63 100644
--- a/apps/exec.c
+++ b/apps/exec.c
@@ -16,11 +16,23 @@ void on_submit(struct gui_event_keyboard *event, struct element *elem)
{
(void)event;
char *inp = ((struct element_text_input *)elem->data)->text;
+
+ // TODO: Support more than one arg
+ char *inp_copy = strdup(inp);
+ char *space = inp_copy;
+ char *arg = NULL;
+ if ((space = strchr(space, ' '))) {
+ inp[space - inp_copy] = '\0';
+ space++;
+ arg = space;
+ }
+ free(inp_copy);
+
u8 l = strlen(PATH) + strlen(inp) + 1;
char *final = malloc(l);
strcat(final, PATH);
strcat(final, inp);
- exec(final, inp, NULL);
+ exec(final, inp, arg, NULL);
}
int main()