X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=libbb%2Fprintf.c;h=4451273ef30effa8da51218103fb9dc2ac9ffdd1;hb=6b00d0d3cab2dfdfc7fab309ded4047d1a993149;hp=3c438b2c9654b38162dc1e65e1010a29461d7313;hpb=c7bda1ce659294d6e22c06e087f6f265983c7578;p=oweals%2Fbusybox.git diff --git a/libbb/printf.c b/libbb/printf.c index 3c438b2c9..4451273ef 100644 --- a/libbb/printf.c +++ b/libbb/printf.c @@ -28,7 +28,7 @@ * reasons for failure which don't set the streams error indicator, * SUSv3 lists EILSEQ, EINVAL, and ENOMEM. * - * In some cases, it would be desireable to have a group of *printf() + * In some cases, it would be desirable to have a group of *printf() * functions available that _always_ set the stream error indicator on * failure. That would allow us to defer error checking until applet * exit. Unfortunately, there is no standard way of setting a streams @@ -38,7 +38,7 @@ * free to send patches for stdio implementations where the following * fails. * - * NOTE: None of this is threadsafe. As busybox is a nonthreaded app, + * NOTE: None of this is thread safe. As busybox is a non-threaded app, * that isn't currently an issue. */ @@ -71,9 +71,18 @@ #define SET_FERROR_UNLOCKED(S) ((S)->mode |= __MODE_ERR) # else -#error unknown uClibc stdio implemenation! +# error unknown uClibc stdio implemenation! # endif +#elif defined(__NEWLIB_H__) +/* I honestly don't know if there are different versions of stdio in + * newlibs history. Anyway, here's what's current. + * #define __sfeof(p) (((p)->_flags & __SEOF) != 0) + * #define __sferror(p) (((p)->_flags & __SERR) != 0) + * #define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF))) + */ +# define SET_FERROR_UNLOCKED(S) ((S)->_flags |= __SERR) + #elif defined(__GLIBC__) # if defined(_STDIO_USES_IOSTREAM) @@ -81,7 +90,7 @@ * #define _IO_feof_unlocked(__fp) (((__fp)->_flags & _IO_EOF_SEEN) != 0) * #define _IO_ferror_unlocked(__fp) (((__fp)->_flags & _IO_ERR_SEEN) != 0) */ -#define SET_FERROR_UNLOCKED(S) ((S)->_flags |= _IO_ERR_SEEN) +# define SET_FERROR_UNLOCKED(S) ((S)->_flags |= _IO_ERR_SEEN) # else /* Assume the older version of glibc which used a bitfield entry @@ -90,26 +99,17 @@ * #define feof_unlocked(stream) ((stream)->__eof != 0) * #define ferror_unlocked(stream) ((stream)->__error != 0) */ -#define SET_FERROR_UNLOCKED(S) ((S)->__error = 1) +# define SET_FERROR_UNLOCKED(S) ((S)->__error = 1) # endif -#elif defined(__NEWLIB_H__) -/* I honestly don't know if there are different versions of stdio in - * newlibs history. Anyway, here's what's current. - * #define __sfeof(p) (((p)->_flags & __SEOF) != 0) - * #define __sferror(p) (((p)->_flags & __SERR) != 0) - * #define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF))) - */ -#define SET_FERROR_UNLOCKED(S) ((S)->_flags |= __SERR) - #elif defined(__dietlibc__) /* * WARNING!!! dietlibc is quite buggy. WARNING!!! * * Some example bugs as of March 12, 2003... * 1) fputc() doesn't set the error indicator on failure. - * 2) freopen() doesn't maintain the same stream object, contary to + * 2) freopen() doesn't maintain the same stream object, contrary to * standards. This makes it useless in its primary role of * reassociating stdin/stdout/stderr. * 3) printf() often fails to correctly format output when conversions @@ -120,13 +120,13 @@ * you can extract the information you need from dietstdio.h. See the * other library implementations for examples. */ -#error dietlibc is currently not supported. Please see the commented source. +# error dietlibc is currently not supported. Please see the commented source. #else /* some other lib */ -/* Please see the comments for the above supported libaries for examples +/* Please see the comments for the above supported libraries for examples * of what is required to support your stdio implementation. */ -#error Your stdio library is currently not supported. Please see the commented source. +# error Your stdio library is currently not supported. Please see the commented source. #endif #ifdef L_bb_vfprintf