Index: EcnlProtoTool/trunk/asp3_dcre/Debug/Makefile
===================================================================
--- EcnlProtoTool/trunk/asp3_dcre/Debug/Makefile	(revision 441)
+++ EcnlProtoTool/trunk/asp3_dcre/Debug/Makefile	(revision 442)
@@ -252,5 +252,5 @@
 				$(INIT_TECS_COBJ) $(CXXRTS)
 SYSSVC_CFLAGS := $(SYSSVC_CFLAGS)
-INCLUDES := $(INCLUDES) -I$(TECSGENDIR) -I$(SRCDIR)/tecs_kernel -I../../musl-1.1.18/include
+INCLUDES := $(INCLUDES) -I$(TECSGENDIR) -I$(SRCDIR)/tecs_kernel
 
 #
Index: EcnlProtoTool/trunk/asp3_dcre/mbed/mbed_stub.c
===================================================================
--- EcnlProtoTool/trunk/asp3_dcre/mbed/mbed_stub.c	(revision 441)
+++ EcnlProtoTool/trunk/asp3_dcre/mbed/mbed_stub.c	(revision 442)
@@ -46,6 +46,5 @@
 #include <sil.h>
 #include "us_ticker_api.h"
-#include <sys/types.h>
-#include <errno.h>
+#include "mbed_retarget.h"
 #include "kernel_cfg.h"
 #include "t_syslog.h"
@@ -80,2 +79,83 @@
 	sta_ker();
 }
+
+void _exit(int status)
+{
+	ext_ker();
+}
+
+int malloc_lock_sem_count[TNUM_TSKID];
+
+void __malloc_lock(void * reent)
+{
+	ER ercd;
+	ID tskid = 0;
+
+	ercd = get_tid(&tskid);
+	if (ercd != E_OK) {
+		goto error;
+	}
+
+	if (malloc_lock_sem_count[tskid - 1] == 0) {
+		ercd = wai_sem(SEM_MALLOC);
+		if (ercd != E_OK) {
+			goto error;
+		}
+	}
+
+	malloc_lock_sem_count[tskid - 1]++;
+	return;
+error:
+	syslog(LOG_ERROR, "%s (%d) __malloc_lock error.",
+		itron_strerror(ercd), SERCD(ercd));
+	DebugBreak();
+}
+
+void __malloc_unlock(void * reent)
+{
+	ER ercd;
+	ID tskid = 0;
+	int count;
+
+	ercd = get_tid(&tskid);
+	if (ercd != E_OK) {
+		goto error;
+	}
+
+	malloc_lock_sem_count[tskid - 1]--;
+	if (malloc_lock_sem_count[tskid - 1] > 0)
+		return;
+
+	if (malloc_lock_sem_count[tskid - 1] < 0) {
+		goto error;
+	}
+
+	ercd = sig_sem(SEM_MALLOC);
+	if (ercd != E_OK) {
+		goto error;
+	}
+	return;
+error:
+	syslog(LOG_ERROR, "%s (%d) __malloc_unlock error.",
+		itron_strerror(ercd), SERCD(ercd));
+	DebugBreak();
+}
+
+extern uint32_t __HeapBase;
+extern uint32_t __HeapLimit;
+extern uint32_t __end__;
+
+void *_sbrk(int incr)
+{ 
+    static unsigned char *heap = (unsigned char *)&__end__;
+    unsigned char        *prev_heap = heap;
+    unsigned char        *new_heap = heap + incr;
+
+    if (new_heap >= (unsigned char *)&__HeapLimit) {
+        errno = ENOMEM;
+        return (void *) -1;
+    }
+
+    heap = new_heap;
+    return (void *) prev_heap;
+}
Index: EcnlProtoTool/trunk/asp3_dcre/mbed/mbed_stub.cfg
===================================================================
--- EcnlProtoTool/trunk/asp3_dcre/mbed/mbed_stub.cfg	(revision 442)
+++ EcnlProtoTool/trunk/asp3_dcre/mbed/mbed_stub.cfg	(revision 442)
@@ -0,0 +1,7 @@
+/*
+ *		mbed用のコンフィギュレーションファイル
+ *
+ *  $Id$
+ */
+
+CRE_SEM(SEM_MALLOC, { TA_TPRI, 1, 1 });
Index: EcnlProtoTool/trunk/asp3_dcre/mbed/platform/mbed_retarget.h
===================================================================
--- EcnlProtoTool/trunk/asp3_dcre/mbed/platform/mbed_retarget.h	(revision 441)
+++ EcnlProtoTool/trunk/asp3_dcre/mbed/platform/mbed_retarget.h	(revision 442)
@@ -1,2 +1,21 @@
+/*
+ * mbed Microcontroller Library
+ * Copyright (c) 2006-2016 ARM Limited
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
 #ifndef RETARGET_H
 #define RETARGET_H
@@ -7,24 +26,446 @@
 #include <stdio.h>
 #endif //__cplusplus
-
-#include <errno.h>
-#include <dirent.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
+#include <stdint.h>
+#include <stddef.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/statvfs.h>
-#include <unistd.h>
-
-#ifdef __cplusplus
-namespace mbed {
-
-class FileHandle;
-class DirHandle;
-
-std::FILE *fdopen(FileHandle *fh, const char *mode);
-
-}
+
+/* Include logic for errno so we can get errno defined but not bring in error_t,
+ * including errno here prevents an include later, which would redefine our
+ * error codes
+ */
+#ifndef __error_t_defined
+#define __error_t_defined 1
+#include <errno.h>
+#undef __error_t_defined
+#else
+#include <errno.h>
 #endif
 
+/* We can get the following standard types from sys/types for gcc, but we
+ * need to define the types ourselves for the other compilers that normally
+ * target embedded systems */
+typedef signed   int  ssize_t;  ///< Signed size type, usually encodes negative errors
+typedef unsigned int  nfds_t;   ///< Number of file descriptors
+typedef unsigned long long fsblkcnt_t;  ///< Count of file system blocks
+#if defined(__ARMCC_VERSION) || !defined(__GNUC__)
+typedef unsigned int  mode_t;   ///< Mode for opening files
+typedef unsigned int  dev_t;    ///< Device ID type
+typedef unsigned long ino_t;    ///< File serial number
+typedef unsigned int  nlink_t;  ///< Number of links to a file
+typedef unsigned int  uid_t;    ///< User ID
+typedef unsigned int  gid_t;    ///< Group ID
+#endif
+
+/* Flags for open() and fcntl(GETFL/SETFL)
+ * At present, fcntl only supports reading and writing O_NONBLOCK
+ */
+#define O_RDONLY 0        ///< Open for reading
+#define O_WRONLY 1        ///< Open for writing
+#define O_RDWR   2        ///< Open for reading and writing
+#define O_NONBLOCK 04000  ///< Non-blocking mode
+#define O_APPEND   02000  ///< Set file offset to end of file prior to each write
+#define O_CREAT    0100   ///< Create file if it does not exist
+#define O_TRUNC    01000  ///< Truncate file to zero length
+#define O_EXCL     0200   ///< Fail if file exists
+#define O_BINARY   0      ///< Open file in binary mode
+
+#define O_ASYNC    020000
+
+#define O_ACCMODE   (O_RDONLY|O_WRONLY|O_RDWR)
+
+#define NAME_MAX 255    ///< Maximum size of a name in a file path
+
+#define STDIN_FILENO  0
+#define STDOUT_FILENO 1
+#define STDERR_FILENO 2
+
+#include <time.h>
+
+/** \addtogroup platform */
+/** @{*/
+/**
+ * \defgroup platform_retarget Retarget functions
+ * @{
+ */
+typedef struct Dir DIR;
+
+
+/* The intent of this section is to unify the errno error values to match
+ * the POSIX definitions for the GCC_ARM, ARMCC and IAR compilers. This is
+ * necessary because the ARMCC/IAR errno.h, or sys/stat.h are missing some
+ * symbol definitions used by the POSIX filesystem API to return errno codes.
+ * Note also that ARMCC errno.h defines some symbol values differently from
+ * the GCC_ARM/IAR/standard POSIX definitions. The definitions guard against
+ * this and future changes by changing the symbol definition as shown below.
+ */
+#undef  EPERM
+#define EPERM           1       /* Operation not permitted */
+#undef  ENOENT
+#define ENOENT          2       /* No such file or directory */
+#undef  ESRCH
+#define ESRCH           3       /* No such process */
+#undef  EINTR
+#define EINTR           4       /* Interrupted system call */
+#undef  EIO
+#define EIO             5       /* I/O error */
+#undef  ENXIO
+#define ENXIO           6       /* No such device or address */
+#undef  E2BIG
+#define E2BIG           7       /* Argument list too long */
+#undef  ENOEXEC
+#define ENOEXEC         8       /* Exec format error */
+#undef  EBADF
+#define EBADF           9       /* Bad file number */
+#undef  ECHILD
+#define ECHILD          10      /* No child processes */
+#undef  EAGAIN
+#define EAGAIN          11      /* Try again */
+#undef  ENOMEM
+#define ENOMEM          12      /* Out of memory */
+#undef  EACCES
+#define EACCES          13      /* Permission denied */
+#undef  EFAULT
+#define EFAULT          14      /* Bad address */
+#undef  ENOTBLK
+#define ENOTBLK         15      /* Block device required */
+#undef  EBUSY
+#define EBUSY           16      /* Device or resource busy */
+#undef  EEXIST
+#define EEXIST          17      /* File exists */
+#undef  EXDEV
+#define EXDEV           18      /* Cross-device link */
+#undef  ENODEV
+#define ENODEV          19      /* No such device */
+#undef  ENOTDIR
+#define ENOTDIR         20      /* Not a directory */
+#undef  EISDIR
+#define EISDIR          21      /* Is a directory */
+#undef  EINVAL
+#define EINVAL          22      /* Invalid argument */
+#undef  ENFILE
+#define ENFILE          23      /* File table overflow */
+#undef  EMFILE
+#define EMFILE          24      /* Too many open files */
+#undef  ENOTTY
+#define ENOTTY          25      /* Not a typewriter */
+#undef  ETXTBSY
+#define ETXTBSY         26      /* Text file busy */
+#undef  EFBIG
+#define EFBIG           27      /* File too large */
+#undef  ENOSPC
+#define ENOSPC          28      /* No space left on device */
+#undef  ESPIPE
+#define ESPIPE          29      /* Illegal seek */
+#undef  EROFS
+#define EROFS           30      /* Read-only file system */
+#undef  EMLINK
+#define EMLINK          31      /* Too many links */
+#undef  EPIPE
+#define EPIPE           32      /* Broken pipe */
+#undef  EDOM
+#define EDOM            33      /* Math argument out of domain of func */
+#undef  ERANGE
+#define ERANGE          34      /* Math result not representable */
+#undef  EDEADLK
+#define EDEADLK         35      /* Resource deadlock would occur */
+#undef  ENAMETOOLONG
+#define ENAMETOOLONG    36      /* File name too long */
+#undef  ENOLCK
+#define ENOLCK          37      /* No record locks available */
+#undef  ENOSYS
+#define ENOSYS          38      /* Function not implemented */
+#undef  ENOTEMPTY
+#define ENOTEMPTY       39      /* Directory not empty */
+#undef  ELOOP
+#define ELOOP           40      /* Too many symbolic links encountered */
+#undef  EWOULDBLOCK
+#define EWOULDBLOCK     EAGAIN  /* Operation would block */
+#undef  ENOMSG
+#define ENOMSG          42      /* No message of desired type */
+#undef  EIDRM
+#define EIDRM           43      /* Identifier removed */
+#undef  ECHRNG
+#define ECHRNG          44      /* Channel number out of range */
+#undef  EL2NSYNC
+#define EL2NSYNC        45      /* Level 2 not synchronized */
+#undef  EL3HLT
+#define EL3HLT          46      /* Level 3 halted */
+#undef  EL3RST
+#define EL3RST          47      /* Level 3 reset */
+#undef  ELNRNG
+#define ELNRNG          48      /* Link number out of range */
+#undef  EUNATCH
+#define EUNATCH         49      /* Protocol driver not attached */
+#undef  ENOCSI
+#define ENOCSI          50      /* No CSI structure available */
+#undef  EL2HLT
+#define EL2HLT          51      /* Level 2 halted */
+#undef  EBADE
+#define EBADE           52      /* Invalid exchange */
+#undef  EBADR
+#define EBADR           53      /* Invalid request descriptor */
+#undef  EXFULL
+#define EXFULL          54      /* Exchange full */
+#undef  ENOANO
+#define ENOANO          55      /* No anode */
+#undef  EBADRQC
+#define EBADRQC         56      /* Invalid request code */
+#undef  EBADSLT
+#define EBADSLT         57      /* Invalid slot */
+#undef  EDEADLOCK
+#define EDEADLOCK       EDEADLK /* Resource deadlock would occur */
+#undef  EBFONT
+#define EBFONT          59      /* Bad font file format */
+#undef  ENOSTR
+#define ENOSTR          60      /* Device not a stream */
+#undef  ENODATA
+#define ENODATA         61      /* No data available */
+#undef  ETIME
+#define ETIME           62      /* Timer expired */
+#undef  ENOSR
+#define ENOSR           63      /* Out of streams resources */
+#undef  ENONET
+#define ENONET          64      /* Machine is not on the network */
+#undef  ENOPKG
+#define ENOPKG          65      /* Package not installed */
+#undef  EREMOTE
+#define EREMOTE         66      /* Object is remote */
+#undef  ENOLINK
+#define ENOLINK         67      /* Link has been severed */
+#undef  EADV
+#define EADV            68      /* Advertise error */
+#undef  ESRMNT
+#define ESRMNT          69      /* Srmount error */
+#undef  ECOMM
+#define ECOMM           70      /* Communication error on send */
+#undef  EPROTO
+#define EPROTO          71      /* Protocol error */
+#undef  EMULTIHOP
+#define EMULTIHOP       72      /* Multihop attempted */
+#undef  EDOTDOT
+#define EDOTDOT         73      /* RFS specific error */
+#undef  EBADMSG
+#define EBADMSG         74      /* Not a data message */
+#undef  EOVERFLOW
+#define EOVERFLOW       75      /* Value too large for defined data type */
+#undef  ENOTUNIQ
+#define ENOTUNIQ        76      /* Name not unique on network */
+#undef  EBADFD
+#define EBADFD          77      /* File descriptor in bad state */
+#undef  EREMCHG
+#define EREMCHG         78      /* Remote address changed */
+#undef  ELIBACC
+#define ELIBACC         79      /* Can not access a needed shared library */
+#undef  ELIBBAD
+#define ELIBBAD         80      /* Accessing a corrupted shared library */
+#undef  ELIBSCN
+#define ELIBSCN         81      /* .lib section in a.out corrupted */
+#undef  ELIBMAX
+#define ELIBMAX         82      /* Attempting to link in too many shared libraries */
+#undef  ELIBEXEC
+#define ELIBEXEC        83      /* Cannot exec a shared library directly */
+#undef  EILSEQ
+#define EILSEQ          84      /* Illegal byte sequence */
+#undef  ERESTART
+#define ERESTART        85      /* Interrupted system call should be restarted */
+#undef  ESTRPIPE
+#define ESTRPIPE        86      /* Streams pipe error */
+#undef  EUSERS
+#define EUSERS          87      /* Too many users */
+#undef  ENOTSOCK
+#define ENOTSOCK        88      /* Socket operation on non-socket */
+#undef  EDESTADDRREQ
+#define EDESTADDRREQ    89      /* Destination address required */
+#undef  EMSGSIZE
+#define EMSGSIZE        90      /* Message too long */
+#undef  EPROTOTYPE
+#define EPROTOTYPE      91      /* Protocol wrong type for socket */
+#undef  ENOPROTOOPT
+#define ENOPROTOOPT     92      /* Protocol not available */
+#undef  EPROTONOSUPPORT
+#define EPROTONOSUPPORT 93      /* Protocol not supported */
+#undef  ESOCKTNOSUPPORT
+#define ESOCKTNOSUPPORT 94      /* Socket type not supported */
+#undef  EOPNOTSUPP
+#define EOPNOTSUPP      95      /* Operation not supported on transport endpoint */
+#undef  EPFNOSUPPORT
+#define EPFNOSUPPORT    96      /* Protocol family not supported */
+#undef  EAFNOSUPPORT
+#define EAFNOSUPPORT    97      /* Address family not supported by protocol */
+#undef  EADDRINUSE
+#define EADDRINUSE      98      /* Address already in use */
+#undef  EADDRNOTAVAIL
+#define EADDRNOTAVAIL   99      /* Cannot assign requested address */
+#undef  ENETDOWN
+#define ENETDOWN        100     /* Network is down */
+#undef  ENETUNREACH
+#define ENETUNREACH     101     /* Network is unreachable */
+#undef  ENETRESET
+#define ENETRESET       102     /* Network dropped connection because of reset */
+#undef  ECONNABORTED
+#define ECONNABORTED    103     /* Software caused connection abort */
+#undef  ECONNRESET
+#define ECONNRESET      104     /* Connection reset by peer */
+#undef  ENOBUFS
+#define ENOBUFS         105     /* No buffer space available */
+#undef  EISCONN
+#define EISCONN         106     /* Transport endpoint is already connected */
+#undef  ENOTCONN
+#define ENOTCONN        107     /* Transport endpoint is not connected */
+#undef  ESHUTDOWN
+#define ESHUTDOWN       108     /* Cannot send after transport endpoint shutdown */
+#undef  ETOOMANYREFS
+#define ETOOMANYREFS    109     /* Too many references: cannot splice */
+#undef  ETIMEDOUT
+#define ETIMEDOUT       110     /* Connection timed out */
+#undef  ECONNREFUSED
+#define ECONNREFUSED    111     /* Connection refused */
+#undef  EHOSTDOWN
+#define EHOSTDOWN       112     /* Host is down */
+#undef  EHOSTUNREACH
+#define EHOSTUNREACH    113     /* No route to host */
+#undef  EALREADY
+#define EALREADY        114     /* Operation already in progress */
+#undef  EINPROGRESS
+#define EINPROGRESS     115     /* Operation now in progress */
+#undef  ESTALE
+#define ESTALE          116     /* Stale NFS file handle */
+#undef  EUCLEAN
+#define EUCLEAN         117     /* Structure needs cleaning */
+#undef  ENOTNAM
+#define ENOTNAM         118     /* Not a XENIX named type file */
+#undef  ENAVAIL
+#define ENAVAIL         119     /* No XENIX semaphores available */
+#undef  EISNAM
+#define EISNAM          120     /* Is a named type file */
+#undef  EREMOTEIO
+#define EREMOTEIO       121     /* Remote I/O error */
+#undef  EDQUOT
+#define EDQUOT          122     /* Quota exceeded */
+#undef  ENOMEDIUM
+#define ENOMEDIUM       123     /* No medium found */
+#undef  EMEDIUMTYPE
+#define EMEDIUMTYPE     124     /* Wrong medium type */
+#undef  ECANCELED
+#define ECANCELED       125     /* Operation Canceled */
+#undef  ENOKEY
+#define ENOKEY          126     /* Required key not available */
+#undef  EKEYEXPIRED
+#define EKEYEXPIRED     127     /* Key has expired */
+#undef  EKEYREVOKED
+#define EKEYREVOKED     128     /* Key has been revoked */
+#undef  EKEYREJECTED
+#define EKEYREJECTED    129     /* Key was rejected by service */
+#undef  EOWNERDEAD
+#define EOWNERDEAD      130     /* Owner died */
+#undef  ENOTRECOVERABLE
+#define ENOTRECOVERABLE 131     /* State not recoverable */
+
+struct statvfs {
+    unsigned long  f_bsize;    ///< Filesystem block size
+    unsigned long  f_frsize;   ///< Fragment size (block size)
+
+    fsblkcnt_t     f_blocks;   ///< Number of blocks
+    fsblkcnt_t     f_bfree;    ///< Number of free blocks
+    fsblkcnt_t     f_bavail;   ///< Number of free blocks for unprivileged users
+
+    unsigned long  f_fsid;     ///< Filesystem ID
+
+    unsigned long  f_namemax;  ///< Maximum filename length
+};
+
+/* The following are dirent.h definitions are declared here to guarantee
+ * consistency where structure may be different with different toolchains
+ */
+struct dirent {
+	ino_t d_ino;
+	off_t d_off;
+	unsigned short d_reclen;
+	unsigned char d_type;
+	char d_name[256];
+};
+
+enum {
+	DT_UNKNOWN = 0,  ///< The file type could not be determined.
+	DT_FIFO = 1,     ///< This is a named pipe (FIFO).
+	DT_CHR = 2,      ///< This is a character device.
+	DT_DIR = 4,      ///< This is a directory.
+	DT_BLK = 6,      ///< This is a block device.
+	DT_REG = 8,      ///< This is a regular file.
+	DT_LNK = 10,     ///< This is a symbolic link.
+	DT_SOCK = 12,    ///< This is a UNIX domain socket.
+};
+
+/* fcntl.h defines */
+#define F_GETFL 3
+#define F_SETFL 4
+#define F_SETOWN 8
+
+struct pollfd {
+    int fd;
+    short events;
+    short revents;
+};
+
+/* termios.h */
+typedef unsigned char cc_t;
+typedef unsigned int speed_t;
+typedef unsigned int tcflag_t;
+
+#define NCCS 32
+
+struct termios {
+	tcflag_t c_iflag;
+	tcflag_t c_oflag;
+	tcflag_t c_cflag;
+	tcflag_t c_lflag;
+	cc_t c_line;
+	cc_t c_cc[NCCS];
+	speed_t __c_ispeed;
+	speed_t __c_ospeed;
+};
+
+#define ICANON 0000002
+#define ECHO   0000010
+
+#define TCSAFLUSH 2
+
+#define DebugBreak()	asm("bkpt #0")
+
+/* POSIX-compatible I/O functions */
+#if __cplusplus
+extern "C" {
+#endif
+	int open(const char *path, int oflag, ...);
+#ifndef __IAR_SYSTEMS_ICC__ /* IAR provides fdopen itself */
+#if __cplusplus
+	std::FILE *fdopen(int fildes, const char *mode);
+#else
+	FILE *fdopen(int fildes, const char *mode);
+#endif
+#endif
+	ssize_t write(int fildes, const void *buf, size_t nbyte);
+	ssize_t read(int fildes, void *buf, size_t nbyte);
+	off_t lseek(int fildes, off_t offset, int whence);
+	int isatty(int fildes);
+	int fsync(int fildes);
+	int fstat(int fildes, struct stat *st);
+	int fcntl(int fildes, int cmd, ...);
+	int poll(struct pollfd fds[], nfds_t nfds, int timeout);
+	int close(int fildes);
+	int stat(const char *path, struct stat *st);
+	int statvfs(const char *path, struct statvfs *buf);
+	DIR *opendir(const char *);
+	struct dirent *readdir(DIR *);
+	int closedir(DIR *);
+	void rewinddir(DIR *);
+	long telldir(DIR *);
+	void seekdir(DIR *, long);
+	int mkdir(const char *name, mode_t n);
+
+#if __cplusplus
+}; // extern "C"
+#endif // __cplusplus
+
 #endif //RETARGET_H
Index: EcnlProtoTool/trunk/asp3_dcre/syssvc/siofd.c
===================================================================
--- EcnlProtoTool/trunk/asp3_dcre/syssvc/siofd.c	(revision 441)
+++ EcnlProtoTool/trunk/asp3_dcre/syssvc/siofd.c	(revision 442)
@@ -40,8 +40,5 @@
  */
 
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <termios.h>
+#include <mbed_retarget.h>
 #include "target_serial.h"
 #include "siofd.h"
Index: EcnlProtoTool/trunk/asp3_dcre/target/gr_peach_gcc/target_kernel.cfg
===================================================================
--- EcnlProtoTool/trunk/asp3_dcre/target/gr_peach_gcc/target_kernel.cfg	(revision 441)
+++ EcnlProtoTool/trunk/asp3_dcre/target/gr_peach_gcc/target_kernel.cfg	(revision 442)
@@ -5,2 +5,5 @@
  */
 INCLUDE("target_timer.cfg");
+
+INCLUDE("mbed_stub.cfg");
+
Index: EcnlProtoTool/trunk/ntshell/Debug/Makefile
===================================================================
--- EcnlProtoTool/trunk/ntshell/Debug/Makefile	(revision 441)
+++ EcnlProtoTool/trunk/ntshell/Debug/Makefile	(revision 442)
@@ -71,5 +71,5 @@
 SRCLANG = c
 ifeq ($(SRCLANG),c)
-	LIBS = -lm -lc -lnosys
+	LIBS = -lm -lc
 endif
 ifeq ($(SRCLANG),c++)
@@ -93,5 +93,5 @@
 #  ï¼ã«ã¼ãã«ã©ã¤ãã©ãªãmakeå¯¾è±¡ã«ããæã¯ï¼ç©ºã«å®ç¾©ããï¼
 #
-KERNEL_LIB = ../../asp3_dcre/Debug
+KERNEL_LIB = 
 
 #
@@ -99,5 +99,5 @@
 #  ï¼ã·ã¹ãã ãµã¼ãã¹ã³ã¼ã«ã©ã¤ãã©ãªãmakeå¯¾è±¡ã«ããæã¯ï¼ç©ºã«å®ç¾©ããï¼
 #
-SYSSVC_LIB = ../../asp3_dcre/Debug
+SYSSVC_LIB = 
 
 #
@@ -209,5 +209,5 @@
 #
 APPLNAME = ntshell
-APPLDIRS = ../src ../tlsf ../fatfs ../webserver ../ntshell ../ntshell/core ../ntshell/util
+APPLDIRS = ../src ../fatfs ../webserver ../ntshell ../ntshell/core ../ntshell/util
 APPL_CFG = main.cfg
 APPL_CDL = main.cdl
@@ -217,7 +217,7 @@
 ifdef USE_CXX
 	APPL_CXXOBJS := main.o
-	APPL_COBJS := fdtable.o stdio_stub.o pipe_stub.o io_stub.o socket_stub.o tlsf.o ffarch.o diskio.o ff.o sdfs.o ccsbcs.o base64.o http-strings.o http_parser.o httpd.o httpd-fs.o sha1.o websocket.o websocket_fbs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o mbedcall.o ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o netcmd.o
+	APPL_COBJS := fdtable.o stdio_stub.o pipe_stub.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o sdfs.o ccsbcs.o base64.o http-strings.o http_parser.o httpd.o httpd-fs.o sha1.o websocket.o websocket_fbs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntstdio.o ntopt.o syscall.o mbedcall.o ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o netcmd.o newlib_stub.o shellif.o
 else
-	APPL_COBJS := main.o fdtable.o stdio_stub.o pipe_stub.o io_stub.o socket_stub.o tlsf.o ffarch.o diskio.o ff.o sdfs.o ccsbcs.o base64.o http-strings.o http_parser.o httpd.o httpd-fs.o sha1.o websocket.o websocket_fbs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntlibc.o ntstdio.o ntopt.o syscall.o mbedcall.o ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o netcmd.o
+	APPL_COBJS := main.o fdtable.o stdio_stub.o pipe_stub.o io_stub.o socket_stub.o ffarch.o diskio.o ff.o sdfs.o ccsbcs.o base64.o http-strings.o http_parser.o httpd.o httpd-fs.o sha1.o websocket.o websocket_fbs.o ntshell.o text_editor.o text_history.o usrcmd.o vtrecv.o vtsend.o ntstdio.o ntopt.o syscall.o mbedcall.o ping.o ping6.o resolver.o dhcp4_cli.o netapp_subr.o ntp_cli.o net_misc.o netcmd.o newlib_stub.o shellif.o
 endif
 APPL_COBJS := $(APPL_COBJS) log_output.o vasyslog.o t_perror.o strerror.o mbed_stub.o
@@ -269,5 +269,5 @@
 				$(INIT_TECS_COBJ) $(CXXRTS)
 SYSSVC_CFLAGS := $(SYSSVC_CFLAGS)
-INCLUDES := $(INCLUDES) -I$(TECSGENDIR) -I$(SRCDIR)/tecs_kernel -I../../musl-1.1.18/include
+INCLUDES := $(INCLUDES) -I$(TECSGENDIR) -I$(SRCDIR)/tecs_kernel
 
 #
Index: EcnlProtoTool/trunk/ntshell/fatfs/ff.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/fatfs/ff.c	(revision 441)
+++ EcnlProtoTool/trunk/ntshell/fatfs/ff.c	(revision 442)
@@ -20,5 +20,4 @@
 #include "ff.h"			/* Declarations of FatFs API */
 #include "diskio.h"		/* Declarations of disk I/O functions */
-#include "util/ntstdio.h"
 
 /*--------------------------------------------------------------------------
@@ -3910,5 +3909,5 @@
 					if (dir[DIR_Attr] & AM_DIR) {	/* The new object is a directory */
 						temp_new_path = (TCHAR *)ff_memalloc((FF_MAX_LFN + 1) * sizeof(WCHAR));
-						ntstdio_snprintf(temp_new_path, FF_MAX_LFN, "%s/%s", path_new, basename((char *)path_old));
+						snprintf(temp_new_path, FF_MAX_LFN, "%s/%s", path_new, basename((char *)path_old));
 						res = follow_path(&djn, temp_new_path);
 					}
Index: EcnlProtoTool/trunk/ntshell/fatfs/sdfs.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/fatfs/sdfs.c	(revision 441)
+++ EcnlProtoTool/trunk/ntshell/fatfs/sdfs.c	(revision 442)
@@ -118,5 +118,4 @@
 //#include "mbed_debug.h"
 #include "mbed_wait_api.h"
-#include "util/ntstdio.h"
 
 void sdfs_debug(const char *fmt, ...);
Index: EcnlProtoTool/trunk/ntshell/ntshell/core/ntshell.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/ntshell/core/ntshell.c	(revision 441)
+++ EcnlProtoTool/trunk/ntshell/ntshell/core/ntshell.c	(revision 442)
@@ -108,5 +108,5 @@
  * @param HANDLE A pointer of the handle.
  */
-#define PROMPT_WRITE(HANDLE)            SERIAL_WRITE((HANDLE), (HANDLE)->prompt, ntlibc_strlen((HANDLE)->prompt))
+#define PROMPT_WRITE(HANDLE)            SERIAL_WRITE((HANDLE), (HANDLE)->prompt, strlen((HANDLE)->prompt))
 
 /**
@@ -115,5 +115,5 @@
  * @param HANDLE A pointer of the handle.
  */
-#define PROMPT_NEWLINE(HANDLE)          SERIAL_WRITE((HANDLE), NTSHELL_PROMPT_NEWLINE, ntlibc_strlen(NTSHELL_PROMPT_NEWLINE))
+#define PROMPT_NEWLINE(HANDLE)          SERIAL_WRITE((HANDLE), NTSHELL_PROMPT_NEWLINE, strlen(NTSHELL_PROMPT_NEWLINE))
 
 /**
@@ -400,5 +400,5 @@
 				 * Found the suggestion.
 				 */
-				int n = ntlibc_strlen((const char *)buf);
+				int n = strlen((const char *)buf);
 				VTSEND_ERASE_LINE(ntshell);
 				VTSEND_CURSOR_HEAD(ntshell);
@@ -430,5 +430,5 @@
 			 * Found the suggestion.
 			 */
-			int n = ntlibc_strlen((const char *)buf);
+			int n = strlen((const char *)buf);
 			VTSEND_ERASE_LINE(ntshell);
 			VTSEND_CURSOR_HEAD(ntshell);
@@ -442,5 +442,5 @@
 			 * Recall the previous input text string.
 			 */
-			int n = ntlibc_strlen(SUGGEST_SOURCE(ntshell));
+			int n = strlen(SUGGEST_SOURCE(ntshell));
 			VTSEND_ERASE_LINE(ntshell);
 			VTSEND_CURSOR_HEAD(ntshell);
@@ -485,5 +485,5 @@
 	UNUSED_VARIABLE(ch);
 	text_editor_get_text(GET_EDITOR(ntshell), buf, sizeof(buf));
-	len = ntlibc_strlen((const char *)buf);
+	len = strlen((const char *)buf);
 	VTSEND_CURSOR_HEAD(ntshell);
 	PROMPT_WRITE(ntshell);
@@ -607,5 +607,5 @@
 	p->func_callback = func_callback;
 	p->extobj = extobj;
-	ntlibc_strcpy(p->prompt, NTSHELL_PROMPT_DEFAULT);
+	strcpy(p->prompt, NTSHELL_PROMPT_DEFAULT);
 
 	p->vtrecv.user_data = p;
@@ -667,5 +667,5 @@
 	}
 
-	ntlibc_strcpy(p->prompt, prompt);
+	strcpy(p->prompt, prompt);
 }
 
Index: EcnlProtoTool/trunk/ntshell/ntshell/core/text_history.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/ntshell/core/text_history.c	(revision 441)
+++ EcnlProtoTool/trunk/ntshell/ntshell/core/text_history.c	(revision 442)
@@ -146,5 +146,5 @@
 	char *buf, const int siz)
 {
-	const int text_len = ntlibc_strlen((const char *)text);
+	const int text_len = strlen((const char *)text);
 	int found = 0;
 	int i;
@@ -152,14 +152,14 @@
 		int target = (p->rp + i) % TEXTHISTORY_DEPTH;
 		char *txtp = p->history + (TEXTHISTORY_MAXLEN * target);
-		const int target_len = ntlibc_strlen((const char *)txtp);
+		const int target_len = strlen((const char *)txtp);
 		int comp_len = (target_len < text_len) ? target_len : text_len;
-		if ((ntlibc_strncmp(
+		if ((strncmp(
 			(const char *)txtp,
 			(const char *)text, comp_len) == 0) && (comp_len > 0)) {
 			if (found == index) {
-				if (siz <= ntlibc_strlen(txtp)) {
+				if (siz <= strlen(txtp)) {
 					return -1;
 				}
-				ntlibc_strcpy((char *)buf, (char *)txtp);
+				strcpy((char *)buf, (char *)txtp);
 				return 0;
 			}
Index: EcnlProtoTool/trunk/ntshell/ntshell/usrcmd.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/ntshell/usrcmd.c	(revision 441)
+++ EcnlProtoTool/trunk/ntshell/ntshell/usrcmd.c	(revision 442)
@@ -32,4 +32,5 @@
 
 #include "shellif.h"
+#include <getopt.h>
 #include <kernel.h>
 #include <t_syslog.h>
@@ -45,104 +46,6 @@
 #include "core/ntshell.h"
 #include "core/ntlibc.h"
-#include "util/ntstdio.h"
-
-extern ntstdio_t *ntstdio;
+
 extern int ntshell_exit;
-
-/* musl_getopt from msul */
-char *optarg;
-int /*optind=1, opterr=1, */optopt, optpos, optreset=0;
-extern int optind, opterr;
-
-static void ntstdio_write(ntstdio_t *handle, const char *str, int l)
-{
-	for (; *str && l >= 0; l--) {
-		ntstdio_putc(handle, *str++);
-	}
-}
-
-static void __getopt_msg(const char *a, const char *b, const char *c, size_t l)
-{
-	ntstdio_puts(&ntstdio, a);
-	ntstdio_write(&ntstdio, b, ntlibc_strlen(b));
-	ntstdio_write(&ntstdio, c, l);
-	ntstdio_putc(&ntstdio, '\n');
-}
-
-static int musl_getopt(int argc, char * const argv[], const char *optstring)
-{
-	int i;
-	wchar_t c, d;
-	int k, l;
-	char *optchar;
-
-	if (!optind || optreset) {
-		optreset = 0;
-		optpos = 0;
-		optind = 1;
-	}
-
-	if (optind >= argc || !argv[optind])
-		return -1;
-
-	if (argv[optind][0] != '-') {
-		if (optstring[0] == '-') {
-			optarg = argv[optind++];
-			return 1;
-		}
-		return -1;
-	}
-
-	if (!argv[optind][1])
-		return -1;
-
-	if (argv[optind][1] == '-' && !argv[optind][2])
-		return optind++, -1;
-
-	if (!optpos) optpos++;
-	if ((k = mbtowc(&c, argv[optind]+optpos, MB_LEN_MAX)) < 0) {
-		k = 1;
-		c = 0xfffd; /* replacement char */
-	}
-	optchar = argv[optind]+optpos;
-	optopt = c;
-	optpos += k;
-
-	if (!argv[optind][optpos]) {
-		optind++;
-		optpos = 0;
-	}
-
-	if (optstring[0] == '-' || optstring[0] == '+')
-		optstring++;
-
-	i = 0;
-	d = 0;
-	do {
-		l = mbtowc(&d, optstring+i, MB_LEN_MAX);
-		if (l>0) i+=l; else i++;
-	} while (l && d != c);
-
-	if (d != c) {
-		if (optstring[0] != ':' && opterr)
-			__getopt_msg(argv[0], ": unrecognized option: ", optchar, k);
-		return '?';
-	}
-	if (optstring[i] == ':') {
-		if (optstring[i+1] == ':') optarg = 0;
-		else if (optind >= argc) {
-			if (optstring[0] == ':') return ':';
-			if (opterr) __getopt_msg(argv[0],
-				": option requires an argument: ",
-				optchar, k);
-			return '?';
-		}
-		if (optstring[i+1] != ':' || optpos) {
-			optarg = argv[optind++] + optpos;
-			optpos = 0;
-		}
-	}
-	return c;
-}
 
 void put_rc(const char *func, FRESULT rc)
@@ -158,5 +61,5 @@
 		while (*p++);
 	}
-	ntstdio_printf(ntstdio, "%s() =>%u FR_%s\n", func, (UINT)rc, p);
+	printf("%s() =>%u FR_%s\n", func, (UINT)rc, p);
 }
 
@@ -170,5 +73,5 @@
 		while (*p++);
 	}
-	ntstdio_printf(ntstdio, "%s() =>%u %s\n", func, (UINT)rc, p);
+	printf("%s() =>%u %s\n", func, (UINT)rc, p);
 }
 
@@ -177,5 +80,5 @@
 	size_t i, j;
 	if (!s || !*s) return ".";
-	i = ntlibc_strlen(s) - 1;
+	i = strlen(s) - 1;
 	for (j = 0; j <= i; j++) if (s[j] == ':') { s = &s[j + 1]; i -= j; break; }
 	for (; i&&s[i] == '/'; i--) s[i] = 0;
@@ -189,5 +92,5 @@
 	size_t i, j;
 	if (!s || !*s) return ".";
-	i = ntlibc_strlen(s) - 1;
+	i = strlen(s) - 1;
 	for (j = 0; j <= i; j++) if (s[j] == ':') { s = &s[j + 1]; i -= j; break; }
 	for (; s[i] == '/'; i--) if (!i) return (s == _s) ? "/" : _s;
@@ -219,6 +122,6 @@
 	}
 
-	ntlibc_strlcat(path, "\n", sizeof(path));
-	ntstdio_printf(ntstdio, path);
+	strlcat(path, "\n", sizeof(path));
+	printf(path);
 
 	return 0;
@@ -243,5 +146,5 @@
 
 	if (list_option & LS_LONG) {
-		ntstdio_printf(ntstdio, "%c%c%c%c%c %04d/%02d/%02d %02d:%02d:%02d ",
+		printf("%c%c%c%c%c %04d/%02d/%02d %02d:%02d:%02d ",
 			(fno->fattrib & AM_DIR) ? 'd' : '-',
 			(fno->fattrib & AM_RDO) ? 'r' : '-',
@@ -257,16 +160,16 @@
 
 		if (fno->fattrib & AM_DIR) {                    /* It is a directory */
-			ntstdio_printf(ntstdio, "%10s ", " ");
+			printf("%10s ", " ");
 		}
 		else {
-			ntstdio_printf(ntstdio, "%10lu ", fno->fsize);
+			printf("%10lu ", fno->fsize);
 		}
 	}
 
 	if (fno->fattrib & AM_DIR) {                    /* It is a directory */
-		ntstdio_printf(ntstdio, "\x1B[32m%s\x1B[0m\n", fn);
+		printf("\x1B[32m%s\x1B[0m\n", fn);
 	}
 	else {
-		ntstdio_printf(ntstdio, "%s\n", fn);
+		printf("%s\n", fn);
 	}
 }
@@ -287,5 +190,5 @@
 	path_backup = ff_memalloc(LFN_BUF_SIZE);
 	if (path_backup == NULL) {
-		ntstdio_printf(ntstdio, "ff_memalloc err.\n");
+		printf("ff_memalloc err.\n");
 		return;
 	}
@@ -295,5 +198,5 @@
 	lfn = ff_memalloc(LFN_BUF_SIZE);
 	if (lfn == NULL) {
-		ntstdio_printf(ntstdio, "ff_memalloc err.\n");
+		printf("ff_memalloc err.\n");
 		ff_memfree(path_backup);
 		return;
@@ -317,5 +220,5 @@
 			fn = *fno.lfname ? fno.lfname : fno.fname;
 #else
-			fn = fno->fname;
+			fn = fno.fname;
 #endif
 			if ((res = f_getcwd(path_backup, LFN_BUF_SIZE)) != FR_OK) {
@@ -331,9 +234,9 @@
 			}
 
-			ntstdio_printf(ntstdio, "\n%s/%s:\n", path_p, fn);
+			printf("\n%s/%s:\n", path_p, fn);
 
 			print_ls(fn, NULL, list_option);
 
-			ntstdio_printf(ntstdio, "\n");
+			printf("\n");
 
 			if ((res = f_chdrive(path_backup)) != FR_OK) {
@@ -370,5 +273,5 @@
 	BYTE list_option = 0;
 
-	while ((c = musl_getopt(argc, argv, "al")) != -1) {
+	while ((c = getopt(argc, argv, "al")) != -1) {
 		switch (c) {
 		case 'a':
@@ -385,9 +288,9 @@
 
 	if (pattern_p != NULL)
-		ntlibc_strlcpy(default_pattern, pattern_p, sizeof(default_pattern));
+		strlcpy(default_pattern, pattern_p, sizeof(default_pattern));
 	basename_p = basename(pattern_p);
 	dirname_p = dirname(default_pattern);
 	if (((dirname_p[0] == '/') && (basename_p[0] == '/')) ||
-		(!ntlibc_strncmp(dirname_p, ".", ntlibc_strlen(dirname_p)) && !ntlibc_strncmp(basename_p, ".", ntlibc_strlen(basename_p))))
+		(!strncmp(dirname_p, ".", strlen(dirname_p)) && !strncmp(basename_p, ".", strlen(basename_p))))
 	{
 		basename_p = NULL;
@@ -432,5 +335,5 @@
 	lfn = ff_memalloc(LFN_BUF_SIZE);
 	if (lfn == NULL) {
-		ntstdio_printf(ntstdio, "alloc err.\n");
+		printf("alloc err.\n");
 		goto cp_end;
 	}
@@ -442,5 +345,5 @@
 	local_buff = ff_memalloc(64);
 	if (local_buff == NULL) {
-		ntstdio_printf(ntstdio, "alloc err.\n");
+		printf("alloc err.\n");
 		goto cp_end;
 	}
@@ -452,7 +355,7 @@
 	if (res != FR_OK) {
 		if (res == FR_NO_FILE)
-			ntstdio_printf(ntstdio, "src no file.\n");
+			printf("src no file.\n");
 		else
-			ntstdio_printf(ntstdio, "src stat err(%d).\n", res);
+			printf("src stat err(%d).\n", res);
 		goto cp_end;
 	}
@@ -463,5 +366,5 @@
 		res = f_open(&src_fp, src_str_p, (FA_OPEN_EXISTING | FA_READ));
 		if (res != FR_OK) {
-			ntstdio_printf(ntstdio, "src open err(%d).\n", res);
+			printf("src open err(%d).\n", res);
 			goto cp_end;
 		}
@@ -478,17 +381,17 @@
 				dst_mod_str_p = ff_memalloc(LFN_BUF_SIZE);
 				if (dst_mod_str_p == NULL) {
-					ntstdio_printf(ntstdio, "alloc err.\n");
+					printf("alloc err.\n");
 					goto cp_end;
 				}
-				ntstdio_snprintf(dst_mod_str_p, LFN_BUF_SIZE, "%s/%s\0", dst_str_p, src_basename_p);
+				snprintf(dst_mod_str_p, LFN_BUF_SIZE, "%s/%s\0", dst_str_p, src_basename_p);
 				dst_str_p = dst_mod_str_p;
 			}
 			else {
-				ntstdio_printf(ntstdio, "dst file exists.\n");
+				printf("dst file exists.\n");
 				goto cp_end_1;
 			}
 		}
 		else {
-			ntstdio_printf(ntstdio, "src stat err(%d).\n", res);
+			printf("src stat err(%d).\n", res);
 			goto cp_end_1;
 		}
@@ -496,5 +399,5 @@
 	res = f_open(&dst_fp, dst_str_p, (FA_CREATE_NEW | FA_WRITE));
 	if (res != FR_OK) {
-		ntstdio_printf(ntstdio, "dst open err(%d).\n", res);
+		printf("dst open err(%d).\n", res);
 		goto cp_end_1;
 	}
@@ -507,5 +410,5 @@
 		res = f_read(&src_fp, local_buff, sizeof(local_buff), &read_size);
 		if (res != FR_OK) {
-			ntstdio_printf(ntstdio, "src read err(%d).\n", res);
+			printf("src read err(%d).\n", res);
 			goto cp_end_2;
 		}
@@ -514,9 +417,9 @@
 		res = f_write(&dst_fp, local_buff, read_size, &write_size);
 		if (res != FR_OK) {
-			ntstdio_printf(ntstdio, "dst write err(%d).\n", res);
+			printf("dst write err(%d).\n", res);
 			goto cp_end_2;
 		}
 		if (read_size != write_size) {
-			ntstdio_printf(ntstdio, "dst write err(disk full).\n");
+			printf("dst write err(disk full).\n");
 			goto cp_end_2;
 		}
@@ -604,13 +507,13 @@
 	unsigned int op_offset = 0, op_size = 0, op_end = 0;
 
-	while ((op = musl_getopt(argc, argv, "hduos0123456789xX")) != -1) {
+	while ((op = getopt(argc, argv, "hduos0123456789xX")) != -1) {
 		switch (op) {
 		case 'h': /* help */
-			ntstdio_printf(ntstdio, " hexdump [OPTION] file\n");
-			ntstdio_printf(ntstdio, "  -h : help\n");
-			ntstdio_printf(ntstdio, "  -d : print all byte with convert and color [in character area] (default)\n");
-			ntstdio_printf(ntstdio, "  -u : try print UTF-8 code [in character area]\n");
-			ntstdio_printf(ntstdio, "  -oOFFSET : print start offset address from top\n");
-			ntstdio_printf(ntstdio, "  -sSIZE   : print size\n");
+			printf(" hexdump [OPTION] file\n");
+			printf("  -h : help\n");
+			printf("  -d : print all byte with convert and color [in character area] (default)\n");
+			printf("  -u : try print UTF-8 code [in character area]\n");
+			printf("  -oOFFSET : print start offset address from top\n");
+			printf("  -sSIZE   : print size\n");
 			break;
 		case 'd': /* print one byte character [in character area] (default) */
@@ -622,9 +525,9 @@
 		case 'o': /* print start offset address from top */
 			option_ptr = *(argv + optind);
-			op_offset = ntlibc_strtoul(&option_ptr[2], &option_endptr, 0);
+			op_offset = strtoul(&option_ptr[2], &option_endptr, 0);
 			break;
 		case 's': /* print size */
 			option_ptr = *(argv + optind);
-			op_size = ntlibc_strtoul(&option_ptr[2], &option_endptr, 0);
+			op_size = strtoul(&option_ptr[2], &option_endptr, 0);
 			break;
 		default:
@@ -643,5 +546,5 @@
 	/* position adjusting */
 	if (op_offset >= fsrc.fsize) {
-		ntstdio_printf(ntstdio, "error : input offset is bigger than file size(0x%lX).\n", fsrc.fsize);
+		printf("error : input offset is bigger than file size(0x%lX).\n", fsrc.fsize);
 		return 0;
 	}
@@ -656,5 +559,5 @@
 		char *pos = line;
 		int rst = sizeof(line);
-		int len = ntstdio_snprintf(pos, rst, "%08X: ", i);
+		int len = snprintf(pos, rst, "%08X: ", i);
 		pos += len;
 		rst -= len;
@@ -675,7 +578,7 @@
 			unsigned char c = data[j];
 			if (j != 7)
-				len = ntstdio_snprintf(pos, rst, "%02X ", c);
+				len = snprintf(pos, rst, "%02X ", c);
 			else
-				len = ntstdio_snprintf(pos, rst, "%02X-", c);
+				len = snprintf(pos, rst, "%02X-", c);
 			pos += len;
 			rst -= len;
@@ -705,7 +608,7 @@
 								break;
 							if (j + k != 7)
-								len = ntstdio_snprintf(pos, rst, "%02X ", data[j + k]);
+								len = snprintf(pos, rst, "%02X ", data[j + k]);
 							else
-								len = ntstdio_snprintf(pos, rst, "%02X-", data[j + k]);
+								len = snprintf(pos, rst, "%02X-", data[j + k]);
 							pos += len;
 							rst -= len;
@@ -725,5 +628,5 @@
 				apos += len;
 				arst -= len;
-				len = ntstdio_snprintf(apos, arst, "\x1B[%dm%c\x1B[0m", CCOLOR_RESET, ' ');
+				len = snprintf(apos, arst, "\x1B[%dm%c\x1B[0m", CCOLOR_RESET, ' ');
 				utf8_odd_bytes--;
 			}
@@ -745,5 +648,5 @@
 					c = '?';
 				}
-				len = ntstdio_snprintf(apos, arst, "\x1B[%dm%c\x1B[0m", ccolor, c);
+				len = snprintf(apos, arst, "\x1B[%dm%c\x1B[0m", ccolor, c);
 			}
 
@@ -754,16 +657,16 @@
 		for (int j = br; j < 16; j++) {
 			if (j != 7)
-				len = ntstdio_snprintf(pos, rst, "   ");
+				len = snprintf(pos, rst, "   ");
 			else
-				len = ntstdio_snprintf(pos, rst, "  -");
+				len = snprintf(pos, rst, "  -");
 			pos += len;
 			rst -= len;
 		}
 
-		len = ntstdio_snprintf(pos, rst, ": %s\n", ascii);
+		len = snprintf(pos, rst, ": %s\n", ascii);
 		pos += len;
 		rst -= len;
 
-		ntstdio_puts(ntstdio, line);
+		printf(line);
 	}
 
@@ -780,5 +683,5 @@
 	ret = shell_clock_gettime(CLOCK_REALTIME, &tp);
 	if (ret != 0) {
-		ntstdio_printf(ntstdio, "clock_gettime error %d", ret);
+		printf("clock_gettime error %d", ret);
 		return 0;
 	}
@@ -786,13 +689,13 @@
 	memset(buf, 0, sizeof(buf));
 	if (ctime_r(&tp.tv_sec, buf) == NULL) {
-		ntstdio_printf(ntstdio, "ctime_r error");
+		printf("ctime_r error");
 		return 0;
 	}
 
 	/* 改行コードの削除 */
-	ret = ntlibc_strlen(buf);
+	ret = strlen(buf);
 	buf[ret - 1] = '\0';
 
-	ntstdio_printf(ntstdio, "%s .%09ld\n", buf, tp.tv_nsec);
+	printf("%s .%09ld\n", buf, tp.tv_nsec);
 	return 0;
 }
@@ -801,19 +704,19 @@
 {
 	if (argc != 2) {
-		ntstdio_printf(ntstdio, "info sys\n");
-		ntstdio_printf(ntstdio, "info ver\n");
-		return 0;
-	}
-	if (ntlibc_strcmp(argv[1], "sys") == 0) {
-		ntstdio_printf(ntstdio, TARGET_NAME" Monitor\n");
-		return 0;
-	}
-	if (ntlibc_strcmp(argv[1], "ver") == 0) {
+		printf("info sys\n");
+		printf("info ver\n");
+		return 0;
+	}
+	if (strcmp(argv[1], "sys") == 0) {
+		printf(TARGET_NAME" Monitor\n");
+		return 0;
+	}
+	if (strcmp(argv[1], "ver") == 0) {
 		int mj, mn, bd;
 		ntshell_version(&mj, &mn, &bd);
-		ntstdio_printf(ntstdio, "Version %d.%d.%d\n", mj, mn, bd);
-		return 0;
-	}
-	ntstdio_printf(ntstdio, "Unknown sub command found\n");
+		printf("Version %d.%d.%d\n", mj, mn, bd);
+		return 0;
+	}
+	printf("Unknown sub command found\n");
 	return -1;
 }
Index: EcnlProtoTool/trunk/ntshell/src/bits/stdint.h
===================================================================
--- EcnlProtoTool/trunk/ntshell/src/bits/stdint.h	(revision 442)
+++ EcnlProtoTool/trunk/ntshell/src/bits/stdint.h	(revision 442)
@@ -0,0 +1,1 @@
+#include "../musl-1.1.18/include/bits/stdint.h"
Index: EcnlProtoTool/trunk/ntshell/src/fdtable.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/src/fdtable.c	(revision 441)
+++ EcnlProtoTool/trunk/ntshell/src/fdtable.c	(revision 442)
@@ -36,5 +36,4 @@
  */
 #include "shellif.h"
-#include <stdint.h>
 #include <kernel.h>
 #include <t_syslog.h>
@@ -46,6 +45,4 @@
 #include "fdtable.h"
 #include "kernel_cfg.h"
-#include <string.h>
-#include "util/ntstdio.h"
 #include "hal/serial_api.h"
 
Index: EcnlProtoTool/trunk/ntshell/src/io_stub.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/src/io_stub.c	(revision 441)
+++ EcnlProtoTool/trunk/ntshell/src/io_stub.c	(revision 442)
@@ -36,5 +36,4 @@
  */
 #include "shellif.h"
-#include <stdint.h>
 #include "ff.h"
 #include <kernel.h>
@@ -42,9 +41,7 @@
 #include <t_stdlib.h>
 #include <sil.h>
-#include <string.h>
 #include "syssvc/serial.h"
 #include "syssvc/syslog.h"
 #include "fdtable.h"
-#include "util/ntstdio.h"
 #include "usrcmd.h"
 #include "core/ntlibc.h"
@@ -305,10 +302,10 @@
 	fi.lfsize = sizeof lfn;
 #endif
-	if (ntlibc_strcmp(path, ".") == 0) {
+	if (strcmp(path, ".") == 0) {
 		char cwd[FF_MAX_LFN];
 		if ((ret = f_getcwd(cwd, sizeof(cwd))) != FR_OK) {
 			return fresult2errno(ret);
 		}
-		int l = ntlibc_strlen(cwd);
+		int l = strlen(cwd);
 		// ルートディレクトリの場合
 		if (cwd[l - 2] == ':' && cwd[l - 1] == '/') {
@@ -485,7 +482,7 @@
 	memset(de, 0, sizeof(*de));
 #if FF_USE_LFN
-	ntlibc_strlcpy(de->d_name, *fno.lfname ? fno.lfname : fno.fname, sizeof(de->d_name));
+	strlcpy(de->d_name, *fno.lfname ? fno.lfname : fno.fname, sizeof(de->d_name));
 #else
-	ntlibc_strlcpy(de->d_name, fno.fname, sizeof(de->d_name));
+	strlcpy(de->d_name, fno.fname, sizeof(de->d_name));
 #endif
 
@@ -559,5 +556,5 @@
 pid_t shell_getpid(void)
 {
-	return 1;
+	return 2;
 }
 
Index: EcnlProtoTool/trunk/ntshell/src/main.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/src/main.c	(revision 441)
+++ EcnlProtoTool/trunk/ntshell/src/main.c	(revision 442)
@@ -40,5 +40,4 @@
  */
 
-#include "shellif.h"
 #include <kernel.h>
 #include <t_stdlib.h>
@@ -51,4 +50,5 @@
 #include "kernel_cfg.h"
 #include "main.h"
+#include "mbed_retarget.h"
 #include "fdtable.h"
 #ifndef NTSHELL_NO_SOCKET
@@ -69,5 +69,4 @@
 #include "core/ntshell.h"
 #include "core/ntlibc.h"
-#include "util/ntstdio.h"
 #include "usrcmd.h"
 #include "util/ntopt.h"
@@ -79,23 +78,8 @@
 ID ws_api_mailboxid = MAIN_DATAQUEUE;
 ID ws_mempoolid = MPF_NET_BUF_256;
-extern ntstdio_t *ntstdio;
 
 char command[NTOPT_TEXT_MAXLEN];
 
 const uint8_t mac_addr[6] = {0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC};
-const struct utsname host_name = {
-	"TOPPERS/ASP3",
-	TARGET_NAME,
-	"3.5.0",
-	"3.5.0",
-	TARGET_NAME,
-	"toppers.jp"
-};
-
-int shell_uname(struct utsname *uts)
-{
-	memcpy(uts, &host_name, sizeof(host_name));
-	return 0;
-}
 
 enum main_state_t {
@@ -220,5 +204,5 @@
 {
 	if (text != NULL) {
-		ntlibc_strlcpy(command, text, sizeof(command));
+		strlcpy(command, text, sizeof(command));
 	}
 	ER ret;
@@ -552,10 +536,9 @@
 		return result;
 
-	if (ntlibc_strcmp((const char *)args[1], "help") == 0) {
-		found = 1;
+	if (strcmp((const char *)args[1], "help") == 0) {
 		result = usrcmd_help(args[0], (char **)&args[1]);
 	}
 	else for (int i = 0; i < cmd_table_info.count; i++) {
-		if (ntlibc_strcmp((const char *)args[1], p->cmd) == 0) {
+		if (strcmp((const char *)args[1], p->cmd) == 0) {
 			found = 1;
 			result = p->func(args[0], (char **)&args[1]);
@@ -571,5 +554,5 @@
 
 	if ((found == 0) && (((const char *)args[1])[0] != '\0'))
-		ntstdio_printf(ntstdio, "Unknown command found. %s \n", (const char *)args[1]);
+		printf("Unknown command found. %s \n", (const char *)args[1]);
 
 	return result;
@@ -580,8 +563,7 @@
 	const cmd_table_t *p = cmd_table_info.table;
 	for (int i = 0; i < cmd_table_info.count; i++) {
-		ntstdio_puts(ntstdio, p->cmd);
-		ntstdio_puts(ntstdio, "\t:");
-		ntstdio_puts(ntstdio, p->desc);
-		ntstdio_puts(ntstdio, "\n");
+		printf(p->cmd);
+		printf("\t:");
+		puts(p->desc);
 		p++;
 	}
@@ -599,22 +581,4 @@
 	/* shellcmdタスクの優先度に戻す */
 	chg_pri(SHELLCMD_PRIORITY, SHELLCMD_PRIORITY);
-}
-
-void shell_abort()
-{
-	shellcmd_exit_code = -1;
-	longjmp(shellcmd_exit, 1);
-}
-
-void shell_exit(int exitcd)
-{
-	shellcmd_exit_code = exitcd;
-	longjmp(shellcmd_exit, 1);
-}
-
-void shell_exit_group(int exitcd)
-{
-	shellcmd_exit_code = exitcd;
-	longjmp(shellcmd_exit, 1);
 }
 
@@ -679,249 +643,2 @@
 }
 
-int shell_clock_getres(clockid_t clk_id, struct timespec *res)
-{
-	if ((clk_id != CLOCK_REALTIME) && (clk_id != CLOCK_MONOTONIC))
-		return -EINVAL;
-
-	memset(&res->tv_sec, 0xFF, sizeof(res->tv_sec));
-	res->tv_nsec = 0;
-
-	return 0;
-}
-
-int shell_clock_gettime(clockid_t clk_id, struct timespec *tp)
-{
-	SYSTIM now = 0;
-
-	if ((clk_id != CLOCK_REALTIME) && (clk_id != CLOCK_MONOTONIC))
-		return -EINVAL;
-
-	get_tim(&now);
-	tp->tv_sec = now / 1000000;
-	tp->tv_nsec = (now % 1000000) * 1000;
-
-	return 0;
-}
-
-int shell_clock_settime(clockid_t clk_id, const struct timespec *tp)
-{
-	if ((clk_id != CLOCK_REALTIME) && (clk_id != CLOCK_MONOTONIC))
-		return -EINVAL;
-
-	SYSTIM time;
-	ER ret;
-
-	time = (tp->tv_sec * 1000000ll) + (tp->tv_nsec / 1000ll);
-
-	ret = set_tim(time);
-	if (ret != E_OK) {
-		return -EPERM;
-	}
-
-	return 0;
-}
-
-sigset_t g_sigmask;
-
-int shell_sigprocmask(int how, const sigset_t *restrict set, sigset_t *restrict old)
-{
-	if (old != NULL)
-		memcpy(old, &g_sigmask, sizeof(sigset_t));
-
-	switch (how) {
-	case SIG_BLOCK:
-		for (int i = 0; i < sizeof(g_sigmask.__bits) / sizeof(g_sigmask.__bits[0]); i++) {
-			g_sigmask.__bits[i] |= set->__bits[i];
-		}
-		break;
-	case SIG_UNBLOCK:
-		for (int i = 0; i < sizeof(g_sigmask.__bits) / sizeof(g_sigmask.__bits[0]); i++) {
-			g_sigmask.__bits[i] &= ~set->__bits[i];
-		}
-		break;
-	case SIG_SETMASK:
-		memcpy(&g_sigmask, set, sizeof(sigset_t));
-		break;
-	default:
-		return -EINVAL;
-	}
-
-	return 0;
-}
-
-// musl-1.1.18\src\internal\ksigaction.h
-struct k_sigaction {
-	void(*handler)(int);
-	unsigned long flags;
-	void(*restorer)(void);
-	unsigned mask[2];
-};
-
-struct k_sigaction sigtable[7];
-
-int shell_sigaction(int sig, const struct k_sigaction *restrict sa,
-	struct k_sigaction *restrict old, size_t size)
-{
-	struct k_sigaction *sat;
-
-	switch(sig){
-	case SIGALRM:
-		sat = &sigtable[0];
-		break;
-	case SIGFPE:
-		sat = &sigtable[1];
-		break;
-	case SIGILL:
-		sat = &sigtable[2];
-		break;
-	case SIGSEGV:
-		sat = &sigtable[3];
-		break;
-	case SIGBUS:
-		sat = &sigtable[4];
-		break;
-	case SIGABRT:
-		sat = &sigtable[5];
-		break;
-	case SIGPIPE:
-		sat = &sigtable[6];
-		break;
-	default:
-		return -EINVAL;
-	}
-
-	if (old != NULL)
-		memcpy(old, sat, offsetof(struct k_sigaction, mask) + size);
-
-	memcpy(sat, sa, offsetof(struct k_sigaction, mask) + size);
-
-	return 0;
-}
-
-int shell_madvise(void *a, size_t b, int c)
-{
-	return 0;
-}
-
-int shell_gettid()
-{
-	ID tskid;
-	ER ret;
-
-	ret = get_tid(&tskid);
-	if (ret != E_OK)
-		return -1;
-
-	return tskid;
-}
-
-int shell_tkill(int tid, int sig)
-{
-	if ((tid == SHELLCMD_TASK) && (sig == SIGABRT)) {
-		shell_abort();
-	}
-
-	no_implement("tkill");
-	return -1;
-}
-
-int shell_kill(int pid, int sig)
-{
-	DebugBreak();
-	return -1;
-}
-
-int shell_gettimeofday(struct timeval *tv, void *tzvp)
-{
-	SYSTIM time;
-	if (!tv) return 0;
-	get_tim(&time);
-	tv->tv_sec = time / 1000000;
-	tv->tv_usec = time - (tv->tv_sec * 1000000);
-	return 0;
-}
-
-int shell_nanosleep(const struct timespec *req, struct timespec *rem)
-{
-	ER ret;
-	TMO tmo;
-	SYSTIM prev, now, diff;
-
-	if ((req == NULL) || (req->tv_nsec < 0) || (req->tv_nsec >= 1000000000))
-		return -EINVAL;
-
-	get_tim(&prev);
-
-	tmo = req->tv_sec * 1000000 + req->tv_nsec / 1000;
-	ret = tslp_tsk(tmo);
-	if (ret == E_OK) {
-		if (rem != NULL) {
-			get_tim(&now);
-			diff = now - prev;
-			rem->tv_sec = diff / 1000000ll;
-			rem->tv_nsec = (diff - (rem->tv_sec * 1000000ll)) * 1000ll;
-		}
-		return 0;
-	}
-	else if (ret == E_TMOUT) {
-		if (rem != NULL) {
-			rem->tv_sec = 0;
-			rem->tv_nsec = 0;
-		}
-		return 0;
-	}
-
-	return -EFAULT;
-}
-
-ssize_t shell_getrandom(void *buf, size_t buflen, unsigned int flags)
-{
-	SYSTIM now;
-	int32_t i;
-	int *output = (int *)buf;
-	size_t sz = buflen / 4;
-
-	get_tim(&now);
-	srand(now);
-
-	for (i = 0; i < sz; i++)
-		output[i] = rand();
-
-	for (i = 4 * sz; i < buflen; i++)
-		((char *)buf)[i] = rand();
-
-	return buflen;
-}
-
-extern uint32_t  __CmdBase;
-extern uint32_t  __CmdLimit;
-
-void *shell_brk(void *addr)
-{
-	if (addr == 0) {
-		return (void *)((intptr_t)&__CmdBase + 0x40000);
-	}
-	if ((addr >= (intptr_t)&__CmdBase + 0x40000) && (addr < &__CmdLimit)) {
-		return addr;
-	}
-	return (void *)-1;
-}
-
-void *shell_mmap2(void *start, size_t length, int prot, int flags, int fd, off_t pgoffset)
-{
-	if (fd != -1)
-		return -EINVAL;
-
-	if ((length >= 0) && (length <= (intptr_t)&__CmdLimit - ((intptr_t)&__CmdBase + 0x40000))) {
-		return &__CmdBase + 0x40000;
-	}
-	return (void *)-1;
-}
-
-int shell_mprotect(void *addr, size_t len, int prot)
-{
-	//if ((addr >= (intptr_t)&__CmdBase + 0x40000) && ((intptr_t)addr + len < &__CmdLimit)) {
-		return 0;
-	//}
-	//return -1;
-}
Index: EcnlProtoTool/trunk/ntshell/src/netcmd.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/src/netcmd.c	(revision 441)
+++ EcnlProtoTool/trunk/ntshell/src/netcmd.c	(revision 442)
@@ -40,5 +40,4 @@
 #include <t_stdlib.h>
 #include <sil.h>
-#include <string.h>
 #include "syssvc/serial.h"
 #include "syssvc/syslog.h"
@@ -59,6 +58,4 @@
 #include <netapp/resolver.h>
 #include "core/ntlibc.h"
-#include "util/ntstdio.h"
-#include <stdio.h>
 #include "ntp_cli.h"
 #include "kernel_cfg.h"
@@ -71,5 +68,4 @@
 extern void ping6(T_IN6_ADDR *addr, uint_t tmo, uint_t len);
 extern void ping4(T_IN4_ADDR *addr, uint_t tmo, uint_t len);
-extern ntstdio_t *ntstdio;
 
 /*
@@ -255,9 +251,9 @@
 
 	if (apip == '1')
-		ntlibc_strcpy(line, i6rlp_pmtu_str1);
+		strcpy(line, i6rlp_pmtu_str1);
 	else if (apip == '2')
-		ntlibc_strcpy(line, i6rlp_pmtu_str2);
+		strcpy(line, i6rlp_pmtu_str2);
 	else if (apip == '3')
-		ntlibc_strcpy(line, i6rlp_pmtu_str3);
+		strcpy(line, i6rlp_pmtu_str3);
 
 #if defined(SUPPORT_INET6) && defined(SUPPORT_INET4)
@@ -280,5 +276,5 @@
 
 	if ((line = lookup_ipaddr(&addr, line, apip)) == NULL) {
-		ntstdio_printf(ntstdio, "[PING] unknown host.\n");
+		printf("[PING] unknown host.\n");
 		return 0;
 	}
@@ -299,18 +295,18 @@
 #if defined(SUPPORT_INET4)
 	if (apip == API_PROTO_IPV6) {
-		ntstdio_printf(ntstdio, "[PING6] size: %d, tmo: %d, host: %s\n", size, tmo, ipv62str(NULL, &addr));
+		printf("[PING6] size: %d, tmo: %d, host: %s\n", size, tmo, ipv62str(NULL, &addr));
 		ping6(&addr, (uint_t)tmo, (uint_t)size);
 	}
 	else {
 		addr4 = ntohl(addr.s6_addr32[3]);
-		ntstdio_printf(ntstdio, "[PING4] size: %d, tmo: %d, host: %s\n", size, tmo, ip2str(NULL, &addr4));
+		printf("[PING4] size: %d, tmo: %d, host: %s\n", size, tmo, ip2str(NULL, &addr4));
 		ping4(&addr4, (uint_t)tmo, (uint_t)size);
 	}
 #else /* of #if defined(SUPPORT_INET4) */
-	ntstdio_printf(ntstdio, "[PING6] size: %d, tmo: %d, host: %s\n", size, tmo, ipv62str(NULL, &addr));
+	printf("[PING6] size: %d, tmo: %d, host: %s\n", size, tmo, ipv62str(NULL, &addr));
 	ping6(&addr, (uint_t)tmo, (uint_t)size);
 #endif	/* of #if defined(SUPPORT_INET4) */
 #else	/* of #if defined(SUPPORT_INET6) */
-	ntstdio_printf(ntstdio, "[PING4] size: %d, tmo: %d, host: %s\n", size, tmo, ip2str(NULL, &addr));
+	printf("[PING4] size: %d, tmo: %d, host: %s\n", size, tmo, ip2str(NULL, &addr));
 	ping4(&addr, (uint_t)tmo, (uint_t)size);
 #endif	/* of #if defined(SUPPORT_INET6) */
@@ -331,13 +327,13 @@
 		pos = str_ipv4addr(temp, sizeof(temp), &svaddr, 0);
 		temp[pos] = '\0';
-		ntstdio_printf(ntstdio, "DHCPv4 server: %s,\n", temp);
-		ntstdio_printf(ntstdio, "  Renew:       %u:%02u:%02u,\n",
+		printf("DHCPv4 server: %s,\n", temp);
+		printf("  Renew:       %u:%02u:%02u,\n",
 			renew / 3600, (renew / 60) % 60, renew % 60);
-		ntstdio_printf(ntstdio, "  Rebind:      %u:%02u:%02u, Expire:   %u:%02u:%02u.\n",
+		printf("  Rebind:      %u:%02u:%02u, Expire:   %u:%02u:%02u.\n",
 			rebind / 3600, (rebind / 60) % 60, rebind % 60,
 			expire / 3600, (expire / 60) % 60, expire % 60);
 	}
 	else if (ret == E_OBJ)
-		ntstdio_printf(ntstdio, "DHCPv4 server: not available.\n");
+		printf("DHCPv4 server: not available.\n");
 }
 
@@ -349,11 +345,11 @@
 		return 0;
 
-	if (ntlibc_strcmp(argv[1], "rel") == 0) {
+	if (strcmp(argv[1], "rel") == 0) {
 		ret = dhcp4c_rel_info();
-		ntstdio_printf(ntstdio, "dhcp4c_rel_info %d\n", ret);
-	}
-	else if (ntlibc_strcmp(argv[1], "renew") == 0) {
+		printf("dhcp4c_rel_info %d\n", ret);
+	}
+	else if (strcmp(argv[1], "renew") == 0) {
 		ret = dhcp4c_renew_info();
-		ntstdio_printf(ntstdio, "dhcp4c_renew_info %d\n", ret);
+		printf("dhcp4c_renew_info %d\n", ret);
 	}
 	else {
@@ -383,8 +379,8 @@
 		else {
 			for (c = 1; c <= *ptr; c++)
-				ntstdio_printf(ntstdio, "%c", *(ptr + c));
+				printf("%c", *(ptr + c));
 			ptr += *ptr + 1;
 			if (*ptr)
-				ntstdio_printf(ntstdio, ".");
+				printf(".");
 		}
 	}
@@ -406,16 +402,16 @@
 		return error;
 
-	ntstdio_printf(ntstdio, "    mname:   ");
+	printf("    mname:   ");
 	rn_offset = s_show_dns_domain_name(msg, offset);
 	putchar('\n');
-	ntstdio_printf(ntstdio, "    rname:   ");
+	printf("    rname:   ");
 	s_show_dns_domain_name(msg, rn_offset);
 	putchar('\n');
 
-	ntstdio_printf(ntstdio, "    serial:  %d\n", soa.serial);
-	ntstdio_printf(ntstdio, "    refresh: %d\n", soa.refresh);
-	ntstdio_printf(ntstdio, "    retry:   %d\n", soa.retry);
-	ntstdio_printf(ntstdio, "    expirel: %d\n", soa.expire);
-	ntstdio_printf(ntstdio, "    minimum: %d\n", soa.minimum);
+	printf("    serial:  %d\n", soa.serial);
+	printf("    refresh: %d\n", soa.refresh);
+	printf("    retry:   %d\n", soa.retry);
+	printf("    expirel: %d\n", soa.expire);
+	printf("    minimum: %d\n", soa.minimum);
 
 	return E_OK;
@@ -433,5 +429,5 @@
 	int		scount;
 
-	ntstdio_printf(ntstdio, "question   section: %d\n", rslv->dns_hdr.qdcount);
+	printf("question   section: %d\n", rslv->dns_hdr.qdcount);
 	offset = rslv->qd_offset;
 	for (scount = 1; scount <= rslv->dns_hdr.qdcount; scount++) {
@@ -439,7 +435,7 @@
 			return error;
 
-		ntstdio_printf(ntstdio, "%2d: ", scount);
+		printf("%2d: ", scount);
 		s_show_dns_domain_name(msg, offset);
-		ntstdio_printf(ntstdio, "\n    type: %-4s, class: %2s\n", dns_strtype(qd.type), dns_strclass(qd.class));
+		printf("\n    type: %-4s, class: %2s\n", dns_strtype(qd.type), dns_strclass(qd.class));
 		offset = error;
 	}
@@ -463,12 +459,12 @@
 	int pos;
 
-	ntstdio_printf(ntstdio, "%10s section: %d\n", title, scount);
+	printf("%10s section: %d\n", title, scount);
 	for (count = 1; count <= scount; count++) {
 		if ((error = dns_analyze_rr(&rr, offset, msg, length)) < 0)
 			return error;
 
-		ntstdio_printf(ntstdio, "%2d: ", count);
+		printf("%2d: ", count);
 		s_show_dns_domain_name(msg, offset);
-		ntstdio_printf(ntstdio, "\n    type: %-4s, class: %2s, TTL: %2d, len: %3d, offset: 0x%02x\n",
+		printf("\n    type: %-4s, class: %2s, TTL: %2d, len: %3d, offset: 0x%02x\n",
 			dns_strtype(rr.type), dns_strclass(rr.class), rr.ttl, rr.rdlength, rr.rdata_offset);
 
@@ -479,13 +475,13 @@
 			pos = str_ipv4addr(temp, sizeof(temp), &in4_addr, 0);
 			temp[pos] = '\0';
-			ntstdio_printf(ntstdio, "    IPv4 addr: %s\n", temp);
+			printf("    IPv4 addr: %s\n", temp);
 			break;
 		case DNS_TYPE_NS:
-			ntstdio_printf(ntstdio, "    host: ");
+			printf("    host: ");
 			s_show_dns_domain_name(msg, rr.rdata_offset);
 			putchar('\n');
 			break;
 		case DNS_TYPE_CNAME:
-			ntstdio_printf(ntstdio, "    host: ");
+			printf("    host: ");
 			s_show_dns_domain_name(msg, rr.rdata_offset);
 			putchar('\n');
@@ -495,5 +491,5 @@
 			break;
 		case DNS_TYPE_PTR:
-			ntstdio_printf(ntstdio, "     PTR: ");
+			printf("     PTR: ");
 			s_show_dns_domain_name(msg, rr.rdata_offset);
 			putchar('\n');
@@ -503,13 +499,13 @@
 			pos = str_ipv6addr(temp, sizeof(temp), &in6_addr, 0);
 			temp[pos] = '\0';
-			ntstdio_printf(ntstdio, "    IPv6 addr: %s\n", temp);
+			printf("    IPv6 addr: %s\n", temp);
 			break;
 		default:
-			ntstdio_printf(ntstdio, "    data: ");
+			printf("    data: ");
 			col = 32;
 			for (dcount = 0; dcount < rr.rdlength; dcount++) {
-				ntstdio_printf(ntstdio, "%02x", *(msg + rr.rdata_offset + dcount));
+				printf("%02x", *(msg + rr.rdata_offset + dcount));
 				if (--col == 0) {
-					ntstdio_printf(ntstdio, "\n          ");
+					printf("\n          ");
 					col = 32;
 				}
@@ -539,9 +535,9 @@
 #if defined(SUPPORT_INET6)
 
-	ntstdio_printf(ntstdio, "domain name:     %s\n", dns_in6_get_dname());
+	printf("domain name:     %s\n", dns_in6_get_dname());
 
 #else	/* of #if defined(SUPPORT_INET6) */
 
-	ntstdio_printf(ntstdio, "domain name:     %s\n", dns_in4_get_dname());
+	printf("domain name:     %s\n", dns_in4_get_dname());
 
 #endif	/* of #if defined(SUPPORT_INET6) */
@@ -549,11 +545,11 @@
 #if defined(SUPPORT_INET6)
 	dns_in6_get_addr(&in6_addr);
-	ntstdio_printf(ntstdio, "IPv6 DNS server: ");
+	printf("IPv6 DNS server: ");
 	if (IN6_IS_ADDR_UNSPECIFIED(&in6_addr))
-		ntstdio_printf(ntstdio, "not available.\n");
+		printf("not available.\n");
 	else {
 		pos = str_ipv6addr(temp, sizeof(temp), &in6_addr, 0);
 		temp[pos] = '\0';
-		ntstdio_printf(ntstdio, "%s.\n", temp);
+		printf("%s.\n", temp);
 	}
 #endif	/* of #if defined(SUPPORT_INET6) */
@@ -561,11 +557,11 @@
 #if defined(SUPPORT_INET4)
 	dns_in4_get_addr(&in4_addr);
-	ntstdio_printf(ntstdio, "IPv4 DNS server: ");
+	printf("IPv4 DNS server: ");
 	if (in4_addr == IPV4_ADDRANY)
-		ntstdio_printf(ntstdio, "not available.\n");
+		printf("not available.\n");
 	else {
 		pos = str_ipv4addr(temp, sizeof(temp), &in4_addr, 0);
 		temp[pos] = '\0';
-		ntstdio_printf(ntstdio, "%s.\n", temp);
+		printf("%s.\n", temp);
 	}
 #endif	/* of #if defined(SUPPORT_INET4) */
@@ -596,5 +592,5 @@
 	uint8_t 	*msg;
 
-	if (ntlibc_strcmp(line, "info") == 0) {
+	if (strcmp(line, "info") == 0) {
 		dns_info();
 		return 0;
@@ -604,5 +600,5 @@
 	line = skip_blanks(resolv_options(&flags, line, DEFAULT_API_PROTO));
 	if ((flags & (DNS_LUP_FLAGS_PROTO_IPV6 | DNS_LUP_FLAGS_PROTO_IPV4)) == 0) {
-		ntstdio_printf(ntstdio, "DNS server not available.\n");
+		printf("DNS server not available.\n");
 		return 0;
 	}
@@ -620,47 +616,47 @@
 
 	if ((error = tget_mpf(MPF_RSLV_SRBUF, (void*)&msg, TMO_FEVR)) != E_OK) {
-		ntstdio_printf(ntstdio, "get buffer error: %s.\n", itron_strerror(error));
+		printf("get buffer error: %s.\n", itron_strerror(error));
 		return 0;
 	}
 
 	if ((length = dns_lookup_host(flags | DNS_LUP_FLAGS_MSG, line, msg, DNS_UDP_MSG_LENGTH, &rslv)) < 0) {
-		//ntstdio_printf(ntstdio, "error: %s.\n", itron_strerror(length));
+		//printf("error: %s.\n", itron_strerror(length));
 		goto err_ret;
 	}
 
 	dly_tsk(1 * 1000);
-	ntstdio_printf(ntstdio, "DNS header: flags: ");
+	printf("DNS header: flags: ");
 	if (rslv.dns_hdr.code & (DNS_QR_RESPONSE | DNS_AUTHORITATIVE |
 		DNS_TRUN_CATION | DNS_RECURSION_DESIRED | DNS_RECURSION_AVAILABLE)) {
-		ntstdio_printf(ntstdio, (rslv.dns_hdr.code & DNS_QR_RESPONSE) ? "QR," : "");
-		ntstdio_printf(ntstdio, (rslv.dns_hdr.code & DNS_AUTHORITATIVE) ? "AA," : "");
-		ntstdio_printf(ntstdio, (rslv.dns_hdr.code & DNS_TRUN_CATION) ? "TC," : "");
-		ntstdio_printf(ntstdio, (rslv.dns_hdr.code & DNS_RECURSION_DESIRED) ? "RD," : "");
-		ntstdio_printf(ntstdio, (rslv.dns_hdr.code & DNS_RECURSION_AVAILABLE) ? "RA," : "");
-		ntstdio_printf(ntstdio, " ");
-	}
-	ntstdio_printf(ntstdio, "opcode: ");
-	ntstdio_printf(ntstdio, (rslv.dns_hdr.code & DNS_OPCODE_REVERSE) ? "RV" : "FW");
-	ntstdio_printf(ntstdio, (rslv.dns_hdr.code & DNS_OPCODE_STATUS) ? ",ST" : "");
-	ntstdio_printf(ntstdio, ", rcode: %s.\n",
+		printf((rslv.dns_hdr.code & DNS_QR_RESPONSE) ? "QR," : "");
+		printf((rslv.dns_hdr.code & DNS_AUTHORITATIVE) ? "AA," : "");
+		printf((rslv.dns_hdr.code & DNS_TRUN_CATION) ? "TC," : "");
+		printf((rslv.dns_hdr.code & DNS_RECURSION_DESIRED) ? "RD," : "");
+		printf((rslv.dns_hdr.code & DNS_RECURSION_AVAILABLE) ? "RA," : "");
+		printf(" ");
+	}
+	printf("opcode: ");
+	printf((rslv.dns_hdr.code & DNS_OPCODE_REVERSE) ? "RV" : "FW");
+	printf((rslv.dns_hdr.code & DNS_OPCODE_STATUS) ? ",ST" : "");
+	printf(", rcode: %s.\n",
 		(rslv.dns_hdr.code & DNS_RCODE_MASK) > DNS_RCODE_REFUSED
 		? "6" : rcode_str[rslv.dns_hdr.code & DNS_RCODE_MASK]);
 
 	if ((offset = show_dns_qdsection(msg, length, &rslv)) < 0) {
-		ntstdio_printf(ntstdio, "msg error: %s.\n", itron_strerror(offset));
+		printf("msg error: %s.\n", itron_strerror(offset));
 	}
 	if ((offset = show_dns_section(msg, length, rslv.dns_hdr.ancount, rslv.an_offset, "answer")) < 0) {
-		ntstdio_printf(ntstdio, "msg error: %s.\n", itron_strerror(offset));
+		printf("msg error: %s.\n", itron_strerror(offset));
 	}
 	if ((offset = show_dns_section(msg, length, rslv.dns_hdr.nscount, rslv.ns_offset, "authority")) < 0) {
-		ntstdio_printf(ntstdio, "msg error: %s.\n", itron_strerror(offset));
+		printf("msg error: %s.\n", itron_strerror(offset));
 	}
 	if ((offset = show_dns_section(msg, length, rslv.dns_hdr.arcount, rslv.ar_offset, "additional")) < 0) {
-		ntstdio_printf(ntstdio, "msg error: %s.\n", itron_strerror(offset));
+		printf("msg error: %s.\n", itron_strerror(offset));
 	}
 
 err_ret:
 	if ((error = rel_mpf(MPF_RSLV_SRBUF, msg)) != E_OK)
-		ntstdio_printf(ntstdio, "release buffer error: %s.\n", itron_strerror(error));
+		printf("release buffer error: %s.\n", itron_strerror(error));
 	return 0;
 }
Index: EcnlProtoTool/trunk/ntshell/src/newlib_stub.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/src/newlib_stub.c	(revision 442)
+++ EcnlProtoTool/trunk/ntshell/src/newlib_stub.c	(revision 442)
@@ -0,0 +1,115 @@
+/*
+ *  TOPPERS PROJECT Home Network Working Group Software
+ * 
+ *  Copyright (C) 2020 Cores Co., Ltd. Japan
+ * 
+ *  上記著作権者は，以下の(1)～(4)の条件を満たす場合に限り，本ソフトウェ
+ *  ア（本ソフトウェアを改変したものを含む．以下同じ）を使用・複製・改
+ *  変・再配布（以下，利用と呼ぶ）することを無償で許諾する．
+ *  (1) 本ソフトウェアをソースコードの形で利用する場合には，上記の著作
+ *      権表示，この利用条件および下記の無保証規定が，そのままの形でソー
+ *      スコード中に含まれていること．
+ *  (2) 本ソフトウェアを，ライブラリ形式など，他のソフトウェア開発に使
+ *      用できる形で再配布する場合には，再配布に伴うドキュメント（利用
+ *      者マニュアルなど）に，上記の著作権表示，この利用条件および下記
+ *      の無保証規定を掲載すること．
+ *  (3) 本ソフトウェアを，機器に組み込むなど，他のソフトウェア開発に使
+ *      用できない形で再配布する場合には，次のいずれかの条件を満たすこ
+ *      と．
+ *    (a) 再配布に伴うドキュメント（利用者マニュアルなど）に，上記の著
+ *        作権表示，この利用条件および下記の無保証規定を掲載すること．
+ *    (b) 再配布の形態を，別に定める方法によって，TOPPERSプロジェクトに
+ *        報告すること．
+ *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
+ *      害からも，上記著作権者およびTOPPERSプロジェクトを免責すること．
+ *      また，本ソフトウェアのユーザまたはエンドユーザからのいかなる理
+ *      由に基づく請求からも，上記著作権者およびTOPPERSプロジェクトを
+ *      免責すること．
+ * 
+ *  本ソフトウェアは，無保証で提供されているものである．上記著作権者お
+ *  よびTOPPERSプロジェクトは，本ソフトウェアに関して，特定の使用目的
+ *  に対する適合性も含めて，いかなる保証も行わない．また，本ソフトウェ
+ *  アの利用により直接的または間接的に生じたいかなる損害に関しても，そ
+ *  の責任を負わない．
+ * 
+ *  @(#) $Id$
+ */
+
+#include <stdint.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <kernel.h>
+#include "kernel_cfg.h"
+
+#undef errno
+extern int errno;
+
+long __syscall_ret(unsigned long r)
+{
+	if (r > -4096UL) {
+		errno = -r;
+		return -1;
+	}
+	return r;
+}
+
+int _kill(int pid, int sig)
+{
+	return 0;
+}
+
+int _getpid(int n)
+{
+	return 1;
+}
+
+int _close(int fd)
+{
+	return __syscall_ret(shell_close(fd));
+}
+
+long _read(int fd, void *buf, long count)
+{
+	return __syscall_ret(shell_read(fd, buf, count));
+}
+
+long _write(int fd, const void *buf, long count)
+{
+	return __syscall_ret(shell_write(fd, buf, count));
+}
+
+off_t _lseek(int fd, off_t offset, int whence)
+{
+	off_t result;
+	long ret = shell_llseek(fd, offset, &result, whence);
+	return __syscall_ret(ret) ? -1 : result;
+}
+
+int _fstat(int fd, struct stat *st)
+{
+	struct SHELL_FILE *fp = fd_to_fp(fd);
+	if (fp == NULL)
+		return __syscall_ret(-EBADF);
+
+	memset(st, 0, sizeof(*st));
+	st->st_mode = S_IFCHR;
+	//st->st_blksize = 1024;
+	return 0;
+}
+
+// musl-1.1.18\arch\generic\bits\ioctl.h
+#define TIOCGWINSZ	0x5413
+
+struct winsize {
+	unsigned short ws_row;
+	unsigned short ws_col;
+	unsigned short ws_xpixel;
+	unsigned short ws_ypixel;
+};
+
+int _isatty(int fd)
+{
+	struct winsize wsz;
+	long ret = shell_ioctl(fd, TIOCGWINSZ, &wsz);
+	return __syscall_ret(ret);
+}
Index: EcnlProtoTool/trunk/ntshell/src/ntp_cli.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/src/ntp_cli.c	(revision 441)
+++ EcnlProtoTool/trunk/ntshell/src/ntp_cli.c	(revision 442)
@@ -271,5 +271,5 @@
 
 	nc->buf[0] = '\0';
-#ifdef __NEED_struct_timespec
+#ifdef _TIME_H_
 	if (ctime_r(&tp.tv_sec, nc->buf) != NULL)
 #else
Index: EcnlProtoTool/trunk/ntshell/src/pipe_stub.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/src/pipe_stub.c	(revision 441)
+++ EcnlProtoTool/trunk/ntshell/src/pipe_stub.c	(revision 442)
@@ -36,5 +36,4 @@
  */
 #include "shellif.h"
-#include <stdint.h>
 #include <kernel.h>
 #include <t_syslog.h>
@@ -46,6 +45,4 @@
 #include "fdtable.h"
 #include "kernel_cfg.h"
-#include <string.h>
-#include "util/ntstdio.h"
 #include "hal/serial_api.h"
 
Index: EcnlProtoTool/trunk/ntshell/src/shellif.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/src/shellif.c	(revision 442)
+++ EcnlProtoTool/trunk/ntshell/src/shellif.c	(revision 442)
@@ -0,0 +1,324 @@
+/*
+ *  TOPPERS PROJECT Home Network Working Group Software
+ * 
+ *  Copyright (C) 2020 Cores Co., Ltd. Japan
+ * 
+ *  上記著作権者は，以下の(1)～(4)の条件を満たす場合に限り，本ソフトウェ
+ *  ア（本ソフトウェアを改変したものを含む．以下同じ）を使用・複製・改
+ *  変・再配布（以下，利用と呼ぶ）することを無償で許諾する．
+ *  (1) 本ソフトウェアをソースコードの形で利用する場合には，上記の著作
+ *      権表示，この利用条件および下記の無保証規定が，そのままの形でソー
+ *      スコード中に含まれていること．
+ *  (2) 本ソフトウェアを，ライブラリ形式など，他のソフトウェア開発に使
+ *      用できる形で再配布する場合には，再配布に伴うドキュメント（利用
+ *      者マニュアルなど）に，上記の著作権表示，この利用条件および下記
+ *      の無保証規定を掲載すること．
+ *  (3) 本ソフトウェアを，機器に組み込むなど，他のソフトウェア開発に使
+ *      用できない形で再配布する場合には，次のいずれかの条件を満たすこ
+ *      と．
+ *    (a) 再配布に伴うドキュメント（利用者マニュアルなど）に，上記の著
+ *        作権表示，この利用条件および下記の無保証規定を掲載すること．
+ *    (b) 再配布の形態を，別に定める方法によって，TOPPERSプロジェクトに
+ *        報告すること．
+ *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
+ *      害からも，上記著作権者およびTOPPERSプロジェクトを免責すること．
+ *      また，本ソフトウェアのユーザまたはエンドユーザからのいかなる理
+ *      由に基づく請求からも，上記著作権者およびTOPPERSプロジェクトを
+ *      免責すること．
+ * 
+ *  本ソフトウェアは，無保証で提供されているものである．上記著作権者お
+ *  よびTOPPERSプロジェクトは，本ソフトウェアに関して，特定の使用目的
+ *  に対する適合性も含めて，いかなる保証も行わない．また，本ソフトウェ
+ *  アの利用により直接的または間接的に生じたいかなる損害に関しても，そ
+ *  の責任を負わない．
+ * 
+ *  @(#) $Id$
+ */
+
+#include "shellif.h"
+#include "target_syssvc.h"
+#include "kernel_cfg.h"
+
+extern int shellcmd_exit_code;
+extern jmp_buf shellcmd_exit;
+
+void shell_abort()
+{
+	shellcmd_exit_code = -1;
+	longjmp(shellcmd_exit, 1);
+}
+
+void shell_exit(int exitcd)
+{
+	shellcmd_exit_code = exitcd;
+	longjmp(shellcmd_exit, 1);
+}
+
+void shell_exit_group(int exitcd)
+{
+	shellcmd_exit_code = exitcd;
+	longjmp(shellcmd_exit, 1);
+}
+
+const struct utsname host_name = {
+	"TOPPERS/ASP3",
+	TARGET_NAME,
+	"3.5.0",
+	"3.5.0",
+	TARGET_NAME,
+	"toppers.jp"
+};
+
+int shell_uname(struct utsname *uts)
+{
+	memcpy(uts, &host_name, sizeof(host_name));
+	return 0;
+}
+
+int shell_clock_getres(clockid_t clk_id, struct timespec *res)
+{
+	if ((clk_id != CLOCK_REALTIME) && (clk_id != CLOCK_MONOTONIC))
+		return -EINVAL;
+
+	memset(&res->tv_sec, 0xFF, sizeof(res->tv_sec));
+	res->tv_nsec = 0;
+
+	return 0;
+}
+
+int shell_clock_gettime(clockid_t clk_id, struct timespec *tp)
+{
+	SYSTIM now = 0;
+
+	if ((clk_id != CLOCK_REALTIME) && (clk_id != CLOCK_MONOTONIC))
+		return -EINVAL;
+
+	get_tim(&now);
+	tp->tv_sec = now / 1000000;
+	tp->tv_nsec = (now % 1000000) * 1000;
+
+	return 0;
+}
+
+int shell_clock_settime(clockid_t clk_id, const struct timespec *tp)
+{
+	if ((clk_id != CLOCK_REALTIME) && (clk_id != CLOCK_MONOTONIC))
+		return -EINVAL;
+
+	SYSTIM time;
+	ER ret;
+
+	time = (tp->tv_sec * 1000000ll) + (tp->tv_nsec / 1000ll);
+
+	ret = set_tim(time);
+	if (ret != E_OK) {
+		return -EPERM;
+	}
+
+	return 0;
+}
+
+sigset_t g_sigmask;
+
+int shell_sigprocmask(int how, const sigset_t *restrict set, sigset_t *restrict old)
+{
+	if (old != NULL)
+		memcpy(old, &g_sigmask, sizeof(sigset_t));
+
+	switch (how) {
+	case SIG_BLOCK:
+		for (int i = 0; i < sizeof(g_sigmask.__bits) / sizeof(g_sigmask.__bits[0]); i++) {
+			g_sigmask.__bits[i] |= set->__bits[i];
+		}
+		break;
+	case SIG_UNBLOCK:
+		for (int i = 0; i < sizeof(g_sigmask.__bits) / sizeof(g_sigmask.__bits[0]); i++) {
+			g_sigmask.__bits[i] &= ~set->__bits[i];
+		}
+		break;
+	case SIG_SETMASK:
+		memcpy(&g_sigmask, set, sizeof(sigset_t));
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+// musl-1.1.18\src\internal\ksigaction.h
+struct k_sigaction {
+	void(*handler)(int);
+	unsigned long flags;
+	void(*restorer)(void);
+	unsigned mask[2];
+};
+
+struct k_sigaction sigtable[7];
+
+int shell_sigaction(int sig, const struct k_sigaction *restrict sa,
+	struct k_sigaction *restrict old, size_t size)
+{
+	struct k_sigaction *sat;
+
+	switch(sig){
+	case SIGALRM:
+		sat = &sigtable[0];
+		break;
+	case SIGFPE:
+		sat = &sigtable[1];
+		break;
+	case SIGILL:
+		sat = &sigtable[2];
+		break;
+	case SIGSEGV:
+		sat = &sigtable[3];
+		break;
+	case SIGBUS:
+		sat = &sigtable[4];
+		break;
+	case SIGABRT:
+		sat = &sigtable[5];
+		break;
+	case SIGPIPE:
+		sat = &sigtable[6];
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	if (old != NULL)
+		memcpy(old, sat, offsetof(struct k_sigaction, mask) + size);
+
+	memcpy(sat, sa, offsetof(struct k_sigaction, mask) + size);
+
+	return 0;
+}
+
+int shell_madvise(void *a, size_t b, int c)
+{
+	return 0;
+}
+
+int shell_gettid()
+{
+	ID tskid;
+	ER ret;
+
+	ret = get_tid(&tskid);
+	if (ret != E_OK)
+		return -1;
+
+	return tskid;
+}
+
+int shell_tkill(int tid, int sig)
+{
+	if ((tid == SHELLCMD_TASK) && (sig == SIGABRT)) {
+		shell_abort();
+	}
+
+	no_implement("tkill");
+	return -1;
+}
+
+int shell_kill(int pid, int sig)
+{
+	DebugBreak();
+	return -1;
+}
+
+int shell_gettimeofday(struct timeval *tv, void *tzvp)
+{
+	SYSTIM time;
+	if (!tv) return 0;
+	get_tim(&time);
+	tv->tv_sec = time / 1000000;
+	tv->tv_usec = time - (tv->tv_sec * 1000000);
+	return 0;
+}
+
+int shell_nanosleep(const struct timespec *req, struct timespec *rem)
+{
+	ER ret;
+	TMO tmo;
+	SYSTIM prev, now, diff;
+
+	if ((req == NULL) || (req->tv_nsec < 0) || (req->tv_nsec >= 1000000000))
+		return -EINVAL;
+
+	get_tim(&prev);
+
+	tmo = req->tv_sec * 1000000 + req->tv_nsec / 1000;
+	ret = tslp_tsk(tmo);
+	if (ret == E_OK) {
+		if (rem != NULL) {
+			get_tim(&now);
+			diff = now - prev;
+			rem->tv_sec = diff / 1000000ll;
+			rem->tv_nsec = (diff - (rem->tv_sec * 1000000ll)) * 1000ll;
+		}
+		return 0;
+	}
+	else if (ret == E_TMOUT) {
+		if (rem != NULL) {
+			rem->tv_sec = 0;
+			rem->tv_nsec = 0;
+		}
+		return 0;
+	}
+
+	return -EFAULT;
+}
+
+ssize_t shell_getrandom(void *buf, size_t buflen, unsigned int flags)
+{
+	SYSTIM now;
+	int32_t i;
+	int *output = (int *)buf;
+	size_t sz = buflen / 4;
+
+	get_tim(&now);
+	srand(now);
+
+	for (i = 0; i < sz; i++)
+		output[i] = rand();
+
+	for (i = 4 * sz; i < buflen; i++)
+		((char *)buf)[i] = rand();
+
+	return buflen;
+}
+
+extern uint32_t  __CmdBase;
+extern uint32_t  __CmdLimit;
+
+void *shell_brk(void *addr)
+{
+	if (addr == 0) {
+		return (void *)((intptr_t)&__CmdBase + 0x40000);
+	}
+	if ((addr >= (intptr_t)&__CmdBase + 0x40000) && (addr < &__CmdLimit)) {
+		return addr;
+	}
+	return (void *)-1;
+}
+
+void *shell_mmap2(void *start, size_t length, int prot, int flags, int fd, off_t pgoffset)
+{
+	if (fd != -1)
+		return -EINVAL;
+
+	if ((length >= 0) && (length <= (intptr_t)&__CmdLimit - ((intptr_t)&__CmdBase + 0x40000))) {
+		return &__CmdBase + 0x40000;
+	}
+	return (void *)-1;
+}
+
+int shell_mprotect(void *addr, size_t len, int prot)
+{
+	//if ((addr >= (intptr_t)&__CmdBase + 0x40000) && ((intptr_t)addr + len < &__CmdLimit)) {
+		return 0;
+	//}
+	//return -1;
+}
Index: EcnlProtoTool/trunk/ntshell/src/shellif.h
===================================================================
--- EcnlProtoTool/trunk/ntshell/src/shellif.h	(revision 441)
+++ EcnlProtoTool/trunk/ntshell/src/shellif.h	(revision 442)
@@ -88,4 +88,9 @@
 #define NCCS 32
 
+#include "../musl-1.1.18/include/stdint.h"
+#include "../musl-1.1.18/include/strings.h"
+#define _STRINGS_H_ // newlibã®strings.hã®includeãææ­¢
+#include "../musl-1.1.18/include/string.h"
+#define _STRING_H_ // newlibã®string.hã®includeãææ­¢
 #include "../musl-1.1.18/include/bits/fcntl.h"
 #include "../musl-1.1.18/include/bits/termios.h"
@@ -93,6 +98,8 @@
 #include "../musl-1.1.18/include/sys/select.h"
 #include "../musl-1.1.18/include/time.h"
+#define _TIME_H_ // newlibã®time.hã®includeãææ­¢
 #include "../musl-1.1.18/include/signal.h"
 #include "../musl-1.1.18/include/stdio.h"
+#define	_STDIO_H_ // newlibã®stdio.hã®includeãææ­¢
 #include "../musl-1.1.18/include/sys/utsname.h"
 #include "../musl-1.1.18/include/dirent.h"
@@ -104,4 +111,5 @@
 #include <stddef.h>
 #include <stdarg.h>
+#include <setjmp.h>
 
 #define DebugBreak()	asm("bkpt #0")
Index: EcnlProtoTool/trunk/ntshell/src/socket_stub.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/src/socket_stub.c	(revision 441)
+++ EcnlProtoTool/trunk/ntshell/src/socket_stub.c	(revision 442)
@@ -39,5 +39,4 @@
 #include <t_syslog.h>
 #include <t_stdlib.h>
-#include <string.h>
 #include <sil.h>
 #include "syssvc/syslog.h"
Index: EcnlProtoTool/trunk/ntshell/src/stdio_stub.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/src/stdio_stub.c	(revision 441)
+++ EcnlProtoTool/trunk/ntshell/src/stdio_stub.c	(revision 442)
@@ -36,5 +36,4 @@
  */
 #include "shellif.h"
-#include <stdint.h>
 #include <kernel.h>
 #include <t_syslog.h>
@@ -46,6 +45,4 @@
 #include "fdtable.h"
 #include "kernel_cfg.h"
-#include <string.h>
-#include <errno.h>
 #include "util/ntstdio.h"
 #include "hal/serial_api.h"
@@ -58,5 +55,6 @@
 #endif
 
-int shell_errno;
+#undef errno
+extern int errno;
 
 extern bool_t sio_isr_snd(ID siopid);
@@ -105,5 +103,4 @@
 
 stdio_sio_t stdio_sio;
-ntstdio_t *ntstdio = &stdio_sio.ntstdio;
 
 void sys_init(intptr_t exinf)
@@ -573,10 +570,10 @@
 	struct SHELL_FILE *fp = fd_to_fp(fd);
 	if ((fp == NULL) || (fp->type != &IO_TYPE_SIO)) {
-		shell_errno = EBADF;
+		errno = EBADF;
 		return -1;
 	}
 
-	shell_errno = sio_close(fp);
-	if (shell_errno != 0)
+	errno = sio_close(fp);
+	if (errno != 0)
 		return 1;
 	return 0;
@@ -587,5 +584,5 @@
 	struct SHELL_FILE *fp = fd_to_fp(fd);
 	if ((fp == NULL) || ((fp->type != &IO_TYPE_STDIN) && (fp->type != &IO_TYPE_SIO))) {
-		shell_errno = EBADF;
+		errno = EBADF;
 		return -1;
 	}
@@ -604,5 +601,5 @@
 	if ((fp == NULL) || ((fp->type != &IO_TYPE_STDOUT) && (fp->type != &IO_TYPE_STDERR)
 		&& (fp->type != &IO_TYPE_SIO))) {
-		shell_errno = EBADF;
+		errno = EBADF;
 		return -1;
 	}
@@ -621,10 +618,10 @@
 	if ((fp == NULL) || ((fp->type != &IO_TYPE_STDIN) && (fp->type != &IO_TYPE_STDOUT)
 		&& (fp->type != &IO_TYPE_STDERR) && (fp->type != &IO_TYPE_SIO))) {
-		shell_errno = EBADF;
+		errno = EBADF;
 		return -1;
 	}
 
-	shell_errno = sio_tcsetattr(fp, act, tio);
-	if (shell_errno != 0)
+	errno = sio_tcsetattr(fp, act, tio);
+	if (errno != 0)
 		return 1;
 	return 0;
@@ -636,10 +633,10 @@
 	if ((fp == NULL) || ((fp->type != &IO_TYPE_STDIN) && (fp->type != &IO_TYPE_STDOUT)
 		&& (fp->type != &IO_TYPE_STDERR) && (fp->type != &IO_TYPE_SIO))) {
-		shell_errno = EBADF;
+		errno = EBADF;
 		return -1;
 	}
 
-	shell_errno = sio_tcgetattr(fp, tio);
-	if (shell_errno != 0)
+	errno = sio_tcgetattr(fp, tio);
+	if (errno != 0)
 		return 1;
 	return 0;
@@ -651,5 +648,5 @@
 	if ((fp == NULL) || ((fp->type != &IO_TYPE_STDIN) && (fp->type != &IO_TYPE_STDOUT)
 		&& (fp->type != &IO_TYPE_STDERR) && (fp->type != &IO_TYPE_SIO))) {
-		shell_errno = EBADF;
+		errno = EBADF;
 		return -1;
 	}
@@ -660,6 +657,6 @@
 	va_end(ap);
 
-	shell_errno = sio_ioctl(fp, cmd, arg);
-	if (shell_errno != 0)
+	errno = sio_ioctl(fp, cmd, arg);
+	if (errno != 0)
 		return 1;
 	return 0;
Index: EcnlProtoTool/trunk/ntshell/src/syscall.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/src/syscall.c	(revision 441)
+++ EcnlProtoTool/trunk/ntshell/src/syscall.c	(revision 442)
@@ -102,4 +102,5 @@
 	case SYS__llseek:
 		ret = shell_llseek(r->a, (((off_t)r->b) << 32) + (off_t)r->c, (off_t *)r->d, r->e);
+		break;
 	case SYS__newselect:
 		ret = shell_select(r->a, (fd_set *)r->b, (fd_set *)r->c, (fd_set *)r->d, (struct timeval *)r->e);
Index: EcnlProtoTool/trunk/ntshell/src/tSIOPortNTShell.cdl
===================================================================
--- EcnlProtoTool/trunk/ntshell/src/tSIOPortNTShell.cdl	(revision 441)
+++ EcnlProtoTool/trunk/ntshell/src/tSIOPortNTShell.cdl	(revision 442)
@@ -49,5 +49,5 @@
  *  NTShell に関する定義
  */
-import_C("termios.h");
+import_C("mbed_retarget.h");
 
 /*
Index: EcnlProtoTool/trunk/ntshell/src/tSIOPortNTShellMain.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/src/tSIOPortNTShellMain.c	(revision 441)
+++ EcnlProtoTool/trunk/ntshell/src/tSIOPortNTShellMain.c	(revision 442)
@@ -46,11 +46,9 @@
 #include <t_syslog.h>
 #include <errno.h> 
-#include <termios.h>
-#include <unistd.h>
-#include <fcntl.h>
 #include "tSIOPortNTShellMain_tecsgen.h"
 #include "syssvc/siofd.h"
  
-extern int shell_errno;
+#undef errno
+extern int errno;
 
 /*
@@ -130,5 +128,5 @@
 		}
 		else {
-			assert(n < 0 && shell_errno == EAGAIN);
+			assert(n < 0 && errno == EAGAIN);
 			VAR_snd_flag = true;
 			VAR_snd_buf = c;
@@ -159,5 +157,5 @@
 	}
 	else {
-		assert(n < 0 && shell_errno == EAGAIN);
+		assert(n < 0 && errno == EAGAIN);
 		return(-1);
 	}
Index: EcnlProtoTool/trunk/ntshell/webserver/base64.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/webserver/base64.c	(revision 441)
+++ EcnlProtoTool/trunk/ntshell/webserver/base64.c	(revision 442)
@@ -86,5 +86,5 @@
     unsigned char *pdst;
     int i, j = 0, k = 0;
-    size_t srcsiz = ntlibc_strlen((const char *)src);
+    size_t srcsiz = strlen((const char *)src);
 
     if ((srcsiz % 4) != 0) {
Index: EcnlProtoTool/trunk/ntshell/webserver/http_parser.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/webserver/http_parser.c	(revision 441)
+++ EcnlProtoTool/trunk/ntshell/webserver/http_parser.c	(revision 442)
@@ -2372,5 +2372,5 @@
   if (u->field_set & (1 << UF_PORT)) {
     /* Don't bother with endp; we've already validated the string */
-    unsigned long v = ntlibc_strtoul(buf + u->field_data[UF_PORT].off, NULL, 10);
+    unsigned long v = strtoul(buf + u->field_data[UF_PORT].off, NULL, 10);
 
     /* Ports have a max value of 2^16 */
Index: EcnlProtoTool/trunk/ntshell/webserver/httpd-fs.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/webserver/httpd-fs.c	(revision 441)
+++ EcnlProtoTool/trunk/ntshell/webserver/httpd-fs.c	(revision 442)
@@ -45,9 +45,8 @@
 #include "kernel_cfg.h"
 #include "syssvc/syslog.h"
-#include "util/ntstdio.h"
 
 #ifndef _MSC_VER
 #ifndef strcat_s
-#define strcat_s(dst, dsz, src) ntlibc_strcat(dst, src)
+#define strcat_s(dst, dsz, src) strcat(dst, src)
 #endif
 #endif
@@ -62,6 +61,4 @@
 #define NULL 0
 #endif /* NULL */
-
-extern ntstdio_t *ntstdio;
 
 /*-----------------------------------------------------------------------------------*/
@@ -77,5 +74,5 @@
 	res = f_opendir(&dir, path);
 	if (res == FR_OK) {
-		i = ntlibc_strlen(path);
+		i = strlen(path);
 		for (;;) {
 			res = f_readdir(&dir, &fno);
@@ -83,5 +80,5 @@
 			fn = fno.fname;
 			if (fno.fattrib & AM_DIR) {
-				ntstdio_sprintf(&path[i], "0:/%s", fn);
+				sprintf(&path[i], "0:/%s", fn);
 				res = scan_files(path, size);
 				if (res != FR_OK) break;
@@ -89,5 +86,5 @@
 			}
 			else {
-				ntstdio_printf(ntstdio, "%s/%s\n", path, fn);
+				printf("%s/%s\n", path, fn);
 			}
 		}
@@ -114,10 +111,10 @@
 	if ((res = f_open(fd, name, FA_OPEN_EXISTING | FA_READ)) != FR_OK) {
 		if ((res = f_opendir(&dir, name)) != FR_OK) {
-			ntstdio_printf(ntstdio, "f_opendir(%s) => %d\n", name, res);
+			printf("f_opendir(%s) => %d\n", name, res);
 			return 0;
 		}
 
 		if ((res = f_readdir(&dir, &fno)) != FR_OK) {
-			ntstdio_printf(ntstdio, "f_readdir(%s) => %d\n", name, res);
+			printf("f_readdir(%s) => %d\n", name, res);
 			return 0;
 		}
@@ -132,5 +129,5 @@
 
 		if (res != FR_OK) {
-			ntstdio_printf(ntstdio, "f_open(%s) => %d %x\n", name, res, fno.fattrib);
+			printf("f_open(%s) => %d %x\n", name, res, fno.fattrib);
 			return 0;
 		}
@@ -139,5 +136,5 @@
 	file->len = fd->fsize;
 
-	//ntstdio_printf(ntstdio, "httpd_fs_open(%s) %d\n", name, file->len);
+	//printf("httpd_fs_open(%s) %d\n", name, file->len);
 
 	return 1;
@@ -158,5 +155,5 @@
 
 	if ((res = f_open(fd, name, FA_CREATE_ALWAYS | FA_WRITE)) != FR_OK) {
-		ntstdio_printf(ntstdio, "f_open(%s) => %d\n", name, res);
+		printf("f_open(%s) => %d\n", name, res);
 		return 0;
 	}
@@ -165,5 +162,5 @@
 	file->len = 0;
 
-	//ntstdio_printf(ntstdio, "httpd_fs_create(%s) %d\n", file->name, file->len);
+	//printf("httpd_fs_create(%s) %d\n", file->name, file->len);
 
 	return 1;
@@ -179,18 +176,18 @@
 
 	if ((ret = f_lseek(fd, file->pos)) != FR_OK) {
-		ntstdio_printf(ntstdio, "f_lseek(%s, %d) => %d\n", file->name, file->pos, ret);
+		printf("f_lseek(%s, %d) => %d\n", file->name, file->pos, ret);
 		return 0;
 	}
 
 	if (file->pos != fd->fptr) {
-		ntstdio_printf(ntstdio, "f_lseek(%s, %d) != %d\n", file->name, file->pos, fd->fptr);
+		printf("f_lseek(%s, %d) != %d\n", file->name, file->pos, fd->fptr);
 	}
 
 	if ((ret = f_read(fd, dst, len, &rlen)) != FR_OK) {
-		ntstdio_printf(ntstdio, "f_read(%s, 0x%p, %d) => %d\n", file->name, dst, len, ret);
-		return 0;
-	}
-
-	//ntstdio_printf(ntstdio, "httpd_fs_read(%s, %d, %d) => %d\n", file->name, file->pos, len, rlen);
+		printf("f_read(%s, 0x%p, %d) => %d\n", file->name, dst, len, ret);
+		return 0;
+	}
+
+	//printf("httpd_fs_read(%s, %d, %d) => %d\n", file->name, file->pos, len, rlen);
 
 	return rlen;
@@ -206,14 +203,14 @@
 
 	if ((ret = f_lseek(fd, file->pos)) != FR_OK) {
-		ntstdio_printf(ntstdio, "f_lseek(%s, %d) => %d\n", file->name, file->pos, ret);
+		printf("f_lseek(%s, %d) => %d\n", file->name, file->pos, ret);
 		return 0;
 	}
 
 	if (file->pos != fd->fptr) {
-		ntstdio_printf(ntstdio, "f_lseek(%s, %d) != %d\n", file->name, file->pos, fd->fptr);
+		printf("f_lseek(%s, %d) != %d\n", file->name, file->pos, fd->fptr);
 	}
 
 	if ((ret = f_write(fd, src, len, &rlen)) != FR_OK) {
-		ntstdio_printf(ntstdio, "f_write(%s, 0x%p, %d) => %d\n", file->name, src, len, ret);
+		printf("f_write(%s, 0x%p, %d) => %d\n", file->name, src, len, ret);
 		return 0;
 	}
@@ -222,5 +219,5 @@
 	file->len += rlen;
 
-	//ntstdio_printf(ntstdio, "httpd_fs_write(%s, %d, %d) => %d\n", file->name, file->pos, len, rlen);
+	//printf("httpd_fs_write(%s, %d, %d) => %d\n", file->name, file->pos, len, rlen);
 
 	return rlen;
@@ -234,5 +231,5 @@
 
 	if ((ret = f_close(fd)) != FR_OK) {
-		ntstdio_printf(ntstdio, "f_close(%s) => %d\n", file->name, ret);
+		printf("f_close(%s) => %d\n", file->name, ret);
 		return 0;
 	}
Index: EcnlProtoTool/trunk/ntshell/webserver/httpd.c
===================================================================
--- EcnlProtoTool/trunk/ntshell/webserver/httpd.c	(revision 441)
+++ EcnlProtoTool/trunk/ntshell/webserver/httpd.c	(revision 442)
@@ -53,5 +53,4 @@
 #include "base64.h"
 #include "sha1.h"
-#include "util/ntstdio.h"
 #include "core/ntlibc.h"
 
@@ -59,5 +58,4 @@
 #define FALSE 0
 
-extern ntstdio_t *ntstdio;
 SYSTIM httpd_time;
 struct httpd_state *uploding;
@@ -111,5 +109,5 @@
 void strcpy_s(char *dst, int size, const char *src)
 {
-	int slen = ntlibc_strlen(src);
+	int slen = strlen(src);
 	if (slen >= size)
 		slen = size - 1;
@@ -120,6 +118,6 @@
 void strcat_s(char *dst, int size, const char *src)
 {
-	int dlen = ntlibc_strlen(dst);
-	int slen = ntlibc_strlen(src);
+	int dlen = strlen(dst);
+	int slen = strlen(src);
 	if (dlen + slen >= size)
 		slen = size - 1 - dlen;
@@ -235,26 +233,26 @@
 	struct message *m = &s->message;
 
-	if (ntlibc_strncmp("Referer", buf, len) == 0) {
+	if (strncmp("Referer", buf, len) == 0) {
 		m->num_headers = 1;
 	}
-	else if (ntlibc_strncmp("Host", buf, len) == 0) {
+	else if (strncmp("Host", buf, len) == 0) {
 		m->num_headers = 2;
 	}
-	else if (ntlibc_strncmp("Upgrade", buf, len) == 0) {
+	else if (strncmp("Upgrade", buf, len) == 0) {
 		m->num_headers = 3;
 	}
-	else if (ntlibc_strncmp("Connection", buf, len) == 0) {
+	else if (strncmp("Connection", buf, len) == 0) {
 		m->num_headers = 4;
 	}
-	else if (ntlibc_strncmp("Sec-WebSocket-Key", buf, len) == 0) {
+	else if (strncmp("Sec-WebSocket-Key", buf, len) == 0) {
 		m->num_headers = 5;
 	}
-	else if (ntlibc_strncmp("Origin", buf, len) == 0) {
+	else if (strncmp("Origin", buf, len) == 0) {
 		m->num_headers = 6;
 	}
-	else if (ntlibc_strncmp("Sec-WebSocket-Protocol", buf, len) == 0) {
+	else if (strncmp("Sec-WebSocket-Protocol", buf, len) == 0) {
 		m->num_headers = 7;
 	}
-	else if (ntlibc_strncmp("Sec-WebSocket-Version", buf, len) == 0) {
+	else if (strncmp("Sec-WebSocket-Version", buf, len) == 0) {
 		m->num_headers = 8;
 	}
@@ -334,5 +332,5 @@
 			// アップロード先はSDカード
 			s->filename[0] = '1';
-			ntstdio_printf(ntstdio, "create:    %s.%d %s\n", s->addr, ((T_IPV4EP *)s->dst)->portno, s->filename);
+			printf("create:    %s.%d %s\n", s->addr, ((T_IPV4EP *)s->dst)->portno, s->filename);
 			if (!httpd_fs_create(s->filename, &s->file)) {
 				goto error;
@@ -341,6 +339,6 @@
 			s->in.state = IN_STATE_UPLOAD;
 		}
-		else if (ntlibc_strcmp(s->filename, uploding->filename) == 0) {
-			ntstdio_printf(ntstdio, "collision: %s.%d %s\n", s->addr, ((T_IPV4EP *)s->dst)->portno, s->filename);
+		else if (strcmp(s->filename, uploding->filename) == 0) {
+			printf("collision: %s.%d %s\n", s->addr, ((T_IPV4EP *)s->dst)->portno, s->filename);
 			goto error;
 		}
@@ -374,5 +372,5 @@
 
 	if (s->message.body_is_final) {
-		ntstdio_printf(ntstdio, "\n\n *** Error http_body_is_final() should return 1 \n"
+		printf("\n\n *** Error http_body_is_final() should return 1 \n"
 			"on last on_body callback call "
 			"but it doesn't! ***\n\n");
@@ -387,5 +385,5 @@
 
 	if (s->message.body_is_final) {
-		ntstdio_printf(ntstdio, "close:     %s.%d %s\n", s->addr, ((T_IPV4EP *)s->dst)->portno, s->filename);
+		printf("close:     %s.%d %s\n", s->addr, ((T_IPV4EP *)s->dst)->portno, s->filename);
 		httpd_fs_close(&s->file);
 		memset(&s->file, 0, sizeof(s->file));
@@ -412,5 +410,5 @@
 	struct httpd_state *s = get_context(p);
 	if (s->message.should_keep_alive != http_should_keep_alive(p)) {
-		ntstdio_printf(ntstdio, "\n\n *** Error http_should_keep_alive() should have same \n"
+		printf("\n\n *** Error http_should_keep_alive() should have same \n"
 			"value in both on_message_complete and on_headers_complete "
 			"but it doesn't! ***\n\n");
@@ -421,5 +419,5 @@
 		http_body_is_final(p) &&
 		!s->message.body_is_final) {
-		ntstdio_printf(ntstdio, "\n\n *** Error http_body_is_final() should return 1 \n"
+		printf("\n\n *** Error http_body_is_final() should return 1 \n"
 			"on last on_body callback call "
 			"but it doesn't! ***\n\n");
@@ -493,5 +491,5 @@
 		slen = tcp_get_buf(s->cepid, (void **)&buf, TMO_FEVR);
 		if (slen < 0) {
-			ntstdio_printf(ntstdio, "send_file#tcp_get_buf(%s.%d) => %d\n", s->addr, ((T_IPV4EP *)s->dst)->portno, slen);
+			printf("send_file#tcp_get_buf(%s.%d) => %d\n", s->addr, ((T_IPV4EP *)s->dst)->portno, slen);
 			s->state = STATE_CLOSING;
 			break;
@@ -506,5 +504,5 @@
 		len = httpd_fs_read(&s->file, buf, len);
 		if (len <= 0) {
-			ntstdio_printf(ntstdio, "send_file#httpd_fs_read(%s.%d) => %d\n", s->addr, ((T_IPV4EP *)s->dst)->portno, len);
+			printf("send_file#httpd_fs_read(%s.%d) => %d\n", s->addr, ((T_IPV4EP *)s->dst)->portno, len);
 			break;
 		}
@@ -514,5 +512,5 @@
 
 		if ((slen = tcp_snd_buf(s->cepid, len)) != E_OK) {
-			ntstdio_printf(ntstdio, "send_file#tcp_snd_buf(%s.%d) => %d\n", s->addr, ((T_IPV4EP *)s->dst)->portno, slen);
+			printf("send_file#tcp_snd_buf(%s.%d) => %d\n", s->addr, ((T_IPV4EP *)s->dst)->portno, slen);
 			s->state = STATE_CLOSING;
 			break;
@@ -520,5 +518,5 @@
 	}
 
-	ntstdio_printf(ntstdio, "close:     %s.%d %s\n", s->addr, ((T_IPV4EP *)s->dst)->portno, s->filename);
+	printf("close:     %s.%d %s\n", s->addr, ((T_IPV4EP *)s->dst)->portno, s->filename);
 	httpd_fs_close(&s->file);
 	s->file.len = 0;
@@ -536,5 +534,5 @@
 		slen = tcp_get_buf(s->cepid, (void **)&buf, TMO_FEVR);
 		if (slen < 0) {
-			ntstdio_printf(ntstdio, "send_data#tcp_get_buf(%s.%d) => %d\n", s->addr, ((T_IPV4EP *)s->dst)->portno, slen);
+			printf("send_data#tcp_get_buf(%s.%d) => %d\n", s->addr, ((T_IPV4EP *)s->dst)->portno, slen);
 			s->state = STATE_CLOSING;
 			break;
@@ -553,5 +551,5 @@
 
 		if ((slen = tcp_snd_buf(s->cepid, len)) != E_OK) {
-			ntstdio_printf(ntstdio, "send_data#tcp_snd_buf(%s.%d) => %d\n", s->addr, ((T_IPV4EP *)s->dst)->portno, slen);
+			printf("send_data#tcp_snd_buf(%s.%d) => %d\n", s->addr, ((T_IPV4EP *)s->dst)->portno, slen);
 			s->state = STATE_CLOSING;
 			break;
@@ -571,5 +569,5 @@
 	char *ptr;
 
-	len = ntlibc_strlen(statushdr);
+	len = strlen(statushdr);
 	tcp_snd_dat(s->cepid, (void *)statushdr, len, TMO_FEVR);
 
@@ -586,9 +584,9 @@
 			tcp_snd_dat(s->cepid, "/~", len, TMO_FEVR);
 		}
-		len = ntlibc_strlen(s->filename);
+		len = strlen(s->filename);
 		tcp_snd_dat(s->cepid, s->filename, len, TMO_FEVR);
 		if (s->query != NULL) {
 			tcp_snd_dat(s->cepid, "?", 1, TMO_FEVR);
-			len = ntlibc_strlen(s->query);
+			len = strlen(s->query);
 			tcp_snd_dat(s->cepid, s->query, len, TMO_FEVR);
 		}
@@ -602,58 +600,58 @@
 		tcp_snd_dat(s->cepid, (void *)http_content_type_binary, len, TMO_FEVR);
 	}
-	else if (ntlibc_strncmp(http_html, ptr, sizeof(http_html) - 1) == 0 ||
-		ntlibc_strncmp(http_htm, ptr, sizeof(http_htm) - 1) == 0) {
+	else if (strncmp(http_html, ptr, sizeof(http_html) - 1) == 0 ||
+		strncmp(http_htm, ptr, sizeof(http_htm) - 1) == 0) {
 		len = sizeof(http_content_type_html) - 1;
 		tcp_snd_dat(s->cepid, (void *)http_content_type_html, len, TMO_FEVR);
 	}
-	else if (ntlibc_strncmp(http_css, ptr, sizeof(http_css) - 1) == 0) {
+	else if (strncmp(http_css, ptr, sizeof(http_css) - 1) == 0) {
 		len = sizeof(http_content_type_css) - 1;
 		tcp_snd_dat(s->cepid, (void *)http_content_type_css, len, TMO_FEVR);
 	}
-	else if (ntlibc_strncmp(http_js, ptr, sizeof(http_js) - 1) == 0) {
+	else if (strncmp(http_js, ptr, sizeof(http_js) - 1) == 0) {
 		len = sizeof(http_content_type_js) - 1;
 		tcp_snd_dat(s->cepid, (void *)http_content_type_js, len, TMO_FEVR);
 	}
-	else if (ntlibc_strncmp(http_json, ptr, sizeof(http_json) - 1) == 0) {
+	else if (strncmp(http_json, ptr, sizeof(http_json) - 1) == 0) {
 		len = sizeof(http_content_type_json) - 1;
 		tcp_snd_dat(s->cepid, (void *)http_content_type_json, len, TMO_FEVR);
 	}
-	else if (ntlibc_strncmp(http_png, ptr, sizeof(http_png) - 1) == 0) {
+	else if (strncmp(http_png, ptr, sizeof(http_png) - 1) == 0) {
 		len = sizeof(http_content_type_png) - 1;
 		tcp_snd_dat(s->cepid, (void *)http_content_type_png, len, TMO_FEVR);
 	}
-	else if (ntlibc_strncmp(http_gif, ptr, sizeof(http_gif) - 1) == 0) {
+	else if (strncmp(http_gif, ptr, sizeof(http_gif) - 1) == 0) {
 		len = sizeof(http_content_type_gif) - 1;
 		tcp_snd_dat(s->cepid, (void *)http_content_type_gif, len, TMO_FEVR);
 	}
-	else if (ntlibc_strncmp(http_jpg, ptr, sizeof(http_jpg) - 1) == 0) {
+	else if (strncmp(http_jpg, ptr, sizeof(http_jpg) - 1) == 0) {
 		len = sizeof(http_content_type_jpg) - 1;
 		tcp_snd_dat(s->cepid, (void *)http_content_type_jpg, len, TMO_FEVR);
 	}
-	else if (ntlibc_strncmp(http_svg, ptr, sizeof(http_svg) - 1) == 0) {
+	else if (strncmp(http_svg, ptr, sizeof(http_svg) - 1) == 0) {
 		len = sizeof(http_content_type_svg) - 1;
 		tcp_snd_dat(s->cepid, (void *)http_content_type_svg, len, TMO_FEVR);
 	}
-	else if (ntlibc_strncmp(http_text, ptr, sizeof(http_text) - 1) == 0) {
+	else if (strncmp(http_text, ptr, sizeof(http_text) - 1) == 0) {
 		len = sizeof(http_content_type_text) - 1;
 		tcp_snd_dat(s->cepid, (void *)http_content_type_text, len, TMO_FEVR);
 	}
-	else if (ntlibc_strncmp(http_eot, ptr, sizeof(http_eot) - 1) == 0) {
+	else if (strncmp(http_eot, ptr, sizeof(http_eot) - 1) == 0) {
 		len = sizeof(http_content_type_eot) - 1;
 		tcp_snd_dat(s->cepid, (void *)http_content_type_eot, len, TMO_FEVR);
 	}
-	else if (ntlibc_strncmp(http_ttf, ptr, sizeof(http_ttf) - 1) == 0) {
+	else if (strncmp(http_ttf, ptr, sizeof(http_ttf) - 1) == 0) {
 		len = sizeof(http_content_type_ttf) - 1;
 		tcp_snd_dat(s->cepid, (void *)http_content_type_ttf, len, TMO_FEVR);
 	}
-	else if (ntlibc_strncmp(http_woff, ptr, sizeof(http_woff) - 1) == 0) {
+	else if (strncmp(http_woff, ptr, sizeof(http_woff) - 1) == 0) {
 		len = sizeof(http_content_type_woff) - 1;
 		tcp_snd_dat(s->cepid, (void *)http_content_type_woff, len, TMO_FEVR);
 	}
-	else if (ntlibc_strncmp(http_woff2, ptr, sizeof(http_woff2) - 1) == 0) {
+	else if (strncmp(http_woff2, ptr, sizeof(http_woff2) - 1) == 0) {
 		len = sizeof(http_content_type_woff2) - 1;
 		tcp_snd_dat(s->cepid, (void *)http_content_type_woff2, len, TMO_FEVR);
 	}
-	else if (ntlibc_strncmp(http_ico, ptr, sizeof(http_ico) - 1) == 0) {
+	else if (strncmp(http_ico, ptr, sizeof(http_ico) - 1) == 0) {
 		len = sizeof(http_content_type_ico) - 1;
 		tcp_snd_dat(s->cepid, (void *)http_content_type_ico, len, TMO_FEVR);
@@ -667,5 +665,5 @@
 		len = sizeof(http_content_length) - 1;
 		tcp_snd_dat(s->cepid, (void *)http_content_length, len, TMO_FEVR);
-		len = ntstdio_snprintf(s->temp, sizeof(s->temp), "%d\r\n", s->file.len);
+		len = snprintf(s->temp, sizeof(s->temp), "%d\r\n", s->file.len);
 		tcp_snd_dat(s->cepid, (void *)s->temp, len, TMO_FEVR);
 	}
@@ -699,5 +697,5 @@
 		break;
 	case OUT_STATE_OPEN_GET_FILE:
-		ntstdio_printf(ntstdio, "open:      %s.%d %s\n", s->addr, ((T_IPV4EP *)s->dst)->portno, s->filename);
+		printf("open:      %s.%d %s\n", s->addr, ((T_IPV4EP *)s->dst)->portno, s->filename);
 		if (!httpd_fs_open(s->filename, sizeof(s->message.request_url), &s->file)) {
 			s->filename = NULL;
@@ -713,26 +711,26 @@
 		break;
 	case OUT_STATE_WAIT_POST_BODY:
-		//ntstdio_printf(ntstdio, "wait post body\n");
+		//printf("wait post body\n");
 		s->out.wait = true;
 		break;
 	case OUT_STATE_BODY_RECEIVED:
-		//ntstdio_printf(ntstdio, "body received\n");
+		//printf("body received\n");
 		s->out.statushdr = http_header_200;
 		s->out.state = OUT_STATE_SEND_HEADER;
 		break;
 	case OUT_STATE_SEND_HEADER:
-		//ntstdio_printf(ntstdio, "send header\n");
+		//printf("send header\n");
 		send_headers(s, s->out.statushdr);
 		break;
 	case OUT_STATE_SEND_FILE:
-		//ntstdio_printf(ntstdio, "send file %d\n", s->file.len);
+		//printf("send file %d\n", s->file.len);
 		send_file(s);
 		break;
 	case OUT_STATE_SEND_DATA:
-		//ntstdio_printf(ntstdio, "send data %d\n", s->response_len);
+		//printf("send data %d\n", s->response_len);
 		send_data(s);
 		break;
 	case OUT_STATE_SEND_END:
-		//ntstdio_printf(ntstdio, "send end\n");
+		//printf("send end\n");
 		s->out.wait = true;
 		if (s->message.should_keep_alive && s->reset == 0) {
@@ -750,10 +748,10 @@
 	int len;
 
-	len = ntlibc_strlen(statushdr);
+	len = strlen(statushdr);
 	tcp_snd_dat(s->cepid, (void *)statushdr, len, TMO_FEVR);
 
 	len = sizeof(http_upgrade) - 1;
 	tcp_snd_dat(s->cepid, (void *)http_upgrade, len, TMO_FEVR);
-	len = ntlibc_strlen(s->message.upgrade);
+	len = strlen(s->message.upgrade);
 	tcp_snd_dat(s->cepid, s->message.upgrade, len, TMO_FEVR);
 	len = sizeof(http_crnl) - 1;
@@ -762,5 +760,5 @@
 	len = sizeof(http_connection) - 1;
 	tcp_snd_dat(s->cepid, (void *)http_connection, len, TMO_FEVR);
-	len = ntlibc_strlen(s->message.connection);
+	len = strlen(s->message.connection);
 	tcp_snd_dat(s->cepid, s->message.connection, len, TMO_FEVR);
 	len = sizeof(http_crnl) - 1;
@@ -769,5 +767,5 @@
 	len = sizeof(http_sec_websocket_accept) - 1;
 	tcp_snd_dat(s->cepid, (void *)http_sec_websocket_accept, len, TMO_FEVR);
-	len = ntlibc_strlen(s->message.response_key);
+	len = strlen(s->message.response_key);
 	tcp_snd_dat(s->cepid, s->message.response_key, len, TMO_FEVR);
 	len = sizeof(http_crnl) - 1;
@@ -776,5 +774,5 @@
 	len = sizeof(http_sec_websocket_protocol) - 1;
 	tcp_snd_dat(s->cepid, (void *)http_sec_websocket_protocol, len, TMO_FEVR);
-	len = ntlibc_strlen(s->message.sec_websocket_protocol);
+	len = strlen(s->message.sec_websocket_protocol);
 	tcp_snd_dat(s->cepid, s->message.sec_websocket_protocol, len, TMO_FEVR);
 	len = sizeof(http_crnl) - 1;
@@ -792,5 +790,5 @@
 	slen = tcp_get_buf(s->cepid, (void **)&buf, TMO_FEVR);
 	if (slen < 0) {
-		ntstdio_printf(ntstdio, "send_ws_data#tcp_get_buf(%s.%d) => %d\n", s->addr, ((T_IPV4EP *)s->dst)->portno, slen);
+		printf("send_ws_data#tcp_get_buf(%s.%d) => %d\n", s->addr, ((T_IPV4EP *)s->dst)->portno, slen);
 		return;
 	}
@@ -856,5 +854,5 @@
 				//}
 			}
-			ntstdio_printf(ntstdio, "handle_input#tcp_rcv_buf#%d(%s.%d) => %d\n", s->in.state, s->addr, ((T_IPV4EP *)s->dst)->portno, len);
+			printf("handle_input#tcp_rcv_buf#%d(%s.%d) => %d\n", s->in.state, s->addr, ((T_IPV4EP *)s->dst)->portno, len);
 			uploding = NULL;
 			s->state = STATE_CLOSING;
@@ -864,5 +862,5 @@
 		tcp_rel_buf(s->cepid, done);
 		if (s->parser.http_errno != HPE_OK) {
-			ntstdio_printf(ntstdio, "http_parser error %s.%d => %d\n", s->addr, ((T_IPV4EP *)s->dst)->portno, s->parser.http_errno);
+			printf("http_parser error %s.%d => %d\n", s->addr, ((T_IPV4EP *)s->dst)->portno, s->parser.http_errno);
 			uploding = NULL;
 			s->state = STATE_CLOSING;
@@ -889,5 +887,5 @@
 					break;
 				}
-				ntstdio_printf(ntstdio, "handle_input#tcp_rcv_buf#%d(%s.%d) => %d\n", s->in.state, s->addr, ((T_IPV4EP *)s->dst)->portno, len);
+				printf("handle_input#tcp_rcv_buf#%d(%s.%d) => %d\n", s->in.state, s->addr, ((T_IPV4EP *)s->dst)->portno, len);
 				s->state = STATE_CLOSING;
 				break;
@@ -927,7 +925,7 @@
 
 	if (s == NULL)
-		ntstdio_printf(ntstdio, "callback_nblk_tcp(%d, %d)\n", fncd, cepid);
+		printf("callback_nblk_tcp(%d, %d)\n", fncd, cepid);
 	else
-		ntstdio_printf(ntstdio, "callback_nblk_tcp(%d, %s.%d)\n", fncd, s->addr, ((T_IPV4EP *)s->dst)->portno);
+		printf("callback_nblk_tcp(%d, %s.%d)\n", fncd, s->addr, ((T_IPV4EP *)s->dst)->portno);
 
 	return E_PAR;
@@ -945,5 +943,5 @@
 		ret2 = get_tim(&httpd_time);
 		if (ret2 != E_OK) {
-			ntstdio_printf(ntstdio, "get_tim\n");
+			printf("get_tim\n");
 			return;
 		}
@@ -953,5 +951,5 @@
 			memset(&s->dst, 0, sizeof(s->dst));
 			if ((ret = tcp_acp_cep(s->cepid, TCP_REPID, (T_IPV4EP *)s->dst, TMO_FEVR)) != E_OK) {
-				ntstdio_printf(ntstdio, "tcp_acp_cep(%d) => %d\n", s->cepid, ret);
+				printf("tcp_acp_cep(%d) => %d\n", s->cepid, ret);
 				tslp_tsk(100 * 1000);	// TODO
 				s->state = STATE_CLOSING;
@@ -959,5 +957,5 @@
 			}
 			IP2STR(s->addr, &((T_IPV4EP *)s->dst)->ipaddr);
-			ntstdio_printf(ntstdio, "connected: %s.%d\n", s->addr, ((T_IPV4EP *)s->dst)->portno);
+			printf("connected: %s.%d\n", s->addr, ((T_IPV4EP *)s->dst)->portno);
 			memset(&s->in, 0, sizeof(s->in));
 			memset(&s->out, 0, sizeof(s->out));
@@ -974,5 +972,5 @@
 			break;
 		case STATE_CLOSING:
-			ntstdio_printf(ntstdio, "close:     %s.%d\n", s->addr, ((T_IPV4EP *)s->dst)->portno);
+			printf("close:     %s.%d\n", s->addr, ((T_IPV4EP *)s->dst)->portno);
 			tcp_sht_cep(s->cepid);
 			tcp_cls_cep(s->cepid, TMO_FEVR);
