mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-17 07:47:41 +01:00
Rewrite uicb_exec
This commit is contained in:
parent
539636c77e
commit
6818a692d2
1 changed files with 9 additions and 13 deletions
22
uicb.c
22
uicb.c
|
@ -52,7 +52,6 @@ void
|
||||||
uicb_exec(int screen __attribute__ ((unused)), char *cmd)
|
uicb_exec(int screen __attribute__ ((unused)), char *cmd)
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
int args_pos;
|
|
||||||
char *args, *path;
|
char *args, *path;
|
||||||
|
|
||||||
/* remap all clients since some WM won't handle them otherwise */
|
/* remap all clients since some WM won't handle them otherwise */
|
||||||
|
@ -61,23 +60,20 @@ uicb_exec(int screen __attribute__ ((unused)), char *cmd)
|
||||||
|
|
||||||
XSync(globalconf.display, False);
|
XSync(globalconf.display, False);
|
||||||
|
|
||||||
if(globalconf.display)
|
|
||||||
close(ConnectionNumber(globalconf.display));
|
|
||||||
|
|
||||||
/* Ignore the leading spaces if any */
|
/* Ignore the leading spaces if any */
|
||||||
for(args_pos = 0;
|
while(cmd[0] && cmd[0] == ' ')
|
||||||
args_pos < a_strlen(cmd) && cmd[args_pos] == ' ';
|
cmd++;
|
||||||
++args_pos);
|
|
||||||
|
|
||||||
/* Get the beginning of the arguments */
|
/* Get the beginning of the arguments */
|
||||||
if((args = strchr(cmd + args_pos, ' ')) == NULL)
|
args = strchr(cmd, ' ');
|
||||||
{
|
|
||||||
warn("invalid command %s\n", cmd);
|
if(args)
|
||||||
return;
|
path = strndup(cmd, args - cmd);
|
||||||
}
|
else
|
||||||
|
path = strndup(cmd, a_strlen(cmd));
|
||||||
|
|
||||||
path = strndup(cmd + args_pos, args - (cmd + args_pos));
|
|
||||||
execlp(path, cmd, NULL);
|
execlp(path, cmd, NULL);
|
||||||
|
|
||||||
p_delete(&path);
|
p_delete(&path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue