Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ctermid(3) [osx man page]

CTERMID(3)						   BSD Library Functions Manual 						CTERMID(3)

NAME
ctermid, ctermid_r -- generate terminal pathname LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <stdio.h> char * ctermid(char *s); char * ctermid_r(char *s); DESCRIPTION
The ctermid() function generates a string that, when used as a pathname, refers to the current controlling terminal of the calling process. If s is the NULL pointer, a pointer to a static area is returned. Otherwise, the pathname is copied into the memory referenced by s. The argument s is assumed to be at least L_ctermid (as defined in the include file <stdio.h>) bytes long. The ctermid_r() function provides the same functionality as ctermid(), except that if s is a NULL pointer, NULL is returned. The current implementation simply returns '/dev/tty'. RETURN VALUES
Upon successful completion, a non-NULL pointer is returned. Otherwise, a NULL pointer is returned and the global variable errno is set to indicate the error. ERRORS
The current implementation detects no error conditions. SEE ALSO
ttyname(3) STANDARDS
The ctermid() function conforms to IEEE Std 1003.1-1988 (``POSIX.1''). BUGS
By default the ctermid() function writes all information to an internal static object. Subsequent calls to ctermid() will modify the same object. BSD
June 4, 1993 BSD

Check Out this Related Man Page

CTERMID(3)						   BSD Library Functions Manual 						CTERMID(3)

NAME
ctermid -- generate terminal pathname LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <stdio.h> char * ctermid(char *buf); char * ctermid_r(char *buf); DESCRIPTION
The ctermid() function generates a string, that, when used as a pathname, refers to the current controlling terminal of the calling process. If buf is the NULL pointer, a pointer to a static area is returned. Otherwise, the pathname is copied into the memory referenced by buf. The argument buf is assumed to be at least L_ctermid (as defined in the include file <stdio.h>) bytes long. The ctermid_r() function provides the same functionality as ctermid() except that if buf is a NULL pointer, NULL is returned. If no suitable lookup of the controlling terminal name can be performed, this implementation returns '/dev/tty'. RETURN VALUES
Upon successful completion, a non-NULL pointer is returned. Otherwise, a NULL pointer is returned and the global variable errno is set to indicate the error. ERRORS
The current implementation detects no error conditions. SEE ALSO
ttyname(3) STANDARDS
The ctermid() function conforms to IEEE Std 1003.1-1988 (``POSIX.1''). BUGS
By default the ctermid() function writes all information to an internal static object. Subsequent calls to ctermid() will modify the same object. BSD
October 1, 2011 BSD
Man Page

4 More Discussions You Might Find Interesting

1. Programming

Who is the current user

How could I get the username and password of user, who started this programm? (6 Replies)
Discussion started by: szzz
6 Replies

2. Shell Programming and Scripting

Command Not running in script

Hi Everyone , have a nice day root@sdp01a>SS7Manager -status the problem with above given expression is that i cant add it in script , it only executes if manually given at remote node , can anyone tell me some way to run it in scripts , also i have few more commands aswell , which are for... (2 Replies)
Discussion started by: Dastard
2 Replies

3. Programming

How to find if a process a daemon ?

I have a scenario where I need to find if a process is a daemon process or not. This check needs to be done from within the process. I know there are no direct API's to do so. I have explored these options. 1. ctermid() - this can be unsuccessful as per the man pages 2. int devtty; if ((devtty... (7 Replies)
Discussion started by: vino
7 Replies

4. Programming

scandir() and threads

I couldn't find anywhere informations about it. Is scandir() thread-safe? (4 Replies)
Discussion started by: dawwin
4 Replies