factor away add_env(), buffer strchr results. fixed a bug where a[i] pointed at argv instead of env