Is this the opposite of what you want here?  strstr returns null if '.cfg' is not found and we're replacing a not-found case - or am I reading this wrong?