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

Function full_readlink

resources/omFindExec.c:228–255  ·  view source on GitHub ↗

similar to readlink (cf. man readlink), except that symbolic links are followed up to MAX_LINK_LEVEL */

Source from the content-addressed store, hash-verified

226 followed up to MAX_LINK_LEVEL
227*/
228static int full_readlink(const char* name, char* buf, size_t bufsize)
229{
230 int ret;
231
232 if ((ret=my_readlink(name, buf, bufsize)) > 0)
233 {
234 char buf2[MAXPATHLEN];
235 int ret2, i = 0;
236
237 do
238 {
239 buf[ret] = '\0';
240 if ((ret2 = my_readlink(buf, buf2, MAXPATHLEN)) > 0)
241 {
242 i++;
243 buf2[ret2] = '\0';
244 strcpy(buf, buf2);
245 ret = ret2;
246 }
247 else
248 {
249 return ret;
250 }
251 }
252 while (i<MAX_LINK_LEVEL);
253 }
254 return -1;
255}
256
257#ifdef __CYGWIN__
258/* for windows, serch first for .exe */

Callers 1

_omFindExecFunction · 0.85

Calls 1

my_readlinkFunction · 0.85

Tested by

no test coverage detected