normalize away spurious percent arguments in the executable

SVN revision: 39608
This commit is contained in:
Viktor Kojouharov 2009-03-21 11:48:45 +00:00
parent d19e0ba2dc
commit 6927a37b23
1 changed files with 17 additions and 5 deletions

View File

@ -450,6 +450,7 @@ _e_exehist_normalize_exe(const char *exe)
{
char *base, *cp, *space = NULL;
const char *ret;
Eina_Bool flag = EINA_FALSE;
base = basename(exe);
if (base[0] == '.' && base[1] == '\0')
@ -463,13 +464,23 @@ _e_exehist_normalize_exe(const char *exe)
{
if (!space)
space = cp;
if (flag)
flag = EINA_FALSE;
}
else
else if (!flag)
{
char lower = tolower(*cp);
if (lower != *cp)
*cp = lower;
space = NULL;
/* usually a variable in the desktop exe field */
if (space && *cp == '%')
flag = EINA_TRUE;
else
{
char lower = tolower(*cp);
space = NULL;
if (lower != *cp)
*cp = lower;
}
}
cp++;
}
@ -479,6 +490,7 @@ _e_exehist_normalize_exe(const char *exe)
ret = eina_stringshare_add(base);
free(base);
return ret;
}