Commit 619d36ef authored by Bruno Haible's avatar Bruno Haible

Fix port to QNX.

parent 220ee975
2007-11-06 Bruno Haible <bruno@clisp.org> 2007-11-06 Bruno Haible <bruno@clisp.org>
* lib/fbufmode.c (fbufmode) [QNX]: Use numerical values for flags; the
symbolic values are not defined in a public header.
* lib/freadable.c (freadable) [QNX]: Likewise.
* lib/freadahead.c (freadahead) [QNX]: Likewise.
* lib/freading.c (freading) [QNX]: Likewise.
* lib/fseterr.c (fseterr) [QNX]: Likewise.
* lib/fwritable.c (fwritable) [QNX]: Likewise.
* lib/fwriting.c (fwriting) [QNX]: Likewise.
* lib/fpurge.c (fpurge) [QNX]: Likewise. Add a return statement.
Reported by Alain Magloire.
* m4/fpending.m4 (gl_FUNC_FPENDING): Add a variant for QNX. * m4/fpending.m4 (gl_FUNC_FPENDING): Add a variant for QNX.
2007-11-05 Bruno Haible <bruno@clisp.org> 2007-11-05 Bruno Haible <bruno@clisp.org>
...@@ -75,9 +75,9 @@ fbufmode (FILE *fp) ...@@ -75,9 +75,9 @@ fbufmode (FILE *fp)
return _IONBF; return _IONBF;
return _IOFBF; return _IOFBF;
#elif defined __QNX__ /* QNX */ #elif defined __QNX__ /* QNX */
if (fp->_Mode & _MLBF) if (fp->_Mode & 0x400 /* _MLBF */)
return _IOLBF; return _IOLBF;
if (fp->_Mode & _MNBF) if (fp->_Mode & 0x800 /* _MNBF */)
return _IONBF; return _IONBF;
return _IOFBF; return _IOFBF;
#else #else
......
...@@ -106,12 +106,13 @@ fpurge (FILE *fp) ...@@ -106,12 +106,13 @@ fpurge (FILE *fp)
# elif defined __QNX__ /* QNX */ # elif defined __QNX__ /* QNX */
fp->_Rback = fp->_Back + sizeof (fp->_Back); fp->_Rback = fp->_Back + sizeof (fp->_Back);
fp->_Rsave = NULL; fp->_Rsave = NULL;
if (fp->_Mode & _MWRITE) if (fp->_Mode & 0x2000 /* _MWRITE */)
/* fp->_Buf <= fp->_Next <= fp->_Wend */ /* fp->_Buf <= fp->_Next <= fp->_Wend */
fp->_Next = fp->_Buf; fp->_Next = fp->_Buf;
else else
/* fp->_Buf <= fp->_Next <= fp->_Rend */ /* fp->_Buf <= fp->_Next <= fp->_Rend */
fp->_Rend = fp->_Next; fp->_Rend = fp->_Next;
return 0;
# else # else
#error "Please port gnulib fpurge.c to your platform! Look at the definitions of fflush, setvbuf and ungetc on your system, then report this to bug-gnulib." #error "Please port gnulib fpurge.c to your platform! Look at the definitions of fflush, setvbuf and ungetc on your system, then report this to bug-gnulib."
# endif # endif
......
...@@ -32,7 +32,7 @@ freadable (FILE *fp) ...@@ -32,7 +32,7 @@ freadable (FILE *fp)
#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */ #elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */
return (fp->_flag & (_IORW | _IOREAD)) != 0; return (fp->_flag & (_IORW | _IOREAD)) != 0;
#elif defined __QNX__ /* QNX */ #elif defined __QNX__ /* QNX */
return (fp->_Mode & _MOPENR) != 0; return (fp->_Mode & 0x1 /* _MOPENR */) != 0;
#else #else
#error "Please port gnulib freadable.c to your platform! Look at the definition of fopen, fdopen on your system, then report this to bug-gnulib." #error "Please port gnulib freadable.c to your platform! Look at the definition of fopen, fdopen on your system, then report this to bug-gnulib."
#endif #endif
......
...@@ -56,7 +56,7 @@ freadahead (FILE *fp) ...@@ -56,7 +56,7 @@ freadahead (FILE *fp)
return 0; return 0;
# endif # endif
#elif defined __QNX__ /* QNX */ #elif defined __QNX__ /* QNX */
if ((fp->_Mode & _MWRITE) != 0) if ((fp->_Mode & 0x2000 /* _MWRITE */) != 0)
return 0; return 0;
/* fp->_Buf <= fp->_Next <= fp->_Rend */ /* fp->_Buf <= fp->_Next <= fp->_Rend */
return fp->_Rend - fp->_Next; return fp->_Rend - fp->_Next;
......
...@@ -40,8 +40,8 @@ freading (FILE *fp) ...@@ -40,8 +40,8 @@ freading (FILE *fp)
#elif defined __UCLIBC__ /* uClibc */ #elif defined __UCLIBC__ /* uClibc */
return (fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) != 0; return (fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) != 0;
#elif defined __QNX__ /* QNX */ #elif defined __QNX__ /* QNX */
return ((fp->_Mode & _MOPENW) == 0 return ((fp->_Mode & 0x2 /* _MOPENW */) == 0
|| (fp->_Mode & _MREAD) != 0); || (fp->_Mode & 0x1000 /* _MREAD */) != 0);
#else #else
#error "Please port gnulib freading.c to your platform!" #error "Please port gnulib freading.c to your platform!"
#endif #endif
......
...@@ -47,7 +47,7 @@ fseterr (FILE *fp) ...@@ -47,7 +47,7 @@ fseterr (FILE *fp)
#elif defined __UCLIBC__ /* uClibc */ #elif defined __UCLIBC__ /* uClibc */
fp->__modeflags |= __FLAG_ERROR; fp->__modeflags |= __FLAG_ERROR;
#elif defined __QNX__ /* QNX */ #elif defined __QNX__ /* QNX */
fp->_Mode |= _MERR; fp->_Mode |= 0x200 /* _MERR */;
#elif 0 /* unknown */ #elif 0 /* unknown */
/* Portable fallback, based on an idea by Rich Felker. /* Portable fallback, based on an idea by Rich Felker.
Wow! 6 system calls for something that is just a bit operation! Wow! 6 system calls for something that is just a bit operation!
......
...@@ -32,7 +32,7 @@ fwritable (FILE *fp) ...@@ -32,7 +32,7 @@ fwritable (FILE *fp)
#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */ #elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */
return (fp->_flag & (_IORW | _IOWRT)) != 0; return (fp->_flag & (_IORW | _IOWRT)) != 0;
#elif defined __QNX__ /* QNX */ #elif defined __QNX__ /* QNX */
return (fp->_mode & _MOPENW) != 0; return (fp->_Mode & 0x2 /* _MOPENW */) != 0;
#else #else
#error "Please port gnulib fwritable.c to your platform! Look at the definition of fopen, fdopen on your system, then report this to bug-gnulib." #error "Please port gnulib fwritable.c to your platform! Look at the definition of fopen, fdopen on your system, then report this to bug-gnulib."
#endif #endif
......
...@@ -34,8 +34,8 @@ fwriting (FILE *fp) ...@@ -34,8 +34,8 @@ fwriting (FILE *fp)
#elif defined __UCLIBC__ /* uClibc */ #elif defined __UCLIBC__ /* uClibc */
return (fp->__modeflags & __FLAG_WRITING) != 0; return (fp->__modeflags & __FLAG_WRITING) != 0;
#elif defined __QNX__ /* QNX */ #elif defined __QNX__ /* QNX */
return ((fp->_Mode & _MOPENR) == 0 return ((fp->_Mode & 0x1 /* _MOPENR */) == 0
|| (fp->_Mode & _MWRITE) != 0); || (fp->_Mode & 0x2000 /* _MWRITE */) != 0);
#else #else
#error "Please port gnulib fwriting.c to your platform!" #error "Please port gnulib fwriting.c to your platform!"
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment