9 #include "singular_resourcesconfig.h" 12 #if defined(HAVE_UNISTD_H) && defined(STDC_HEADERS) 24 #define MAXPATHLEN 1024 28 #define ABSOLUTE_FILENAME_P(fname) (fname[0] == '/') 36 static char * omFindExec_link (
const char *
name,
char* executable)
43 if (ABSOLUTE_FILENAME_P(
name))
46 if (! access (
name, F_OK))
49 strcpy(executable,
name);
55 if (((
name[0] ==
'.') && (
name[1] ==
'/')) ||
56 ((
name[0] ==
'.') && (
name[1] ==
'.') && (
name[2] ==
'/')) ||
69 if (! access(tbuf, F_OK))
71 strcpy(executable, tbuf);
91 while (*
p && *
p !=
':')
95 if ((tbuf[0] ==
'.' && tbuf[1] ==
'\0') || tbuf[0] ==
'\0') {
105 if (tbuf[strlen(tbuf)-1] !=
'/') strcat(tbuf,
"/");
109 if (! access (tbuf, F_OK))
111 strcpy(executable, tbuf);
131 static int my_readlink(
const char*
name,
char*
buf,
size_t bufsize)
136 if ((ret = readlink(
name,
buf2, bufsize)) > 0)
161 #define MAX_LINK_LEVEL 10 165 static int full_readlink(
const char*
name,
char*
buf,
size_t bufsize)
169 if ((ret=my_readlink(
name,
buf, bufsize)) > 0)
189 while (
i<MAX_LINK_LEVEL);
196 char * _omFindExec (
const char *
name,
char* exec);
206 ret = _omFindExec(
buf, exec);
207 if (ret !=
NULL)
return ret;
209 return _omFindExec(
name, exec);
212 #define _omFindExec omFindExec 215 char * _omFindExec (
const char *
name,
char* exec)
217 char * link = omFindExec_link(
name, exec);
224 link = omFindExec_link(
buf, exec);
228 char *
p = strrchr(link,
'/');
int search(const CFArray &A, const CanonicalForm &F, int i, int j)
search for F in A between index i and j
int status int void * buf
char name(const Variable &v)
char * omFindExec(const char *name, char *exec)