|
|
| version 1.13, 2005/03/05 14:09:37 | version 1.14, 2005/03/09 16:13:24 |
|---|---|
| Line 9 | Line 9 |
| #include "dosio.h" | #include "dosio.h" |
| static char curpath[MAX_PATH]; | static OEMCHAR curpath[MAX_PATH]; |
| static char *curfilep = curpath; | static OEMCHAR *curfilep = curpath; |
| #define ISKANJI(c) ((((c) - 0xa1) & 0xff) < 0x5c) | #define ISKANJI(c) ((((c) - 0xa1) & 0xff) < 0x5c) |
| Line 31 dosio_term(void) | Line 31 dosio_term(void) |
| /* ファイル操作 */ | /* ファイル操作 */ |
| FILEH | FILEH |
| file_open(const char *path) | file_open(const OEMCHAR *path) |
| { | { |
| FILEH fh; | FILEH fh; |
| Line 42 file_open(const char *path) | Line 42 file_open(const char *path) |
| } | } |
| FILEH | FILEH |
| file_open_rb(const char *path) | file_open_rb(const OEMCHAR *path) |
| { | { |
| return fopen(path, "rb"); | return fopen(path, "rb"); |
| } | } |
| FILEH | FILEH |
| file_create(const char *path) | file_create(const OEMCHAR *path) |
| { | { |
| return fopen(path, "wb+"); | return fopen(path, "wb+"); |
| Line 96 file_getsize(FILEH handle) | Line 96 file_getsize(FILEH handle) |
| } | } |
| short | short |
| file_attr(const char *path) | file_attr(const OEMCHAR *path) |
| { | { |
| struct stat sb; | struct stat sb; |
| short attr; | short attr; |
| Line 148 file_getdatetime(FILEH handle, DOSDATE * | Line 148 file_getdatetime(FILEH handle, DOSDATE * |
| } | } |
| short | short |
| file_delete(const char *path) | file_delete(const OEMCHAR *path) |
| { | { |
| return (short)unlink(path); | return (short)unlink(path); |
| } | } |
| short | short |
| file_dircreate(const char *path) | file_dircreate(const OEMCHAR *path) |
| { | { |
| return (short)mkdir(path, 0777); | return (short)mkdir(path, 0777); |
| Line 164 file_dircreate(const char *path) | Line 164 file_dircreate(const char *path) |
| /* カレントファイル操作 */ | /* カレントファイル操作 */ |
| void | void |
| file_setcd(const char *exepath) | file_setcd(const OEMCHAR *exepath) |
| { | { |
| milstr_ncpy(curpath, exepath, sizeof(curpath)); | milstr_ncpy(curpath, exepath, sizeof(curpath)); |
| Line 173 file_setcd(const char *exepath) | Line 173 file_setcd(const char *exepath) |
| } | } |
| char * | char * |
| file_getcd(const char *filename) | file_getcd(const OEMCHAR *filename) |
| { | { |
| *curfilep = '\0'; | *curfilep = '\0'; |
| Line 182 file_getcd(const char *filename) | Line 182 file_getcd(const char *filename) |
| } | } |
| FILEH | FILEH |
| file_open_c(const char *filename) | file_open_c(const OEMCHAR *filename) |
| { | { |
| *curfilep = '\0'; | *curfilep = '\0'; |
| Line 191 file_open_c(const char *filename) | Line 191 file_open_c(const char *filename) |
| } | } |
| FILEH | FILEH |
| file_open_rb_c(const char *filename) | file_open_rb_c(const OEMCHAR *filename) |
| { | { |
| *curfilep = '\0'; | *curfilep = '\0'; |
| Line 200 file_open_rb_c(const char *filename) | Line 200 file_open_rb_c(const char *filename) |
| } | } |
| FILEH | FILEH |
| file_create_c(const char *filename) | file_create_c(const OEMCHAR *filename) |
| { | { |
| *curfilep = '\0'; | *curfilep = '\0'; |
| Line 209 file_create_c(const char *filename) | Line 209 file_create_c(const char *filename) |
| } | } |
| short | short |
| file_delete_c(const char *filename) | file_delete_c(const OEMCHAR *filename) |
| { | { |
| *curfilep = '\0'; | *curfilep = '\0'; |
| Line 218 file_delete_c(const char *filename) | Line 218 file_delete_c(const char *filename) |
| } | } |
| short | short |
| file_attr_c(const char *filename) | file_attr_c(const OEMCHAR *filename) |
| { | { |
| *curfilep = '\0'; | *curfilep = '\0'; |
| Line 227 file_attr_c(const char *filename) | Line 227 file_attr_c(const char *filename) |
| } | } |
| FLISTH | FLISTH |
| file_list1st(const char *dir, FLINFO *fli) | file_list1st(const OEMCHAR *dir, FLINFO *fli) |
| { | { |
| FLISTH ret; | FLISTH ret; |
| Line 258 file_list1st(const char *dir, FLINFO *fl | Line 258 file_list1st(const char *dir, FLINFO *fl |
| BOOL | BOOL |
| file_listnext(FLISTH hdl, FLINFO *fli) | file_listnext(FLISTH hdl, FLINFO *fli) |
| { | { |
| char buf[MAX_PATH]; | OEMCHAR buf[MAX_PATH]; |
| struct dirent *de; | struct dirent *de; |
| struct stat sb; | struct stat sb; |
| Line 301 file_listclose(FLISTH hdl) | Line 301 file_listclose(FLISTH hdl) |
| } | } |
| static int | static int |
| euckanji1st(const char *str, int pos) | euckanji1st(const OEMCHAR *str, int pos) |
| { | { |
| int ret; | int ret; |
| int c; | int c; |
| Line 315 euckanji1st(const char *str, int pos) | Line 315 euckanji1st(const char *str, int pos) |
| } | } |
| void | void |
| file_cpyname(char *dst, const char *src, int maxlen) | file_cpyname(OEMCHAR *dst, const OEMCHAR *src, int maxlen) |
| { | { |
| int i; | int i; |
| Line 333 file_cpyname(char *dst, const char *src, | Line 333 file_cpyname(char *dst, const char *src, |
| } | } |
| void | void |
| file_catname(char *path, const char *filename, int maxlen) | file_catname(OEMCHAR *path, const OEMCHAR *filename, int maxlen) |
| { | { |
| for (; maxlen > 0; path++, maxlen--) { | for (; maxlen > 0; path++, maxlen--) { |
| Line 359 file_catname(char *path, const char *fil | Line 359 file_catname(char *path, const char *fil |
| } | } |
| BOOL | BOOL |
| file_cmpname(const char *path, const char *path2) | file_cmpname(const OEMCHAR *path, const OEMCHAR *path2) |
| { | { |
| return strcmp(path, path2); | return strcmp(path, path2); |
| } | } |
| char * | OEMCHAR * |
| file_getname(const char *path) | file_getname(const OEMCHAR *path) |
| { | { |
| const char *ret; | const OEMCHAR *ret; |
| for (ret = path; *path != '\0'; path++) { | for (ret = path; *path != '\0'; path++) { |
| if (ISKANJI(*path)) { | if (ISKANJI(*path)) { |
| Line 380 file_getname(const char *path) | Line 380 file_getname(const char *path) |
| ret = path + 1; | ret = path + 1; |
| } | } |
| } | } |
| return (char *)ret; | return (OEMCHAR *)ret; |
| } | } |
| void | void |
| file_cutname(char *path) | file_cutname(OEMCHAR *path) |
| { | { |
| char *p; | OEMCHAR *p; |
| p = file_getname(path); | p = file_getname(path); |
| *p = '\0'; | *p = '\0'; |
| } | } |
| char * | OEMCHAR * |
| file_getext(const char *path) | file_getext(const OEMCHAR *path) |
| { | { |
| const char *p, *q; | const OEMCHAR *p, *q; |
| for (p = file_getname(path), q = NULL; *p != '\0'; p++) { | for (p = file_getname(path), q = NULL; *p != '\0'; p++) { |
| if (*p == '.') { | if (*p == '.') { |
| Line 409 file_getext(const char *path) | Line 409 file_getext(const char *path) |
| } | } |
| void | void |
| file_cutext(char *path) | file_cutext(OEMCHAR *path) |
| { | { |
| char *p, *q; | OEMCHAR *p, *q; |
| for (p = file_getname(path), q = NULL; *p != '\0'; p++) { | for (p = file_getname(path), q = NULL; *p != '\0'; p++) { |
| if (*p == '.') { | if (*p == '.') { |
| Line 424 file_cutext(char *path) | Line 424 file_cutext(char *path) |
| } | } |
| void | void |
| file_cutseparator(char *path) | file_cutseparator(OEMCHAR *path) |
| { | { |
| int pos; | int pos; |
| Line 435 file_cutseparator(char *path) | Line 435 file_cutseparator(char *path) |
| } | } |
| void | void |
| file_setseparator(char *path, int maxlen) | file_setseparator(OEMCHAR *path, int maxlen) |
| { | { |
| int pos; | int pos; |