'\"macro stdmacro
.if n .pH g3c.ptsname @(#)ptsname	40.4 of 10/10/89
.\" Copyright 1989 AT&T
.nr X
.if \nX=0 .ds x} ptsname 3C "" "\&"
.if \nX=1 .ds x} ptsname 3C ""
.if \nX=2 .ds x} ptsname 3C "" "\&"
.if \nX=3 .ds x} ptsname "" "" "\&"
.TH \*(x}
.SH NAME
\f4ptsname\fP \- get name of the slave pseudo-terminal device
.SH SYNOPSIS
.nf
\f4#include <stdio.h>
      
char *ptsname(int fildes\fP);
.fi
.SH DESCRIPTION
The function \f4ptsname()\f1 returns the name of the slave
pseudo-terminal device associated with a master pseudo-terminal device.
\f2fildes\f1 is a file descriptor returned from a successful open
of the master device.
\f4ptsname\f1() returns a pointer to a
string containing the null-terminated path name of the
slave device of the form \f4/dev/pts/N\f1, where \f4N\fP is an integer between
0 and 255.
.SH "RETURN VALUE"
Upon successful completion, the function \f4ptsname\f1() returns a 
pointer to a string which is the name of the pseudo-terminal slave device.
This value points to a static data area that is 
overwritten by each call to \f4ptsname()\f1.
Upon failure, \f4ptsname\f1() returns \f4NULL\f1.
This could occur if \f2fildes\f1 is an invalid file descriptor or if 
the slave device name does not exist in the file system.
.SH "SEE ALSO"
.nf
\f4open\fP(2), \f4grantpt\fP(3C), \f4ttyname\fP(3C), \f4unlockpt\fP(3C).
\f2Programmer's Guide: \s-1STREAMS\s0\fP.
.fi
