According to ISO/IEC 9899 International Standard for "C" SEEK_xxx are to be defined in stdio.h
Acording to POSIX Programmers Guide (Levine, O'Reilly & Associates Inc) SEEK_xxx are to be defined in stdio.h
On "gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-52)" the following appears in unistd.h:

/* Values for the WHENCE argument to lseek.  */
#ifndef _STDIO_H                /* <stdio.h> has the same definitions.  */
# define SEEK_SET       0       /* Seek from beginning of file.  */
# define SEEK_CUR       1       /* Seek from current position.  */
# define SEEK_END       2       /* Seek from end of file.  */
#endif

so I guess that stdio.h wins for the definitions and we ought to be able to do what is done in the RedHat example wrt unistd.h

Roger Wells, P.E.
SAIC
221 Third St
Newport, RI 02840
401-847-4210 (voice)
401-849-1585 (fax)
roger.k.wells@saic.com



Christophe GRENIER <grenier@cgsecurity.org>
Sent by: mingw-users-admin@lists.sourceforge.net

08/23/2005 08:37 AM
Please respond to mingw-users

       
        To:        mingw-users@lists.sourceforge.net
        cc:        
        Subject:        Re: [Mingw-users] Patch for w32api



On Tue, 23 Aug 2005, Earnie Boyd wrote:

> On 11:41:10 am 2005-08-23 Christophe GRENIER <grenier@cgsecurity.org>
> wrote:--- /usr/i386-pc-mingw32/sys-include/unistd.h.org                 2005-08-13
> 14:46:38.000000000 +0200
> +++ /usr/i386-pc-mingw32/sys-include/unistd.h                 2005-08-19 16:49:24.000000000
> +0200
> @@ -14,6 +14,20 @@
> #include <getopt.h>
> #undef __UNISTD_GETOPT__
>
> +/* Constants for origin indicating the position relative to which lseek
> + * sets the file position.  */
> +#ifndef                 SEEK_SET
> +#define SEEK_SET                 (0)
> +#endif
> +
> +#ifndef                 SEEK_CUR
> +#define                 SEEK_CUR                 (1)
> +#endif
> +
> +#ifndef                 SEEK_END
> +#define SEEK_END                 (2)
> +#endif
> +
> #ifdef __cplusplus
> extern "C" {
> #endif
>
> What if we instead of the above definitions, we simply ``#include
> <stdio.h>'' to obtain these definitions?

Don't include <stdio.h> inside unistd.h, otherwise people will forget
to include stdio.h in there source code and programs won't be portable.

Adding "#include <stdio.h>" to source code do the trick with mingw
but a lot of source code that use lseek doesn't include stdio.h
By standard, lseek is defined by unistd.h, fseek is defined by stdio.h
and you shouldn't have to include both to have a working lseek.

                 Christophe

---------------------------------------------------------------------
  ,-~~-.___.                  ._.
 / |  '     \                  | |"""""""""|                       -= GRENIER Christophe =-
(  )         0                  | |         |
 \_/-, ,----'                  | |         |
    ====         !_!--v---v--"                      http://www.cgsecurity.org
    /  \-'~;      |""""""""|
   /  __/~| ._-""||        |      Email: grenier@cgsecurity.org
 =(  _____|_|____||________|
---------------------------------------------------------------------


-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
MinGW-users mailing list
MinGW-users@lists.sourceforge.net

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users