ctermid(3s)ctermid(3s)Name
ctermid - generate file name for terminal
Syntax
#include <stdio.h>
char *ctermid(s)
char *s;
Description
The subroutine generates the pathname of the controlling terminal for the current process, and stores it in a string.
If s is a NULL pointer, the string is stored in an internal static area, the contents of which are overwritten at the next call to and the
address of which is returned. Otherwise, s is assumed to point to a character array of at least elements. The pathname is placed in this
array and the value of s is returned. The constant is defined in the <stdio.h> header file. The difference between and is that must be
handed a file descriptor and returns the actual name of the terminal associated with that file descriptor, while returns a string ( ) that
will refer to the terminal if used as a file name. Thus subroutine is useful only if the process already has at least one file open to a
terminal.
See Alsottyname(3)ctermid(3s)
Check Out this Related Man Page
ctermid(3C) Standard C Library Functions ctermid(3C)NAME
ctermid, ctermid_r - generate path name for controlling terminal
SYNOPSIS
#include <stdio.h>
char *ctermid(char *s);
char *ctermid_r(char *s);
DESCRIPTION
ctermid()
The ctermid() function generates the path name of the controlling terminal for the current process and stores it in a string.
If s is a null pointer, the string is stored in an internal static area whose address is returned and whose contents are overwritten at the
next call to ctermid(). Otherwise, s is assumed to point to a character array of at least L_ctermid elements. The path name is placed in
this array and the value of s is returned. The constant L_ctermid is defined in the header <stdio.h>.
ctermid_r()
The ctermid_r() function behaves as ctermid() except that if s is a null pointer, the function returns NULL.
USAGE
The difference between ctermid() and ttyname(3C) is that ttyname() must be passed a file descriptor and returns the actual name of the ter-
minal associated with that file descriptor, while ctermid() returns a string (/dev/tty) that will refer to the terminal if used as a file
name. The ttyname() function is useful only if the process already has at least one file open to a terminal.
The ctermid() function is unsafe in multithreaded applications. The ctermid_r() function is MT-Safe and should be used instead.
When compiling multithreaded applications, the _REENTRANT flag must be defined on the compile line. This flag should be used only with
multithreaded applications.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |ctermid() is Standard |
+-----------------------------+-----------------------------+
|MT-Level |ctermid() is Unsafe; cter- |
| |mid_r() is MT-Safe |
+-----------------------------+-----------------------------+
SEE ALSO ttyname(3C), attributes(5)SunOS 5.11 25 Jul 2000 ctermid(3C)
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)
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)