Is this POSIX compliant?

Geoff Clare gwc at root.co.uk
Sat Jun 15 03:53:02 AEST 1991


Submitted-by: gwc at root.co.uk (Geoff Clare)

berg at physik.tu-muenchen.de (Stephen R. van den Berg) wrote:

] Could someone knowledgable please tell me if the following include files,
] the mentioned identifiers and the include files they are 'allocated' to are
] all conform the POSIX standard?  (I dont't have any POSIX literature,
] so all the data I present here are educated guesses).

I emailed my answer to Stephen like a good net.user, but now I see
that an incorrect answer has been posted to the newsgroup, so I feel
obliged to waste more bandwidth by correcting it.

lewine at cheshirecat.webo.dg.com (Donald Lewine) writes:

]|> 
]  #include <unistd.h> 
]  ^^^^^^^^^^^^^^^^^^  unistd.h contains the prototypes for the
]                      functions you list and should be included in
]                      an ANSI C system.

Except that open() is in <fcntl.h>, not <unistd.h>.  Also the comments
regarding prototypes and ANSI C are misleading.  The original poster asked
about "POSIX", he didn't specify "POSIX with ANSI C", so I assume he wants
answers which apply equally well to POSIX with either common C or ANSI C.

]|> #include <stddef.h>		/* EOF */
]                   NO.  EOF is defined in <stdio.h>.  
]                   <stddef.h> defines:
]                   NULL, offsetof, ptrdiff_t, size_t, wchar_t

<stddef.h> is not required by POSIX.1.

]|> #include <stdlib.h>		/* getenv() memmove() malloc() realloc()
]|> 				   free() strtol() size_t */
]                   memmove() is in <string.h>  all others are 
]                   in <stdlib.h>

memmove() and strtol() are not required by POSIX.1.

]|> #include <signal.h>		/* signal() kill() */

signal() is not required by POSIX.1.

]A complete listing of the POSIX headers is in Appendix A of the 
]POSIX Programmer's Guide available for $34.95 from:
(address deleted)
]In my not so humble opinion, the POSIX Programmer's Guide is
]required reading for anyone who wants to write programs that
]work on all POSIX systems.

I hope it wasn't the source of the errors above.

-- 
Geoff Clare <gwc at root.co.uk>  (Dumb American mailers: ...!uunet!root.co.uk!gwc)
UniSoft Limited, London, England.   Tel: +44 71 729 3773   Fax: +44 71 729 3273


Volume-Number: Volume 24, Number 7



More information about the Comp.std.unix mailing list