summaryrefslogtreecommitdiff
path: root/openbsd-compat/bsd-misc.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2003-08-02 23:31:42 +1000
committerDarren Tucker <dtucker@zip.com.au>2003-08-02 23:31:42 +1000
commit2e9c9cf702d8e90809d901ec51358406be6f810a (patch)
tree175e32010d57d4aa3f3b818018fead17ef5aacfd /openbsd-compat/bsd-misc.c
parent06ef75bf0c2449ab4880f6ff40729497782e6e60 (diff)
- (dtucker) [openbsd-compat/bsd-misc.c openbsd-compat/bsd-misc.h]
Add a tcgetpgrp function.
Diffstat (limited to 'openbsd-compat/bsd-misc.c')
-rw-r--r--openbsd-compat/bsd-misc.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/openbsd-compat/bsd-misc.c b/openbsd-compat/bsd-misc.c
index cdc63c24..64de6945 100644
--- a/openbsd-compat/bsd-misc.c
+++ b/openbsd-compat/bsd-misc.c
@@ -25,7 +25,7 @@
#include "includes.h"
#include "xmalloc.h"
-RCSID("$Id: bsd-misc.c,v 1.13 2003/05/18 14:13:39 djm Exp $");
+RCSID("$Id: bsd-misc.c,v 1.14 2003/08/02 13:31:42 dtucker Exp $");
/*
* NB. duplicate __progname in case it is an alias for argv[0]
@@ -167,3 +167,16 @@ int nanosleep(const struct timespec *req, struct timespec *rem)
#endif
+#ifndef HAVE_TCGETPGRP
+pid_t
+tcgetpgrp(int fd)
+{
+ int result, ctty_pgrp;
+
+ if (ioctl(STDOUT_FILENO, TIOCGPGRP, &ctty_pgrp) == -1)
+ return(-1);
+ else
+ return(ctty_pgrp);
+}
+#endif /* HAVE_TCGETPGRP */
+