Controlling stdin and stdouts of other executables

Maarten Litmaath maart at cs.vu.nl
Wed May 9 04:01:12 AEST 1990


In article <4077 at hcx1.SSD.CSD.HARRIS.COM>,
	brad at SSD.CSD.HARRIS.COM (Brad Appleton) writes:
)In article <6418 at star.cs.vu.nl> maart at cs.vu.nl (Maarten Litmaath) writes:
)...
)>Bonus: the `0' in the execlp() call should be `(char *) 0'; grrrr, when
)>do people ever learn?  :-(
)
)GRRRRRR yourself! I used it the way it was documented for my system!!!!

The documentation is wrong.

)I originally had used NULL (which is preferred over (char *) 0) instead of
                                      ^^^^^^^^^
                                      Nonsense.

)0 but My reference text used 0 (not (char * 0))! My system may be slightly
)different than yours, but I did use the proper type according to my FM.
                                         ^^^^^^
The type of the bare `0' is not proper: you're relying on the compiler to
turn it into the proper `(char *) 0'; you would be right to do so *iff* a
complete prototype were in scope.  The problem, however, is execlp() being
a variadic function, hence the following incomplete prototype:

	extern	int	execlp(char *path, char *name, ...);

There isn't a way to specify *every* argument of execlp() is to be a
`char *'.  Printf() on the other hand accepts arguments of various types
(only the first must be a `char *'), yet its prototype looks quite the same:

	extern	int	printf(char *format, ...);

)(Of course, it could be a problem in the FM :-)

You bet.
--
 Antique fairy tale: Little Red Riding Hood. |Maarten Litmaath @ VU Amsterdam:
 Modern fairy tale: Oswald shot Kennedy. |maart at cs.vu.nl, uunet!cs.vu.nl!maart



More information about the Comp.lang.c mailing list