🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.unix
Article #840

Must POSIX 1003.1 include files be standalone?

#840
From: Rainer Orth
Date: Sat, 11 May 1991 04:06
36 lines
1733 bytes
Submitted-by: ro@thp.uni-koeln.de (Rainer Orth)

Recently while working on the command sources of Andy Tanenbaums Minix 1.6
(currently in beta and trying to become fully P1003.1 and .2 compatible),
there appeared the question whether code like

	#include <pwd.h>
	
	int main (void)
	{
	}

is required to work in a strictly conforming POSIX.1 implementation with
Standard C Bindings. 

The problem is as follows:

	<pwd.h> contains a prototype for struct passwd *getpwuid (uid_t)
	and doesn't include <sys/types.h> by itself. I'm not shure if the
	above program needs to #include <sys/types.h> itself or <pwd.h> is
	wrong. From P1003.1-1988 <sys/types.h> needs to be included only if
	the program uses getpwuid().

The same problem occurs in several other headers: e.g. <signal.h>, <grp.h>,
<unistd.h>, <sys/wait.h>.

Does P1003.1-1990 specify the correct behaviour?

	Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Institute of Theoretical Physics, University of Cologne

Internet: ro@thp.Uni-Koeln.DE

Volume-Number: Volume 23, Number 65
Technical Details
Message-ID: <1991May12.181445.4553@uunet.uu.net>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!uunet.UU.NET!sef

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!uunet.UU.NET!sef
From: ro@thp.uni-koeln.de (Rainer Orth)
Newsgroups: comp.std.unix
Subject: Must POSIX 1003.1 include files be standalone?
Message-ID: <1991May12.181445.4553@uunet.uu.net>
Date: 11 May 91 04:06:15 GMT
Sender: usenet@uunet.uu.net (UseNet News)
Organization: Institute of Theoretical Physics, University of Cologne, F. R.
Lines: 36
Approved: sef@uunet.uu.net (Moderator, Sean Eric Fagan - comp.std.unix)
Originator: sef@uunet.UU.NET
Nntp-Posting-Host: uunet.uu.net
X-Submissions: std-unix@uunet.uu.net