- for (path = p ; path ; path = p) {
- /* construct full path name to try */
- if ((p = index(path,':')) == NULL) {
- strcpy(fnbuffer, path);
- } else {
- strncpy(fnbuffer, path, p-path);
- fnbuffer[p-path] = '\0';
- p++; /* Skip : for next time */
- }
- if (strlen(fnbuffer) != 0)
- strcat(fnbuffer,"/");
- strcat(fnbuffer,filename);
-
- /* check to see if file is there and is a normal file */
- if (stat(fnbuffer, &statbuf) < 0) {
- if (errno == ENOENT)
- continue; /* file not there,keep on looking */
- else
- goto fail; /* failed for some reason, return */
- }
- if (!S_ISREG(statbuf.st_mode)) continue;
-
- if (execve(fnbuffer, argstart, environ) < 0
- && errno != ENOENT
- && errno != ENOEXEC) {
- /* failed, for some other reason besides "file
+ for (path = p; path; path = p)
+ {
+ /* construct full path name to try */
+ if ((p = index (path, ':')) == NULL)
+ {
+ strcpy (fnbuffer, path);
+ }
+ else
+ {
+ strncpy (fnbuffer, path, p - path);
+ fnbuffer[p - path] = '\0';
+ p++; /* Skip : for next time */
+ }
+ if (strlen (fnbuffer) != 0)
+ strcat (fnbuffer, "/");
+ strcat (fnbuffer, filename);
+
+ /* check to see if file is there and is a normal file */
+ if (stat (fnbuffer, &statbuf) < 0)
+ {
+ if (errno == ENOENT)
+ continue; /* file not there,keep on looking */
+ else
+ goto fail; /* failed for some reason, return */
+ }
+ if (!S_ISREG (statbuf.st_mode))
+ continue;
+
+ if (execve (fnbuffer, argstart, environ) < 0
+ && errno != ENOENT
+ && errno != ENOEXEC)
+ {
+ /* failed, for some other reason besides "file