Lines Matching refs:fn

386 apprentice_1(struct magic_set *ms, const char *fn, int action)  in apprentice_1()  argument
400 map = apprentice_load(ms, fn, action); in apprentice_1()
403 return apprentice_compile(ms, map, fn); in apprentice_1()
406 map = apprentice_map(ms, fn); in apprentice_1()
408 if (fn) { in apprentice_1()
410 file_magwarn(ms, "using regular magic file `%s'", fn); in apprentice_1()
411 map = apprentice_load(ms, fn, action); in apprentice_1()
541 file_apprentice(struct magic_set *ms, const char *fn, int action) in file_apprentice() argument
548 if ((fn = magic_getpath(fn, action)) == NULL) in file_apprentice()
554 if (fn == NULL) in file_apprentice()
555 fn = getenv("MAGIC"); in file_apprentice()
556 if (fn == NULL) { in file_apprentice()
564 return apprentice_1(ms, fn, action); in file_apprentice()
567 if ((mfn = estrdup(fn)) == NULL) { in file_apprentice()
568 file_oomem(ms, strlen(fn)); in file_apprentice()
586 fn = mfn; in file_apprentice()
588 while (fn) { in file_apprentice()
589 p = strchr(fn, PATHSEP); in file_apprentice()
592 if (*fn == '\0') in file_apprentice()
594 file_err = apprentice_1(ms, fn, action); in file_apprentice()
596 fn = p; in file_apprentice()
937 load_1(struct magic_set *ms, int action, const char *fn, int *errs, in load_1() argument
950 ms->file = fn; in load_1()
952 stream = php_stream_open_wrapper((char *)fn, "rb", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL); in load_1()
954 stream = php_stream_open_wrapper((char *)fn, "rb", REPORT_ERRORS, NULL); in load_1()
960 fn); in load_1()
1131 apprentice_load(struct magic_set *ms, const char *fn, int action) in apprentice_load() argument
1170 if (php_sys_stat(fn, &st) == 0 && S_ISDIR(st.st_mode)) { in apprentice_load()
1174 dir = php_stream_opendir((char *)fn, REPORT_ERRORS, NULL); in apprentice_load()
1180 if ((mflen = snprintf(mfn, sizeof(mfn), "%s/%s", fn, d.d_name)) < 0) { in apprentice_load()
1182 strlen(fn) + strlen(d.d_name) + 2); in apprentice_load()
1213 load_1(ms, action, fn, &errs, mentry, mentrycount); in apprentice_load()
2590 apprentice_map(struct magic_set *ms, const char *fn) in apprentice_map() argument
2609 if (fn == NULL) { in apprentice_map()
2617 if (php_stream_stat_path_ex((char *)fn, 0, &st, NULL) == SUCCESS) { in apprentice_map()
2624 dbname = mkdbname(ms, fn, 0); in apprentice_map()
2629 stream = php_stream_open_wrapper((char *)fn, "rb", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL); in apprentice_map()
2631 stream = php_stream_open_wrapper((char *)fn, "rb", REPORT_ERRORS, NULL); in apprentice_map()
2687 if (needsbyteswap && fn == NULL) { in apprentice_map()
2692 if (NULL != fn) { in apprentice_map()
2713 if (NULL != fn && entries != nentries + 1) { in apprentice_map()
2747 apprentice_compile(struct magic_set *ms, struct magic_map *map, const char *fn) in apprentice_compile() argument
2760 dbname = mkdbname(ms, fn, 0); in apprentice_compile()
2767 stream = php_stream_open_wrapper((char *)fn, "wb+", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL); in apprentice_compile()
2769 stream = php_stream_open_wrapper((char *)fn, "wb+", REPORT_ERRORS, NULL); in apprentice_compile()
2817 mkdbname(struct magic_set *ms, const char *fn, int strip) argument
2824 if ((p = strrchr(fn, '/')) != NULL)
2825 fn = ++p;
2828 for (q = fn; *q; q++)
2831 for (p = ext + sizeof(ext) - 1; p >= ext && q >= fn; p--, q--)
2843 spprintf(&buf, MAXPATHLEN, "%.*s.mime%s", (int)(q - fn), fn, ext);
2854 spprintf(&buf, MAXPATHLEN, "%.*s%s", (int)(q - fn), fn, ext);