From: Hallvard Furuseth Date: Tue, 22 Jul 2008 10:16:11 +0000 (+0000) Subject: ITS#5604: Normalize lutil_progname(): strip .exe from Windows executable names X-Git-Tag: LOCKER_IDS~24 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4f935126c4ec262e41e0bfb6b7aba3a4d6e51666;p=openldap ITS#5604: Normalize lutil_progname(): strip .exe from Windows executable names --- diff --git a/libraries/liblutil/utils.c b/libraries/liblutil/utils.c index 9a7559ff72..63b0f3802a 100644 --- a/libraries/liblutil/utils.c +++ b/libraries/liblutil/utils.c @@ -77,6 +77,13 @@ char* lutil_progname( const char* name, int argc, char *argv[] ) LUTIL_SLASHPATH( argv[0] ); progname = strrchr ( argv[0], *LDAP_DIRSEP ); progname = progname ? &progname[1] : argv[0]; +#ifdef _WIN32 + { + size_t len = strlen( progname ); + if ( len > 4 && strcasecmp( &progname[len - 4], ".exe" ) == 0 ) + progname[len - 4] = '\0'; + } +#endif return progname; }