parse uicb command with no arguments and no tailing space

This commit is contained in:
daniel@brinkers.de 2007-10-15 19:11:19 +02:00 committed by Julien Danjou
parent fefa16611a
commit 1de87e372d
1 changed files with 9 additions and 7 deletions

12
uicb.c
View File

@ -48,9 +48,10 @@ parse_control(char *cmd, awesome_config *awesomeconf)
int int
run_uicb(char *cmd, awesome_config *awesomeconf) run_uicb(char *cmd, awesome_config *awesomeconf)
{ {
char *p, *uicb_name, *arg; char *p, *uicb_name;
const char *arg;
int screen; int screen;
void (*uicb) (awesome_config *, char *); void (*uicb) (awesome_config *, const char *);
if(!a_strlen(cmd)) if(!a_strlen(cmd))
return -1; return -1;
@ -66,11 +67,12 @@ run_uicb(char *cmd, awesome_config *awesomeconf)
uicb_name = p; uicb_name = p;
if(!(p = strchr(p, ' '))) if(!(p = strchr(p, ' ')))
return -1; arg = "";
else
{
*p++ = '\0'; *p++ = '\0';
arg = p; arg = p;
}
if((p = strchr(arg, '\n'))) if((p = strchr(arg, '\n')))
*p = '\0'; *p = '\0';