From b0db05957a20f6506b0de6b499468baf73ae5121 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 8 Apr 2008 13:11:19 +0200 Subject: [PATCH] Add tentative support for OpenServer. --- ChangeLog | 18 ++++++++++++++++++ lib/fbufmode.c | 7 +++++-- lib/fpurge.c | 9 +++++++-- lib/freadable.c | 7 +++++-- lib/freadahead.c | 6 +++++- lib/freading.c | 7 +++++-- lib/freadptr.c | 7 ++++++- lib/freadseek.c | 6 +++++- lib/fseeko.c | 14 +++++++++++--- lib/fseterr.c | 7 +++++-- lib/fwritable.c | 7 +++++-- lib/fwriting.c | 7 +++++-- 12 files changed, 82 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index db6db0f90..0cb470d12 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2008-04-08 Bruno Haible + + Add tentative support for OpenServer. + * lib/fbufmode.c (fbufmode): Add conditional define for _flag, _base, + _ptr, _cnt. + * lib/fpurge.c (fpurge): Likewise. + * lib/freadable.c (freadable): Likewise. + * lib/freadahead.c (freadahead): Likewise. + * lib/freading.c (freading): Likewise. + * lib/freadptr.c (freadptr): Likewise. + * lib/freadseek.c (freadptrinc): Likewise. + * lib/fseeko.c (rpl_fseeko): Likewise. + * lib/fseterr.c (fseterr): Likewise. + * lib/fwritable.c (fwritable): Likewise. + * lib/fwriting.c (fwriting): Likewise. + Reported by Roger Cornelius and + Brian K. White . + 2008-04-06 Jim Meyering * gnulib-tool (func_add_or_update): s/backuped/backed up/ in diagnostic diff --git a/lib/fbufmode.c b/lib/fbufmode.c index 5f659bfe9..52ce917c4 100644 --- a/lib/fbufmode.c +++ b/lib/fbufmode.c @@ -1,5 +1,5 @@ /* Retrieve information about a FILE stream. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007-2008 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -46,7 +46,7 @@ fbufmode (FILE *fp) if (fp->_flags & __SNBF) return _IONBF; return _IOFBF; -#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */ +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw */ # if HAVE___FLBF /* Solaris >= 7 */ if (__flbf (fp)) return _IOLBF; @@ -64,6 +64,9 @@ fbufmode (FILE *fp) } *) fp) return fp_->_flag & (_IONBF | _IOFBF); # else +# if defined _SCO_DS /* OpenServer */ +# define _flag __flag +# endif if (fp->_flag & _IONBF) return _IONBF; return _IOFBF; diff --git a/lib/fpurge.c b/lib/fpurge.c index cc230fb1c..7bdc29263 100644 --- a/lib/fpurge.c +++ b/lib/fpurge.c @@ -1,5 +1,5 @@ /* Flushing buffers of a FILE stream. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007-2008 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -90,7 +90,12 @@ fpurge (FILE *fp) fp_ub._base = NULL; } return 0; -# elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */ +# elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw */ +# if defined _SCO_DS /* OpenServer */ +# define _base __base +# define _ptr __ptr +# define _cnt __cnt +# endif fp->_ptr = fp->_base; if (fp->_ptr != NULL) fp->_cnt = 0; diff --git a/lib/freadable.c b/lib/freadable.c index e49c950ff..9e9cb09da 100644 --- a/lib/freadable.c +++ b/lib/freadable.c @@ -1,5 +1,5 @@ /* Retrieve information about a FILE stream. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007-2008 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,7 +29,10 @@ freadable (FILE *fp) return (fp->_flags & _IO_NO_READS) == 0; #elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ return (fp->_flags & (__SRW | __SRD)) != 0; -#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */ +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw */ +# if defined _SCO_DS /* OpenServer */ +# define _flag __flag +# endif return (fp->_flag & (_IORW | _IOREAD)) != 0; #elif defined __QNX__ /* QNX */ return (fp->_Mode & 0x1 /* _MOPENR */) != 0; diff --git a/lib/freadahead.c b/lib/freadahead.c index a28595d39..6c02d75a1 100644 --- a/lib/freadahead.c +++ b/lib/freadahead.c @@ -43,7 +43,7 @@ freadahead (FILE *fp) return 0; return fp->_r + (HASUB (fp) ? fp->_ur : 0); -#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */ +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw */ # if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */ # define fp_ ((struct { unsigned char *_ptr; \ unsigned char *_base; \ @@ -56,6 +56,10 @@ freadahead (FILE *fp) return 0; return fp_->_cnt; # else +# if defined _SCO_DS /* OpenServer */ +# define _flag __flag +# define _cnt __cnt +# endif if ((fp->_flag & _IOWRT) != 0) return 0; return fp->_cnt; diff --git a/lib/freading.c b/lib/freading.c index dcdc3d24c..11c943cdf 100644 --- a/lib/freading.c +++ b/lib/freading.c @@ -1,5 +1,5 @@ /* Retrieve information about a FILE stream. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007-2008 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -35,7 +35,10 @@ freading (FILE *fp) && fp->_IO_read_base != NULL)); #elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ return (fp->_flags & __SRD) != 0; -#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */ +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw */ +# if defined _SCO_DS /* OpenServer */ +# define _flag __flag +# endif return (fp->_flag & _IOREAD) != 0; #elif defined __UCLIBC__ /* uClibc */ return (fp->__modeflags & (__FLAG_READONLY | __FLAG_READING)) != 0; diff --git a/lib/freadptr.c b/lib/freadptr.c index 8459508a1..4b170363c 100644 --- a/lib/freadptr.c +++ b/lib/freadptr.c @@ -41,7 +41,7 @@ freadptr (FILE *fp, size_t *sizep) return NULL; *sizep = size; return (const char *) fp->_p; -#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */ +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw */ # if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */ # define fp_ ((struct { unsigned char *_ptr; \ unsigned char *_base; \ @@ -58,6 +58,11 @@ freadptr (FILE *fp, size_t *sizep) *sizep = size; return (const char *) fp_->_ptr; # else +# if defined _SCO_DS /* OpenServer */ +# define _flag __flag +# define _ptr __ptr +# define _cnt __cnt +# endif if ((fp->_flag & _IOWRT) != 0) return NULL; size = fp->_cnt; diff --git a/lib/freadseek.c b/lib/freadseek.c index c4078d4f5..82fd64819 100644 --- a/lib/freadseek.c +++ b/lib/freadseek.c @@ -37,7 +37,7 @@ freadptrinc (FILE *fp, size_t increment) #elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ fp->_p += increment; fp->_r -= increment; -#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */ +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw */ # if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */ # define fp_ ((struct { unsigned char *_ptr; \ unsigned char *_base; \ @@ -49,6 +49,10 @@ freadptrinc (FILE *fp, size_t increment) fp_->_ptr += increment; fp_->_cnt -= increment; # else +# if defined _SCO_DS /* OpenServer */ +# define _ptr __ptr +# define _cnt __cnt +# endif fp->_ptr += increment; fp->_cnt -= increment; # endif diff --git a/lib/fseeko.c b/lib/fseeko.c index 97dcf6da0..1ed8921ad 100644 --- a/lib/fseeko.c +++ b/lib/fseeko.c @@ -1,5 +1,5 @@ /* An fseeko() function that, together with fflush(), is POSIX compliant. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007-2008 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -70,7 +70,7 @@ rpl_fseeko (FILE *fp, off_t offset, int whence) ? fp->_bf._size : 0) && fp_ub._base == NULL) -#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */ +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw */ # if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */ # define fp_ ((struct { unsigned char *_ptr; \ unsigned char *_base; \ @@ -82,6 +82,11 @@ rpl_fseeko (FILE *fp, off_t offset, int whence) if (fp_->_ptr == fp_->_base && (fp_->_ptr == NULL || fp_->_cnt == 0)) # else +# if defined _SCO_DS /* OpenServer */ +# define _base __base +# define _ptr __ptr +# define _cnt __cnt +# endif if (fp->_ptr == fp->_base && (fp->_ptr == NULL || fp->_cnt == 0)) # endif @@ -112,7 +117,10 @@ rpl_fseeko (FILE *fp, off_t offset, int whence) fp->_offset = pos; fp->_flags |= __SOFF; fp->_flags &= ~__SEOF; -#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */ +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw */ +# if defined _SCO_DS /* OpenServer */ +# define _flag __flag +# endif fp->_flag &= ~_IOEOF; #endif return 0; diff --git a/lib/fseterr.c b/lib/fseterr.c index b34ef75f6..7b0c68b9f 100644 --- a/lib/fseterr.c +++ b/lib/fseterr.c @@ -1,5 +1,5 @@ /* Set the error indicator of a stream. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007-2008 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -31,7 +31,7 @@ fseterr (FILE *fp) fp->_flags |= _IO_ERR_SEEN; #elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ fp->_flags |= __SERR; -#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */ +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw */ # if defined __sun && defined _LP64 /* Solaris/{SPARC,AMD64} 64-bit */ # define fp_ ((struct { unsigned char *_ptr; \ unsigned char *_base; \ @@ -42,6 +42,9 @@ fseterr (FILE *fp) } *) fp) fp_->_flag |= _IOERR; # else +# if defined _SCO_DS /* OpenServer */ +# define _flag __flag +# endif fp->_flag |= _IOERR; # endif #elif defined __UCLIBC__ /* uClibc */ diff --git a/lib/fwritable.c b/lib/fwritable.c index 5617beee3..278ef7e3c 100644 --- a/lib/fwritable.c +++ b/lib/fwritable.c @@ -1,5 +1,5 @@ /* Retrieve information about a FILE stream. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007-2008 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,7 +29,10 @@ fwritable (FILE *fp) return (fp->_flags & _IO_NO_WRITES) == 0; #elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ return (fp->_flags & (__SRW | __SWR)) != 0; -#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */ +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw */ +# if defined _SCO_DS /* OpenServer */ +# define _flag __flag +# endif return (fp->_flag & (_IORW | _IOWRT)) != 0; #elif defined __QNX__ /* QNX */ return (fp->_Mode & 0x2 /* _MOPENW */) != 0; diff --git a/lib/fwriting.c b/lib/fwriting.c index 3ae6d569a..9f3c1c98b 100644 --- a/lib/fwriting.c +++ b/lib/fwriting.c @@ -1,5 +1,5 @@ /* Retrieve information about a FILE stream. - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007-2008 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -29,7 +29,10 @@ fwriting (FILE *fp) return (fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) != 0; #elif defined __sferror /* FreeBSD, NetBSD, OpenBSD, MacOS X, Cygwin */ return (fp->_flags & __SWR) != 0; -#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, mingw */ +#elif defined _IOERR /* AIX, HP-UX, IRIX, OSF/1, Solaris, OpenServer, mingw */ +# if defined _SCO_DS /* OpenServer */ +# define _flag __flag +# endif return (fp->_flag & _IOWRT) != 0; #elif defined __UCLIBC__ /* uClibc */ return (fp->__modeflags & __FLAG_WRITING) != 0; -- 2.11.0