From 0983b116fce1f3b536e2159f7b1142f04ce3d937 Mon Sep 17 00:00:00 2001 From: giraffedata Date: Thu, 20 Apr 2017 23:55:59 +0000 Subject: cleanup git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@2960 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- lib/libpm.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'lib/libpm.c') diff --git a/lib/libpm.c b/lib/libpm.c index 2e2097ec..dbfcac12 100644 --- a/lib/libpm.c +++ b/lib/libpm.c @@ -776,10 +776,17 @@ extractAfterLastSlash(const char * const fullPath, strncpy(retval, slashPos +1, retvalSize); retval[retvalSize-1] = '\0'; } +} + + - /* Chop any .exe off the right end */ - if (strlen(retval) >= 4 && strcmp(retval+strlen(retval)-4, ".exe") == 0) - retval[strlen(retval)-4] = 0; +static void +chopOffExe(char * const arg) { +/*---------------------------------------------------------------------------- + Chop any .exe off the right end of 'arg'. +-----------------------------------------------------------------------------*/ + if (strlen(arg) >= 4 && strcmp(arg+strlen(arg)-4, ".exe") == 0) + arg[strlen(arg)-4] = 0; } @@ -814,6 +821,7 @@ pm_arg0toprogname(const char arg0[]) { #else static char retval[MAX_RETVAL_SIZE+1]; extractAfterLastSlash(arg0, retval, sizeof(retval)); + chopOffExe(retval); #endif return retval; -- cgit 1.4.1