diff options
author | LRN <lrn1986@gmail.com> | 2013-08-16 04:08:08 +0000 |
---|---|---|
committer | LRN <lrn1986@gmail.com> | 2013-08-16 04:08:08 +0000 |
commit | 24a7f0787b2e5a1714b575695bfdf24344cf62d8 (patch) | |
tree | 9545392a886ff7b433fe05ec34ba38eb0af2cd05 /src/include/plibc.h | |
parent | 16d21a3a2f100e33c2aaeea12a8e4ce41d252507 (diff) | |
download | gnunet-24a7f0787b2e5a1714b575695bfdf24344cf62d8.tar.gz gnunet-24a7f0787b2e5a1714b575695bfdf24344cf62d8.zip |
Modernize plibc, use MinGW ANSI STDIO
Diffstat (limited to 'src/include/plibc.h')
-rw-r--r-- | src/include/plibc.h | 84 |
1 files changed, 20 insertions, 64 deletions
diff --git a/src/include/plibc.h b/src/include/plibc.h index 7ef80acaf..d19037728 100644 --- a/src/include/plibc.h +++ b/src/include/plibc.h | |||
@@ -558,9 +558,7 @@ int _win_creat(const char *path, mode_t mode); | |||
558 | char *_win_ctime(const time_t *clock); | 558 | char *_win_ctime(const time_t *clock); |
559 | char *_win_ctime_r(const time_t *clock, char *buf); | 559 | char *_win_ctime_r(const time_t *clock, char *buf); |
560 | int _win_fstat(int handle, struct stat *buffer); | 560 | int _win_fstat(int handle, struct stat *buffer); |
561 | off_t _win_lseek(int fildes, off_t offset, int whence); | ||
562 | int _win_ftruncate(int fildes, off_t length); | 561 | int _win_ftruncate(int fildes, off_t length); |
563 | void _win_gettimeofday(struct timeval *tp, void *tzp); | ||
564 | int _win_kill(pid_t pid, int sig); | 562 | int _win_kill(pid_t pid, int sig); |
565 | int _win_pipe(int *phandles); | 563 | int _win_pipe(int *phandles); |
566 | intptr_t _win_mkfifo(const char *path, mode_t mode); | 564 | intptr_t _win_mkfifo(const char *path, mode_t mode); |
@@ -590,49 +588,6 @@ int _win_lstat64(const char *path, struct stat64 *buf); | |||
590 | int _win_readlink(const char *path, char *buf, size_t bufsize); | 588 | int _win_readlink(const char *path, char *buf, size_t bufsize); |
591 | int _win_accept(int s, struct sockaddr *addr, int *addrlen); | 589 | int _win_accept(int s, struct sockaddr *addr, int *addrlen); |
592 | 590 | ||
593 | int _win_printf(const char *format,...); | ||
594 | int _win_wprintf(const wchar_t *format, ...); | ||
595 | |||
596 | int _win_fprintf(FILE *f,const char *format,...); | ||
597 | int _win_fwprintf(FILE *f,const wchar_t *format, ...); | ||
598 | |||
599 | int _win_vprintf(const char *format, va_list ap); | ||
600 | int _win_vfwprintf(FILE *stream, const wchar_t *format, va_list arg_ptr); | ||
601 | |||
602 | int _win_vfprintf(FILE *stream, const char *format, va_list arg_ptr); | ||
603 | int _win_vwprintf(const wchar_t *format, va_list ap); | ||
604 | |||
605 | int _win_vsprintf(char *dest,const char *format, va_list arg_ptr); | ||
606 | int _win_vswprintf(wchar_t *dest, const wchar_t *format, va_list arg_ptr); | ||
607 | |||
608 | int _win_vsnprintf(char* str, size_t size, const char *format, va_list arg_ptr); | ||
609 | int _win_vsnwprintf(wchar_t* wstr, size_t size, const wchar_t *format, va_list arg_ptr); | ||
610 | |||
611 | int _win_snprintf(char *str,size_t size,const char *format,...); | ||
612 | int _win_snwprintf(wchar_t *str, size_t size, const wchar_t *format, ...); | ||
613 | |||
614 | int _win_sprintf(char *dest,const char *format,...); | ||
615 | int _win_swprintf(wchar_t *dest, const wchar_t *format, ...); | ||
616 | |||
617 | int _win_vsscanf(const char* str, const char* format, va_list arg_ptr); | ||
618 | int _win_vswscanf(const wchar_t* wstr, const wchar_t* format, va_list arg_ptr); | ||
619 | |||
620 | int _win_sscanf(const char *str, const char *format, ...); | ||
621 | int _win_swscanf(const wchar_t *wstr, const wchar_t *format, ...); | ||
622 | |||
623 | int _win_vfscanf(FILE *stream, const char *format, va_list arg_ptr); | ||
624 | int _win_vfwscanf(FILE *stream, const wchar_t *format, va_list arg_ptr); | ||
625 | |||
626 | int _win_vscanf(const char *format, va_list arg_ptr); | ||
627 | int _win_vwscanf(const wchar_t *format, va_list arg_ptr); | ||
628 | |||
629 | int _win_scanf(const char *format, ...); | ||
630 | int _win_wscanf(const wchar_t *format, ...); | ||
631 | |||
632 | int _win_fscanf(FILE *stream, const char *format, ...); | ||
633 | int _win_fwscanf(FILE *stream, const wchar_t *format, ...); | ||
634 | |||
635 | |||
636 | pid_t _win_waitpid(pid_t pid, int *stat_loc, int options); | 591 | pid_t _win_waitpid(pid_t pid, int *stat_loc, int options); |
637 | int _win_bind(int s, const struct sockaddr *name, int namelen); | 592 | int _win_bind(int s, const struct sockaddr *name, int namelen); |
638 | int _win_connect(int s,const struct sockaddr *name, int namelen); | 593 | int _win_connect(int s,const struct sockaddr *name, int namelen); |
@@ -661,6 +616,7 @@ struct hostent *gethostbyname2(const char *name, int af); | |||
661 | char *_win_strerror(int errnum); | 616 | char *_win_strerror(int errnum); |
662 | int IsWinNT(); | 617 | int IsWinNT(); |
663 | char *index(const char *s, int c); | 618 | char *index(const char *s, int c); |
619 | char *_win_strtok_r (char *ptr, const char *sep, char **end); | ||
664 | 620 | ||
665 | #if !HAVE_STRNDUP | 621 | #if !HAVE_STRNDUP |
666 | char *strndup (const char *s, size_t n); | 622 | char *strndup (const char *s, size_t n); |
@@ -668,9 +624,6 @@ char *strndup (const char *s, size_t n); | |||
668 | #if !HAVE_STRNLEN && (!defined(__MINGW64_VERSION_MAJOR) || !defined(_INC_STRING)) | 624 | #if !HAVE_STRNLEN && (!defined(__MINGW64_VERSION_MAJOR) || !defined(_INC_STRING)) |
669 | size_t strnlen (const char *str, size_t maxlen); | 625 | size_t strnlen (const char *str, size_t maxlen); |
670 | #endif | 626 | #endif |
671 | #if !HAVE_STRTOK_R | ||
672 | char *strtok_r (char *ptr, const char *sep, char **end); | ||
673 | #endif | ||
674 | char *stpcpy(char *dest, const char *src); | 627 | char *stpcpy(char *dest, const char *src); |
675 | char *strcasestr(const char *haystack_start, const char *needle_start); | 628 | char *strcasestr(const char *haystack_start, const char *needle_start); |
676 | #ifndef __MINGW64_VERSION_MAJOR | 629 | #ifndef __MINGW64_VERSION_MAJOR |
@@ -683,6 +636,9 @@ char *strcasestr(const char *haystack_start, const char *needle_start); | |||
683 | #ifndef wcsncasecmp | 636 | #ifndef wcsncasecmp |
684 | #define wcsncasecmp(a, b, c) wcsnicmp(a, b, c) | 637 | #define wcsncasecmp(a, b, c) wcsnicmp(a, b, c) |
685 | #endif | 638 | #endif |
639 | #ifndef strtok_r /* winpthreads defines it in pthread.h */ | ||
640 | #define strtok_r _win_strtok_r | ||
641 | #endif | ||
686 | #endif /* WINDOWS */ | 642 | #endif /* WINDOWS */ |
687 | 643 | ||
688 | #ifndef WINDOWS | 644 | #ifndef WINDOWS |
@@ -807,7 +763,7 @@ char *strcasestr(const char *haystack_start, const char *needle_start); | |||
807 | #define CHDIR(d) _win_chdir(d) | 763 | #define CHDIR(d) _win_chdir(d) |
808 | #define CLOSE(f) _win_close(f) | 764 | #define CLOSE(f) _win_close(f) |
809 | #define PLIBC_KILL(p, s) _win_kill(p, s) | 765 | #define PLIBC_KILL(p, s) _win_kill(p, s) |
810 | #define LSEEK(f, o, w) _win_lseek(f, o, w) | 766 | #define LSEEK(f, o, w) lseek(f, o, w) |
811 | #define FSTAT(h, b) _win_fstat(h, b) | 767 | #define FSTAT(h, b) _win_fstat(h, b) |
812 | #define RMDIR(f) _win_rmdir(f) | 768 | #define RMDIR(f) _win_rmdir(f) |
813 | #define ACCESS(p, m) _win_access(p, m) | 769 | #define ACCESS(p, m) _win_access(p, m) |
@@ -834,20 +790,20 @@ char *strcasestr(const char *haystack_start, const char *needle_start); | |||
834 | #define READLINK(p, b, s) _win_readlink(p, b, s) | 790 | #define READLINK(p, b, s) _win_readlink(p, b, s) |
835 | #define LSTAT(p, b) _win_lstat(p, b) | 791 | #define LSTAT(p, b) _win_lstat(p, b) |
836 | #define LSTAT64(p, b) _win_lstat64(p, b) | 792 | #define LSTAT64(p, b) _win_lstat64(p, b) |
837 | #define PRINTF(f, ...) _win_printf(f , __VA_ARGS__) | 793 | #define PRINTF printf |
838 | #define FPRINTF(fil, fmt, ...) _win_fprintf(fil, fmt, __VA_ARGS__) | 794 | #define FPRINTF fprintf |
839 | #define VPRINTF(f, a) _win_vprintf(f, a) | 795 | #define VPRINTF(f, a) vprintf(f, a) |
840 | #define VFPRINTF(s, f, a) _win_vfprintf(s, f, a) | 796 | #define VFPRINTF(s, f, a) vfprintf(s, f, a) |
841 | #define VSPRINTF(d, f, a) _win_vsprintf(d, f, a) | 797 | #define VSPRINTF(d, f, a) vsprintf(d, f, a) |
842 | #define VSNPRINTF(str, size, fmt, a) _win_vsnprintf(str, size, fmt, a) | 798 | #define VSNPRINTF(str, size, fmt, a) vsnprintf(str, size, fmt, a) |
843 | #define _REAL_SNPRINTF(str, size, fmt, ...) _win_snprintf(str, size, fmt, __VA_ARGS__) | 799 | #define _REAL_SNPRINTF snprintf |
844 | #define SPRINTF(d, f, ...) _win_sprintf(d, f, __VA_ARGS__) | 800 | #define SPRINTF sprintf |
845 | #define VSSCANF(s, f, a) _win_vsscanf(s, f, a) | 801 | #define VSSCANF(s, f, a) vsscanf(s, f, a) |
846 | #define SSCANF(s, f, ...) _win_sscanf(s, f, __VA_ARGS__) | 802 | #define SSCANF sscanf |
847 | #define VFSCANF(s, f, a) _win_vfscanf(s, f, a) | 803 | #define VFSCANF(s, f, a) vfscanf(s, f, a) |
848 | #define VSCANF(f, a) _win_vscanf(f, a) | 804 | #define VSCANF(f, a) vscanf(f, a) |
849 | #define SCANF(f, ...) _win_scanf(f, __VA_ARGS__) | 805 | #define SCANF scanf |
850 | #define FSCANF(s, f, ...) _win_fscanf(s, f, __VA_ARGS__) | 806 | #define FSCANF fscanf |
851 | #define WAITPID(p, s, o) _win_waitpid(p, s, o) | 807 | #define WAITPID(p, s, o) _win_waitpid(p, s, o) |
852 | #define ACCEPT(s, a, l) _win_accept(s, a, l) | 808 | #define ACCEPT(s, a, l) _win_accept(s, a, l) |
853 | #define BIND(s, n, l) _win_bind(s, n, l) | 809 | #define BIND(s, n, l) _win_bind(s, n, l) |
@@ -866,7 +822,7 @@ char *strcasestr(const char *haystack_start, const char *needle_start); | |||
866 | #define SOCKET(a, t, p) _win_socket(a, t, p) | 822 | #define SOCKET(a, t, p) _win_socket(a, t, p) |
867 | #define GETHOSTBYADDR(a, l, t) _win_gethostbyaddr(a, l, t) | 823 | #define GETHOSTBYADDR(a, l, t) _win_gethostbyaddr(a, l, t) |
868 | #define GETHOSTBYNAME(n) _win_gethostbyname(n) | 824 | #define GETHOSTBYNAME(n) _win_gethostbyname(n) |
869 | #define GETTIMEOFDAY(t, n) _win_gettimeofday(t, n) | 825 | #define GETTIMEOFDAY(t, n) gettimeofday(t, n) |
870 | #define INSQUE(e, p) _win_insque(e, p) | 826 | #define INSQUE(e, p) _win_insque(e, p) |
871 | #define REMQUE(e) _win_remque(e) | 827 | #define REMQUE(e) _win_remque(e) |
872 | #define HSEARCH(i, a) _win_hsearch(i, a) | 828 | #define HSEARCH(i, a) _win_hsearch(i, a) |