static int out_scan_fbox_dir(s_outbound_callback_data *callback, const char *path, s_faddr addr, int flavor) { DIR *dir; struct dirent *dirent; if( (dir = opendir(path)) == NULL ) { logerr("can't open filebox directory \"%s\"", path); return -1; } while( (dirent = readdir(dir)) ) { callback->path = string_concat(path, dirent->d_name, NULL); if( is_regfile(callback->path) ) { callback->addr = addr; callback->type = OUTB_TYPE_FBOX; callback->flavor = flavor; callback->callback(callback); } free(callback->path); callback->path = NULL; } closedir(dir); return 0; }
/** * tifiles_file_is_ti: * @filename: a filename as string. * * Check whether file is a TI file by checking the signature. * * Return value: a boolean value. **/ TIEXPORT2 int TICALL tifiles_file_is_ti(const char *filename) { // bug: check that file is not a FIFO if (!is_regfile(filename)) return 0; if(tifiles_file_has_ti_header(filename)) return !0; if(tifiles_file_has_tib_header(filename)) return !0; if(tifiles_file_has_tig_header(filename)) return !0; if(tifiles_file_has_tno_header(filename)) return !0; { char *e = tifiles_fext_get(filename); if (!strcmp(e, "")) return 0; if(!g_ascii_strcasecmp(e, "tns")) return !0; } return 0; }