From 71f809d21ce73dffecf370a761a83d892504465b Mon Sep 17 00:00:00 2001 From: midipix Date: Sun, 15 Jul 2018 12:16:36 -0400 Subject: internals: removed the surrogate streams layer, as it is no longer needed. --- src/internal/ntux_nolibc_impl.h | 14 --------- src/internal/ntux_ntaio_impl.c | 64 ----------------------------------------- 2 files changed, 78 deletions(-) (limited to 'src') diff --git a/src/internal/ntux_nolibc_impl.h b/src/internal/ntux_nolibc_impl.h index a12b848..eac2631 100644 --- a/src/internal/ntux_nolibc_impl.h +++ b/src/internal/ntux_nolibc_impl.h @@ -2,11 +2,7 @@ #define NTUX_NOLIBC_IMPL_H #define isatty ntux_isatty -#define fileno ntux_fileno -#define fputs ntux_fputs -#define fflush ntux_fflush -#define fprintf ntux_fprintf #define sprintf ntux_sprintf #define snprintf ntux_snprintf @@ -23,20 +19,10 @@ #define calloc ntux_calloc #define free ntux_free -#define stdin (void *)0 -#define stdout (void *)1 -#define stderr (void *)2 - -typedef struct ntux_file FILE; - int ntux_isatty(int fildes); -int ntux_fileno(void * any); int ntux_sprintf(char * str, const char * fmt, ...); int ntux_snprintf(char * str, size_t n, const char * fmt, ...); -int ntux_fprintf(FILE *__restrict, const char *__restrict, ...); -int ntux_fputs(const char * str, FILE * file); -int ntux_fflush(FILE *); void * ntux_memcpy(void * dst, const void * src, size_t n); void * memset(void * ch, int c, size_t n); diff --git a/src/internal/ntux_ntaio_impl.c b/src/internal/ntux_ntaio_impl.c index a1a4d8e..772df64 100644 --- a/src/internal/ntux_ntaio_impl.c +++ b/src/internal/ntux_ntaio_impl.c @@ -10,60 +10,6 @@ extern const ntapi_vtbl * ntux_ntapi; -typedef struct ntux_file { - void * hany; -} FILE; - -int ntux_fputs(const char * str, FILE * file) -{ - ssize_t ret; - size_t size; - size_t nbytes; - - size = ntux_ntapi->tt_string_null_offset_multibyte(str); - nbytes = size; - - while (nbytes) { - ret = __sys_write( - (int)(intptr_t)file, - str,nbytes); - - if (ret == -EINTR) - (void)0; - - else if (ret < 0) - return -1; - - else { - str += ret; - nbytes -= ret; - } - } - - /* all done */ - return (int)size; -} - -int ntux_fprintf(FILE * file, const char * fmt, ...) -{ - va_list ap; - char * str; - size_t buffer[32768/sizeof(size_t)]; - - ntux_ntapi->tt_aligned_block_memset( - buffer,0,sizeof(buffer)); - - str = (char *)buffer; - - va_start(ap, fmt); - ntux_ntapi->vsnprintf(str, sizeof(buffer), fmt, ap); - va_end(ap); - - str[sizeof(buffer)-1] = 0; - - return ntux_fputs(str,file); -} - int ntux_sprintf(char * str, const char * fmt, ...) { int ret; @@ -107,13 +53,3 @@ int ntux_isatty(int fildes) else return 0; } - -int ntux_fileno(void * any) -{ - return (int)(intptr_t)any; -} - -int ntux_fflush(FILE * file) -{ - return __sys_fsync((int)(intptr_t)file); -} -- cgit v1.2.3