no  first  since you are using execvp  but don t you do not need to search the  path manually  second  just append bin  to whatever main s argv is  and assume require that the wrapper and the thing it is wrapping live in the same directory  then we could invoke foo bar cgpt and if that particular cgpt is really the wrapper  then the actual binary would have to be foo bar cgpt bin similarly  if we renamed it to anything else mv foo bar cgpt foo bar hey  mv foo bar cgpt bin foo bar hey bin foo bar hey