Diff for /np2/x11/dosio.c between versions 1.3 and 1.6

version 1.3, 2003/11/17 13:17:16 version 1.6, 2003/12/19 16:08:01
Line 2 Line 2
   
 #include <sys/stat.h>  #include <sys/stat.h>
 #include <time.h>  #include <time.h>
   #include <dirent.h>
   
 #include "codecnv.h"  #include "codecnv.h"
 #include "dosio.h"  #include "dosio.h"
Line 31  dosio_term(void) Line 32  dosio_term(void)
 FILEH  FILEH
 file_open(const char *path)  file_open(const char *path)
 {  {
           FILEH fh;
   
         return fopen(path, "rb+");          fh = fopen(path, "rb+");
           if (fh)
                   return fh;
           return fopen(path, "rb");
 }  }
   
 FILEH  FILEH
 file_open_rb(const char *path)  file_open_rb(const char *path)
 {  {
   
         return fopen(path, "rb+");          return fopen(path, "rb");
 }  }
   
 FILEH  FILEH
Line 212  file_attr_c(const char *sjis) Line 217  file_attr_c(const char *sjis)
         return file_attr_c(curpath);          return file_attr_c(curpath);
 }  }
   
   FILEFINDH
   file_find1st(const char *dir, FILEFINDT *fft)
   {
           DIR *ret;
   
           ret = opendir(dir);
           if (ret == NULL) {
                   return FILEFINDH_INVALID;
           }
           if (file_findnext((FILEFINDH)ret, fft) == SUCCESS) {
                   return (FILEFINDH)ret;
           }
           closedir(ret);
           return FILEFINDH_INVALID;
   }
   
   BOOL
   file_findnext(FILEFINDH hdl, FILEFINDT *fft)
   {
           struct dirent *de;
           struct stat sb;
           UINT32 attr;
           UINT32 size;
   
           de = readdir((DIR *)hdl);
           if (de == NULL) {
                   return FAILURE;
           }
           if (fft) {
                   mileuc_ncpy(fft->path, de->d_name, sizeof(fft->path));
                   size = 0;
                   attr = 0;
                   if (stat(de->d_name, &sb) == 0) {
                           size = sb.st_size;
                           if (S_ISDIR(sb.st_mode)) {
                                   attr = FILEATTR_DIRECTORY;
                           }
                           else if (!(sb.st_mode & S_IWUSR)) {
                                   attr = FILEATTR_READONLY;
                           }
                   }
                   fft->size = size;
                   fft->attr = attr;
           }
           return SUCCESS;
   }
   
   void
   file_findclose(FILEFINDH hdl)
   {
   
           closedir((DIR *)hdl);
   }
   
 static int  static int
 euckanji1st(const char *str, int pos)  euckanji1st(const char *str, int pos)
 {  {
Line 233  file_cpyname(char *dst, const char *src, Line 292  file_cpyname(char *dst, const char *src,
                 for (i = 0; i < maxlen && src[i] != '\0'; i++) {                  for (i = 0; i < maxlen && src[i] != '\0'; i++) {
                         dst[i] = src[i];                          dst[i] = src[i];
                 }                  }
                 if (i != 0) {                  if (i > 0) {
                         if (euckanji1st(src, i-1)) {                          if (euckanji1st(src, i-1)) {
                                 i--;                                  i--;
                         }                          }

Removed from v.1.3  
changed lines
  Added in v.1.6


RetroPC.NET-CVS <cvs@retropc.net>