summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorWes Peters <wes@FreeBSD.org>1999-11-28 23:28:49 +0000
committerWes Peters <wes@FreeBSD.org>1999-11-28 23:28:49 +0000
commitbe728db4894b7e2e76010c23e39b534d7f7f8ad7 (patch)
treee2d9a07d8c46e3d59b25075100450c1cf96f411b /lib/libc
parente3867a1a44be03d09b7ca071a49529a8af081f52 (diff)
Notes
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gen/ctermid.313
-rw-r--r--lib/libc/gen/ctermid.c12
2 files changed, 23 insertions, 2 deletions
diff --git a/lib/libc/gen/ctermid.3 b/lib/libc/gen/ctermid.3
index e3da33ac64bf..3b1668fead23 100644
--- a/lib/libc/gen/ctermid.3
+++ b/lib/libc/gen/ctermid.3
@@ -42,6 +42,8 @@
.Fd #include <stdio.h>
.Ft char *
.Fn ctermid "char *buf"
+.Ft char *
+.Fn ctermid_r "char *buf"
.Sh DESCRIPTION
The
.Fn ctermid
@@ -64,6 +66,17 @@ file
.Aq Pa stdio.h )
bytes long.
.Pp
+.Fn ctermid_r
+provides the same functionality as
+.Fn ctermid
+except that if
+.Ar buf
+is a
+.Dv NULL
+pointer,
+.Dv NULL
+is returned.
+.Pp
The current implementation simply returns
.Ql /dev/tty .
.Sh RETURN VALUES
diff --git a/lib/libc/gen/ctermid.c b/lib/libc/gen/ctermid.c
index 262d6df1681e..e43d6ab926a7 100644
--- a/lib/libc/gen/ctermid.c
+++ b/lib/libc/gen/ctermid.c
@@ -29,6 +29,8 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
+ *
+ * $FreeBSD$
*/
#if defined(LIBC_SCCS) && !defined(lint)
@@ -40,8 +42,7 @@ static char sccsid[] = "@(#)ctermid.c 8.1 (Berkeley) 6/4/93";
#include <string.h>
char *
-ctermid(s)
- char *s;
+ctermid(char *s)
{
static char def[] = _PATH_TTY;
@@ -51,3 +52,10 @@ ctermid(s)
}
return(def);
}
+
+
+char *
+ctermid_r(char *s)
+{
+ return (s) ? ctermid(s) : NULL;
+}