1 /* tty - return terminal name */
3 /* See Makefile for compilation details. */
10 #include "bashgetopt.h"
12 extern char *ttyname ();
20 reset_internal_getopt ();
22 while ((opt
= internal_getopt (list
, "s")) != -1)
38 puts (t
? t
: "not a tty");
39 return (t
? EXECUTION_SUCCESS
: EXECUTION_FAILURE
);
43 "tty writes the name of the terminal that is opened for standard",
44 "input to standard output. If the `-s' option is supplied, nothing",
45 "is written; the exit status determines whether or not the standard",
46 "input is connected to a tty.",
50 /* The standard structure describing a builtin command. bash keeps an array
51 of these structures. */
52 struct builtin tty_struct
= {
53 "tty", /* builtin name */
54 tty_builtin
, /* function implementing the builtin */
55 BUILTIN_ENABLED
, /* initial flags for builtin */
56 tty_doc
, /* array of long documentation strings. */
57 "tty [-s]", /* usage synopsis; becomes short_doc */
58 0 /* reserved for internal use */