From: Earnie B. <ea...@us...> - 2005-08-23 14:57:39
|
On 12:37:28 pm 2005-08-23 Christophe GRENIER <gr...@cg...> wrote: > On Tue, 23 Aug 2005, Earnie Boyd wrote: > > > On 11:41:10 am 2005-08-23 Christophe GRENIER <grenier@cgsecurity.or > g> > > 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. > But one would have to modify the stdio.h to check for declarations. I prefer since the unistd.h currently only includes other header files to just include stdio.h so that we don't have to change stdio.h. Besides, unistd.h for MinGW is one of those extentions to allow easier porting of UNIX code. Unistd.h doesn't exist in MSVC or other compilers for Windows AFAIK. Earnie |