Provide and document ctermid_r function.

This commit is contained in:
Wes Peters 1999-11-28 23:28:49 +00:00
parent e3867a1a44
commit be728db489
2 changed files with 23 additions and 2 deletions

View File

@ -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

View File

@ -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;
}