Changeset 442 for EcnlProtoTool/trunk/ntshell/webserver/httpd-fs.c
- Timestamp:
- Jul 13, 2020, 8:07:55 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
EcnlProtoTool/trunk/ntshell/webserver/httpd-fs.c
r441 r442 45 45 #include "kernel_cfg.h" 46 46 #include "syssvc/syslog.h" 47 #include "util/ntstdio.h"48 47 49 48 #ifndef _MSC_VER 50 49 #ifndef strcat_s 51 #define strcat_s(dst, dsz, src) ntlibc_strcat(dst, src)50 #define strcat_s(dst, dsz, src) strcat(dst, src) 52 51 #endif 53 52 #endif … … 62 61 #define NULL 0 63 62 #endif /* NULL */ 64 65 extern ntstdio_t *ntstdio;66 63 67 64 /*-----------------------------------------------------------------------------------*/ … … 77 74 res = f_opendir(&dir, path); 78 75 if (res == FR_OK) { 79 i = ntlibc_strlen(path);76 i = strlen(path); 80 77 for (;;) { 81 78 res = f_readdir(&dir, &fno); … … 83 80 fn = fno.fname; 84 81 if (fno.fattrib & AM_DIR) { 85 ntstdio_sprintf(&path[i], "0:/%s", fn);82 sprintf(&path[i], "0:/%s", fn); 86 83 res = scan_files(path, size); 87 84 if (res != FR_OK) break; … … 89 86 } 90 87 else { 91 ntstdio_printf(ntstdio,"%s/%s\n", path, fn);88 printf("%s/%s\n", path, fn); 92 89 } 93 90 } … … 114 111 if ((res = f_open(fd, name, FA_OPEN_EXISTING | FA_READ)) != FR_OK) { 115 112 if ((res = f_opendir(&dir, name)) != FR_OK) { 116 ntstdio_printf(ntstdio,"f_opendir(%s) => %d\n", name, res);113 printf("f_opendir(%s) => %d\n", name, res); 117 114 return 0; 118 115 } 119 116 120 117 if ((res = f_readdir(&dir, &fno)) != FR_OK) { 121 ntstdio_printf(ntstdio,"f_readdir(%s) => %d\n", name, res);118 printf("f_readdir(%s) => %d\n", name, res); 122 119 return 0; 123 120 } … … 132 129 133 130 if (res != FR_OK) { 134 ntstdio_printf(ntstdio,"f_open(%s) => %d %x\n", name, res, fno.fattrib);131 printf("f_open(%s) => %d %x\n", name, res, fno.fattrib); 135 132 return 0; 136 133 } … … 139 136 file->len = fd->fsize; 140 137 141 // ntstdio_printf(ntstdio,"httpd_fs_open(%s) %d\n", name, file->len);138 //printf("httpd_fs_open(%s) %d\n", name, file->len); 142 139 143 140 return 1; … … 158 155 159 156 if ((res = f_open(fd, name, FA_CREATE_ALWAYS | FA_WRITE)) != FR_OK) { 160 ntstdio_printf(ntstdio,"f_open(%s) => %d\n", name, res);157 printf("f_open(%s) => %d\n", name, res); 161 158 return 0; 162 159 } … … 165 162 file->len = 0; 166 163 167 // ntstdio_printf(ntstdio,"httpd_fs_create(%s) %d\n", file->name, file->len);164 //printf("httpd_fs_create(%s) %d\n", file->name, file->len); 168 165 169 166 return 1; … … 179 176 180 177 if ((ret = f_lseek(fd, file->pos)) != FR_OK) { 181 ntstdio_printf(ntstdio,"f_lseek(%s, %d) => %d\n", file->name, file->pos, ret);178 printf("f_lseek(%s, %d) => %d\n", file->name, file->pos, ret); 182 179 return 0; 183 180 } 184 181 185 182 if (file->pos != fd->fptr) { 186 ntstdio_printf(ntstdio,"f_lseek(%s, %d) != %d\n", file->name, file->pos, fd->fptr);183 printf("f_lseek(%s, %d) != %d\n", file->name, file->pos, fd->fptr); 187 184 } 188 185 189 186 if ((ret = f_read(fd, dst, len, &rlen)) != FR_OK) { 190 ntstdio_printf(ntstdio,"f_read(%s, 0x%p, %d) => %d\n", file->name, dst, len, ret);191 return 0; 192 } 193 194 // ntstdio_printf(ntstdio,"httpd_fs_read(%s, %d, %d) => %d\n", file->name, file->pos, len, rlen);187 printf("f_read(%s, 0x%p, %d) => %d\n", file->name, dst, len, ret); 188 return 0; 189 } 190 191 //printf("httpd_fs_read(%s, %d, %d) => %d\n", file->name, file->pos, len, rlen); 195 192 196 193 return rlen; … … 206 203 207 204 if ((ret = f_lseek(fd, file->pos)) != FR_OK) { 208 ntstdio_printf(ntstdio,"f_lseek(%s, %d) => %d\n", file->name, file->pos, ret);205 printf("f_lseek(%s, %d) => %d\n", file->name, file->pos, ret); 209 206 return 0; 210 207 } 211 208 212 209 if (file->pos != fd->fptr) { 213 ntstdio_printf(ntstdio,"f_lseek(%s, %d) != %d\n", file->name, file->pos, fd->fptr);210 printf("f_lseek(%s, %d) != %d\n", file->name, file->pos, fd->fptr); 214 211 } 215 212 216 213 if ((ret = f_write(fd, src, len, &rlen)) != FR_OK) { 217 ntstdio_printf(ntstdio,"f_write(%s, 0x%p, %d) => %d\n", file->name, src, len, ret);214 printf("f_write(%s, 0x%p, %d) => %d\n", file->name, src, len, ret); 218 215 return 0; 219 216 } … … 222 219 file->len += rlen; 223 220 224 // ntstdio_printf(ntstdio,"httpd_fs_write(%s, %d, %d) => %d\n", file->name, file->pos, len, rlen);221 //printf("httpd_fs_write(%s, %d, %d) => %d\n", file->name, file->pos, len, rlen); 225 222 226 223 return rlen; … … 234 231 235 232 if ((ret = f_close(fd)) != FR_OK) { 236 ntstdio_printf(ntstdio,"f_close(%s) => %d\n", file->name, ret);233 printf("f_close(%s) => %d\n", file->name, ret); 237 234 return 0; 238 235 }
Note:
See TracChangeset
for help on using the changeset viewer.