**********************************************************************
*
* Function:
* --------
*
* This routine is attach_exec()ed to or spawn()ed to from a
* non-superuser caller (unless UID 0 is logging on).
*
* It receives an open master and slave pseudo-TTY pair as input.
* It sets up file descriptors 0/1/2 as usual, sets up several
* environment variables, fork/exec()s /bin/fomtlinc to do the utmpx
* recording, and than exec()s to the shell.
*
* Parameters:
* ----------
*
* 1:IN argc -- usual main() parameter
*
* = 17 -- normal version
*
*
*
* 2:IN argv -- usual main() parameter
*
* note: all arguments are the usual NULL-terminated C/370
* strings
*
* max
* len argument description
* --- -------- -------------------------------------------
*
* 15 argv[0] = program name
*
* "fomtlinp"
*
*
* 16 argv[1] = magic number string (to prevent accidental
* invocation from shell command line)
*
* "*4OurhrEa)R0,H/h" (required value)
* 47 argv[2] = message catalog name for catopen()
*
* Empty string means use the default message
* catalog ="fomcmcat.cat".
*
* catopen() will supply the full path
* name by looking at any inherited settings
* for LC_MESSAGES, NLSPATH, etc. (note that
* catopen() is issued with the NL_CAT_LOCALE
* parameter.)
*
* -- argv[3] = message catalog set for catopen()
*
* "0" means to use the default catalog set,
* which is 2
*
*
* -- argv[4] = master pseudo-TTY file descriptor
*
* The correct value is required, if the master
* TTY file descriptor is open in the
* spawned process. If the master TTY is
* closed (perhaps because FD_CLOEXEC was set),
* this parameter must be the number of some
* closed file descriptor.
*
*
* -- argv[5] = slave pseudo-TTY file descriptor
*
* (correct value is required -- must be open)
*
*
* -- argv[6] = highest used file descriptor
*
* (This value is used only if fcntl(F_CLOSFD)
* fails (perhaps because one of the file
* descriptors was opened by an authorized
* program, etc.). fomtlinp will then close
* (one-by-one) all file descriptors from 3 to
* argv[6] + argv[7] onclusive.)
*
* This argument should not be needed by anyone
* other than the TSO/E OMVS command.
* -- argv[7] = extra file descriptors to close
*
* (This value is used only if fcntl(F_CLOSFD)
* fails (perhaps because one of the file
* descriptors was opened by an authorized
* program, etc.). fomtlinp will then close
* (one-by-one) all file descriptors from 3 to
* argv[6] + argv[7] inclusive.)
*
* This argument should not be needed by anyone
* other than the TSO/E OMVS command.
* -- argv[8] = debug level
*
* controls whether or not (hidden) debug
* messages are sent to the TTY slave file
* descriptor or STDERR (after it has been
* set up). These messages contain debug
* information, but are backspaced over and
* overwritten with blanks, so they would not
* usually appear on the screen. They will
* appear in traces, etc. This option is
* meant to work in conjunction with TSO/E
* OMVS command debug mode.
*
* 0 = don't do any debug recording
* 1 = don't do any debug recording
* 2 = don't do any debug recording
* 3 = don't do any debug recording
*
* 4 = do debug recording, with overwriting
* to hide message on display screen
*
* 5 = do debug recording, but don't try to
* overwrite the debug text on the screen
*
* 6 = do debug recording to syslog
* -- argv[9] = screen width for debug messages
*
* This value should be set to the width of
* the display screen, if the debug level is
* set to 4. It is used when backspacing and
* erasing the debug messages.
*
* This value may be set to 0, if the debug
* level is not 4.
*
*
* 31 argv[10] = remote hostname (or null) -- only 15
* bytes of this will fit into the utmpx
* entry
* 255 argv[11] = text for TERM environment variable
*
* TERM is not set, if this is an empty
* string ("").
*
*
* 15 argv[12] = text for ROWS environment variable
*
* ROWS is not set, if this is an empty
* string ("").
*
*
* 15 argv[13] = text for COLUMNS environment variable
*
* COLUMNS is not set, if this is an empty
* string ("").
* 47 argv[14] = path name for SETUID utmpx recording
* routine
*
* Empty string ("") means use the default
* path, which is "/bin/fomtlinc"
*
*
* 15 argv[15] = program name for SETUID utmpx recording
* routine
*
* Empty string ("") means use the default
* program, which is "fomtlinc"
*
*
* -- argv[16] = SIGCHLD reset flag
*
* 1 = SIGCHLD will be reset to the default
* handling (This value should seldom
* (if ever) be needed -- the main
* purpose in the past was to be sure
* that NOCLDSTOP was off.)
*
* 0 = SIGCHLD handling will not be changed
*
* Other expected input conditions:
* -------------------------------
*
* 1) Slave TTY must be open, with no controlling terminal
* established yet.
*
*
* 2) All signals (except perhaps SIGCHLD) should be in their
* default handling state, before this routine is called.
* It is OK for signals to be blocked when this routine is
* called, however.
*
* 3) Any environment variables other than NLSPATH, LC_SYNTAX,
* LC_MESSAGES, LC_CTYPE, and LC_COLLATE will be passed through
* to the invoked shell. The environment variables named here
* will be gotten rid of before the shell is called. They
* will control message catalog processing before the shell is
* invoked.
*
* 4) Little validity checking is done on the parameters, which
* are expected to be correct. This command is not designed to
* be run from the shell command line.
*
*
*
* Return Value: Does not return to caller
* ------------
*
*
* Non-returning Exits: Does not return to caller
* -------------------