summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>1995-03-21 21:24:36 +0000
committerRoland McGrath <roland@redhat.com>1995-03-21 21:24:36 +0000
commit3608635ec6b66da56a524958e4a0deeaa3806b0a (patch)
treec314a51825fe1ee6e809041aa67199955598306f
parentca53696814cc1d56c9e992443056ec86ea5ec11c (diff)
downloadgunmake-3608635ec6b66da56a524958e4a0deeaa3806b0a.tar.gz
(search_path): Function removed (was already #if 0'd out).
-rw-r--r--job.c105
1 files changed, 0 insertions, 105 deletions
diff --git a/job.c b/job.c
index 8e979fc..b7daf2d 100644
--- a/job.c
+++ b/job.c
@@ -1071,111 +1071,6 @@ child_execute_job (stdin_fd, stdout_fd, argv, envp)
exec_command (argv, envp);
}
-#if 0
-
-/* Default path to search for executables. */
-static char default_path[] = ":/bin:/usr/bin";
-
-/* Search PATH for FILE.
- If successful, store the full pathname in PROGRAM and return 1.
- If not sucessful, return zero. */
-
-static int
-search_path (file, path, program)
- char *file, *path, *program;
-{
- if (path == 0 || path[0] == '\0')
- path = default_path;
-
- if (
-#ifdef __MSDOS__
- strpbrk (file, "/\\:")
-#else
- index (file, '/')
-#endif
- != 0)
- {
- strcpy (program, file);
- return 1;
- }
- else
- {
- unsigned int len;
-
-#ifdef HAVE_GETGROUPS
-#ifndef HAVE_UNISTD_H
- extern int getgroups ();
-#endif
- static int ngroups = -1;
-#ifdef NGROUPS_MAX
- static GETGROUPS_T groups[NGROUPS_MAX];
-#define ngroups_max NGROUPS_MAX
-#else
- static GETGROUPS_T *groups = 0;
- static int ngroups_max;
- if (groups == 0)
- {
- ngroups_max = GET_NGROUPS_MAX;
- groups = (GETGROUPS_T *) malloc (ngroups_max * sizeof (GETGROUPS_T));
- }
-#endif
- if (groups != 0 && ngroups == -1)
- ngroups = getgroups (ngroups_max, groups);
-#endif /* Have getgroups. */
-
- len = strlen (file) + 1;
- do
- {
- struct stat st;
- int perm;
- char *p;
-
- p = index (path, PATH_SEPARATOR_CHAR);
- if (p == 0)
- p = path + strlen (path);
-
- if (p == path)
- bcopy (file, program, len);
- else
- {
- bcopy (path, program, p - path);
- program[p - path] = '/';
- bcopy (file, program + (p - path) + 1, len);
- }
-
- if (safe_stat (program, &st) == 0
- && S_ISREG (st.st_mode))
- {
- if (st.st_uid == geteuid ())
- perm = (st.st_mode & 0100);
- else if (st.st_gid == getegid ())
- perm = (st.st_mode & 0010);
- else
- {
-#ifdef HAVE_GETGROUPS
- register int i;
- for (i = 0; i < ngroups; ++i)
- if (groups[i] == st.st_gid)
- break;
- if (i < ngroups)
- perm = (st.st_mode & 0010);
- else
-#endif /* Have getgroups. */
- perm = (st.st_mode & 0001);
- }
-
- if (perm != 0)
- return 1;
- }
-
- path = p + 1;
- } while (*path != '\0');
- }
-
- return 0;
-}
-#endif /* search_path commented out */
-
/* Replace the current process with one running the command in ARGV,
with environment ENVP. This function does not return. */