2012-03-24 10:23:07 -04:00
|
|
|
/*******************************************************************************
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2012-03-24 10:23:07 -04:00
|
|
|
COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011, 2012.
|
2011-08-05 08:25:00 -04:00
|
|
|
|
|
|
|
This file is part of LibMaxsi.
|
|
|
|
|
|
|
|
LibMaxsi is free software: you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU Lesser General Public License as published by the Free
|
|
|
|
Software Foundation, either version 3 of the License, or (at your option)
|
|
|
|
any later version.
|
|
|
|
|
|
|
|
LibMaxsi is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
2012-03-24 10:23:07 -04:00
|
|
|
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
|
|
|
details.
|
2011-08-05 08:25:00 -04:00
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
|
|
|
along with LibMaxsi. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
2011-11-02 14:17:17 -04:00
|
|
|
io.cpp
|
2011-08-05 08:25:00 -04:00
|
|
|
Functions for management of input and output.
|
|
|
|
|
2012-03-24 10:23:07 -04:00
|
|
|
*******************************************************************************/
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2012-02-11 20:03:34 -05:00
|
|
|
#include <libmaxsi/platform.h>
|
|
|
|
#include <libmaxsi/syscall.h>
|
|
|
|
#include <libmaxsi/io.h>
|
|
|
|
#include <libmaxsi/format.h>
|
|
|
|
#include <libmaxsi/string.h>
|
|
|
|
#include <libmaxsi/memory.h>
|
2011-11-20 18:02:53 -05:00
|
|
|
#include <sys/readdirents.h>
|
2012-02-21 18:30:34 -05:00
|
|
|
#include <sys/stat.h>
|
2011-11-24 04:26:36 -05:00
|
|
|
#include <unistd.h>
|
2011-11-26 05:00:45 -05:00
|
|
|
#include <errno.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <error.h>
|
|
|
|
#include <stdlib.h>
|
Implemented large parts of the stdio(3), including fprintf.
Made FILE an interface to various backends. This allows application writers
to override the standard FILE API functions with their own backends. This
is highly unportable - it'd be nice if a real standard existed for this.
glibc already does something like this internally, but AFAIK you can't hook
into it.
Added fdopen(3), fopen(3), fregister(3), funregister(3), fread(3),
fwrite(3), fseek(3), clearerr(3), ferror(3), feof(3), rewind(3), ftell(3),
fflush(3), fclose(3), fileno(3), fnewline(3), fcloseall(3), memset(3),
stdio(3), vfprintf(3), fprintf(3), and vprintf(3).
Added a file-descriptor backend to the FILE API.
fd's {0, 1, 2} are now initialized as stdin, stdout, and stderr when the
standard library initializes.
fcloseall(3) is now called on exit(3).
decl/intn_t_.h now @include(size_t.h) instead of declaring it itself.
Added <stdint.h>.
The following programs now flush stdout: cat(1), clear(1), editor(1),
init(1), mxsh(1).
printf(3) is now hooked up against vprintf(3), while Maxsi::PrintF
remains using the system call, for now.
2011-12-23 22:08:10 -05:00
|
|
|
#include <stdio.h>
|
2011-08-05 08:25:00 -04:00
|
|
|
|
|
|
|
namespace Maxsi
|
|
|
|
{
|
2011-12-09 06:41:06 -05:00
|
|
|
DEFN_SYSCALL1(size_t, SysPrint, SYSCALL_PRINT_STRING, const char*);
|
|
|
|
DEFN_SYSCALL3(ssize_t, SysRead, SYSCALL_READ, int, void*, size_t);
|
|
|
|
DEFN_SYSCALL3(ssize_t, SysWrite, SYSCALL_WRITE, int, const void*, size_t);
|
|
|
|
DEFN_SYSCALL1(int, SysPipe, SYSCALL_PIPE, int*);
|
|
|
|
DEFN_SYSCALL1(int, SysClose, SYSCALL_CLOSE, int);
|
|
|
|
DEFN_SYSCALL1(int, SysDup, SYSCALL_DUP, int);
|
|
|
|
DEFN_SYSCALL3(int, SysOpen, SYSCALL_OPEN, const char*, int, mode_t);
|
|
|
|
DEFN_SYSCALL3(int, SysReadDirEnts, SYSCALL_READDIRENTS, int, struct sortix_dirent*, size_t);
|
|
|
|
DEFN_SYSCALL1(int, SysChDir, SYSCALL_CHDIR, const char*);
|
|
|
|
DEFN_SYSCALL2(char*, SysGetCWD, SYSCALL_GETCWD, char*, size_t);
|
|
|
|
DEFN_SYSCALL1(int, SysUnlink, SYSCALL_UNLINK, const char*);
|
2011-12-26 17:12:12 -05:00
|
|
|
DEFN_SYSCALL3_VOID(SysSeek, SYSCALL_SEEK, int, off_t*, int);
|
2012-01-14 10:25:28 -05:00
|
|
|
DEFN_SYSCALL2(int, SysMkDir, SYSCALL_MKDIR, const char*, mode_t);
|
|
|
|
DEFN_SYSCALL1(int, SysRmDir, SYSCALL_RMDIR, const char*);
|
2012-01-14 10:37:21 -05:00
|
|
|
DEFN_SYSCALL2(int, SysTruncate, SYSCALL_TRUNCATE, const char*, off_t);
|
|
|
|
DEFN_SYSCALL2(int, SysFTruncate, SYSCALL_FTRUNCATE, int, off_t);
|
2012-02-21 18:30:34 -05:00
|
|
|
DEFN_SYSCALL2(int, SysStat, SYSCALL_STAT, const char*, struct stat*);
|
|
|
|
DEFN_SYSCALL2(int, SysFStat, SYSCALL_FSTAT, int, struct stat*);
|
2012-03-04 15:36:40 -05:00
|
|
|
DEFN_SYSCALL3(int, SysFCntl, SYSCALL_FCNTL, int, int, unsigned long);
|
2012-03-05 09:46:23 -05:00
|
|
|
DEFN_SYSCALL2(int, SysAccess, SYSCALL_ACCESS, const char*, int);
|
2011-08-22 19:32:49 -04:00
|
|
|
|
2011-11-24 04:26:36 -05:00
|
|
|
size_t Print(const char* string)
|
2011-08-05 08:25:00 -04:00
|
|
|
{
|
2011-11-24 04:26:36 -05:00
|
|
|
size_t stringlen = String::Length(string);
|
2012-03-24 10:34:30 -04:00
|
|
|
return writeall(1, string, stringlen);
|
2011-08-22 19:32:49 -04:00
|
|
|
}
|
2011-08-05 08:25:00 -04:00
|
|
|
|
2011-08-22 19:32:49 -04:00
|
|
|
size_t PrintCallback(void* user, const char* string, size_t stringlen)
|
|
|
|
{
|
2012-03-24 10:34:30 -04:00
|
|
|
return writeall(1, string, stringlen);
|
2011-08-22 19:32:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
size_t PrintF(const char* format, ...)
|
|
|
|
{
|
|
|
|
va_list list;
|
|
|
|
va_start(list, format);
|
|
|
|
size_t result = Maxsi::Format::Virtual(PrintCallback, NULL, format, list);
|
|
|
|
va_end(list);
|
|
|
|
return result;
|
|
|
|
}
|
2011-08-05 08:25:00 -04:00
|
|
|
|
|
|
|
#ifdef LIBMAXSI_LIBC
|
Implemented large parts of the stdio(3), including fprintf.
Made FILE an interface to various backends. This allows application writers
to override the standard FILE API functions with their own backends. This
is highly unportable - it'd be nice if a real standard existed for this.
glibc already does something like this internally, but AFAIK you can't hook
into it.
Added fdopen(3), fopen(3), fregister(3), funregister(3), fread(3),
fwrite(3), fseek(3), clearerr(3), ferror(3), feof(3), rewind(3), ftell(3),
fflush(3), fclose(3), fileno(3), fnewline(3), fcloseall(3), memset(3),
stdio(3), vfprintf(3), fprintf(3), and vprintf(3).
Added a file-descriptor backend to the FILE API.
fd's {0, 1, 2} are now initialized as stdin, stdout, and stderr when the
standard library initializes.
fcloseall(3) is now called on exit(3).
decl/intn_t_.h now @include(size_t.h) instead of declaring it itself.
Added <stdint.h>.
The following programs now flush stdout: cat(1), clear(1), editor(1),
init(1), mxsh(1).
printf(3) is now hooked up against vprintf(3), while Maxsi::PrintF
remains using the system call, for now.
2011-12-23 22:08:10 -05:00
|
|
|
size_t FileWriteCallback(void* user, const char* string, size_t stringlen)
|
|
|
|
{
|
|
|
|
FILE* fp = (FILE*) user;
|
|
|
|
return fwrite(string, 1, stringlen, fp);
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" int vfprintf(FILE* fp, const char* /*restrict*/ format, va_list list)
|
|
|
|
{
|
|
|
|
size_t result = Maxsi::Format::Virtual(FileWriteCallback, fp, format, list);
|
|
|
|
return (int) result;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" int fprintf(FILE* fp, const char* /*restrict*/ format, ...)
|
|
|
|
{
|
|
|
|
va_list list;
|
|
|
|
va_start(list, format);
|
|
|
|
size_t result = vfprintf(fp, format, list);
|
|
|
|
va_end(list);
|
|
|
|
return (int) result;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" int vprintf(const char* /*restrict*/ format, va_list list)
|
|
|
|
{
|
|
|
|
size_t result = vfprintf(stdout, format, list);
|
|
|
|
return (int) result;
|
|
|
|
}
|
|
|
|
|
2011-08-22 19:32:49 -04:00
|
|
|
extern "C" int printf(const char* /*restrict*/ format, ...)
|
|
|
|
{
|
|
|
|
va_list list;
|
|
|
|
va_start(list, format);
|
Implemented large parts of the stdio(3), including fprintf.
Made FILE an interface to various backends. This allows application writers
to override the standard FILE API functions with their own backends. This
is highly unportable - it'd be nice if a real standard existed for this.
glibc already does something like this internally, but AFAIK you can't hook
into it.
Added fdopen(3), fopen(3), fregister(3), funregister(3), fread(3),
fwrite(3), fseek(3), clearerr(3), ferror(3), feof(3), rewind(3), ftell(3),
fflush(3), fclose(3), fileno(3), fnewline(3), fcloseall(3), memset(3),
stdio(3), vfprintf(3), fprintf(3), and vprintf(3).
Added a file-descriptor backend to the FILE API.
fd's {0, 1, 2} are now initialized as stdin, stdout, and stderr when the
standard library initializes.
fcloseall(3) is now called on exit(3).
decl/intn_t_.h now @include(size_t.h) instead of declaring it itself.
Added <stdint.h>.
The following programs now flush stdout: cat(1), clear(1), editor(1),
init(1), mxsh(1).
printf(3) is now hooked up against vprintf(3), while Maxsi::PrintF
remains using the system call, for now.
2011-12-23 22:08:10 -05:00
|
|
|
size_t result = vprintf(format, list);
|
2011-08-22 19:32:49 -04:00
|
|
|
va_end(list);
|
|
|
|
return (int) result;
|
2011-08-05 08:25:00 -04:00
|
|
|
}
|
2011-11-16 02:37:29 -05:00
|
|
|
|
2012-03-05 10:01:43 -05:00
|
|
|
// TODO: This is an ugly hack to help build binutils.
|
|
|
|
#warning Ugly sscanf hack to help build binutils
|
2012-03-05 10:06:15 -05:00
|
|
|
extern "C" int sscanf(const char* s, const char* format, ...)
|
2012-03-05 10:01:43 -05:00
|
|
|
{
|
|
|
|
if ( strcmp(format, "%x") != 0 )
|
|
|
|
{
|
|
|
|
fprintf(stderr, "sscanf hack doesn't implement: '%s'\n", format);
|
|
|
|
abort();
|
|
|
|
}
|
|
|
|
|
|
|
|
va_list list;
|
|
|
|
va_start(list, format);
|
|
|
|
unsigned* dec = va_arg(list, unsigned*);
|
|
|
|
*dec = strtol(s, NULL, 16);
|
|
|
|
return strlen(s);
|
|
|
|
}
|
|
|
|
|
2012-01-08 18:31:42 -05:00
|
|
|
typedef struct vsnprintf_struct
|
|
|
|
{
|
|
|
|
char* str;
|
|
|
|
size_t size;
|
|
|
|
size_t produced;
|
|
|
|
size_t written;
|
|
|
|
} vsnprintf_t;
|
|
|
|
|
|
|
|
size_t StringPrintCallback(void* user, const char* string, size_t stringlen)
|
|
|
|
{
|
|
|
|
vsnprintf_t* info = (vsnprintf_t*) user;
|
|
|
|
if ( info->produced < info->size )
|
|
|
|
{
|
|
|
|
size_t available = info->size - info->produced;
|
|
|
|
size_t possible = (stringlen < available) ? stringlen : available;
|
|
|
|
Memory::Copy(info->str + info->produced, string, possible);
|
|
|
|
info->written += possible;
|
|
|
|
}
|
|
|
|
info->produced += stringlen;
|
|
|
|
return stringlen;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" int vsnprintf(char* restrict str, size_t size, const char* restrict format, va_list list)
|
|
|
|
{
|
|
|
|
vsnprintf_t info;
|
|
|
|
info.str = str;
|
|
|
|
info.size = (size) ? size-1 : 0;
|
|
|
|
info.produced = 0;
|
|
|
|
info.written = 0;
|
|
|
|
Maxsi::Format::Virtual(StringPrintCallback, &info, format, list);
|
|
|
|
if ( size ) { info.str[info.written] = '\0'; }
|
|
|
|
return (int) info.produced;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" int snprintf(char* restrict str, size_t size, const char* restrict format, ...)
|
|
|
|
{
|
|
|
|
va_list list;
|
|
|
|
va_start(list, format);
|
|
|
|
int result = vsnprintf(str, size, format, list);
|
|
|
|
va_end(list);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" int vsprintf(char* restrict str, const char* restrict format, va_list list)
|
|
|
|
{
|
|
|
|
return vsnprintf(str, SIZE_MAX, format, list);
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" int sprintf(char* restrict str, const char* restrict format, ...)
|
|
|
|
{
|
|
|
|
va_list list;
|
|
|
|
va_start(list, format);
|
|
|
|
int result = vsprintf(str, format, list);
|
|
|
|
va_end(list);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2012-05-28 17:03:03 -04:00
|
|
|
extern "C" void gnu_error(int status, int errnum, const char *format, ...)
|
2011-11-26 05:00:45 -05:00
|
|
|
{
|
2011-12-23 22:36:42 -05:00
|
|
|
fprintf(stderr, "%s: ", program_invocation_name);
|
2011-11-26 05:00:45 -05:00
|
|
|
|
|
|
|
va_list list;
|
|
|
|
va_start(list, format);
|
2011-12-23 22:36:42 -05:00
|
|
|
vfprintf(stderr, format, list);
|
2011-11-26 05:00:45 -05:00
|
|
|
va_end(list);
|
|
|
|
|
2012-03-01 10:42:13 -05:00
|
|
|
if ( errnum ) { fprintf(stderr, ": %s", strerror(errnum)); }
|
|
|
|
fprintf(stderr, "\n");
|
2011-11-26 05:00:45 -05:00
|
|
|
if ( status ) { exit(status); }
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" void perror(const char* s)
|
|
|
|
{
|
|
|
|
error(0, errno, "%s", s);
|
|
|
|
}
|
|
|
|
|
2011-11-16 02:37:29 -05:00
|
|
|
extern "C" ssize_t read(int fd, void* buf, size_t count)
|
|
|
|
{
|
2012-03-17 10:35:45 -04:00
|
|
|
retry:
|
|
|
|
ssize_t result = SysRead(fd, buf, count);
|
|
|
|
if ( result < 0 && errno == EAGAIN ) { goto retry; }
|
|
|
|
return result;
|
2011-11-16 02:37:29 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" ssize_t write(int fd, const void* buf, size_t count)
|
|
|
|
{
|
2012-03-17 10:35:45 -04:00
|
|
|
retry:
|
|
|
|
ssize_t result = SysWrite(fd, buf, count);
|
|
|
|
if ( result < 0 && errno == EAGAIN ) { goto retry; }
|
|
|
|
return result;
|
2011-11-16 02:37:29 -05:00
|
|
|
}
|
|
|
|
|
2012-03-24 10:23:07 -04:00
|
|
|
extern "C" ssize_t pread(int, void*, size_t, off_t)
|
|
|
|
{
|
|
|
|
errno = ENOSYS;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" ssize_t pwrite(int, const void*, size_t, off_t)
|
|
|
|
{
|
|
|
|
errno = ENOSYS;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2011-12-26 17:12:12 -05:00
|
|
|
extern "C" off_t lseek(int fd, off_t offset, int whence)
|
|
|
|
{
|
|
|
|
SysSeek(fd, &offset, whence);
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
2011-11-16 02:37:29 -05:00
|
|
|
extern "C" int pipe(int pipefd[2])
|
|
|
|
{
|
|
|
|
return SysPipe(pipefd);
|
|
|
|
}
|
|
|
|
|
2011-11-17 04:22:43 -05:00
|
|
|
extern "C" int close(int fd)
|
|
|
|
{
|
|
|
|
return SysClose(fd);
|
|
|
|
}
|
2011-11-17 16:28:20 -05:00
|
|
|
|
2011-11-17 14:34:04 -05:00
|
|
|
extern "C" int dup(int fd)
|
|
|
|
{
|
|
|
|
return SysDup(fd);
|
|
|
|
}
|
2011-11-17 17:31:41 -05:00
|
|
|
|
|
|
|
extern "C" int open(const char* path, int flags, mode_t mode)
|
|
|
|
{
|
|
|
|
return SysOpen(path, flags, mode);
|
|
|
|
}
|
2011-11-20 18:02:53 -05:00
|
|
|
|
|
|
|
extern "C" int readdirents(int fd, struct sortix_dirent* dirent, size_t size)
|
|
|
|
{
|
|
|
|
return SysReadDirEnts(fd, dirent, size);
|
|
|
|
}
|
2011-11-21 06:19:57 -05:00
|
|
|
|
|
|
|
extern "C" int chdir(const char* path)
|
|
|
|
{
|
|
|
|
return SysChDir(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" char* getcwd(char* buf, size_t size)
|
|
|
|
{
|
|
|
|
return SysGetCWD(buf, size);
|
|
|
|
}
|
2011-11-21 12:49:55 -05:00
|
|
|
|
|
|
|
extern "C" int unlink(const char* pathname)
|
|
|
|
{
|
|
|
|
return SysUnlink(pathname);
|
|
|
|
}
|
2011-11-26 14:56:45 -05:00
|
|
|
|
2012-01-14 10:25:28 -05:00
|
|
|
extern "C" int mkdir(const char* pathname, mode_t mode)
|
|
|
|
{
|
|
|
|
return SysMkDir(pathname, mode);
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" int rmdir(const char* pathname)
|
|
|
|
{
|
|
|
|
return SysRmDir(pathname);
|
|
|
|
}
|
|
|
|
|
2012-01-14 10:37:21 -05:00
|
|
|
extern "C" int truncate(const char* pathname, off_t length)
|
|
|
|
{
|
|
|
|
return SysTruncate(pathname, length);
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" int ftruncate(int fd, off_t length)
|
|
|
|
{
|
|
|
|
return SysFTruncate(fd, length);
|
|
|
|
}
|
2012-02-21 18:30:34 -05:00
|
|
|
|
|
|
|
extern "C" int stat(const char* path, struct stat* st)
|
|
|
|
{
|
|
|
|
return SysStat(path, st);
|
|
|
|
}
|
|
|
|
|
2012-03-05 09:50:41 -05:00
|
|
|
extern "C" int lstat(const char* path, struct stat* st)
|
|
|
|
{
|
|
|
|
return SysStat(path, st);
|
|
|
|
}
|
|
|
|
|
2012-02-21 18:30:34 -05:00
|
|
|
extern "C" int fstat(int fd, struct stat* st)
|
|
|
|
{
|
|
|
|
return SysFStat(fd, st);
|
|
|
|
}
|
2012-03-04 11:29:50 -05:00
|
|
|
|
2012-03-04 15:36:40 -05:00
|
|
|
extern "C" int fcntl(int fd, int cmd, unsigned long arg)
|
|
|
|
{
|
|
|
|
return SysFCntl(fd, cmd, arg);
|
|
|
|
}
|
|
|
|
|
2012-03-05 09:46:23 -05:00
|
|
|
extern "C" int access(const char* pathname, int mode)
|
|
|
|
{
|
|
|
|
return SysAccess(pathname, mode);
|
|
|
|
}
|
|
|
|
|
2012-03-04 16:57:44 -05:00
|
|
|
// TODO: Implement these in the kernel.
|
|
|
|
extern "C" int chmod(const char* path, mode_t mode)
|
|
|
|
{
|
|
|
|
errno = ENOTSUP;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: Implement these in the kernel.
|
|
|
|
extern "C" int fchmod(int fd, mode_t mode)
|
|
|
|
{
|
|
|
|
errno = ENOTSUP;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2012-03-04 17:01:41 -05:00
|
|
|
// TODO: Implement these in the kernel.
|
|
|
|
extern "C" mode_t umask(mode_t mask)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-03-04 11:29:50 -05:00
|
|
|
// TODO: This is a hacky implementation of a stupid function.
|
2012-03-05 07:05:45 -05:00
|
|
|
extern "C" char* mktemp(char* templ)
|
2012-03-04 11:29:50 -05:00
|
|
|
{
|
|
|
|
size_t templlen = strlen(templ);
|
|
|
|
for ( size_t i = templlen-6UL; i < templlen; i++ )
|
|
|
|
{
|
|
|
|
templ[i] = '0' + rand() % 10;
|
|
|
|
}
|
|
|
|
return templ;
|
|
|
|
}
|
2012-05-28 17:11:44 -04:00
|
|
|
|
|
|
|
// TODO: This has been replaced with sysconf(_SC_OPEN_MAX). This is only
|
|
|
|
// here for compatibility with gzip and should be removed as soon as sysconf
|
|
|
|
// is implemented.
|
|
|
|
extern "C" int getdtablesize(void)
|
|
|
|
{
|
|
|
|
return 0x10000;
|
|
|
|
}
|
2012-05-29 16:14:58 -04:00
|
|
|
|
|
|
|
extern "C" int fscanf(FILE* /*fp*/, const char* /*format*/, ...)
|
|
|
|
{
|
|
|
|
fprintf(stderr, "fscanf(3) is not implemented\n");
|
|
|
|
abort();
|
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" int mbtowc(wchar_t* /*pwd*/, const char* /*s*/, size_t /*n*/)
|
|
|
|
{
|
|
|
|
fprintf(stderr, "mbtowc(3) is not implemented\n");
|
|
|
|
abort();
|
|
|
|
}
|
2011-08-22 19:32:49 -04:00
|
|
|
#endif
|
|
|
|
|
2011-08-05 08:25:00 -04:00
|
|
|
}
|