[286] | 1 | /*
|
---|
| 2 | * TOPPERS ECHONET Lite Communication Middleware
|
---|
| 3 | *
|
---|
| 4 | * Copyright (C) 2017 Cores Co., Ltd. Japan
|
---|
| 5 | *
|
---|
| 6 | * 上記著作権者は,以下の(1)~(4)の条件を満たす場合に限り,本ソフトウェ
|
---|
| 7 | * ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
|
---|
| 8 | * 変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
|
---|
| 9 | * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
|
---|
| 10 | * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー
|
---|
| 11 | * スコード中に含まれていること.
|
---|
| 12 | * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
|
---|
| 13 | * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用
|
---|
| 14 | * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記
|
---|
| 15 | * の無保証規定を掲載すること.
|
---|
| 16 | * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
|
---|
| 17 | * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ
|
---|
| 18 | * と.
|
---|
| 19 | * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
|
---|
| 20 | * 作権表示,この利用条件および下記の無保証規定を掲載すること.
|
---|
| 21 | * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
|
---|
| 22 | * 報告すること.
|
---|
| 23 | * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
|
---|
| 24 | * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
|
---|
| 25 | * また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
|
---|
| 26 | * 由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
|
---|
| 27 | * 免責すること.
|
---|
| 28 | *
|
---|
| 29 | * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お
|
---|
| 30 | * よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
|
---|
| 31 | * に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
|
---|
| 32 | * アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
|
---|
| 33 | * の責任を負わない.
|
---|
| 34 | *
|
---|
| 35 | * @(#) $Id$
|
---|
| 36 | */
|
---|
[279] | 37 | #include <stdint.h>
|
---|
| 38 | #include <stdio.h>
|
---|
| 39 | #include <sys/unistd.h>
|
---|
| 40 | #include <limits.h>
|
---|
| 41 | #include <fcntl.h>
|
---|
| 42 | #include "ff.h"
|
---|
| 43 | #include <kernel.h>
|
---|
| 44 | #include <t_syslog.h>
|
---|
| 45 | #include <t_stdlib.h>
|
---|
| 46 | #include <sil.h>
|
---|
| 47 | #include <stdlib.h>
|
---|
| 48 | #include <string.h>
|
---|
| 49 | #include <stdio.h>
|
---|
| 50 | #include <setjmp.h>
|
---|
| 51 | #include "syssvc/syslog.h"
|
---|
| 52 | #include <tinet_config.h>
|
---|
| 53 | #include <netinet/in.h>
|
---|
| 54 | #include <netinet/in_itron.h>
|
---|
| 55 | #include <tinet_nic_defs.h>
|
---|
| 56 | #include <tinet_cfg.h>
|
---|
| 57 | #include <netinet/in_var.h>
|
---|
| 58 | #include <net/ethernet.h>
|
---|
| 59 | #include <net/if6_var.h>
|
---|
| 60 | #include <net/net.h>
|
---|
| 61 | #include <net/if_var.h>
|
---|
| 62 | #include <netinet/udp_var.h>
|
---|
| 63 | #include <ethernet_api.h>
|
---|
| 64 | #include "ff.h"
|
---|
| 65 | #include "socket_stub.h"
|
---|
| 66 | #include "../../../musl-1.1.12/include/_dirent.h"
|
---|
| 67 | #include "../../../musl-1.1.12/include/_termios.h"
|
---|
| 68 | #include "ntstdio.h"
|
---|
| 69 |
|
---|
| 70 | int shell_open(const char * path, int flags)
|
---|
| 71 | {
|
---|
| 72 | FRESULT res;
|
---|
| 73 |
|
---|
| 74 | struct _IO_FILE *fp = new_file_fd(0);
|
---|
| 75 | if (fp == NULL)
|
---|
| 76 | return -1;
|
---|
| 77 |
|
---|
| 78 | BYTE fmd = 0;
|
---|
| 79 | switch (flags & O_ACCMODE) {
|
---|
| 80 | case O_RDONLY:
|
---|
| 81 | fmd = FA_READ;
|
---|
| 82 | break;
|
---|
| 83 | case O_WRONLY:
|
---|
| 84 | fmd = FA_WRITE;
|
---|
| 85 | break;
|
---|
| 86 | default:
|
---|
| 87 | fmd = FA_READ | FA_WRITE;
|
---|
| 88 | break;
|
---|
| 89 | }
|
---|
| 90 | /* ファイルを作成 */
|
---|
| 91 | if (flags & O_CREAT) {
|
---|
| 92 | /* 既存の内容は消す */
|
---|
| 93 | if (flags & O_TRUNC) {
|
---|
| 94 | fmd |= FA_CREATE_ALWAYS;
|
---|
| 95 | }
|
---|
| 96 | /* 新規作成の保障 */
|
---|
| 97 | else if (flags & O_EXCL) {
|
---|
| 98 | fmd |= FA_CREATE_NEW;
|
---|
| 99 | }
|
---|
| 100 | else {
|
---|
| 101 | fmd |= FA_OPEN_ALWAYS;
|
---|
| 102 | }
|
---|
| 103 | }
|
---|
| 104 | /* ある場合は開く */
|
---|
| 105 | else {
|
---|
| 106 | /* 既存の内容は消す */
|
---|
| 107 | if (flags & O_TRUNC) {
|
---|
| 108 | fmd |= FA_CREATE_ALWAYS;
|
---|
| 109 | }
|
---|
| 110 | }
|
---|
| 111 |
|
---|
| 112 | if ((res = f_open(&fp->file, path, fmd)) == FR_OK) {
|
---|
| 113 | fp->handle = fp->fd;
|
---|
| 114 | return fp->fd;
|
---|
| 115 | }
|
---|
| 116 |
|
---|
| 117 | return -1;
|
---|
| 118 | }
|
---|
| 119 |
|
---|
| 120 | int file_close(struct _IO_FILE *fp)
|
---|
| 121 | {
|
---|
| 122 | FRESULT res;
|
---|
| 123 |
|
---|
| 124 | if ((res = f_close(&fp->file)) == FR_OK) {
|
---|
| 125 | return 0;
|
---|
| 126 | }
|
---|
| 127 |
|
---|
| 128 | return -1;
|
---|
| 129 | }
|
---|
| 130 |
|
---|
| 131 | size_t file_read(struct _IO_FILE *fp, unsigned char *data, size_t len)
|
---|
| 132 | {
|
---|
| 133 | unsigned int ret = 0;
|
---|
| 134 | FRESULT res;
|
---|
| 135 |
|
---|
| 136 | if ((res = f_read(&fp->file, data, len, &ret)) != FR_OK)
|
---|
| 137 | return -1;
|
---|
| 138 |
|
---|
| 139 | return ret;
|
---|
| 140 | }
|
---|
| 141 |
|
---|
| 142 | size_t file_write(struct _IO_FILE *fp, const unsigned char *data, size_t len)
|
---|
| 143 | {
|
---|
| 144 | unsigned int ret = 0;
|
---|
| 145 | FRESULT res;
|
---|
| 146 |
|
---|
| 147 | if ((res = f_write(&fp->file, data, len, &ret)) != FR_OK)
|
---|
| 148 | return -1;
|
---|
| 149 |
|
---|
| 150 | return ret;
|
---|
| 151 | }
|
---|
| 152 |
|
---|
| 153 | int shell_close(int fd)
|
---|
| 154 | {
|
---|
| 155 | struct _IO_FILE *fp = fd_to_fp(fd);
|
---|
| 156 | if (fp == NULL)
|
---|
| 157 | return -1;
|
---|
| 158 |
|
---|
| 159 | return fp->close(fp);
|
---|
| 160 | }
|
---|
| 161 |
|
---|
| 162 | int shell_read(int fd, char *data, int len)
|
---|
| 163 | {
|
---|
| 164 | struct _IO_FILE *fp = fd_to_fp(fd);
|
---|
| 165 | if (fp == NULL)
|
---|
| 166 | return -1;
|
---|
| 167 |
|
---|
| 168 | return fp->read(fp, (unsigned char *)data, len);
|
---|
| 169 | }
|
---|
| 170 |
|
---|
| 171 | int shell_write(int fd, char *data, int len)
|
---|
| 172 | {
|
---|
| 173 | struct _IO_FILE *fp = fd_to_fp(fd);
|
---|
| 174 | if (fp == NULL)
|
---|
| 175 | return -1;
|
---|
| 176 |
|
---|
| 177 | return fp->write(fp, (unsigned char *)data, len);
|
---|
| 178 | }
|
---|
| 179 |
|
---|
| 180 | int shell_lseek(int fd, int ptr, int dir)
|
---|
| 181 | {
|
---|
| 182 | struct _IO_FILE *fp = fd_to_fp(fd);
|
---|
| 183 | if (fp == NULL)
|
---|
| 184 | return -1;
|
---|
| 185 |
|
---|
| 186 | FRESULT res;
|
---|
| 187 | if ((res = f_seek(&fp->file, ptr, dir)) != FR_OK)
|
---|
| 188 | return -1;
|
---|
| 189 |
|
---|
| 190 | return fp->file.fptr;
|
---|
| 191 | }
|
---|
| 192 |
|
---|
| 193 | int shell_fstat(int fd, struct stat * st)
|
---|
| 194 | {
|
---|
| 195 | struct _IO_FILE *fp = fd_to_fp(fd);
|
---|
| 196 | if (fp == NULL)
|
---|
| 197 | return -1;
|
---|
| 198 |
|
---|
| 199 | memset(st, 0, sizeof(*st));
|
---|
| 200 | st->st_mode = S_IFCHR;
|
---|
| 201 | //st->st_blksize = 1024;
|
---|
| 202 | return 0;
|
---|
| 203 | }
|
---|
| 204 |
|
---|
| 205 | int fsync(int fd)
|
---|
| 206 | {
|
---|
| 207 | struct _IO_FILE *fp = fd_to_fp(fd);
|
---|
| 208 | if (fp == NULL)
|
---|
| 209 | return -1;
|
---|
| 210 | return -1;
|
---|
| 211 | }
|
---|
| 212 |
|
---|
| 213 | int ftruncate(int fd, off_t length)
|
---|
| 214 | {
|
---|
| 215 | struct _IO_FILE *fp = fd_to_fp(fd);
|
---|
| 216 | if (fp == NULL)
|
---|
| 217 | return -1;
|
---|
| 218 |
|
---|
| 219 | FRESULT res;
|
---|
| 220 | if ((res = f_truncate(&fp->file)) != FR_OK)
|
---|
| 221 | return -1;
|
---|
| 222 |
|
---|
| 223 | return 0;
|
---|
| 224 | }
|
---|
| 225 |
|
---|
| 226 | int ioctl(int fd, int request, va_list ap)
|
---|
| 227 | {
|
---|
| 228 | struct _IO_FILE *fp = fd_to_fp(fd);
|
---|
| 229 | if (fp == NULL)
|
---|
| 230 | return -1;
|
---|
| 231 | return -1;
|
---|
| 232 | }
|
---|
| 233 |
|
---|
| 234 | int tcgetattr(int fd, struct termios *termios)
|
---|
| 235 | {
|
---|
| 236 | extern ntstdio_t ntstdio;
|
---|
| 237 |
|
---|
| 238 | if (fd == STDIN_FILENO) {
|
---|
| 239 | memset(termios, 0, sizeof(*termios));
|
---|
| 240 |
|
---|
| 241 | if (ntstdio.option & NTSTDIO_OPTION_LINE_ECHO) {
|
---|
| 242 | termios->c_lflag |= ECHO;
|
---|
| 243 | }
|
---|
| 244 | else {
|
---|
| 245 | termios->c_lflag &= ~ECHO;
|
---|
| 246 | }
|
---|
| 247 | if (ntstdio.option & NTSTDIO_OPTION_CANON) {
|
---|
| 248 | termios->c_lflag |= ICANON;
|
---|
| 249 | }
|
---|
| 250 | else {
|
---|
| 251 | termios->c_lflag &= ~ICANON;
|
---|
| 252 | }
|
---|
| 253 | if (ntstdio.option & NTSTDIO_OPTION_LF_CR) {
|
---|
| 254 | termios->c_iflag |= INLCR;
|
---|
| 255 | }
|
---|
| 256 | else {
|
---|
| 257 | termios->c_iflag &= ~INLCR;
|
---|
| 258 | }
|
---|
| 259 | if (ntstdio.option & NTSTDIO_OPTION_LF_CRLF) {
|
---|
| 260 | termios->c_oflag |= ONLCR;
|
---|
| 261 | }
|
---|
| 262 | else {
|
---|
| 263 | termios->c_oflag &= ~ONLCR;
|
---|
| 264 | }
|
---|
| 265 | return 0;
|
---|
| 266 | }
|
---|
| 267 | abort();
|
---|
| 268 | return 0;
|
---|
| 269 | }
|
---|
| 270 |
|
---|
| 271 | int tcsetattr(int fd, int optional_actions, const struct termios *termios)
|
---|
| 272 | {
|
---|
| 273 | extern ntstdio_t ntstdio;
|
---|
| 274 |
|
---|
| 275 | if ((fd == STDIN_FILENO) && (optional_actions == TCSANOW)) {
|
---|
| 276 | if (termios->c_lflag & ECHO) {
|
---|
| 277 | ntstdio.option |= NTSTDIO_OPTION_LINE_ECHO;
|
---|
| 278 | }
|
---|
| 279 | else {
|
---|
| 280 | ntstdio.option &= ~NTSTDIO_OPTION_LINE_ECHO;
|
---|
| 281 | }
|
---|
| 282 | if (termios->c_lflag & ICANON) {
|
---|
| 283 | ntstdio.option |= NTSTDIO_OPTION_CANON;
|
---|
| 284 | }
|
---|
| 285 | else {
|
---|
| 286 | ntstdio.option &= ~NTSTDIO_OPTION_CANON;
|
---|
| 287 | }
|
---|
| 288 | if (termios->c_iflag & INLCR) {
|
---|
| 289 | ntstdio.option |= NTSTDIO_OPTION_LF_CR;
|
---|
| 290 | }
|
---|
| 291 | else{
|
---|
| 292 | ntstdio.option &= ~NTSTDIO_OPTION_LF_CR;
|
---|
| 293 | }
|
---|
| 294 | if (termios->c_oflag & ONLCR) {
|
---|
| 295 | ntstdio.option |= NTSTDIO_OPTION_LF_CRLF;
|
---|
| 296 | }
|
---|
| 297 | else {
|
---|
| 298 | ntstdio.option &= ~NTSTDIO_OPTION_LF_CRLF;
|
---|
| 299 | }
|
---|
| 300 | return 0;
|
---|
| 301 | }
|
---|
| 302 | abort();
|
---|
| 303 | return 0;
|
---|
| 304 | }
|
---|
| 305 |
|
---|
| 306 | int shell_stat(const char *path, struct stat *st)
|
---|
| 307 | {
|
---|
| 308 | FILINFO fi;
|
---|
| 309 | FRESULT ret;
|
---|
| 310 | #if _USE_LFN
|
---|
| 311 | static char lfn[_MAX_LFN + 1]; /* Buffer to store the LFN */
|
---|
| 312 | fi.lfname = lfn;
|
---|
| 313 | fi.lfsize = sizeof lfn;
|
---|
| 314 | #endif
|
---|
| 315 | if (strcmp(path, ".") == 0) {
|
---|
| 316 | char cwd[_MAX_LFN];
|
---|
| 317 | if ((ret = f_getcwd(cwd, sizeof(cwd))) != FR_OK) {
|
---|
| 318 | return -1;
|
---|
| 319 | }
|
---|
| 320 | int l = strlen(cwd);
|
---|
| 321 | // ルートディレクトリの場合
|
---|
| 322 | if (cwd[l - 2] == ':' && cwd[l - 1] == '/') {
|
---|
| 323 | st->st_size = 0;
|
---|
| 324 | st->st_mtime = 0;
|
---|
| 325 | st->st_mode = S_IFDIR;
|
---|
| 326 | return 0;
|
---|
| 327 | }
|
---|
| 328 | if ((ret = f_stat(cwd, &fi)) != FR_OK) {
|
---|
| 329 | return -1;
|
---|
| 330 | }
|
---|
| 331 | }
|
---|
| 332 | else if ((ret = f_stat(path, &fi)) != FR_OK) {
|
---|
| 333 | return -1;
|
---|
| 334 | }
|
---|
| 335 |
|
---|
| 336 | st->st_size = fi.fsize;
|
---|
| 337 | st->st_mtime = fi.fdate + fi.ftime;
|
---|
| 338 | st->st_mode = (S_IRUSR | S_IRGRP | S_IROTH);
|
---|
| 339 | st->st_mode |= (fi.fattrib & AM_RDO) ? 0 : (S_IWUSR | S_IWGRP | S_IWOTH);
|
---|
| 340 | st->st_mode |= (fi.fattrib & (AM_DIR | AM_VOL)) ? S_IFDIR : S_IFREG;
|
---|
| 341 |
|
---|
| 342 | return 0;
|
---|
| 343 | }
|
---|
| 344 |
|
---|
| 345 | int shell_link(void)
|
---|
| 346 | {
|
---|
| 347 | return -1;
|
---|
| 348 | }
|
---|
| 349 |
|
---|
| 350 | int shell_unlink(const char *path)
|
---|
| 351 | {
|
---|
| 352 | FRESULT res;
|
---|
| 353 |
|
---|
| 354 | if ((res = f_unlink(path)) != FR_OK)
|
---|
| 355 | return -1;
|
---|
| 356 |
|
---|
| 357 | return 0;
|
---|
| 358 | }
|
---|
| 359 |
|
---|
| 360 | int rmdir(const char *path)
|
---|
| 361 | {
|
---|
| 362 | FRESULT res;
|
---|
| 363 |
|
---|
| 364 | if ((res = f_unlink(path)) != FR_OK)
|
---|
| 365 | return -1;
|
---|
| 366 |
|
---|
| 367 | return 0;
|
---|
| 368 | }
|
---|
| 369 |
|
---|
| 370 | int shell_rename(const char *oldpath, const char *newpath)
|
---|
| 371 | {
|
---|
| 372 | FRESULT res;
|
---|
| 373 |
|
---|
| 374 | if ((res = f_rename(oldpath, newpath)) != FR_OK)
|
---|
| 375 | return -1;
|
---|
| 376 | return 0;
|
---|
| 377 | }
|
---|
| 378 |
|
---|
| 379 | int mkdir(const char *path, mode_t mode)
|
---|
| 380 | {
|
---|
| 381 | FRESULT res;
|
---|
| 382 |
|
---|
| 383 | if ((res = f_mkdir(path)) != FR_OK)
|
---|
| 384 | return -1;
|
---|
| 385 |
|
---|
| 386 | BYTE attr = 0;
|
---|
| 387 | BYTE mask = AM_RDO | AM_SYS; // AM_ARC, AM_HID
|
---|
| 388 |
|
---|
| 389 | if(mode & S_IREAD) {
|
---|
| 390 | if((mode & S_IWRITE) == 0) {
|
---|
| 391 | attr |= AM_RDO;
|
---|
| 392 | }
|
---|
| 393 | }
|
---|
| 394 | else {
|
---|
| 395 | attr |= AM_SYS;
|
---|
| 396 | }
|
---|
| 397 |
|
---|
| 398 | if((res = f_chmod(path, attr, mask)) != FR_OK) {
|
---|
| 399 | return -1;
|
---|
| 400 | }
|
---|
| 401 |
|
---|
| 402 | return 0;
|
---|
| 403 | }
|
---|
| 404 |
|
---|
| 405 | int chmod(const char *path, mode_t mode)
|
---|
| 406 | {
|
---|
| 407 | FRESULT ret;
|
---|
| 408 | BYTE attr = 0;
|
---|
| 409 | BYTE mask = AM_RDO | AM_SYS; // AM_ARC, AM_HID
|
---|
| 410 |
|
---|
| 411 | if(mode & S_IREAD) {
|
---|
| 412 | if((mode & S_IWRITE) == 0) {
|
---|
| 413 | attr |= AM_RDO;
|
---|
| 414 | }
|
---|
| 415 | }
|
---|
| 416 | else {
|
---|
| 417 | attr |= AM_SYS;
|
---|
| 418 | }
|
---|
| 419 |
|
---|
| 420 | if((ret = f_chmod(path, attr, mask)) != FR_OK) {
|
---|
| 421 | return -1;
|
---|
| 422 | }
|
---|
| 423 |
|
---|
| 424 | return 0;
|
---|
| 425 | }
|
---|
| 426 |
|
---|
| 427 | char *getcwd(char *buf, size_t size)
|
---|
| 428 | {
|
---|
| 429 | FRESULT ret;
|
---|
| 430 | if((ret = f_getcwd(buf, size)) != FR_OK) {
|
---|
| 431 | return NULL;
|
---|
| 432 | }
|
---|
| 433 |
|
---|
| 434 | return buf;
|
---|
| 435 | }
|
---|
| 436 |
|
---|
| 437 | int chdir(const char *path)
|
---|
| 438 | {
|
---|
| 439 | FRESULT ret;
|
---|
| 440 | if ((ret = f_chdir(path)) != FR_OK) {
|
---|
| 441 | return -1;
|
---|
| 442 | }
|
---|
| 443 |
|
---|
| 444 | return 0;
|
---|
| 445 | }
|
---|
| 446 |
|
---|
| 447 | int chroot(const char *path)
|
---|
| 448 | {
|
---|
| 449 | abort();
|
---|
| 450 | return -1;
|
---|
| 451 | }
|
---|
| 452 |
|
---|
| 453 | DIR *opendir(const char *path)
|
---|
| 454 | {
|
---|
| 455 | DIR *dir = malloc(sizeof(DIR) + sizeof(struct dirent));
|
---|
| 456 | FRESULT ret;
|
---|
| 457 | if ((ret = f_opendir(dir, path)) != FR_OK) {
|
---|
| 458 | free(dir);
|
---|
| 459 | return NULL;
|
---|
| 460 | }
|
---|
| 461 |
|
---|
| 462 | dir->dirent = &dir[1];
|
---|
| 463 | return dir;
|
---|
| 464 | }
|
---|
| 465 |
|
---|
| 466 | int closedir(DIR *dir)
|
---|
| 467 | {
|
---|
| 468 | FRESULT ret;
|
---|
| 469 | if ((ret = f_closedir(dir)) != FR_OK) {
|
---|
| 470 | free(dir);
|
---|
| 471 | return -1;
|
---|
| 472 | }
|
---|
| 473 |
|
---|
| 474 | free(dir);
|
---|
| 475 | return 0;
|
---|
| 476 | }
|
---|
| 477 |
|
---|
| 478 | struct dirent *readdir(DIR *dir)
|
---|
| 479 | {
|
---|
| 480 | struct dirent *de = dir->dirent;
|
---|
| 481 | FILINFO fno;
|
---|
| 482 | #if _USE_LFN
|
---|
| 483 | static char lfn[_MAX_LFN + 1]; /* Buffer to store the LFN */
|
---|
| 484 | fno.lfname = lfn;
|
---|
| 485 | fno.lfsize = sizeof lfn;
|
---|
| 486 | #endif
|
---|
| 487 | FRESULT ret;
|
---|
| 488 | if ((ret = f_readdir(dir, &fno)) != FR_OK || fno.fname[0] == '\0') {
|
---|
| 489 | return NULL;
|
---|
| 490 | }
|
---|
| 491 |
|
---|
| 492 | memset(de, 0, sizeof(*de));
|
---|
| 493 | #if _USE_LFN
|
---|
| 494 | strlcpy(de->d_name, *fno.lfname ? fno.lfname : fno.fname, sizeof(de->d_name));
|
---|
| 495 | #else
|
---|
| 496 | strlcpy(de->d_name, fno.fname, sizeof(de->d_name));
|
---|
| 497 | #endif
|
---|
| 498 |
|
---|
| 499 | return de;
|
---|
| 500 | }
|
---|
| 501 |
|
---|
| 502 | void rewinddir(DIR *dir)
|
---|
| 503 | {
|
---|
| 504 | FRESULT ret;
|
---|
| 505 | if ((ret = f_rewinddir(dir)) != FR_OK) {
|
---|
| 506 | return;
|
---|
| 507 | }
|
---|
| 508 | }
|
---|
| 509 |
|
---|
| 510 | void seekdir(DIR *dir, long pos)
|
---|
| 511 | {
|
---|
| 512 | abort();
|
---|
| 513 | }
|
---|
| 514 |
|
---|
| 515 | long telldir(DIR *dir)
|
---|
| 516 | {
|
---|
| 517 | abort();
|
---|
| 518 | return 0;
|
---|
| 519 | }
|
---|
| 520 |
|
---|
| 521 | int shell_getpid(int n)
|
---|
| 522 | {
|
---|
| 523 | return 1;
|
---|
| 524 | }
|
---|