DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

ptsname(S)


ptsname -- get name of the slave pseudo-terminal

Syntax

cc ...-lc

#include <stdlib.h>

char *ptsname(int fildes);

Description

ptsname(S) returns the name of the slave pseudo-terminal device for a master pseudo-terminal device. fildes is a file descriptor returned from a successful open of the master device.

ptsname( ) returns a pointer to a string containing the null-terminated path name of the slave device. The form of the name is /dev/ptsN, where N is a three-digit integer between 000 and 255.

Return values

On successful completion, ptsname( ) returns a pointer to a string that is the name of the slave pseudo-terminal device. It points to a static data area that is overwritten by each call to ptsname( ).

On failure, ptsname( ) returns NULL. This can happen if fildes is an invalid file descriptor or if the slave device name does not exist in the file system.

Diagnostics

This function does not set errno.

See also

grantpt(S), open(S), ttyname(S), unlockpt(S)

Standards conformance

ptsname(S) is conformant with:

X/Open CAE Specification, System Interfaces and Headers, Issue 4, Version 2.


© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003