Changeset 442 for EcnlProtoTool/trunk/ntshell/src/stdio_stub.c
- Timestamp:
- Jul 13, 2020, 8:07:55 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
EcnlProtoTool/trunk/ntshell/src/stdio_stub.c
r441 r442 36 36 */ 37 37 #include "shellif.h" 38 #include <stdint.h>39 38 #include <kernel.h> 40 39 #include <t_syslog.h> … … 46 45 #include "fdtable.h" 47 46 #include "kernel_cfg.h" 48 #include <string.h>49 #include <errno.h>50 47 #include "util/ntstdio.h" 51 48 #include "hal/serial_api.h" … … 58 55 #endif 59 56 60 int shell_errno; 57 #undef errno 58 extern int errno; 61 59 62 60 extern bool_t sio_isr_snd(ID siopid); … … 105 103 106 104 stdio_sio_t stdio_sio; 107 ntstdio_t *ntstdio = &stdio_sio.ntstdio;108 105 109 106 void sys_init(intptr_t exinf) … … 573 570 struct SHELL_FILE *fp = fd_to_fp(fd); 574 571 if ((fp == NULL) || (fp->type != &IO_TYPE_SIO)) { 575 shell_errno = EBADF;572 errno = EBADF; 576 573 return -1; 577 574 } 578 575 579 shell_errno = sio_close(fp);580 if ( shell_errno != 0)576 errno = sio_close(fp); 577 if (errno != 0) 581 578 return 1; 582 579 return 0; … … 587 584 struct SHELL_FILE *fp = fd_to_fp(fd); 588 585 if ((fp == NULL) || ((fp->type != &IO_TYPE_STDIN) && (fp->type != &IO_TYPE_SIO))) { 589 shell_errno = EBADF;586 errno = EBADF; 590 587 return -1; 591 588 } … … 604 601 if ((fp == NULL) || ((fp->type != &IO_TYPE_STDOUT) && (fp->type != &IO_TYPE_STDERR) 605 602 && (fp->type != &IO_TYPE_SIO))) { 606 shell_errno = EBADF;603 errno = EBADF; 607 604 return -1; 608 605 } … … 621 618 if ((fp == NULL) || ((fp->type != &IO_TYPE_STDIN) && (fp->type != &IO_TYPE_STDOUT) 622 619 && (fp->type != &IO_TYPE_STDERR) && (fp->type != &IO_TYPE_SIO))) { 623 shell_errno = EBADF;620 errno = EBADF; 624 621 return -1; 625 622 } 626 623 627 shell_errno = sio_tcsetattr(fp, act, tio);628 if ( shell_errno != 0)624 errno = sio_tcsetattr(fp, act, tio); 625 if (errno != 0) 629 626 return 1; 630 627 return 0; … … 636 633 if ((fp == NULL) || ((fp->type != &IO_TYPE_STDIN) && (fp->type != &IO_TYPE_STDOUT) 637 634 && (fp->type != &IO_TYPE_STDERR) && (fp->type != &IO_TYPE_SIO))) { 638 shell_errno = EBADF;635 errno = EBADF; 639 636 return -1; 640 637 } 641 638 642 shell_errno = sio_tcgetattr(fp, tio);643 if ( shell_errno != 0)639 errno = sio_tcgetattr(fp, tio); 640 if (errno != 0) 644 641 return 1; 645 642 return 0; … … 651 648 if ((fp == NULL) || ((fp->type != &IO_TYPE_STDIN) && (fp->type != &IO_TYPE_STDOUT) 652 649 && (fp->type != &IO_TYPE_STDERR) && (fp->type != &IO_TYPE_SIO))) { 653 shell_errno = EBADF;650 errno = EBADF; 654 651 return -1; 655 652 } … … 660 657 va_end(ap); 661 658 662 shell_errno = sio_ioctl(fp, cmd, arg);663 if ( shell_errno != 0)659 errno = sio_ioctl(fp, cmd, arg); 660 if (errno != 0) 664 661 return 1; 665 662 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.