[Patches] openpty() and forkpty()

Greg Stein gstein@lyra.org
Fri, 9 Jun 2000 17:56:14 -0700


On Fri, Jun 09, 2000 at 05:51:23PM +0200, Thomas Wouters wrote:
> On Fri, Jun 09, 2000 at 11:18:43AM -0400, Andrew M. Kuchling wrote:
> 
> > Anyway, the patch basically boils down to the following, which looks
> > good.  With the addition of a patch to libposix.tex documenting the
> > two new functions, I'd suggest checking it in.
> 
> Thanx. I have one comment though, something I didn't notice until after I
> sent the patch in: posixmodule.c should include an include file for for the
> prototype openpty/forkpty. Unfortunately, the actual file to include differs
> between Linux and FreeBSD, and is nonexistant on BSDI. On Linux, it should
> include pty.h, on FreeBSD libutil.h, and on BSDI there simply is no
> prototype for openpty/forkpty to be found.
> 
> Should I make autoconf check for the existance of pty.h/libutil.h and

Yes. Take a look at the AC_CHECK_HEADERS line in configure.in around line
356. Each header should go in there.

When AMK (or whoever folds in the patch) runs "autoheader", the autconf
package will regenerate config.h.in with the new HAVE_PTY, etc symbols.

> include other platforms seperately, once those get found, or should it just
> provide the prototypes for openpty/forkpty itself ? The prototype does
> match, on all three systems I am able to check.

Have something like this in posixmodule.c:

#ifdef HAVE_PTY
#include <pty.h>
#elifdef HAVE_LIBUTIL
#include <libutil.h>
#else
extern int openpty(int *amaster, ... blah blah
#endif


Cheers,
-g

p.s. and your patch doesn't need to include 'configure' or 'config.h.in'
since they are generated files.

-- 
Greg Stein, http://www.lyra.org/