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

Fix port to QNX.

parent 220ee975
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.
2007-11-05 Bruno Haible <bruno@clisp.org>
......@@ -75,9 +75,9 @@ fbufmode (FILE *fp)
return _IONBF;
return _IOFBF;
#elif defined __QNX__ /* QNX */
if (fp->_Mode & _MLBF)
if (fp->_Mode & 0x400 /* _MLBF */)
return _IOLBF;
if (fp->_Mode & _MNBF)
if (fp->_Mode & 0x800 /* _MNBF */)
return _IONBF;
return _IOFBF;
#else
......
......@@ -106,12 +106,13 @@ fpurge (FILE *fp)
# elif defined __QNX__ /* QNX */
fp->_Rback = fp->_Back + sizeof (fp->_Back);
fp->_Rsave = NULL;
if (fp->_Mode & _MWRITE)
if (fp->_Mode & 0x2000 /* _MWRITE */)
/* fp->_Buf <= fp->_Next <= fp->_Wend */
fp->_Next = fp->_Buf;
else
/* fp->_Buf <= fp->_Next <= fp->_Rend */
fp->_Rend = fp->_Next;
return 0;
# 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."
# endif
......
......@@ -32,7 +32,7 @@ freadable (FILE *fp)
#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */
return (fp->_flag & (_IORW | _IOREAD)) != 0;
#elif defined __QNX__ /* QNX */
return (fp->_Mode & _MOPENR) != 0;
return (fp->_Mode & 0x1 /* _MOPENR */) != 0;
#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."
#endif
......
......@@ -56,7 +56,7 @@ freadahead (FILE *fp)
return 0;
# endif
#elif defined __QNX__ /* QNX */
if ((fp->_Mode & _MWRITE) != 0)
if ((fp->_Mode & 0x2000 /* _MWRITE */) != 0)
return 0;
/* fp->_Buf <= fp->_Next <= fp->_Rend */
return fp->_Rend - fp->_Next;
......
......@@ -40,8 +40,8 @@ freading (FILE *fp)
#elif defined __UCLIBC__ /* uClibc */
return (fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) != 0;
#elif defined __QNX__ /* QNX */
return ((fp->_Mode & _MOPENW) == 0
|| (fp->_Mode & _MREAD) != 0);
return ((fp->_Mode & 0x2 /* _MOPENW */) == 0
|| (fp->_Mode & 0x1000 /* _MREAD */) != 0);
#else
#error "Please port gnulib freading.c to your platform!"
#endif
......
......@@ -47,7 +47,7 @@ fseterr (FILE *fp)
#elif defined __UCLIBC__ /* uClibc */
fp->__modeflags |= __FLAG_ERROR;
#elif defined __QNX__ /* QNX */
fp->_Mode |= _MERR;
fp->_Mode |= 0x200 /* _MERR */;
#elif 0 /* unknown */
/* Portable fallback, based on an idea by Rich Felker.
Wow! 6 system calls for something that is just a bit operation!
......
......@@ -32,7 +32,7 @@ fwritable (FILE *fp)
#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */
return (fp->_flag & (_IORW | _IOWRT)) != 0;
#elif defined __QNX__ /* QNX */
return (fp->_mode & _MOPENW) != 0;
return (fp->_Mode & 0x2 /* _MOPENW */) != 0;
#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."
#endif
......
......@@ -34,8 +34,8 @@ fwriting (FILE *fp)
#elif defined __UCLIBC__ /* uClibc */
return (fp->__modeflags & __FLAG_WRITING) != 0;
#elif defined __QNX__ /* QNX */
return ((fp->_Mode & _MOPENR) == 0
|| (fp->_Mode & _MWRITE) != 0);
return ((fp->_Mode & 0x1 /* _MOPENR */) == 0
|| (fp->_Mode & 0x2000 /* _MWRITE */) != 0);
#else
#error "Please port gnulib fwriting.c to your platform!"
#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