* Wine uses normal slashes instead of backslashes on windows
getprogname (void)
{
const char *name;
- const char *p;
+ const char *p, *p2;
size_t length;
name = __argv[0];
return NULL;
p = strrchr (name, '\\');
+ p2 = strrchr (name, '/');
+ if (p2 > p)
+ p = p2;
if (p != NULL)
name = p + 1;
strncpy (prognamebuf, name, length);
prognamebuf[length] = 0;
length = strlen (prognamebuf);
- if (length > 4 && _stricmp (prognamebuf + (length - 4), ".exe"))
+ if (length > 4 && _stricmp (prognamebuf + (length - 4), ".exe") == 0)
prognamebuf[length - 4] = '\0';
return prognamebuf;