MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / getnextfilename

Function getnextfilename

lib/lua/src/loadlib.c:438–453  ·  view source on GitHub ↗

** Get the next name in '*path' = 'name1;name2;name3;...', changing ** the ending ';' to '\0' to create a zero-terminated string. Return ** NULL when list ends. */

Source from the content-addressed store, hash-verified

436** NULL when list ends.
437*/
438static const char *getnextfilename (char **path, char *end) {
439 char *sep;
440 char *name = *path;
441 if (name == end)
442 return NULL; /* no more names */
443 else if (*name == '\0') { /* from previous iteration? */
444 *name = *LUA_PATH_SEP; /* restore separator */
445 name++; /* skip it */
446 }
447 sep = strchr(name, *LUA_PATH_SEP); /* find next separator */
448 if (sep == NULL) /* separator not found? */
449 sep = end; /* name goes until the end */
450 *sep = '\0'; /* finish file name */
451 *path = sep; /* will start next search from here */
452 return name;
453}
454
455
456/*

Callers 1

searchpathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected