void file_cutext(OEMCHAR *path) { OEMCHAR *p, *q; for (p = file_getname(path), q = NULL; *p != '\0'; p++) { if (*p == '.') { q = p; } } if (q != NULL) { *q = '\0'; } }
OEMCHAR * file_getext(const OEMCHAR *path) { const OEMCHAR *p, *q; for (p = file_getname(path), q = NULL; *p != '\0'; p++) { if (*p == '.') { q = p + 1; } } if (q == NULL) { q = p; } return (char *)q; }
void file_cutext(char *path) { char *p; char *q; p = file_getname(path); q = NULL; while(*p != '\0') { if (*p == '.') { q = p; } p++; } if (q != NULL) { *q = '\0'; } }
void DOSIOCALL file_cutext(OEMCHAR *path) { OEMCHAR *p; OEMCHAR *q; int csize; p = file_getname(path); q = NULL; while((csize = milstr_charsize(p)) != 0) { if ((csize == 1) && (*p == '.')) { q = p; } p += csize; } if (q) { *q = '\0'; } }
char *file_getext(const char *path) { const char *p; const char *q; p = file_getname(path); q = NULL; while(*p != '\0') { if (*p == '.') { q = p + 1; } p++; } if (q == NULL) { q = p; } return((char *)q); }
char *file_getext(const char *path) { char *p; char *q; p = file_getname(path); q = NULL; while(*p != '\0') { if (*p++ == '.') { q = p; } } if (!q) { q = p; } return(q); }
static void dlgsetlist(void) { LISTARRAY flist; FLISTH flh; FLINFO fli; BOOL append; FLIST fl; ITEMEXPRM prm; menudlg_itemreset(DID_FLIST); menudlg_settext(DID_FOLDER, file_getname(filesel.path)); listarray_destroy(filesel.flist); flist = listarray_new(sizeof(_FLIST), 64); filesel.flist = flist; filesel.fbase = NULL; flh = file_list1st(filesel.path, &fli); if (flh != FLISTH_INVALID) { do { append = FALSE; if (fli.attr & 0x10) { append = TRUE; } else if (!(fli.attr & 0x08)) { append = checkext(fli.path, filesel.ext); } if (append) { if (fappend(flist, &fli) != SUCCESS) { break; } } } while(file_listnext(flh, &fli,filesel.path) == SUCCESS); file_listclose(flh); } prm.pos = 0; fl = filesel.fbase; while(fl) { menudlg_itemappend(DID_FLIST, NULL); prm.icon = (fl->isdir)?MICON_FOLDER:MICON_FILE; prm.str = fl->name; menudlg_itemsetex(DID_FLIST, &prm); fl = fl->next; prm.pos++; } }
OEMCHAR * DOSIOCALL file_getext(const OEMCHAR *path) { const OEMCHAR *p; const OEMCHAR *q; int csize; p = file_getname(path); q = NULL; while((csize = milstr_charsize(p)) != 0) { if ((csize == 1) && (*p == '.')) { q = p + 1; } p += csize; } if (q == NULL) { q = p; } return((OEMCHAR *)q); }
/** * 拡張子を削除 * @param[in,out] lpPathName パス */ void DOSIOCALL file_cutext(OEMCHAR* lpPathName) { OEMCHAR* p = file_getname(lpPathName); OEMCHAR* q = NULL; while (1 /* EVER */) { const int cch = milstr_charsize(p); if (cch == 0) { break; } else if ((cch == 1) && (*p == '.')) { q = p; } p += cch; } if (q) { *q = '\0'; } }
/** * 拡張子のポインタを得る * @param[in] lpPathName パス * @return ポインタ */ OEMCHAR* DOSIOCALL file_getext(const OEMCHAR* lpPathName) { const OEMCHAR* p = file_getname(lpPathName); const OEMCHAR* q = NULL; while (1 /* EVER */) { const int cch = milstr_charsize(p); if (cch == 0) { break; } else if ((cch == 1) && (*p == '.')) { q = p + 1; } p += cch; } if (q == NULL) { q = p; } return const_cast<OEMCHAR*>(q); }
void initgetfile(OEMCHAR *path, UINT size) { const OEMCHAR *ext; file_cpyname(path, modulefile, size); if (np2arg.ini) { if ((np2arg.ini[0] == '/') || (np2arg.ini[0] == '-')) { file_cutname(path); file_catname(path, file_getname(np2arg.ini + 2), size); } else { file_cpyname(path, np2arg.ini, size); } ext = file_getext(path); if (ext[0] != '\0') { file_catname(path, ext_ini, size); } } else { file_cutext(path); file_catname(path, ext_ini, size); } }
/** * ファイル名を削除 * @param[in,out] lpPathName パス */ void DOSIOCALL file_cutname(OEMCHAR* lpPathName) { OEMCHAR* p = file_getname(lpPathName); p[0] = '\0'; }
/** * カレント パス設定 * @param[in] lpPathName カレント ファイル名 */ void DOSIOCALL file_setcd(const OEMCHAR* lpPathName) { file_cpyname(curpath, lpPathName, NELEMENTS(curpath)); curfilep = file_getname(curpath); *curfilep = '\0'; }
static int blockset_open_file(struct blockstore *blockStore, struct blockset *bs) { uint64 offset; mtime_t ts; int res; res = file_open(bs->filename, 0 /* R/O */, 0 /* !unbuf */, &bs->desc); if (res) { return res; } bs->filesize = file_getsize(bs->desc); if (bs->filesize < 0) { return errno; } if (bs->filesize > 0) { char *s = print_size(bs->filesize); char *name = file_getname(bs->filename); Log(LGPFX" reading file %s -- %s -- %llu headers.\n", name, s, bs->filesize / sizeof(btc_block_header)); free(name); free(s); } ts = time_get(); offset = 0; while (offset < bs->filesize) { btc_block_header buf[10000]; size_t numRead; size_t numBytes; int numHeaders; int i; numBytes = MIN(bs->filesize - offset, sizeof buf); res = file_pread(bs->desc, offset, buf, numBytes, &numRead); if (res != 0) { break; } if (btc->stop != 0) { res = 1; NOT_TESTED(); break; } numHeaders = numRead / sizeof(btc_block_header); for (i = 0; i < numHeaders; i++) { struct blockentry *be; uint256 hash; be = blockstore_alloc_entry(buf + i); be->written = 1; hash256_calc(buf + i, sizeof buf[0], &hash); if (!blockstore_validate_chkpt(&hash, blockStore->height + 1)) { return 1; } blockstore_add_entry(blockStore, be, &hash); if (i == numHeaders - 1) { bitcui_set_status("loading headers .. %llu%%", (offset + numBytes) * 100 / bs->filesize); } if (i == numHeaders - 1 || (numBytes < sizeof buf && i > numHeaders - 256)) { bitcui_set_last_block_info(&hash, blockStore->height, be->header.timestamp); } } offset += numRead; } ts = time_get() - ts; char hashStr[80]; char *latStr; uint256_snprintf_reverse(hashStr, sizeof hashStr, &blockStore->best_hash); Log(LGPFX" loaded blocks up to %s\n", hashStr); latStr = print_latency(ts); Log(LGPFX" this took %s\n", latStr); free(latStr); return res; }
// カレントファイル操作 void DOSIOCALL file_setcd(const OEMCHAR *exepath) { file_cpyname(curpath, exepath, NELEMENTS(curpath)); curfilep = file_getname(curpath); *curfilep = '\0'; }
/* カレントファイル操作 */ void file_setcd(const char *exepath) { file_cpyname(curpath, exepath, sizeof(curpath)); curfilep = file_getname(curpath); *curfilep = '\0'; }