MCPcopy Create free account
hub / github.com/ading2210/linuxpdf / preload_parse_str

Function preload_parse_str

tinyemu/fs_net.c:2317–2412  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2315}
2316
2317static void preload_parse_str(FSDevice *fs1, const char *p)
2318{
2319 FSDeviceMem *fs = (FSDeviceMem *)fs1;
2320 PreloadEntry *pe;
2321 PreloadArchive *pa;
2322 FSINode *n;
2323 BOOL is_archive;
2324 char fname[1024];
2325
2326 pe = NULL;
2327 pa = NULL;
2328 for(;;) {
2329 while (isspace_nolf(*p))
2330 p++;
2331 if (*p == '\n') {
2332 pe = NULL;
2333 p++;
2334 continue;
2335 }
2336 if (*p == '#')
2337 continue; /* comment */
2338 if (*p == '\0')
2339 break;
2340
2341 is_archive = FALSE;
2342 if (*p == '@') {
2343 is_archive = TRUE;
2344 p++;
2345 }
2346 if (parse_fname(fname, sizeof(fname), &p) < 0) {
2347 fprintf(stderr, "invalid filename\n");
2348 return;
2349 }
2350 while (isspace_nolf(*p))
2351 p++;
2352 if (*p == ':') {
2353 p++;
2354 // printf("preload file='%s' archive=%d\n", fname, is_archive);
2355 n = inode_search_path(fs1, fname);
2356 pe = NULL;
2357 pa = NULL;
2358 if (!n || n->type != FT_REG || n->u.reg.state == REG_STATE_LOCAL) {
2359 fprintf(stderr, "invalid preload file: '%s'\n", fname);
2360 while (*p != '\n' && *p != '\0')
2361 p++;
2362 } else if (is_archive) {
2363 pa = mallocz(sizeof(*pa));
2364 pa->name = strdup(fname);
2365 init_list_head(&pa->file_list);
2366 list_add_tail(&pa->link, &fs->preload_archive_list);
2367 } else {
2368 pe = mallocz(sizeof(*pe));
2369 pe->file_id = n->u.reg.file_id;
2370 init_list_head(&pe->file_list);
2371 list_add_tail(&pe->link, &fs->preload_list);
2372 }
2373 } else {
2374 if (!pe && !pa) {

Callers 1

preload_parseFunction · 0.85

Calls 8

isspace_nolfFunction · 0.85
parse_fnameFunction · 0.85
inode_search_pathFunction · 0.85
malloczFunction · 0.85
init_list_headFunction · 0.85
list_add_tailFunction · 0.85
parse_uint64Function · 0.85
parse_file_idFunction · 0.85

Tested by

no test coverage detected