forked from enlightenment/efl
parent
fb2ab4ef6c
commit
e13146588e
|
@ -254,10 +254,11 @@ char *
|
||||||
ecore_file_app_exe_get(const char *app)
|
ecore_file_app_exe_get(const char *app)
|
||||||
{
|
{
|
||||||
char *p, *pp, *exe1 = NULL, *exe2 = NULL;
|
char *p, *pp, *exe1 = NULL, *exe2 = NULL;
|
||||||
char *exe;
|
char *exe = NULL;
|
||||||
int in_quot_dbl = 0, in_quot_sing = 0;
|
int in_quot_dbl = 0, in_quot_sing = 0, restart = 0;
|
||||||
|
|
||||||
p = (char *)app;
|
p = (char *)app;
|
||||||
|
restart:
|
||||||
while ((*p) && (isspace(*p))) p++;
|
while ((*p) && (isspace(*p))) p++;
|
||||||
exe1 = p;
|
exe1 = p;
|
||||||
while (*p)
|
while (*p)
|
||||||
|
@ -296,6 +297,7 @@ ecore_file_app_exe_get(const char *app)
|
||||||
homedir = getenv("HOME");
|
homedir = getenv("HOME");
|
||||||
if (!homedir) return NULL;
|
if (!homedir) return NULL;
|
||||||
len = strlen(homedir);
|
len = strlen(homedir);
|
||||||
|
if (exe) free(exe);
|
||||||
exe = malloc(len + exe2 - exe1 + 2);
|
exe = malloc(len + exe2 - exe1 + 2);
|
||||||
if (!exe) return NULL;
|
if (!exe) return NULL;
|
||||||
pp = exe;
|
pp = exe;
|
||||||
|
@ -312,11 +314,13 @@ ecore_file_app_exe_get(const char *app)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (exe) free(exe);
|
||||||
exe = malloc(exe2 - exe1 + 1);
|
exe = malloc(exe2 - exe1 + 1);
|
||||||
if (!exe) return NULL;
|
if (!exe) return NULL;
|
||||||
pp = exe;
|
pp = exe;
|
||||||
}
|
}
|
||||||
p = exe1;
|
p = exe1;
|
||||||
|
restart = 0;
|
||||||
in_quot_dbl = 0;
|
in_quot_dbl = 0;
|
||||||
in_quot_sing = 0;
|
in_quot_sing = 0;
|
||||||
while (*p)
|
while (*p)
|
||||||
|
@ -360,12 +364,23 @@ ecore_file_app_exe_get(const char *app)
|
||||||
pp++;
|
pp++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ((p > exe1) && (*p == '='))
|
||||||
|
{
|
||||||
|
restart = 1;
|
||||||
|
*pp = *p;
|
||||||
|
pp++;
|
||||||
|
}
|
||||||
else if (*p == '\'')
|
else if (*p == '\'')
|
||||||
in_quot_sing = 1;
|
in_quot_sing = 1;
|
||||||
else if (*p == '\"')
|
else if (*p == '\"')
|
||||||
in_quot_dbl = 1;
|
in_quot_dbl = 1;
|
||||||
else if (isspace(*p))
|
else if (isspace(*p))
|
||||||
break;
|
{
|
||||||
|
if (restart)
|
||||||
|
goto restart;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*pp = *p;
|
*pp = *p;
|
||||||
|
|
Loading…
Reference in New Issue