| version 1.8, 2005/02/09 20:11:35 | version 1.11, 2005/03/20 08:58:19 | 
| Line 5 | Line 5 | 
 | static  OEMCHAR curpath[MAX_PATH]; | static  OEMCHAR curpath[MAX_PATH]; | 
 | static  OEMCHAR *curfilep = curpath; | static  OEMCHAR *curfilep = curpath; | 
 |  |  | 
 | #define ISKANJI(c)      (((((c) ^ 0x20) - 0xa1) & 0xff) < 0x3c) |  | 
 |  |  | 
 |  |  | 
 | // ---- | // ---- | 
 |  |  | 
| Line 154  void DOSIOCALL file_setcd(const OEMCHAR | Line 152  void DOSIOCALL file_setcd(const OEMCHAR | 
 |  |  | 
 | OEMCHAR * DOSIOCALL file_getcd(const OEMCHAR *path) { | OEMCHAR * DOSIOCALL file_getcd(const OEMCHAR *path) { | 
 |  |  | 
| *curfilep = '\0'; | file_cpyname(curfilep, path, NELEMENTS(curpath) - (curfilep - curpath)); | 
| file_catname(curpath, path, NELEMENTS(curpath)); |  | 
 | return(curpath); | return(curpath); | 
 | } | } | 
 |  |  | 
 | FILEH DOSIOCALL file_open_c(const OEMCHAR *path) { | FILEH DOSIOCALL file_open_c(const OEMCHAR *path) { | 
 |  |  | 
| *curfilep = '\0'; | file_cpyname(curfilep, path, NELEMENTS(curpath) - (curfilep - curpath)); | 
| file_catname(curpath, path, NELEMENTS(curpath)); |  | 
 | return(file_open(curpath)); | return(file_open(curpath)); | 
 | } | } | 
 |  |  | 
 | FILEH DOSIOCALL file_open_rb_c(const OEMCHAR *path) { | FILEH DOSIOCALL file_open_rb_c(const OEMCHAR *path) { | 
 |  |  | 
| *curfilep = '\0'; | file_cpyname(curfilep, path, NELEMENTS(curpath) - (curfilep - curpath)); | 
| file_catname(curpath, path, NELEMENTS(curpath)); |  | 
 | return(file_open_rb(curpath)); | return(file_open_rb(curpath)); | 
 | } | } | 
 |  |  | 
 | FILEH DOSIOCALL file_create_c(const OEMCHAR *path) { | FILEH DOSIOCALL file_create_c(const OEMCHAR *path) { | 
 |  |  | 
| *curfilep = '\0'; | file_cpyname(curfilep, path, NELEMENTS(curpath) - (curfilep - curpath)); | 
| file_catname(curpath, path, NELEMENTS(curpath)); |  | 
 | return(file_create(curpath)); | return(file_create(curpath)); | 
 | } | } | 
 |  |  | 
 | short DOSIOCALL file_delete_c(const OEMCHAR *path) { | short DOSIOCALL file_delete_c(const OEMCHAR *path) { | 
 |  |  | 
| *curfilep = '\0'; | file_cpyname(curfilep, path, NELEMENTS(curpath) - (curfilep - curpath)); | 
| file_catname(curpath, path, NELEMENTS(curpath)); |  | 
 | return(file_delete(curpath)); | return(file_delete(curpath)); | 
 | } | } | 
 |  |  | 
 | short DOSIOCALL file_attr_c(const OEMCHAR *path) { | short DOSIOCALL file_attr_c(const OEMCHAR *path) { | 
 |  |  | 
| *curfilep = '\0'; | file_cpyname(curfilep, path, NELEMENTS(curpath) - (curfilep - curpath)); | 
| file_catname(curpath, path, NELEMENTS(curpath)); |  | 
 | return(file_attr(curpath)); | return(file_attr(curpath)); | 
 | } | } | 
 |  |  | 
| Line 255  void DOSIOCALL file_listclose(FLISTH hdl | Line 247  void DOSIOCALL file_listclose(FLISTH hdl | 
 | OEMCHAR * DOSIOCALL file_getname(const OEMCHAR *path) { | OEMCHAR * DOSIOCALL file_getname(const OEMCHAR *path) { | 
 |  |  | 
 | const OEMCHAR   *ret; | const OEMCHAR   *ret; | 
 |  | int                     csize; | 
 |  |  | 
 | ret = path; | ret = path; | 
| while(*path != '\0') { | while((csize = milstr_charsize(path)) != 0) { | 
| if (!ISKANJI(*path)) { | if (csize == 1) { | 
 | if ((*path == '\\') || (*path == '/') || (*path == ':')) { | if ((*path == '\\') || (*path == '/') || (*path == ':')) { | 
 | ret = path + 1; | ret = path + 1; | 
 | } | } | 
 | } | } | 
| else { | path += csize; | 
| if (path[1]) { |  | 
| path++; |  | 
| } |  | 
| } |  | 
| path++; |  | 
 | } | } | 
 | return((OEMCHAR *)ret); | return((OEMCHAR *)ret); | 
 | } | } | 
| Line 285  OEMCHAR * DOSIOCALL file_getext(const OE | Line 273  OEMCHAR * DOSIOCALL file_getext(const OE | 
 |  |  | 
 | const OEMCHAR   *p; | const OEMCHAR   *p; | 
 | const OEMCHAR   *q; | const OEMCHAR   *q; | 
 |  | int                     csize; | 
 |  |  | 
 | p = file_getname(path); | p = file_getname(path); | 
 | q = NULL; | q = NULL; | 
|  | while((csize = milstr_charsize(p)) != 0) { | 
| while(*p != '\0') { | if ((csize == 1) && (*p == '.')) { | 
| if (!ISKANJI(*p)) { | q = p + 1; | 
| if (*p == '.') { |  | 
| q = p + 1; |  | 
| } |  | 
| } |  | 
| else { |  | 
| if (p[1]) { |  | 
| p++; |  | 
| } |  | 
 | } | } | 
| p++; | p += csize; | 
 | } | } | 
| if (!q) { | if (q == NULL) { | 
 | q = p; | q = p; | 
 | } | } | 
 | return((OEMCHAR *)q); | return((OEMCHAR *)q); | 
| Line 312  void DOSIOCALL file_cutext(OEMCHAR *path | Line 293  void DOSIOCALL file_cutext(OEMCHAR *path | 
 |  |  | 
 | OEMCHAR *p; | OEMCHAR *p; | 
 | OEMCHAR *q; | OEMCHAR *q; | 
 |  | int             csize; | 
 |  |  | 
 | p = file_getname(path); | p = file_getname(path); | 
 | q = NULL; | q = NULL; | 
| while(*p != '\0') { | while((csize = milstr_charsize(p)) != 0) { | 
| if (!ISKANJI(*p)) { | if ((csize == 1) && (*p == '.')) { | 
| if (*p == '.') { | q = p; | 
| q = p; |  | 
| } |  | 
| } |  | 
| else { |  | 
| if (p[1]) { |  | 
| p++; |  | 
| } |  | 
 | } | } | 
| p++; | p += csize; | 
 | } | } | 
 | if (q) { | if (q) { | 
 | *q = '\0'; | *q = '\0'; |