MCPcopy Create free account
hub / github.com/Singular/Singular / _omFindExec

Function _omFindExec

resources/omFindExec.c:278–310  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

276#endif
277
278char * _omFindExec (const char *name, char* exec)
279{
280 char * link = omFindExec_link(name, exec);
281 char buf[MAXPATHLEN];
282 int ret;
283
284 if (link == NULL && (ret=full_readlink(name, buf, MAXPATHLEN)) > 0)
285 {
286 buf[ret] ='\0';
287 link = omFindExec_link(buf, exec);
288 }
289 if (link != NULL && (ret=full_readlink(link, buf, MAXPATHLEN)) > 0)
290 {
291 char *p = strrchr(link, '/');
292
293
294 if(p!=NULL) *(p+1)='\0';
295 buf[ret]='\0';
296
297 if (buf[0] != '/')
298 {
299 strcpy(exec, link);
300 strcat(exec, buf);
301 }
302 else
303 {
304 strcpy(exec, buf);
305 }
306
307 return exec;
308 }
309 return link;
310}
311#endif /* HAVE_READLINK */
312
313#else

Callers 1

omFindExecFunction · 0.85

Calls 2

omFindExec_linkFunction · 0.85
full_readlinkFunction · 0.85

Tested by

no test coverage detected