Category : UNIX Files
Archive   : GETPS202.ZIP
Filename : GETPS202.TAR

 
Output of file : GETPS202.TAR contained in archive : GETPS202.ZIP

getty_ps/ 755 144 0 0 5232346037 11173 5ustar stevewheelgetty_ps/pat.Configure 640 144 0 5525 5232346037 13705 0ustar stevewheelThis is an unofficial patch to getty 2.0. It corrects a problem in
which Configure doesn't create a shell script called Cppsym that it
needs to determine predefined symbols in your C-preprocessor.

Apply using "patch -p0 < this_file"

*** /tmp/,RCSt1000540 Mon Oct 8 21:04:07 1990
--- Configure Mon Oct 8 20:59:59 1990
***************
*** 8,14 ****
# and edit it to reflect your system. Some packages may include samples
# of config.h for certain machines, so you might look for one of those.)
#
! # $Id: Configure,v 2.0 90/09/19 19:23:44 paul Rel $
#
# Yes, you may rip this off to use in other distribution packages.
# (Note: this Configure script was generated automatically. Rather than
--- 8,14 ----
# and edit it to reflect your system. Some packages may include samples
# of config.h for certain machines, so you might look for one of those.)
#
! # $Id: Configure,v 2.0.1.1 90/10/08 20:54:32 paul Exp $
#
# Yes, you may rip this off to use in other distribution packages.
# (Note: this Configure script was generated automatically. Rather than
***************
*** 15,20 ****
--- 15,23 ----
# working with this copy of Configure, you may wish to get metaconfig.)
#
# $Log: Configure,v $
+ # Revision 2.0.1.1 90/10/08 20:54:32 paul
+ # patch1: Included missing text that created the Cppsym shell script.
+ #
# Revision 2.0 90/09/19 19:23:44 paul
# Initial 2.0 release
#
***************
*** 656,662 ****
--- 659,721 ----
EOM
fi

+ : get C preprocessor symbols handy
+ echo " "
+ echo $attrlist | $tr '[ - ]' '[\012-\012]' >Cppsym.know
+ $cat <Cppsym
+ $startsh
+ case "\$1" in
+ -l) list=true
+ shift
+ ;;
+ esac
+ unknown=''
+ case "\$list\$#" in
+ 1|2)
+ for sym do
+ if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
+ exit 0
+ elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
+ :
+ else
+ unknown="\$unknown \$sym"
+ fi
+ done
+ set X \$unknown
+ shift
+ ;;
+ esac
+ case \$# in
+ 0) exit 1;;
+ esac
+ echo \$* | $tr '[ - ]' '[\012-\012]' | $sed -e 's/\(.*\)/\\
+ #ifdef \1\\
+ exit 0; _ _ _ _\1\\ \1\\
+ #endif\\
+ /' >/tmp/Cppsym\$\$
+ echo exit 1 >>/tmp/Cppsym\$\$
+ $cppstdin $cppminus /tmp/Cppsym2\$\$
+ case "\$list" in
+ true) awk 'NF > 5 {print substr(\$6,2,100)}' + *)
+ sh /tmp/Cppsym2\$\$
+ status=\$?
+ ;;
+ esac
+ $rm -f /tmp/Cppsym\$\$ /tmp/Cppsym2\$\$
+ exit \$status
+ EOSS
+ chmod +x Cppsym
+ $eunicefix Cppsym
+ echo "Your C preprocessor defines the following symbols:"
+ Cppsym -l $attrlist >Cppsym.true
+ cat Cppsym.true
+ rmlist="$rmlist Cppsym Cppsym.know Cppsym.true"
+
: see what memory models we can support
+ if Cppsym M_I8086 M_I186 M_I286; then
+ models='small medium large huge'
+ fi
case "$models" in
'')
: We may not use Cppsym or we get a circular dependency through cc.
getty_ps/man/ 755 144 0 0 5211026352 11736 5ustar stevewheelgetty_ps/man/README 644 144 0 3547 5200627323 12712 0ustar stevewheel
Getty 2.0 manual page files.

This README describes the files used and created by the Makefile.

In general, a file with a `.m4' extension is nroff source intersperced
with m4 macros. These files are processed by m4 to yield nroff-able
files, and use the macros to create man pages whose content matches the
way you've configured your getty/uugetty executables. Running m4 on
the .m4 files produce ready-for-nroff files with either a `.1m', `.3'
or `.4' extension, depending upon the chapter to which the man page
belongs. The makefile will also run nroff on these files, producing
files with a `.man' extension, by saying "make man".

After running make in this directory, you will have the following files:

getty.1m nroff-ready man page for getty
getty.man nroff'd getty man page
gettytab.4 * nroff-ready man page for the gettytab file
gettytab.man * nroff'd gettytab man page
issue.4 nroff-ready man page for the issue file
issue.man nroff'd issue man page

* Note: the name `gettytab' will be replaced by the actual name you
assigned for that file -- usually `gettydefs'.

Also, you may have some (or all) of the following files, depending upon
the configuration of your Unix/Xenix. These files describe library
routines used by getty that were not found in your libc.a (and thus
homegrown versions were used):

getutent.3 nroff-ready man page for getutent(3)
getutent.man nroff'd getutent man page
strdup.3 nroff-ready man page for strdup(3)
strdup.man nroff'd strdup man page
putenv.3 nroff-ready man page for putenv(3)
putenv.man nroff'd putenv man page

You will need to manually install the man pages. Use either the .{1m,3,4}
(pre-nroff) or .man (post-nroff) files, according to the needs of your
system.

- paul

INTERNET: [email protected] | How many whales do you have to
UUCP: ...!rutgers!devon!paul | save to get a toaster?
getty_ps/man/getty.m4 644 144 0 52607 5200631241 13443 0ustar stevewheel.\" +----------
.\" | $Id: getty.m4,v 2.0 90/09/19 20:11:33 paul Rel $
.\" |
.\" | GETTY/UUGETTY man page.
.\" |
.\" | Copyright 1989,1990 by Paul Sutcliffe Jr.
.\" |
.\" | Permission is hereby granted to copy, reproduce, redistribute,
.\" | or otherwise use this software as long as: there is no monetary
.\" | profit gained specifically from the use or reproduction or this
.\" | software, it is not sold, rented, traded or otherwise marketed,
.\" | and this copyright notice is included prominently in any copy
.\" | made.
.\" |
.\" | The author make no claims as to the fitness or correctness of
.\" | this software for any use whatsoever, and it is provided as is.
.\" | Any use of this software is at the user's own risk.
.\" |
.\"
.\" +----------
.\" | $Log: getty.m4,v $
.\" | Revision 2.0 90/09/19 20:11:33 paul
.\" | Initial 2.0 release
.\" |
.\" |
.\"
.\" +----------
.\" | M4 configuration
.\"
include(config.m4).\"
.\"
.\" define(`_gtab_file_', _gtab_`_file')
.\"
.\" +----------
.\" | Manpage source follows:
.\"
.TH GETTY _mcmd_section_ "DATE" "Release RELEASE"
.SH NAME
getty \- sets terminal mode, speed, and line discipline
.SH SYNOPSIS
.B /etc/getty
.\" +----------
.\" | M4_start (trs16)
ifdef(`trs16',
.B speed
.I [defaults_file],
.\" | else (trs16)
[\-d
.I defaults_file]
[\-a] [\-h] [\-r
.I delay]
[\-t
.I timeout]
[\-w
.I waitfor]
.B line
.I [speed [type [lined]]])
.\" | M4_end (trs16)
.\" +----------
.br
.B /etc/getty \-c
.I _gtab_file_
.SH DESCRIPTION
.I Getty
is the second of the three programs
.IR (init (_mcmd_section_),
.IR getty (_mcmd_section_),
and
.IR login (_mcmd_section_)),
used by the
.\" +----------
.\" | M4_start
ifdef(`M_XENIX', XENIX, .\")
ifdef(`XENIX', XENIX, .\")
ifdef(`UNIX', UNIX, .\")
.\" | M4_end
.\" +----------
system to allow users to login.
.I Getty
is invoked by
.IR init (_mcmd_section_)
to:
.br
.TP 3
1.
Open tty lines and set their modes.
.TP
2.
Print the login prompt, and get the user's name.
.TP
3.
Initiate a login process for the user.
.P
The actual procedure that
.I getty
follows is described below: Initially,
.I getty
parses its command line. If no errors are found,
.I getty
scans the defaults file (normally
.BR _defaults_`/getty' )
to determine certain runtime values. The values in the defaults file
(whose compiled\-in name can be altered with the optional
.\" +----------
.\" | M4_start (trs16)
ifdef(`trs16', .\", .B \-d)
.\" | M4_end (trs16)
.\" +----------
.I defaults_file
argument) take precedence to those on the command line.
.I Getty
then opens the
.I line
for reading and writing, and disables stdio buffering.
.\" +----------
.\" | M4_start (logutmp)
ifdef(`logutmp',
The
.IR utmp (_file_section_)
and
.IR wtmp (_file_section_)
(if it exists) files are updated to indicate a LOGIN_PROCESS.,
.\" | else (logutmp)
.\")
.\" | M4_end (logutmp)
.\" +----------
If an initialization was specified, it is performed (see LINE
INITIALIZATION).
.PP
Next,
.I getty
types the
.\" +----------
.\" | M4_start (issue)
ifdef(`_issue_',
issue `(or login banner,' usually from
.BR _issue_ `)'
and,
.\" | else (issue)
.\")
.\" | M4_end (issue)
.\" +----------
login prompt. Finally,
.I getty
reads the user's login name and invokes
.IR login (_mcmd_section_)
with the user's name as an argument. While reading the name,
.I getty
attempts to adapt the system to the speed of the terminal being used,
and also sets certain terminal parameters (see
.\" +----------
.\" | M4_start (trs16)
ifdef(`trs16',
.IR tty `('_misc_section_`))',
.\" | else (trs16)
.IR termio `('_misc_section_`))')
.\" | M4_end (trs16)
.\" +----------
to conform with the user's login procedure.
.PP
The tty device used by
.I getty
is determined by
.\" +----------
.\" | M4_start (trs16)
ifdef(`trs16',
a call to
.IR ttyname (S)`,'
which sets the
.I line
value.,
.\" | else (trs16)
the
.I line
argument.)
.\" | M4_end (trs16)
.\" +----------
.I Getty
uses the string
.BI /dev/ line
as the name of the device to attach itself to. Unless
.I getty
is invoked with the
.B \-h
flag (or
.B HANGUP=NO
is specified in the defaults file), it will force a hangup on the line
by setting the speed to zero. Giving
.B \-r
.I delay
on the command line (or using
.B WAITCHAR=YES
and
.BI DELAY= delay
in the defaults file) will cause
.I getty
to wait for a single character from the line, and then to wait
.I delay
seconds before continuing. If no delay is desired, use
.BR \-r0 .
Giving
.B \-w
.I waitfor
on the command line (or using
.BI WAITFOR= waitfor
in the defaults file) will cause
.I getty
to wait for the specified string of characters from the line
before continuing. Giving
.B \-t
.I timeout
on the command line (or using
.BR TIMEOUT= timeout
in the defaults file) will cause
.I getty
to exit if no user name is accepted within
.I timeout
seconds after the login prompt is typed.
.PP
The
.I speed
argument is a label to a entry in the
.B _gettytab_
file (see
.IR _gtab_ `('_file_section_)).
This entry defines to
.I getty
the initial speed (baud rate) and tty settings, the login prompt to be
used, the final speed and tty settings, and a pointer to another entry
to try should the user indicate that the speed is not correct. This
is done by sending a
.I
character (actually sequence). Under certain conditions, a
carriage\-return will perform the same function. This is usually the
case when getty is set to a higher speed than the modem or terminal.
.I Getty
scans the _gtab_ file sequentially looking for a matching entry.
.\" +----------
.\" | M4_start (trs16)
ifdef(`trs16',
If an entry for the given
.I speed,
.\" | else (trs16)
If no
.I speed
was given or the entry)
.\" | M4_end (trs16)
.\" +----------
cannot be found, the first entry in the
.B _gettytab_
file is used as a default. In the event that the _gtab_ file cannot be
accessed`,' there is a compiled\-in default entry that is used.
.PP
.\" +----------
.\" | M4_start (trs16)
ifdef(`trs16',
The terminal type is determined by examining the
.I ttytype
file`,' using the value associated with
.I line.
.I Getty
uses this value to determine how to clear the video display.,
.\" | else (trs16)
The
.I type
argument is a string which names the type of terminal attached to the
line. The
.I type
should be a valid terminal name listed in the
.\" +----------
.\" | M4_start (termcap)
ifdef(`termcap',
.BR termcap (_misc_section_),
.\" | else (termcap)
.BR terminfo (_misc_section_))
.\" | M4_end (termcap)
.\" +----------
database.
.\" +----------
.\" | M4_start (ttytype)
ifdef(`ttytype',
If no
.I type
is given on the command line`,' one is deduced from the
.B ttytype
file.,
.\" | else (ttytype)
.\")
.\" | M4_end (ttytype)
.\" +----------
.I Getty
uses this value to determine how to clear the video display.
.PP
The
.I lined
argument is a string describing the line discipline to use on the
line. The default is
.BR LDISC0 .)
.\" | M4_end (trs16)
.\" +----------
.PP
As mentioned,
.I getty
types the login prompt and then reads the user's login name. If a
null character is received, it is assumed to be the result of the user
pressing the
.I
key or the carriage\-return key to indicate the speed is wrong. This
causes
.I getty
to locate the next
.I speed
in the series (defined in _gettytab_).
.PP
The user's name is terminated by a new\-line or carriage\-return
character. A carriage\-return results in the system being set to map
those to new\-lines (see
.IR ioctl (_system_section_)).
.PP
The user's name is scanned to see if it contains only upper\-case
characters. If so,
.\" +----------
.\" | M4_start (warncase)
ifdef(`warncase',
a warning is issued to the user to retry his login`,' using lower\-case
if possible. If the second attempt is still all upper\-case`,',
.\" | else (warncase)
.\")
.\" | M4_end (warncase)
.\" +----------
the system is set to map any future upper\-case characters into
lower\-case.
.PP
A check option is provided for testing the _gtab_ file. When
.I getty
is invoked with the
.BI \-c _gtab_
option, it scans the named
.I _gtab_
file and prints out (to the standard output) the values it sees. If
any parsing errors occur (due to errors in the syntax of the _gtab_
file), they are reported.
.SH "DEFAULTS FILE"
During its startup,
.I getty
looks for the file
.BI _defaults_`/getty' .line,
(or, if it cannot find that file, then
.BR _defaults_`/getty' ),
and if found, reads the contents for lines of the form

.in +.5i
NAME=\fIvalue\fR
.in -.5i

This allows getty to have certain features configurable at runtime,
without recompiling. The recognized NAME strings, and their
corresponding values, follows:
.TP 6
SYSTEM=\fIname\fR
Sets the nodename value (displayed by
.B @S
\-\- see PROMPT SUBSTITUTIONS) to
.IR name .
The default is the
.I nodename
value returned by the
.IR uname (_library_section_)
call. On XENIX systems, if the value of nodename is a zero\-length
string, the file
.B /etc/systemid
is examined to get the nodename.
Note that some sites may have elected to compile the nodename value
into
.IR getty .
.TP
VERSION=\fIstring\fR
Sets the value that is displayed by the
.B @V
parameter (see PROMPT SUBSTITUTIONS) to
.I string.
There is no default value. If
.I string
begins with a '/' character, it is assumed to be the full pathname of a
file, and
.B @V
is set to be the contents of that file.
.TP
LOGIN=\fIname\fR
Sets the name of the login program to
.I name.
The default is
.B _login_
(see
.IR login (_mcmd_section_)).
If used,
.I name
must be the full pathname of the program that
.I getty
will execute instead of
.BR _login_ .
Note that this program is called, as is
.BR _login_ ,
the with the user's name as its only argument.
.TP
INIT=\fIstring\fR
If defined,
.I string
is an expect/send sequence that is used to initialize the line before
.I getty
attempts to use it. This string is in a form resembling that used in
the
.I _systems_
file of
.IR uucp (_cmd_section_).
For more details, see LINE INITIALIZATION. By default, no
initialization is done.
.\" +----------
.\" | M4_start (issue)
ifdef(`_issue_',
.TP
ISSUE=\fIstring\fR
During startup`,'
.I getty
defaults to displaying`,' as an issue or login banner`,' the contents of
the
.B _issue_
file. If ISSUE is defined to a
.I string`,'
that string is typed instead. If
.I string
begins with a '/' character`,' it is assumed to be the full pathname of
a file`,' and that file is used instead of
.BR _issue_ .,
.\" | else (issue)
.\")
.\" | M4_end (issue)
.\" +----------
.TP
CLEAR=\fIvalue\fR
If
.I value
is
.BR NO ,
then
.I getty
will not attempt to clear the video screen before typing the
.\" +----------
.\" < M4_start (issue)
ifdef(`_issue_',
issue or login prompts.,
.\" | else (issue)
login prompt.)
.\" | M4_end (issue)
.\" +----------
The default is to clear the screen.
.TP
HANGUP=\fIvalue\fR
If
.I value
is
.BR NO ,
then
.I getty
will NOT hangup the line during its startup. This is analogus to
giving the
.B \-h
argument on the command line.
.TP
WAITCHAR=\fIvalue\fR
If
.I value
is
.BR YES ,
then
.I getty
will wait for a single character from it's line before continuing.
This is useful for modem connections where the modem has CD forced
high at all times, to keep getty from endlessly chatting with the
modem.
.TP
DELAY=\fIseconds\fR
Used in conjunction with
.BR WAITCHAR ,
this adds a time delay of
.I seconds
after the character is accepted before allowing
.I getty
to continue. Both
.B WAITCHAR
and
.B DELAY
have the same effect as specifying
.BI \-r delay
on the command line.
If
.B WAITCHAR
is given without a
.BR DELAY ,
the result is equal to having said
.B \-r0
on the command line.
The default is to not wait for a character.
.TP
TIMEOUT=\fInumber\fR
As with the
.B \-t
.I timeout
command line argument, tells
.I getty
to exit if no user name is accepted before the
.I number
of seconds elapse after the login prompt is typed.
The default is to wait indefinetly for the user name.
.TP
CONNECT=\fIstring\fR
If defined,
.I string
should be an expect/send sequence (like that for INIT) to direct
.I getty
in establishing the connection.
.I String
may be defined as
.BR DEFAULT ,
which will substitute the built\-in string:

.in +.5i
.nf
_connect_
.fi
.in -.5i

The \\A escape marks the place where the digits showing the speed
will be seen. See CONNECTION AND AUTOBAUDING for more details.
The default is to not perform a connection chat sequence.
.TP
WAITFOR=\fIstring\fR
This parameter is similar to WAITCHAR, but defines a string of
characters to be waited for.
.I Getty
will wait until
.I string
is received before issuing the login prompt.
This parameter is best used when combined with CONNECT, as in
this example:

.in +.5i
.nf
WAITFOR=RING
CONNECT="" ATA\\r CONNECT\\s\\A
.fi
.in -.5i

This would cause
.I getty
to wait for the string
.BR RING ,
then expect nothing, send
.B ATA
followed by a carriage\-return, and then wait for a string such as
.BR "CONNECT 2400" ,
in which case,
.I getty
would set itself to 2400 baud.
The default is not to wait for any string of characters.
.TP
ALTLOCK=\fIline\fR
.I Uugetty
uses this parameter to lock an alternate device, in addition to the
one it is attached to. This is for those systems that have two
different device names that refer to the same physical port; e.g.
/dev/tty1A vs. /dev/tty1a, where one uses modem control and the
other doesn't. See the section on UUGETTY for more details.
The default is to have no alternate lockfile.
.P
The name of the defaults file can be changed by specifying
.\" +----------
.\" | M4_start (trs16)
ifdef(`trs16',
.\" Nothing,
.\" | else (trs16)
.B \-d)
.\" | M4_end (trs16)
.\" +----------
.I defaults_file
on the command line. If
.I defaults_file
begins with a slash, it is assumed to be a complete pathname of the
defaults file to be used. Otherwise, it is assumed to be a regular
filename, causing
.I getty
to use the pathname
.BI _defaults_ `/defaults_file.'
.SH "PROMPT SUBSTITUTIONS"
When
.I getty
is typing
.\" +----------
.\" | M4_start (issue)
ifdef(`_issue_',
the issue or login banner (ususally
.BR _issue_ )`,'
or,
.\" | else (issue)
.\")
.\" | M4_end (issue)
.\" +----------
the
.I login\-prompt,
it recognizes several escape (quoted) characters. When one of these
quoted characters is found, its value is substituted in the output
produced by
.I getty.
Recognized escape characters are:
.br
.TP 6
\\\\\\\\\\\\\\\\
Backslash (\\).
.TP
\\\\\\\\b
Backspace (^H).
.TP
\\\\\\\\c
Placed at the end of a string, this prevents a new\-line from
being typed after the string.
.TP
\\\\\\\\f
Formfeed (^L).
.TP
\\\\\\\\n
New\-line (^J).
.TP
\\\\\\\\r
Carriage\-return (^M).
.TP
\\\\\\\\s
A single space (' ').
.TP
\\\\\\\\t
Horizontal tab (^I).
.TP
\\\\\\\\\fInnn\fR
Outputs the ASCII character whose decimal value is
.IR nnn .
If
.I nnn
begins with 0, the value is taken to be in octal. If it begins
with 0x, the value is taken to be in hexidecimal.
.P
In addition, a single backslash at the end of a line causes the
immediately following new\-line to be ignored, allowing continuation
lines.
.PP
Also, certain
.BI "@" char
parameters are recognized. Those parameters, and the value that is
substituted for them are:
.TP 6
@B
The current (evaluated at the time the
.B @B
is seen) baud rate.
.TP
@D
The current date, in MM/DD/YY format.
.TP
@L
The
.I line
to which
.I getty
is attached.
.TP
@S
The system node name.
.TP
@T
The current time, in HH:MM:SS (24-hour) format.
.TP
@U
The number of currently signed\-on users. This is a count of the
number of entries in the
.I _utmp_
file
.\" +----------
.\" | M4_start (logutmp)
ifdef(`logutmp',
whose ut_type field is USER_PROCESS.,
.\" | else (logutmp)
that have a non\-null ut_name field.)
.\" | M4_end (logutmp)
.\" +----------
.TP
@V
The value of
.BR VERSION ,
as given in the defaults file.
.P
To display a single '@' character, use either '\\@' or '@@'.
.SH "LINE INITIALIZATION"
One of the greatest benefits (in the author's opinion, at least) is
the ability of
.I getty
to initialize its line before use. This will most likely be done on
lines with modems, not terminals, although initializing terminals is
not out of the question.
.PP
Line initialization is performed just after the
.I line
is opened and prior to handling the WAITCHAR and/or WAITFOR options.
Initialization is accomplished by placing an

.in +.5i
INIT=\fIstring\fR
.in -.5i

line in the defaults file.
.I String
is a series of one or more fields in the form

.in +.5i
expect [ send [ expect [ send ] ] ... ]
.in -.5i

This format resembles the expect/send sequences used in the UUCP
.I _systems_
file, with the following exception:
A carriage return is NOT appended automatically to sequences that
are 'sent.' If you want a carriage\-return sent, you must explicitly
show it, with '\\r'.
.PP
.I Getty
supports subfields in the expect field of the form

.in +.5i
expect[\-send\-expect]...
.in -.5i

as with UUCP. All the escape characters (those beginning with a '\\'
character) listed in the PROMPT SUBSTITUTIONS section are valid in
the send and expect fields.
In addition, the following escape characters are recognized:
.br
.TP 6
\\\\\\\\p
Inserts a 1\-second delay.
.TP
\\\\\\\\d
Inserts a 2\-second delay.
.TP
\\\\\\\\K
Sends a .25\-second Break.
.TP
\\\\\\\\T\fInnn\fR
Modifies the default timeout (usually 30 seconds) to
the value indicated by
.IR nnn .
The value
.I nnn
may be decimal, octal, or hexidecimal; see the usage of
\fB\\\fInnn\fR in PROMPT SUBSTITUTIONS.
.P
Note that for these additional escape characters, no actual
character is sent.
.SH "CONNECTION AND AUTOBAUDING"
.I Getty
will perform a chat sequence establish a proper connection.
The best use of this feature is to look for the
.B CONNECT
message sent by a modem and set the line speed to the number given
in that message (e.g. CONNECT 2400).
.PP
The format for the connect chat script is exactly the same as that
for the INIT script (see LINE INITIALIZATION), with the following
addition:
.br
.TP 6
\\\\\\\\A
Marks the spot where the baud rate will be seen. This mark will
match any and all digits 0\-9 at that location in the script, and
set it's speed to that value, if possible.
.P
Autobauding, therefore, is enabled by placing the
.B \\\\A
mark in the chat script. For example, the definition:

.in+.5i
CONNECT=CONNECT\\s\\A
.in-.5i

would match the string
.B "CONNECT 1200"
and cause
.I getty
to set it's baud rate to 1200, using the following steps:
.TP 3
1.
Having matched the value 1200,
.I getty
will attempt to find an entry with the label
.B 1200
in the
.B _gtab_
file. If a matching _gtab_ entry is found, those values are
used. If there is no match, then
.TP
2.
The _gtab_ values currently in use are modified to use the
matched speed (e.g. 1200). However, if the matched speed
is invalid, then
.TP
3.
.I Getty
logs a warning message and resumes normal operation. This
allows the practice of toggling through linked entries in the
_gtab_ file to behave as expected.
.P
.SH UUGETTY
.I Uugetty
has identical behavior to
.I getty,
except that
.I uugetty
is designed to create and use the lock files maintained by the UUCP
family
.IR (uucp (_cmd_section_),
.IR cu (_cmd_section_)
and others). This prevents two or more processes from having conficting
use of a tty line.
.PP
When
.I uugetty
starts up, if it sees a lock file on the line it intends to use,
it will use the pid in the lock file to see if there is an active
process holding the lock. If not,
.I uugetty
will remove the lock file and continue. If a valid process is found,
.I uugetty
will sleep until that process releases the lock and then it will exit,
forcing
.IR init (_mcmd_section_)
to spawn a new
.I uugetty.
Once no conflicting process is found,
.I uugetty
grabs the
.I line
by creating the lock file itself before issuing the login prompt.
This prevents other processes from using the line.
.PP
.I Uugetty
will normally only lock the name of the line it is running on. On
systems where there are two device names referring to the same port
(as is the case where one device uses modem control while the other
doesn't), place a line of the form

.in +.5i
ALTLOCK=\fIline\fR
.in -.5i

line in the defaults file. For instance, if
.I uugetty
is on
.I /dev/tty1a,
and you want to have it lock
.I /dev/tty1A
also, use the line
.B ALTLOCK=tty1A
in the defaults file.
.SH FILES
.TP 16
_console_
The device to which errors are reported.
.\" +----------
.\" | M4_start (trymail)
ifdef(`trymail',
If the device is for some reason unavailable (cannot be written to)`,'
a mail message containing the error is sent to the user
.BR _notify_ .,
.\" | else (trymail)
.\")
.\" | M4_end (trymail)
.\" +----------
.TP
_defaults_`/getty[\fI.line\fR]'
Contains the runtime configuration. Note that
.I uugetty
uses _defaults_`/uugetty[\fI.line\fR].'
.TP
_gettytab_
Contains speed and tty settings to be used by
.I getty.
.\" +----------
.\" | M4_start (issue)
ifdef(`_issue_',
.TP
_issue_
The default issue (or login banner).
.\" | else (issue)
.\")
.\" | M4_end (issue)
.\" +----------
.TP
_login_
The default login program called after the user's name is entered.
.\" +----------
.\" | M4_start (ttytype)
ifdef(`ttytype',
.TP
_ttytype_
Contains the terminal types for each line in the system.,
.\" | else (ttytype)
.\")
.\" | M4_end (ttytype)
.\" +----------
.P
.SH "SEE ALSO"
init(_mcmd_section_),
login(_mcmd_section_),
uucp(_cmd_section_),
ioctl(_system_section_),
uname(_library_section_),
.\" +----------
.\" | M4_start (issue)
ifdef(`issue',
issue`('_file_section_`)',
.\" | else (issue)
.\")
.\" | M4_end (issue)
.\" +----------
_gtab_`('_file_section_),
utmp(_file_section_),
.\" +----------
.\" | M4_start (trs16)
ifdef(`trs16',
tty`('_misc_section_`)',
.\" | else (trs16)
termio`('_misc_section_`)')
.\" | M4_end (trs16)
.\" +----------
.SH AUTHOR
.nf
Paul Sutcliffe, Jr.
UUCP: ...!rutgers!devon!paul
.br

Autobauding routines adapted from code submitted by
Mark Keating <...!utzoo!censor!markk>
getty_ps/man/gettytab.m4 644 144 0 11661 5200631247 14133 0ustar stevewheel.\" +----------
.\" | $Id: gettytab.m4,v 2.0 90/09/19 20:12:26 paul Rel $
.\" |
.\" | GETTYTAB man page.
.\" |
.\" | Copyright 1989,1990 by Paul Sutcliffe Jr.
.\" |
.\" | Permission is hereby granted to copy, reproduce, redistribute,
.\" | or otherwise use this software as long as: there is no monetary
.\" | profit gained specifically from the use or reproduction or this
.\" | software, it is not sold, rented, traded or otherwise marketed,
.\" | and this copyright notice is included prominently in any copy
.\" | made.
.\" |
.\" | The author make no claims as to the fitness or correctness of
.\" | this software for any use whatsoever, and it is provided as is.
.\" | Any use of this software is at the user's own risk.
.\" |
.\"
.\" +----------
.\" | $Log: gettytab.m4,v $
.\" | Revision 2.0 90/09/19 20:12:26 paul
.\" | Initial 2.0 release
.\" |
.\" |
.\"
.\" +----------
.\" | M4 configuration
.\"
include(config.m4).\"
.\"
.\" define(`_temp_', maketemp(m4bXXXXX))
.\" syscmd(echo _gtab_ | tr "[a-z]" "[A-Z]" | tr -d "\012" > _temp_)
.\" define(`_GTAB_', include(_temp_))
.\" syscmd(rm -f _temp_)
.\"
.\" +----------
.\" | Manpage source follows:
.\"
.TH _GTAB_ _file_section_
.SH NAME
_gtab_ \- speed and tty settings used by getty
.SH DESCRIPTION
The file
.B _gettytab_
contains information used by
.IR getty (_mcmd_section_)
to set up the speed and tty settings for a line. It supplies
information on what the
.I login-prompt
should look like. It also supplies the speed to try next if
the user indicates the current speed is not correct by typing a
.I
character.
.PP
Each entry in
.B _gettytab_
has the following format:

.in +.2i
.ll 7.5i
label# initial-flags # final-flags # login-prompt #next-label
.ll
.in -.2i

Each entry is followed by a blank line. Lines that begin with
.B \#
are ignored and may be used to comment the file. The various
fields can contain quoted characters of the form
\fB\\b\fR, \fB\\n\fR, \fB\\c\fR, etc., as well as \fB\\\fInnn\fR,
where
.I nnn
is the octal value of the desired character. The various fields are:
.TP 16
.I label
This is the string against which
.I getty
tries to match its second argument. It is often the speed, such as
.BR 1200 ,
at which the terminal is supposed to run, but it needn't be (see below).
.TP
.I initial-flags
These flags are the initial
.IR ioctl (_system_section_)
settings to which the terminal is to be set if a terminal type is
not specified to
.IR getty .
.I Getty
understands the symbolic names specified in
.B /usr/`include'/termio.h
(see
.\" +----------
.\" | M4_start (trs16)
ifdef(`trs16',
.IR tty `('_misc_section_`)).',
.\" | else (trs16)
.IR termio `('_misc_section_`)).')
.\" | M4_end (trs16)
.\" +----------
Normally only the speed flag is required in the
.I initial-flags
field.
.I Getty
automatically sets the terminal to raw input mode and takes care of
most of the other flags. The
.I initial-flag
settings remain in effect until
.I getty
executes
.IR login (_mcmd_section_).
.TP
.I final-flags
These flags take the same values as the
.I initial-flags
and are set just prior to
.I getty
executes
.BR _login_ .
The speed flag is again required. The composite flag
.B SANE
takes care of most of the other flags that need to be set so that
the processor and terminal are communicating in a rational fashion.
The other two commonly specified
.I final-flags
are
.BR TAB3 ,
so that tabs are sent to the terminal as spaces, and
.BR HUPCL ,
so that the line is hung up on the final close.
.TP
.I login-prompt
This entire field is printed as the
.IR login-prompt .
Unlike the above fields where white space is ignored (a space,
tab or new-line), they are included in the
.I login-prompt
field.

The
.I login-prompt
may contain various
.BI @ char
and
\fB\\\fIchar\fR
parameters. These are described in full in the
.IR getty (_mcmd_section_)
section PROMPT SUBSTITUTIONS.
.TP
.I next-label
This indicates the next
.I label
of the entry in the table that
.I getty
should use if the user types a
.I
or the input cannot be read. Usually, a series of speeds are linked
together in this fashion, into a closed set. For instance,
.B 2400
linked to
.BR 1200 ,
which in turn is linked to
.BR 300 ,
which finally is linked back to
.BR 2400 .
.P
If
.I getty
is called without a
.I speed
argument, then the first entry of
.B _gettytab_
is used, thus making the first entry of
.B _gettytab_
the default entry. It is also used if
.I getty
can't find the specified
.I label.
If
.B _gettytab_
itself is missing, there is one entry built into
.I getty
which will bring up a terminal at 9600 baud.
.P
It is strongly recommended that after making or modifying
.BR _gettytab_ `,'
it be run through
.I getty
with the check (\fB\-c\fR) option to be sure there are no errors.
.SH FILES
_gettytab_
.SH "SEE ALSO"
login(_mcmd_section_),
getty(_mcmd_section_),
ioctl(_system_section_),
.\" +----------
.\" | M4_start (trs16)
ifdef(`trs16',
tty`('_misc_section_`)',
.\" | else (trs16)
termio`('_misc_section_`)')
.\" | M4_end (trs16)
.\" +----------
getty_ps/man/makeconfig 755 144 0 5705 5200631251 14054 0ustar stevewheel:
#
# $Id: makeconfig,v 2.0 90/09/19 20:13:46 paul Rel $
#
# $Log: makeconfig,v $
# Revision 2.0 90/09/19 20:13:46 paul
# Initial 2.0 release
#
#

case $CONFIG in
'')
if test ! -f config.sh; then
ln ../config.sh . || \
ln ../../config.sh . || \
ln ../../../config.sh . || \
(echo "Can't find config.sh."; exit 1)
fi
. config.sh
;;
esac
case "$0" in
*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
esac

tmp=/tmp/mc$$
rmlist="$tmp"
trap 'echo " "; $rm -f $rmlist; exit 1' 1 2 3

: where is the source
src=..
tune=$src/tune.h
release=$src/release.h

: is package complete
if $test ! -f $tune; then
echo "Can't find tune.h."
exit 1
fi

: things we can tell from tune.h
cppout=".cppout"
tuneout=".tune"
rmlist="$cppout $tuneout $rmlist"
$cppstdin -I$src -I. $cppminus <$cppout
#include <$tune>
#include <$release>
console=CONSOLE
defaults=DEFAULTS
issue=ISSUE
login=LOGIN
connect=DEF_CONNECT
#ifdef LOGUTMP
logutmp="$define"
#endif
#ifdef TRS16
trs16="$define"
#endif
#ifdef TRYMAIL
trymail="$define"
notify=NOTIFY
#endif
#ifdef WARNCASE
warncase="$define"
#endif
release=RELEASE
date=DATE
EOS
$sed 's/[ ]//' <$cppout >$tuneout
chmod +x $tuneout
. $tuneout

defaults=`$echo $defaults | $sed 's;/\%s;;'`
$sed 's;\\;\\\\;g' <$tmp
$connect
EOS
connect=`cat $tmp`

: things we cannot tell from tune.h
if $test ! -d /usr/lib/terminfo; then
termcap="$define"
fi
systems=L.sys
if $test -f /usr/lib/uucp/Systems; then
systems=Systems
fi
gtab=`basename $gettytab`

: name the man pages
case "$xenix" in
"$define")
cmd=C; mcmd=M; system=S; library=S; file=F; misc=M
;;
"$undef")
cmd=1; mcmd=1m; system=2; library=3; file=4; misc=7
;;
esac

$cat <config.m4
.\" +----------
.\" | local GETTY configurations
.\"
.\" define(\`_cmd_section_', $cmd)
.\" define(\`_mcmd_section_', $mcmd)
.\" define(\`_system_section_', $system)
.\" define(\`_library_section_', $library)
.\" define(\`_file_section_', $file)
.\" define(\`_misc_section_', $misc)
.\" define(\`_console_', $console)
.\" define(\`_defaults_', $defaults)
.\" define(\`_gettytab_', $gettytab)
.\" define(\`_gtab_', $gtab)
.\" define(\`_issue_', $issue)
.\" define(\`_login_', $login)
.\" define(\`_utmp_', $utmp)
.\" define(\`_wtmp_', $wtmp)
.\" define(\`_systems_', $systems)
.\" define(\`_connect_', $connect)
.\" define(\`RELEASE', $release)
.\" define(\`DATE', $date)
.\"
EOC

case "$logutmp" in
"$define") $cat <>config.m4
.\" define(\`logutmp')
EOC
;;
esac
case "$termcap" in
"$define") $cat <>config.m4
.\" define(\`termcap')
EOC
;;
esac
case "$trs16" in
"$define") $cat <>config.m4
.\" define(\`trs16')
EOC
;;
esac
case "$trymail" in
"$define") $cat <>config.m4
.\" define(\`trymail')
.\" define(\`_notify_', $notify)
EOC
;;
esac
case "$ttytype" in
"/*") $cat <>config.m4
.\" define(\`ttytype', $ttytype)
EOC
;;
esac
case "$warncase" in
"$define") $cat <>config.m4
.\" define(\`warncase')
EOC
;;
esac

$rm -f $rmlist
# grrr, don't ask
$rm -f $cppout
$rm -f $tuneout
getty_ps/man/getutent.m4 644 144 0 5641 5200631252 14124 0ustar stevewheel.\" +----------
.\" | $Id: getutent.m4,v 2.0 90/09/19 20:12:55 paul Rel $
.\" |
.\" | GETUTENT man page.
.\" |
.\" | Copyright 1989,1990 by Paul Sutcliffe Jr.
.\" |
.\" | Permission is hereby granted to copy, reproduce, redistribute,
.\" | or otherwise use this software as long as: there is no monetary
.\" | profit gained specifically from the use or reproduction or this
.\" | software, it is not sold, rented, traded or otherwise marketed,
.\" | and this copyright notice is included prominently in any copy
.\" | made.
.\" |
.\" | The author make no claims as to the fitness or correctness of
.\" | this software for any use whatsoever, and it is provided as is.
.\" | Any use of this software is at the user's own risk.
.\" |
.\"
.\" +----------
.\" | $Log: getutent.m4,v $
.\" | Revision 2.0 90/09/19 20:12:55 paul
.\" | Initial 2.0 release
.\" |
.\" |
.\"
.\" +----------
.\" | M4 configuration
.\"
include(config.m4).\"
.\"
.\" +----------
.\" | Manpage source follows:
.\"
.TH GETUTENT _library_section_
.SH NAME
getutent, getutline, setutent, endutent,
utmpname \- access utmp file entry
.SH SYNOPSIS
.B \#include

.B struct utmp *getutent();

.B struct utmp *getutline(\fIline\fB)\fR;
.br
.B struct utmp *\fIline\fR;

.B void setutent();

.B void endutent();

.B void utmpname(\fIfile\fB)\fR;
.br
.B char *\fIfile\fR;
.SH DESCRIPTION
.I Getutent
and
.I getutline
each return a pointer to a structure of the following type:
.nf

struct utmp {
char ut_line[8]; /* tty name */
char ut_name[8]; /* user id */
long ut_time; /* time on */
};

.fi
.I Getutent
reads in the next entry from a
.IR utmp \-like
file. If the file is not already open, it opens it. If it
reaches the end of file, it fails.
.PP
.I Getutline
searches forward from the current point in the
.I utmp
file until it finds an entry which has a
.I ut_line
string matching the
.I line\->ut_line
string. If the end of file is reached without a match, it fails.
.PP
.I Setutent
resets the input stream to the beginning of the file. This should be
done before each search for a new entry if it is desired that the
entire file be examined.
.PP
.I Endutent
closes the currently open file.
.PP
.I Utmpname
allows the user to change the name of the file examined, from
.B _utmp_
to any other file. It is most often expected that this other file
will be
.BR _wtmp_ .
If the file does not exist, this will not be apparent until the first
attempt to reference the file is made.
.I Utmpname
does not open the file. It just closes the old file if it is
currently open and saves the new file name.
.SH FILES
_utmp_
.br
_wtmp_
.SH BUGS
The most current entry is saved in a static structure. Multiple
accesses require that it be copied before further accesses are made.
.PP
These routines use buffered standard I/O for input.
.SH "SEE ALSO"
utmp(_file_section_)
.SH AUTHOR
.nf
Paul Sutcliffe, Jr.
UUCP: ...!rutgers!devon!paul
getty_ps/man/putenv.m4 644 144 0 4640 5200631253 13605 0ustar stevewheel.\" +----------
.\" | $Id: putenv.m4,v 2.0 90/09/19 20:14:13 paul Rel $
.\" |
.\" | PUTENV man page.
.\" |
.\" | Copyright 1989,1990 by Paul Sutcliffe Jr.
.\" |
.\" | Permission is hereby granted to copy, reproduce, redistribute,
.\" | or otherwise use this software as long as: there is no monetary
.\" | profit gained specifically from the use or reproduction or this
.\" | software, it is not sold, rented, traded or otherwise marketed,
.\" | and this copyright notice is included prominently in any copy
.\" | made.
.\" |
.\" | The author make no claims as to the fitness or correctness of
.\" | this software for any use whatsoever, and it is provided as is.
.\" | Any use of this software is at the user's own risk.
.\" |
.\"
.\" +----------
.\" | $Log: putenv.m4,v $
.\" | Revision 2.0 90/09/19 20:14:13 paul
.\" | Initial 2.0 release
.\" |
.\" |
.\"
.\" +----------
.\" | M4 configuration
.\"
include(config.m4).\"
.\"
.\" +----------
.\" | Manpage source follows:
.\"
.TH PUTENV _library_section_
.SH NAME
putenv \- change or add value to environment
.SH SYNOPSIS
.B int putenv(\fIstring\fB)\fR;
.br
.B char *\fIstring\fR;
.SH DESCRIPTION
.I String
points to a string of the form
.I name=value.
.I Putenv
makes the value of the environment variable
.I name
equal to
.I value
by altering an existing variable or creating a new one. In either
case, the string pointed to by
.I string
becomes part of the environment, so altering the string changes
the environment. The space used by
.I string
is no longer used once a new string\-defining
.I name
is passed to
.I putenv.
.SH "RETURN VALUE"
.I Putenv
returns non\-zero if it was unable to obtain enough space via
.I malloc
for an expanded environment, otherwise zero.
.SH "SEE ALSO"
exec(_system_section_),
getenv(_library_section_),
malloc(_library_section_),
environ(_file_section_)
.SH WARNINGS
.I Putenv
manipulates the environment pointed to by
.I environ,
and can be used in conjunction with
.I getenv.
However,
.I envp
(the third argument to
.IR main )
is not changed.
.PP
This routine uses
.IR malloc (_library_section_)
to enlarge the environment.
.PP
After
.I putenv
is called, environmental variables are not in alphabetical order.
.PP
A potential error is to call
.I putenv
with an automatic variable as the argument, then exit the calling
function while
.I string
is still part of the environment.
.SH AUTHOR
.nf
Paul Sutcliffe, Jr.
UUCP: ...!rutgers!devon!paul
getty_ps/man/Makefile.SH 644 144 0 3756 5210514343 14003 0ustar stevewheel:
# $Id: Makefile.SH,v 2.0 90/09/19 20:07:16 paul Rel $
#
# Creates man/Makefile for getty distribution
#
# $Log: Makefile.SH,v $
# Revision 2.0 90/09/19 20:07:16 paul
# Initial 2.0 release
#
#

case $CONFIG in
'')
if test ! -f config.sh; then
ln ../config.sh . || \
ln ../../config.sh . || \
ln ../../../config.sh . || \
(echo "Can't find config.sh."; exit 1)
fi
. config.sh
;;
esac
case "$0" in
*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
esac

gtab=`basename $gettytab`
all="getty.1m $gtab.4 issue.4"
man="getty.man $gtab.man issue.man"
case "$d_getutent" in
"$undef")
all="$all getutent.3"
man="$man getutent.man"
;;
esac
case "$d_strdup" in
"$undef")
all="$all strdup.3"
man="$man strdup.man"
;;
esac
case "$d_putenv" in
"$undef")
all="$all putenv.3"
man="$man putenv.man"
;;
esac

echo "Extracting man/Makefile (with variable substitutions)"
$spitshell >Makefile < #
# Makefile for getty man pages
#

SHELL= /bin/sh
# no nroff? get Henry Spencer's AWF!
ROFF= nroff -man

SRC= ..
TUNE= \$(SRC)/tune.h
RELEASE=\$(SRC)/release.h

# what to make
all: $all

man: $man

install:
@echo "Manpage installation must be done manually, Sorry."

# how to make it
.SUFFIXES: .m4 .3 .man

.m4.3:
m4 \$*.m4 > \$*.3

.3.man:
\$(ROFF) \$*.3 > \$*.man

# dependencies
config.m4: \$(SRC)/config.sh \$(TUNE) \$(RELEASE)
chmod +x makeconfig
./makeconfig

getty.1m: getty.m4 config.m4
m4 getty.m4 > getty.1m

getty.man: getty.1m
\$(ROFF) getty.1m > getty.man

$gtab.4: gettytab.m4 config.m4
m4 gettytab.m4 > $gtab.4

$gtab.man: $gtab.4
\$(ROFF) $gtab.4 > $gtab.man

issue.4: issue.m4 config.m4
m4 issue.m4 > issue.4

issue.man: issue.4
\$(ROFF) issue.4 > issue.man

getutent.3: getutent.m4 config.m4

getutent.man: getutent.3

strdup.3: strdup.m4 config.m4

strdup.man: strdup.3

putenv.3: putenv.m4 config.m4

putenv.man: putenv.3

clean:
rm -f *.out config.m4 config.sh core

clobber: clean
rm -f *.1m *.[34] *.man

!GROK!THIS!
chmod 644 Makefile
$eunicefix Makefile
getty_ps/man/strdup.m4 644 144 0 3101 5200631255 13576 0ustar stevewheel.\" +----------
.\" | $Id: strdup.m4,v 2.0 90/09/19 20:14:57 paul Rel $
.\" |
.\" | STRDUP man page.
.\" |
.\" | Copyright 1989,1990 by Paul Sutcliffe Jr.
.\" |
.\" | Permission is hereby granted to copy, reproduce, redistribute,
.\" | or otherwise use this software as long as: there is no monetary
.\" | profit gained specifically from the use or reproduction or this
.\" | software, it is not sold, rented, traded or otherwise marketed,
.\" | and this copyright notice is included prominently in any copy
.\" | made.
.\" |
.\" | The author make no claims as to the fitness or correctness of
.\" | this software for any use whatsoever, and it is provided as is.
.\" | Any use of this software is at the user's own risk.
.\" |
.\"
.\" +----------
.\" | $Log: strdup.m4,v $
.\" | Revision 2.0 90/09/19 20:14:57 paul
.\" | Initial 2.0 release
.\" |
.\" |
.\"
.\" +----------
.\" | M4 configuration
.\"
include(config.m4).\"
.\"
.\" +----------
.\" | Manpage source follows:
.\"
.TH STRDUP _library_section_
.SH NAME
strdup \- duplicate a string in memory
.SH SYNOPSIS
.B char *strdup(\fIstring\fB)\fR;
.br
.B char *\fIstring\fR;
.SH DESCRIPTION
.I Strdup
allocates storage space (with a call to
.IR malloc (_library_section_))
for a copy of
.I string
and returns a pointer to the storage space containing the copied
string.
.SH "RETURN VALUE"
.I Strdup
returns NULL if storage cannot be allocated. Otherwise, a valid
pointer is returned.
.SH "SEE ALSO"
malloc(_library_section_),
string(_library_section_)
.SH AUTHOR
.nf
Paul Sutcliffe, Jr.
UUCP: ...!rutgers!devon!paul
getty_ps/man/issue.m4 644 144 0 3017 5200631255 13413 0ustar stevewheel.\" +----------
.\" | $Id: issue.m4,v 2.0 90/09/19 20:13:21 paul Rel $
.\" |
.\" | ISSUE man page.
.\" |
.\" | Copyright 1989,1990 by Paul Sutcliffe Jr.
.\" |
.\" | Permission is hereby granted to copy, reproduce, redistribute,
.\" | or otherwise use this software as long as: there is no monetary
.\" | profit gained specifically from the use or reproduction or this
.\" | software, it is not sold, rented, traded or otherwise marketed,
.\" | and this copyright notice is included prominently in any copy
.\" | made.
.\" |
.\" | The author make no claims as to the fitness or correctness of
.\" | this software for any use whatsoever, and it is provided as is.
.\" | Any use of this software is at the user's own risk.
.\" |
.\"
.\" +----------
.\" | $Log: issue.m4,v $
.\" | Revision 2.0 90/09/19 20:13:21 paul
.\" | Initial 2.0 release
.\" |
.\" |
.\"
.\" +----------
.\" | M4 configuration
.\"
include(config.m4).\"
.\"
.\" +----------
.\" | Manpage source follows:
.\"
.TH ISSUE _file_section_
.SH NAME
issue \- issue identification file
.SH DESCRIPTION
The file
.B _issue_
contains the
.I issue
or project identification to be printed as a login prompt. This
is an ASCII file which is read by the program
.IR getty (_mcmd_section_)
and then written to the terminal just prior to printing the
.I login:
prompt.
.PP
The line(s) may contain various
.BI @ char
and
\fB\\\fIchar\fR
parameters. These are described in full in the
.IR getty (_mcmd_section_)
section PROMPT SUBSTITUTIONS.
.SH FILES
_issue_
.SH "SEE ALSO"
getty(_mcmd_section_)
getty_ps/man/Makefile 644 144 0 2124 5210754575 13473 0ustar stevewheel#
# Makefile for getty man pages
#

SHELL= /bin/sh
# no nroff? get Henry Spencer's AWF!
ROFF= nroff -man

SRC= ..
TUNE= $(SRC)/tune.h
RELEASE=$(SRC)/release.h

# what to make
all: getty.1m gettydefs.4 issue.4

man: getty.man gettydefs.man issue.man

install:
@echo "Manpage installation must be done manually, Sorry."

# how to make it
.SUFFIXES: .m4 .3 .man

.m4.3:
m4 $*.m4 > $*.3

.3.man:
$(ROFF) $*.3 > $*.man

# dependencies
config.m4: $(SRC)/config.sh $(TUNE) $(RELEASE)
chmod +x makeconfig
./makeconfig

getty.1m: getty.m4 config.m4
m4 getty.m4 > getty.1m

getty.man: getty.1m
$(ROFF) getty.1m > getty.man

gettydefs.4: gettytab.m4 config.m4
m4 gettytab.m4 > gettydefs.4

gettydefs.man: gettydefs.4
$(ROFF) gettydefs.4 > gettydefs.man

issue.4: issue.m4 config.m4
m4 issue.m4 > issue.4

issue.man: issue.4
$(ROFF) issue.4 > issue.man

getutent.3: getutent.m4 config.m4

getutent.man: getutent.3

strdup.3: strdup.m4 config.m4

strdup.man: strdup.3

putenv.3: putenv.m4 config.m4

putenv.man: putenv.3

clean:
rm -f *.out config.m4 config.sh core

clobber: clean
rm -f *.1m *.[34] *.man

getty_ps/defaults.c 644 144 0 12101 5205320315 13230 0ustar stevewheel/*
** $Id: defaults.c,v 2.0 90/09/19 19:42:09 paul Rel $
**
** Routines to access runtime defaults file.
** This is to allow program features to be configured
** without the need to recompile.
**
** XENIX has defopen(S) and defread(S), but I think this is better,
** since it reads the file only once, storing the values in core.
** It is certainly more portable.
*/

/*
** Copyright 1989,1990 by Paul Sutcliffe Jr.
**
** Permission is hereby granted to copy, reproduce, redistribute,
** or otherwise use this software as long as: there is no monetary
** profit gained specifically from the use or reproduction or this
** software, it is not sold, rented, traded or otherwise marketed,
** and this copyright notice is included prominently in any copy
** made.
**
** The author make no claims as to the fitness or correctness of
** this software for any use whatsoever, and it is provided as is.
** Any use of this software is at the user's own risk.
*/

/*
** $Log: defaults.c,v $
** Revision 2.0 90/09/19 19:42:09 paul
** Initial 2.0 release
**
*/


#include "getty.h"
#include "defaults.h"
#include
#include

#if defined(RCSID) && !defined(lint)
static char *RcsId =
"@(#)$Id: defaults.c,v 2.0 90/09/19 19:42:09 paul Rel $";
#endif

#ifndef DEFAULTS
#define DEFAULTS "/etc/default/%s" /* location of defaults file */
#endif /* DEFAULTS */

#ifndef MAXLINE
#define MAXLINE 256 /* maximum # chars in a line */
#endif /* MAXLINE */

#ifndef MAXDEF
#define MAXDEF 100 /* maximum # of lines in defaults file */
#endif /* MAXDEF */


/*
** defbuild() - create in-core list of defaults
**
** Returns (DEF**)NULL if no defaults file found or an error occurs.
*/

DEF **
defbuild(filename)
char *filename;
{
register int i;
register DEF *dp;
register DEF *next;
FILE *fp;
char *fname, defname[MAXLINE+1], buf[MAXLINE+1];
static DEF *deflist[MAXDEF+1]; /* in-core list */
struct stat st;
extern int errno;

debug3(D_DEF, "defbuild(%s) called\n",
((filename == (char *) NULL) ? "NULL" : filename));

/* look to see if there's a DEFAULTS/MyName.Device file
*/
(void) sprintf(buf, "%s", DEFAULTS);
(void) strcat(buf, ".%s");
(void) sprintf(defname, buf, MyName, Device);
debug3(D_DEF, "looking for %s\n", defname);
if ((stat(defname, &st) == FAIL) && errno == ENOENT) { /* Nope */
debug2(D_DEF, "stat failed, no file\n");
(void) sprintf(defname, DEFAULTS, MyName);
}

fname = (filename != (char *) NULL) ? filename : defname;

/* if fname doesn't begin with a '/', assume it's a
* filename to be made "DEFAULTS/fname"
*/
if (*fname != '/') {
(void) sprintf(defname, DEFAULTS, fname);
fname = defname;
}

debug3(D_DEF, "fname = (%s)\n", fname);

if ((fp = defopen(fname)) == (FILE *) NULL) {
debug2(D_DEF, "defopen() failed\n");
return((DEF **) NULL); /* couldn't open file */
}

for (i=0; i < MAXDEF; i++) {
if ((dp = defread(fp)) == (DEF *) NULL)
break;
if ((next = (DEF *) malloc((unsigned) sizeof(DEF))) ==
(DEF *) NULL) {
logerr("malloc() failed: defaults list truncated");
break;
}
next->name = dp->name;
next->value = dp->value;
deflist[i] = next;
debug5(D_DEF, "deflist[%d]: name=(%s), value=(%s)\n",
i, deflist[i]->name, deflist[i]->value);
}
deflist[i] = (DEF *) NULL; /* terminate list */
(void) defclose(fp);
debug2(D_DEF, "defbuild() successful\n");
return(deflist);
}


/*
** defvalue() - locate the value in "deflist" that matches "name"
**
** Returns (char*)NULL if no match is made.
*/

char *
defvalue(deflist, name)
register DEF **deflist;
register char *name;
{
debug3(D_DEF, "defvalue(%s) called\n", name);

if (deflist != (DEF **) NULL)
for (; *deflist != (DEF *) NULL; *deflist++)
if (strequal(name, (*deflist)->name)) {
debug3(D_DEF, "defvalue returns (%s)\n",
(*deflist)->value);
return((*deflist)->value); /* normal exit */
}

debug2(D_DEF, "defvalue returns NULL\n");
return((char *) NULL);
}


/*
** defopen() - open the defaults file
**
** Returns (FILE*)NULL if file not found or an error occurs.
*/

FILE *
defopen(filename)
register char *filename;
{
if (filename != (char *) NULL)
return(fopen(filename, "r"));

return((FILE *) NULL);
}


/*
** defread() - read a line from the defaults file
**
** Returns (DEF*)NULL if an error occurs.
*/

DEF *
defread(fp)
register FILE *fp;
{
register char *p;
STDCHAR buf[MAXLINE+1]; /* buffer large enough for 1 line */
static DEF def;

do {
if (fgets(buf, sizeof(buf), fp) == (char *) NULL)
return((DEF *) NULL); /* no more lines */

} while ((buf[0] == '#') || (buf[0] == '\n'));
/* SMR - ignore comment lines */

buf[strlen(buf)-1] = '\0'; /* rm trailing \n */

/* lines should be in the form "NAME=value"
*/
if ((p = index(buf, '=')) == (char *) NULL) {
(void) sprintf(MsgBuf, "bad defaults line: %s", buf);
logerr(MsgBuf);
return((DEF *) NULL);
}
*p++ = '\0'; /* split into two fields, name and value */
def.name = strdup(buf);
def.value = strdup(p);

return(&def);
}


/*
** defclose() - closes the defaults file
**
** Returns EOF if an error occurs.
*/

int
defclose(fp)
register FILE *fp;
{
return(fclose(fp));
}


/* end of defaults.c */
getty_ps/README 644 144 0 22633 5200627323 12154 0ustar stevewheel
Getty Kit, Version 2.0

Copyright (c) 1989,1990, Paul Sutcliffe Jr.

-------------------------------------------------------------------------------

Permission is hereby granted to copy, reproduce, redistribute,
or otherwise use this software as long as: there is no monetary
profit gained specifically from the use or reproduction or this
software, it is not sold, rented, traded or otherwise marketed,
and this copyright notice is included prominently in any copy
made.

The author make no claims as to the fitness or correctness of
this software for any use whatsoever, and it is provided as is.
Any use of this software is at the user's own risk.

-------------------------------------------------------------------------------


WHY THIS GETTY:

As most people have seen, the stock getty provided on Unix/Xenix
systems lacks many features that can be useful. The getty included in
this distribution adds several features that I needed on my own system,
plus includes several "Wouldn't it be nice if ..." features I've heard
mentioned around UseNet.

Getty 2.0 trys to emulate a "standard" System V getty in every way it
can. For instance, it uses the SysV /etc/gettydefs file (although you
may give it a different name). It also uses an /etc/issue file, if one
is present.

Added features include:

+ Can be used as a normal getty, or as "uugetty" to allow
bi-directional usage of modem lines.

+ Reads a "defaults" file at runtime, so that a single binary
can be configured differently on individual lines. This also
allows you to change getty's behavior without recompiling.

+ Let's you specify default erase and kill characters, instead
of the ancient '#' and '@' convention still used in some
"modern" gettys.

+ Extensive debugging (to a log file) can be enabled at compile-
time. The command line argument to envoke debugging is an
octal number -- the bit pattern determines which aspects of
getty's behavior are logged.

+ Let's you specify a program other than "login" to be executed
after the user name is entered.

+ (and the best for last:) The line can be "initialized"
before sending the login banner (/etc/issue) and prompt with
the use of an expect/send sequence not unlike that used by the
UUCP L.sys (or Systems) file.

+ (and new in version 2.0:) The CONNECT message from the modem
can be used to set the line speed; no more having to toggle
the speed by sending 's or CR's.


REQUIREMENTS:

Getty 2.0 should drop right in to any AT&T (System III or V) Unix
or derivitive. It has already been successfully installed on:

Tandy 6000 Tandy Xenix 3.2 (Microsoft Xenix 3.0)
NCR Tower 32/400 Unix SVR[23]
80386 clone SCO Xenix V/386 2.2
Everex STEP 386is ESIX SVR3.2 Rev C


INSTALLATION:

Please read all the directions below before you proceed any further, and
then follow them carefully. Failure to do so may void your warranty. 🙂

After you have unpacked your kit(s), you should have all the files listed
in MANIFEST.

1) Run Configure. This will figure out various things about your system.
Some things Configure will figure out for itself, other things it will
ask you about. It will then proceed to make config.h, config.sh, and
Makefile.

You might possibly have to trim # comments from the front of Configure
if your sh doesn't handle them, but all other # comments will be taken
care of.

2) Glance through config.h to make sure system dependencies are correct.
Most of them should have been taken care of by running the Configure
script.

If you have any additional changes to make to the C definitions, they
can be done in the Makefile, or in config.h. Bear in mind that they
will get undone next time you run Configure.

3) Copy the sample file tune.H to tune.h and edit tune.h to reflect the
special needs of your system and your desired features. Use the
following as a guide:

boolean If your compiler supports a (boolean) type, you may
remove this definition.

DEF_CFL Define this to the parameters that will
identify your system's normal word length and parity.
Possible values are:

(CS8) /* 8-bit, no parity */
(CS7|PARENB) /* 7-bit, even parity */
(CS7|PARENB|PARODD) /* 7-bit, odd parity */

Be sure to use only symbols defined in on
your system.

DEF_CONNECT Define this to the default CONNECT string for your
modem(s).

DEBUG Define this if you want the runtime debugging code
included in the executables. See the section on
DEBUGGING in this readme for instructions in usage.

LOGUTMP Define this if your utmp file (/etc/utmp) records
getty processes as a LOGIN_PROCESS. This is true
for all SYS V sites that I'm aware of.

MY_CANON Define this if you want to define your own ERASE and
KILL characters. You may wish to do this if you are a
SYS V site whose defaults are the ancient '#' and '@'
characters. See MY_ERASE and MY_KILL below.

RCSID Define this if you want RCS version strings compiled
into the executables. These can later be found with
the what (SCCS) or ident (RCS) commands.

SETTERM Define this if you want getty to export the TERM
environment variable before calling login. This will
only be done if getty knows what kind of terminal is
attached to the line it's running on.

TELEBIT Define this if you will be using the autobauding
feature with Telebit modems.

TRYMAIL Define this if you want getty to send email if it has
and error and cannot access the CONSOLE device.

WARNCASE Define this to allow getty to warn a user if he/she has
used only upper-case letters in their login id. If the
user re-enters his/her id a second time in upper-case,
that value is accepted and process accordingly.

MY_ERASE If you've defined MY_CANON, use these to define the values
MY_KILL you want for erase and kill characters.

TB_FAST During autobauding, a Telebit will say CONNECT FAST
if a 9600 or 19200 PEP connection is made. Define
this to the speed (either 9600 or 19200) you want
getty to set when it sees FAST.

NOTIFY If you've defined TRYMAIL, use this to define the account
to which the email will be sent.

CONSOLE Define this to the name of the console device.

DEFAULTS Define this to the name of the defaults file. The %s is
necessary, and will be replaced (via an sprintf()) by the
name of the executable--either getty or uugetty.

ISSUE Define this to the name of your issue file. If this
is undefined, no issue file will be displayed during
getty's startup.

LOGIN Define this to the name of the login program to be called.

TRS16 Define this only if you're compiling getty on a Tandy 6000.
This define handles the different command line required due
to the V7 based /etc/init and also the dain-bramaged
/etc/inittab used on Tandy Xenix-68000 3.2

You may also wish to modify the values of {I,O,C,L}SANE in table.c,
as my idea of "Sane conditions" may differ from yours.

4) make depend

This will look for all the includes and modify Makefile accordingly.
Configure will offer to do this for you.

5) make lint

This step is optional, but highly recommended.

6) make

This will attempt to make getty and uugetty in the current directory.
It will also go to the man sub-directory and use m4 to create
nroff-able man pages. It will then run nroff on the m4 output.

7) make install

This will put getty/uugetty into a public directory (normally /etc).
It will also make sure the man pages have been created. It will not
install them. You may need to be root to do this. If you are not
root, you must own the directories in question and you should ignore
any messages about chown not working.

Also, if you don't already have an /etc/gettydefs file, you'll need
to create one. This goes for the /etc/default files (if you are
using them) and the /etc/issue file. There are examples of these
in the `sample.files' file.

8) Read the manual entries before running getty/uugetty.

9) IMPORTANT! Help save the world! Communicate any problems and suggested
patches to me, [email protected] (Paul Sutcliffe Jr.), so we can
keep the world in sync. If you have a problem, there's someone else
out there who either has had or will have the same problem.

If possible, send in patches such that the patch program will apply them.
Context diffs are the best, then normal diffs. Don't send ed scripts--
I've probably changed my copy since the version you have.

Watch for getty patches in comp.sources.bugs. Patches will generally be
in a form usable by the patch program. If you are just now bringing up
getty and aren't sure how many patches there are, write to me and I'll
send any you don't have. Your current patch level is shown in patchlevel.h.


DEBUGGING:

To use debugging, you must define DEBUG (in config.h) before compiling.

To envoke debugging, use the "-D onum" command line argument. Onum is
an octal number. To turn on all levels of debugging, use "-D 0377".
To pick specific areas to be watched, look at the defines in the "debug
levels" section of getty.h. The value for onum will be the result of
OR-ing the values you want. For instance, to debug the defaults file
and gettytab file processing, use "-D 022".


Have fun.

- paul

INTERNET: [email protected] | How many whales do you have to
UUCP: ...!rutgers!devon!paul | save to get a toaster?
getty_ps/main.c 660 144 0 55546 5232343626 12401 0ustar stevewheel/*
** $Id: main.c,v 2.0 90/09/19 20:02:06 paul Rel $
**
** Main body of program.
*/

/*
** Copyright 1989,1990 by Paul Sutcliffe Jr.
**
** Permission is hereby granted to copy, reproduce, redistribute,
** or otherwise use this software as long as: there is no monetary
** profit gained specifically from the use or reproduction or this
** software, it is not sold, rented, traded or otherwise marketed,
** and this copyright notice is included prominently in any copy
** made.
**
** The author make no claims as to the fitness or correctness of
** this software for any use whatsoever, and it is provided as is.
** Any use of this software is at the user's own risk.
*/

/*
** $Log: main.c,v $
** Revision 2.0 90/09/19 20:02:06 paul
** Initial 2.0 release
**
*/


#define MAIN

#include "getty.h"
#include "defaults.h"
#include "table.h"
#include
#include
#include
#ifdef PWD
#include
#endif /* PWD */

#if defined(RCSID) && !defined(lint)
static char *RcsId =
"@(#)$Id: main.c,v 2.0 90/09/19 20:02:06 paul Rel $";
#endif

#if !defined(lint)
#include "release.h"
static char *Release = RELEASE;
static char *RelDate = DATE;
#endif

/* how does this thing work
*/
#define USAGE "Usage:\t%s [options] %s\n\t%s -c checkfile\n"
#ifdef TRS16
#define UOPT "speed [defaultfile]" /* Tandy Xenix/68k 3.2 */
#else /* TRS16 */
#define UOPT "line [speed [type [lined]]]" /* real System V */
#endif /* TRS16 */

#define VALUE(cptr) ((cptr == (char *) NULL) ? "NULL" : cptr)

struct speedtab {
ushort cbaud; /* baud rate */
int nspeed; /* speed in numeric format */
char *speed; /* speed in display format */
} speedtab[] = {
{ B50, 50, "50" },
{ B75, 75, "75" },
{ B110, 110, "110" },
{ B134, 134, "134" },
{ B150, 150, "150" },
{ B200, 200, "200" },
{ B300, 300, "300" },
{ B600, 600, "600" },
{ B1200, 1200, "1200" },
{ B1800, 1800, "1800" },
{ B2400, 2400, "2400" },
{ B4800, 4800, "4800" },
{ B9600, 9600, "9600" },
#ifdef B19200
{ B19200, 19200, "19200" },
#endif /* B19200 */
#ifdef B38400
{ B38400, 38400, "38400" },
#endif /* B38400 */
{ EXTA, 0, "EXTA" },
{ EXTB, 0, "EXTB" },
{ 0, 0, "" }
};

extern int errno;

sig_t timeout();
int tputc();
void exit_usage();
struct passwd *getpwuid();
struct utmp *getutent();
#ifdef DEBUG
char *ctime();
#endif /* DEBUG */


#ifdef UUGETTY

char *lock, *altlock;

int makelock(), readlock();
boolean checklock();
sig_t rmlocks();

#endif /* UUGETTY */


#ifdef WARNCASE
char *bad_case[] = {
"\r\n",
"If your terminal supports lower case letters, please\r\n",
"use them. Login again, using lower case if possible.\r\n",
(char *) NULL
};
#endif /* WARNCASE */


main(argc, argv)
int argc;
char *argv[];
{
register int c, i, fd;
int cbaud, nspeed, flags;
char ch, *p, *speed, devname[MAXLINE+1];
STDCHAR buf[MAXLINE+1];
char termcap[1024], tbuf[64];
char *tgetstr();
DEF **def;
TERMIO termio;
GTAB *gtab, *gt;
FILE *fp;
struct utmp *utmp;
struct stat st;

#if defined(DEBUG) || defined(LOGUTMP)
time_t clock;
#endif /* DEBUG || LOGUTMP */

#ifndef TRS16
char lined[MAXLINE+1];
#endif /* TRS16 */

#ifdef UUGETTY
struct passwd *pwd;
UIDTYPE uucpuid = 0;
GIDTYPE uucpgid = 0;
#endif /* UUGETTY */

#ifdef TTYTYPE
char name[16], line[16];
#endif /* TTYTYPE */

#ifdef LOGUTMP
int pid;
#endif /* LOGUTMP */

#ifdef ISSUE
char *issue = ISSUE; /* default issue file */
#endif /* ISSUE */

boolean clear = TRUE; /* clear screen flag */
char *login = LOGIN; /* default login program */
char *clrscr = (char *) NULL; /* string to clear screen */
char *defname = (char *) NULL; /* defaults file name */
char *init = (char *) NULL; /* value of INIT */
char term[16]; /* terminal type */
boolean waitchar = FALSE; /* wait for char flag */
unsigned int delay = 0; /* #sec's delay before prompt */
char *waitfor = (char *) NULL; /* string to wait for */
char *connect = (char *) NULL; /* connect chat string */

extern int optind;
extern char *optarg;
extern int expect();

/* startup
*/
(void) signal(SIGINT, SIG_IGN);
(void) signal(SIGQUIT, SIG_DFL);
(void) signal(SIGTERM, SIG_DFL);

(void) strcpy(term, "unknown");
AutoBaud = FALSE;
AutoRate[0] = '\0';
Check = FALSE;
CheckFile = (char *) NULL;
#ifdef DEBUG
Debug = 0;
#endif /* DEBUG */
Device = "unknown";
GtabId = (char *) NULL;
LineD = (char *) NULL;
NoHangUp = FALSE;
TimeOut = 0;
#ifdef WARNCASE
WarnCase = TRUE;
#endif /* WARNCASE */

/* who am I?
*/
#ifdef UUGETTY
MyName = "uugetty";
#else
MyName = "getty";
#endif /* UUGETTY */

/* process the command line
*/

while ((c = getopt(argc, argv, "C:D:c:d:ht:w:")) != EOF) {
switch (c) {
case 'C':
connect = optarg;
break;
case 'D':
#ifdef DEBUG
(void) sscanf(optarg, "%o", &Debug);
Dfp = stderr;
#else /* DEBUG */
logerr("DEBUG not compiled in");
#endif /* DEBUG */
break;
case 'c':
Check = TRUE;
CheckFile = optarg;
break;
case 'd':
defname = optarg;
break;
case 'h':
NoHangUp = TRUE;
break;
case 'r':
waitchar = TRUE;
delay = (unsigned) atoi(optarg);
break;
case 't':
TimeOut = atoi(optarg);
break;
case 'w':
waitchar = TRUE;
waitfor = optarg;
break;
case '?':
exit_usage(2);
}
}

/* just checking?
*/
if (Check) {
(void) signal(SIGINT, SIG_DFL);
(void) gtabvalue((char *) NULL, G_CHECK);
exit(0);
}

#ifdef TRS16

/* special handling for v7-based init
*/

if (optind < argc)
GtabId = argv[optind++];
else {
logerr("no speed given");
exit_usage(2);
}

/* Tandy Xenix/68k 3.2 /etc/inittab allows one optional argument
* after the speed flag. The best use I could do with it here is
* to assume that it's the name of the defaults file to be used.
*
* Sigh. Actually, it's not optional -- if none is given in
* /etc/inittab, then it appears here as a 0-length string.
*/
if (optind < argc)
if (strlen(argv[optind]) > 0)
defname = argv[optind++];

if ((p = ttyname(STDIN)) != (char *) NULL)
Device = p+5; /* strip off "/dev/" */
else {
logerr("cannot determine line");
exit_usage(2);
}

#else /* TRS16 */

/* normal System V handling
*/

if (optind < argc)
Device = argv[optind++];
else {
logerr("no line given");
exit_usage(2);
}
if (optind < argc)
GtabId = argv[optind++];
if (optind < argc)
(void) strncpy(term, argv[optind++], sizeof(term));
if (optind < argc) {
(void) strncpy(lined, argv[optind++], sizeof(lined));
LineD = lined;
}

#endif /* TRS16 */

#ifdef TTYTYPE

if (strequal(term, "unknown")) {
if ((fp = fopen(TTYTYPE, "r")) == (FILE *) NULL) {
(void) sprintf(MsgBuf, "cannot open %s", TTYTYPE);
logerr(MsgBuf);
} else {
while ((fscanf(fp, "%s %s", name, line)) != EOF) {
if (strequal(line, Device)) {
(void) strncpy(term,name,sizeof(term));
break;
}
}
(void) fclose(fp);
}
}

#endif /* TTYTYPE */

/* need full name of the device
*/
(void) sprintf(devname, "/dev/%s", Device);

/* command line parsed, now build the list of
* runtime defaults; this may override things set above.
*/
def = defbuild(defname);

#ifdef DEBUG

/* debugging on?
*/
if ((p = defvalue(def, "DEBUG")) != (char *) NULL)
(void) sscanf(p, "%o", &Debug);

if (Debug) {
(void) sprintf(buf, "/tmp/getty:%s", Device);
if ((Dfp = fopen(buf, "a+")) == (FILE *) NULL) {
logerr("cannot open debug file");
exit(FAIL);
} else {
if (fileno(Dfp) < 3) {
if ((fd = fcntl(fileno(Dfp), F_DUPFD, 3)) > 2) {
(void) fclose(Dfp);
Dfp = fdopen(fd, "a+");
}
}
(void) time(&clock);
(void) fprintf(Dfp, "%s Started: %s",
MyName, ctime(&clock));
}
}

debug(D_OPT, "command line values:\n");
debug(D_OPT, " [-C] connect = (%s)\n", VALUE(connect));
debug(D_OPT, " [-d] defname = (%s)\n", VALUE(defname));
debug(D_OPT, " [-h] NoHangUp = (%s)\n", (NoHangUp) ? "TRUE" : "FALSE");
debug(D_OPT, " [-r] waitchar = (%s)\n", (waitchar) ? "TRUE" : "FALSE");
debug(D_OPT, " delay = (%u)\n", delay);
debug(D_OPT, " [-t] TimeOut = (%d)\n", TimeOut);
debug(D_OPT, " [-w] waitfor = (%s)\n", VALUE(waitfor));
debug(D_OPT, " line = (%s)\n", VALUE(Device));
debug(D_OPT, " speed = (%s)\n", VALUE(GtabId));
debug(D_OPT, " type = (%s)\n", term);
debug(D_OPT, " lined = (%s)\n", VALUE(LineD));
debug(D_RUN, "loading defaults\n");

#endif /* DEBUG */

/* setup all runtime values
*/

if ((SysName = defvalue(def, "SYSTEM")) == (char *) NULL)
SysName = getuname();

if ((Version = defvalue(def, "VERSION")) != (char *) NULL)
if (*Version == '/') {
if ((fp = fopen(Version, "r")) != (FILE *) NULL) {
(void) fgets(buf, sizeof(buf), fp);
(void) fclose(fp);
buf[strlen(buf)-1] = '\0';
Version = strdup(buf);
}
}

if ((p = defvalue(def, "LOGIN")) != (char *) NULL)
login = p;
if ((p = defvalue(def, "INIT")) != (char *) NULL)
init = p;
#ifdef ISSUE
if ((p = defvalue(def, "ISSUE")) != (char *) NULL)
issue = p;
#endif /* ISSUE */
if ((p = defvalue(def, "CLEAR")) != (char *) NULL)
if (strequal(p, "NO"))
clear = FALSE;
if ((p = defvalue(def, "HANGUP")) != (char *) NULL)
if (strequal(p, "NO"))
NoHangUp = TRUE;
if ((p = defvalue(def, "WAITCHAR")) != (char *) NULL)
if (strequal(p, "YES"))
waitchar = TRUE;
if ((p = defvalue(def, "DELAY")) != (char *) NULL)
delay = (unsigned) atoi(p);
if ((p = defvalue(def, "TIMEOUT")) != (char *) NULL)
TimeOut = atoi(p);
if ((p = defvalue(def, "CONNECT")) != (char *) NULL)
connect = p;
if ((p = defvalue(def, "WAITFOR")) != (char *) NULL) {
waitchar = TRUE;
waitfor = p;
}

/* find out how to clear the screen
*/
if (!strequal(term, "unknown")) {
p = tbuf;
if ((tgetent(termcap, term)) == 1)
if ((clrscr = tgetstr("cl", &p)) == (char *) NULL)
clrscr = "";
}

#ifdef UUGETTY

debug2(D_RUN, "check for lockfiles\n");

/* deal with the lockfiles; we don't want to charge
* ahead if uucp, kermit or something is already
* using the line.
*/

/* name the lock file(s)
*/
(void) sprintf(buf, LOCK, Device);
lock = strdup(buf);
altlock = defvalue(def, "ALTLOCK");
if (altlock != (char *) NULL) {
(void) sprintf(buf, LOCK, altlock);
altlock = strdup(buf);
}
debug3(D_LOCK, "lock = (%s)\n", lock);
debug3(D_LOCK, "altlock = (%s)\n", VALUE(altlock));

/* check for existing lock file(s)
*/
if (checklock(lock) == TRUE) {
while (checklock(lock) == TRUE)
(void) sleep(60);
exit(0);
}

/* there's a race condition just asking for trouble here 🙁
*/
if (altlock != (char *) NULL && checklock(altlock) == TRUE) {
while (checklock(altlock) == TRUE)
(void) sleep(60);
exit(0);
}

/* allow uucp to access the device
*/
(void) chmod(devname, 0666);
if ((pwd = getpwuid(UUCPID)) != (struct passwd *) NULL) {
uucpuid = pwd->pw_uid;
uucpgid = pwd->pw_gid;
}
(void) chown(devname, uucpuid, uucpgid);

#else /* UUGETTY */

(void) chmod(devname, 0622);
if (stat(devname, &st) == 0)
(void) chown(devname, 0, st.st_gid);
else
(void) chown(devname, 0, 0);

#endif /* UUGETTY */

/* the line is mine now ...
*/

debug2(D_RUN, "open stdin, stdout and stderr\n");

/* open the device; don't wait around for carrier-detect
*/
if ((fd = open(devname, O_RDWR | O_NDELAY)) < 0) {
logerr("cannot open line");
exit(FAIL);
}

/* make new fd == stdin if it isn't already
*/
if (fd > 0) {
(void) close(0);
if (dup(fd) != 0) {
logerr("cannot open stdin");
exit(FAIL);
}
}

/* make stdout and stderr, too
*/
(void) close(1);
(void) close(2);
if (dup(0) != 1) {
logerr("cannot open stdout");
exit(FAIL);
}
if (dup(0) != 2) {
logerr("cannot open stderr");
exit(FAIL);
}

if (fd > 0)
(void) close(fd);

/* no buffering
*/
setbuf(stdin, (char *) NULL);
setbuf(stdout, (char *) NULL);
setbuf(stderr, (char *) NULL);

debug2(D_STTY, "Stdin just opened:\n");
if (Debug & D_STTY) system("stty -a >&3");
debug2(D_RUN, "setup terminal\n");

/* get the required info from the gettytab file
*/
gtab = gtabvalue(GtabId, G_FORCE);

/* setup terminal
*/
if (!NoHangUp) {
(void) ioctl(STDIN, TCGETA, &termio);
termio.c_cflag &= ~CBAUD; /* keep all but CBAUD bits */
termio.c_cflag |= B0; /* set speed == 0 */
(void) ioctl(STDIN, TCSETAF, &termio);
}
settermio(&(gtab->itermio), INITIAL);

debug2(D_STTY, "After processing gettydefs:\n");
if (Debug & D_STTY) system("stty -a >&3");

/* clear O_NDELAY flag now
*/
flags = fcntl(STDIN, F_GETFL, 0);
(void) fcntl(STDIN, F_SETFL, flags & ~O_NDELAY);

/* handle init sequence if requested
*/
if (init != (char *) NULL) {
debug2(D_RUN, "perform line initialization\n");
if (chat(init) == FAIL){
logerr("warning: INIT sequence failed");
debug2(D_RUN, "Modem initialization failed -- aborting\n");
exit(FAIL);
}
}

#ifdef LOGUTMP

debug2(D_RUN, "update utmp/wtmp files\n");

pid = getpid();
#ifndef linux
while ((utmp = getutent()) != (struct utmp *) NULL)
if (utmp->ut_type == INIT_PROCESS && utmp->ut_pid == pid)
#endif
{
debug2(D_UTMP, "logutmp entry made\n");
/* show login process in utmp
*/
strncopy(utmp->ut_line, Device);
strncopy(utmp->ut_id, Device+3);
utmp->ut_host[0] = '\0';
utmp->ut_addr = 0;
strncopy(utmp->ut_user, "LOGIN");
utmp->ut_pid = pid;
utmp->ut_type = LOGIN_PROCESS;
(void) time(&clock);
utmp->ut_time = clock;
pututline(utmp);

/* write same record to end of wtmp
* if wtmp file exists
*/
#ifndef linux
if (stat(WTMP_FILE, &st) && errno == ENOENT)
break;
#endif
if ((fp = fopen(WTMP_FILE, "a")) != (FILE *) NULL) {
(void) fseek(fp, 0L, 2);
(void) fwrite((char *)utmp,sizeof(*utmp),1,fp);
(void) fclose(fp);
}
}
endutent();

#endif /* LOGUTMP */

/* do we need to wait ?
*/
if (waitchar) {

debug2(D_RUN, "waiting for any char ...\n");

(void) ioctl(STDIN, TCFLSH, 0);
(void) read(STDIN, &ch, 1); /* this will block */

debug2(D_RUN, "... got one!\n");

#ifdef UUGETTY
/* check to see if line is locked, we don't want to
* read more chars if that's the case
*/
if (checklock(lock) == TRUE) {
debug2(D_RUN, "line locked now, stopping\n");
while (checklock(lock) == TRUE)
(void) sleep(60);
exit(0);
}
if (altlock != (char *) NULL && checklock(altlock) == TRUE) {
debug2(D_RUN, "line locked now, stopping\n");
while (checklock(altlock) == TRUE)
(void) sleep(60);
exit(0);
}
#endif /* UUGETTY */

if (waitfor != (char *) NULL) {
if (ch == *waitfor) { /* first char equal ? */
waitfor++;
debug3(D_RUN, "matched waitfor[0] (%c)\n", ch);
if (!(*waitfor)) {
debug2(D_RUN, "match complete\n");
goto wait_cont;
}
}
if (expect(waitfor) == FAIL)
exit(0);
}

wait_cont:
if (delay) {
debug3(D_RUN, "delay(%d)\n", delay);
(void) sleep(delay);
/* eat up any garbage from the line (modem) */
(void) fcntl(STDIN, F_SETFL, flags | O_NDELAY);
while (read(STDIN, &ch, 1) == 1)
;
(void) fcntl(STDIN, F_SETFL, flags & ~O_NDELAY);
}

}

#ifdef UUGETTY

debug2(D_RUN, "locking the line\n");

/* try to lock the line
*/
if (makelock(lock) == FAIL) {
while (checklock(lock) == TRUE)
(void) sleep(60);
exit(0);
}
if (altlock != (char *) NULL && makelock(altlock) == FAIL) {
while (checklock(altlock) == TRUE)
(void) sleep(60);
exit(0);
}

/* set to remove lockfile(s) on certain signals
*/
(void) signal(SIGHUP, rmlocks);
(void) signal(SIGINT, rmlocks);
(void) signal(SIGQUIT, rmlocks);
(void) signal(SIGTERM, rmlocks);

#endif /* UUGETTY */

if (connect != (char *) NULL) {

debug2(D_RUN, "perform connect sequence\n");

cbaud = 0;
if (strequal(connect, "DEFAULT"))
connect = DEF_CONNECT;
if (chat(connect) == FAIL){
logerr("warning: CONNECT sequence failed");
debug2(D_RUN, "Failed connect sequence -- aborting\n");
exit(FAIL);
}
if (AutoBaud) {
debug3(D_RUN, "AutoRate = (%s)\n", AutoRate);
#ifdef TELEBIT
if (strequal(AutoRate, "FAST"))
(void) strcpy(AutoRate, TB_FAST);
#endif /* TELEBIT */
if ((nspeed = atoi(AutoRate)) > 0)
for (i=0; speedtab[i].nspeed; i++)
if (nspeed == speedtab[i].nspeed) {
cbaud = speedtab[i].cbaud;
speed = speedtab[i].speed;
break;
}
}
if (cbaud) { /* AutoBaud && match found */
debug3(D_RUN, "setting speed to %s\n", speed);
if ((gt = gtabvalue(speed, G_FIND)) != (GTAB *) NULL) {
/* use matching line from gettytab */
if (strequal(gt->cur_id, speed)) {
gtab = gt;
goto set_term;
}
}
/* change speed of existing gettytab line
*/
gtab->itermio.c_cflag =
(gtab->itermio.c_cflag & ~CBAUD) | cbaud;
gtab->ftermio.c_cflag =
(gtab->ftermio.c_cflag & ~CBAUD) | cbaud;
set_term:
settermio(&(gtab->itermio), INITIAL);
}
}

debug2(D_RUN, "entering login loop\n");

/* loop until a successful login is made
*/
for (;;) {

/* set Nusers value
*/
Nusers = 0;
setutent();
while ((utmp = getutent()) != (struct utmp *) NULL) {
#ifdef USER_PROCESS
if (utmp->ut_type == USER_PROCESS)
#endif /* USER_PROCESS */
{
Nusers++;
debug3(D_UTMP, "utmp entry (%s)\n",
utmp->ut_name);
}
}
endutent();
debug3(D_UTMP, "Nusers=%d\n", Nusers);

/* set Speed value
*/
cbaud = gtab->itermio.c_cflag & CBAUD;
for (i=0; speedtab[i].cbaud != cbaud; i++)
;
Speed = speedtab[i].speed;

#ifdef ISSUE
if (clear && *clrscr) /* clear screen */
(void) tputs(clrscr, 1, tputc);

(void) fputc('\r', stdout); /* just in case */

/* display ISSUE, if present
*/
if (*issue != '/') {
(void) Fputs(issue, stdout);
(void) fputs("\r\n", stdout);
} else if ((fp = fopen(issue, "r")) != (FILE *) NULL) {
while (fgets(buf, sizeof(buf), fp) != (char *) NULL)
(void) Fputs(buf, stdout);
(void) fclose(fp);
}
#endif /* ISSUE */

login_prompt:

/* display login prompt
*/
(void) Fputs("@S ", stdout);
(void) Fputs(gtab->login, stdout);

/* eat any chars from line noise
*/
(void) ioctl(STDIN, TCFLSH, 0);

/* start timer, if required
*/
if (TimeOut > 0) {
(void) signal(SIGALRM, timeout);
(void) alarm((unsigned) TimeOut);
}

/* handle the login name
*/
switch (getlogname(&termio, buf, MAXLINE)) {
case SUCCESS:
/* stop alarm clock
*/
if (TimeOut > 0)
(void) alarm((unsigned) 0);

/* setup terminal
*/
termio.c_iflag |= gtab->ftermio.c_iflag;
termio.c_oflag |= gtab->ftermio.c_oflag;
termio.c_cflag |= gtab->ftermio.c_cflag;
termio.c_lflag |= gtab->ftermio.c_lflag;
termio.c_line |= gtab->ftermio.c_line;
settermio(&termio, FINAL);
#ifdef DEBUG
debug2(D_STTY, "Final settings:\n");
if (Debug & D_STTY) system("stty -a >&3");
if (Debug)
(void) fclose(Dfp);
#endif /* DEBUG */

#ifdef SETTERM
(void) sprintf(MsgBuf, "TERM=%s", term);
(void) putenv(strdup(MsgBuf));
#endif /* SETTERM */

/* hand off to login, which can be a shell script!
*/
(void) execl(login, "login", buf, (char *) NULL);
(void) execl("/bin/sh", "sh", "-c",
login, buf, (char *) NULL);
(void) sprintf(MsgBuf, "cannot execute %s", login);
logerr(MsgBuf);
exit(FAIL);

case BADSPEED:
/* go to next entry
*/
GtabId = gtab->next_id;
debug3(D_RUN, "Bad Speed; trying %s\n", GtabId);
gtab = gtabvalue(GtabId, G_FORCE);
settermio(&(gtab->itermio), INITIAL);
break;

#ifdef WARNCASE
case BADCASE:
/* first try was all uppercase
*/
for (i=0; bad_case[i] != (char *) NULL; i++)
(void) fputs(bad_case[i], stdout);
goto login_prompt;
#endif /* WARNCASE */

case NONAME:
/* no login name entered
*/
break;
}
}
}


/*
** timeout() - handles SIGALRM
*/

sig_t
timeout()
{
TERMIO termio;

/* say bye-bye
*/
(void) sprintf(MsgBuf, "\nTimed out after %d seconds.\n", TimeOut);
(void) Fputs(MsgBuf, stdout);
(void) Fputs("Bye Bye.\n", stdout);

/* force a hangup
*/
(void) ioctl(STDIN, TCGETA, &termio);
termio.c_cflag &= ~CBAUD;
termio.c_cflag |= B0;
(void) ioctl(STDIN, TCSETAF, &termio);

exit(1);
}


/*
** tputc() - output a character for tputs()
*/

int
tputc(c)
char c;
{
fputc(c, stdout);
}


/*
** exit_usage() - exit with usage display
*/

void
exit_usage(code)
int code;
{
FILE *fp;

if ((fp = fopen(CONSOLE, "w")) != (FILE *) NULL) {
(void) fprintf(fp, USAGE, MyName, UOPT, MyName);
(void) fclose(fp);
}
exit(code);
}


#ifdef UUGETTY

/*
** makelock() - attempt to create a lockfile
**
** Returns FAIL if lock could not be made (line in use).
*/

int
makelock(name)
char *name;
{
int fd, pid;
char *temp, buf[MAXLINE+1];
#ifdef ASCIIPID
char apid[16];
#endif /* ASCIIPID */
int getpid();
char *mktemp();

debug3(D_LOCK, "makelock(%s) called\n", name);

/* first make a temp file
*/
(void) sprintf(buf, LOCK, "TM.XXXXXX");
if ((fd = creat((temp=mktemp(buf)), 0444)) == FAIL) {
(void) sprintf(MsgBuf, "cannot create tempfile (%s)", temp);
logerr(MsgBuf);
return(FAIL);
}
debug3(D_LOCK, "temp = (%s)\n", temp);

/* put my pid in it
*/
#ifdef ASCIIPID
(void) sprintf(apid, "%09d", getpid());
(void) write(fd, apid, strlen(apid));
#else
pid = getpid();
(void) write(fd, (char *)&pid, sizeof(pid));
#endif /* ASCIIPID */
(void) close(fd);

/* link it to the lock file
*/
while (link(temp, name) == FAIL) {
debug3(D_LOCK, "link(temp,name) failed, errno=%d\n", errno);
if (errno == EEXIST) { /* lock file already there */
if ((pid = readlock(name)) == FAIL)
continue;
if ((kill(pid, 0) == FAIL) && errno == ESRCH) {
/* pid that created lockfile is gone */
(void) unlink(name);
continue;
}
}
debug2(D_LOCK, "lock NOT made\n");
(void) unlink(temp);
return(FAIL);
}
debug2(D_LOCK, "lock made\n");
(void) unlink(temp);
return(SUCCESS);
}

/*
** checklock() - test for presense of valid lock file
**
** Returns TRUE if lockfile found, FALSE if not.
*/

boolean
checklock(name)
char *name;
{
int pid;
struct stat st;

debug3(D_LOCK, "checklock(%s) called\n", name);

if ((stat(name, &st) == FAIL) && errno == ENOENT) {
debug2(D_LOCK, "stat failed, no file\n");
return(FALSE);
}

if ((pid = readlock(name)) == FAIL) {
debug2(D_LOCK, "couldn't read lockfile\n");
return(FALSE);
}

if ((kill(pid, 0) == FAIL) && errno == ESRCH) {
debug2(D_LOCK, "no active process has lock, will remove\n");
(void) unlink(name);
return(FALSE);
}

debug2(D_LOCK, "active process has lock, return(TRUE)\n");
return(TRUE);
}

/*
** readlock() - read contents of lockfile
**
** Returns pid read or FAIL on error.
*/

int
readlock(name)
char *name;
{
int fd, pid, n;
#ifdef ASCIIPID
char apid[16];
#endif /* ASCIIPID */

if ((fd = open(name, O_RDONLY)) == FAIL)
return(FAIL);

#ifdef ASCIIPID
(void) read(fd, apid, sizeof(apid));
n = sscanf(apid, "%d", &pid);
#else
(void) read(fd, (char *)&pid, sizeof(pid));
#endif /* ASCIIPID */

#ifdef BOTHPID
if (n != 1){
(void) close(fd);
fd = open(name, O_RDONLY);
(void) read(fd, (char *)&pid, sizeof(pid));
}
#endif

(void) close(fd);
debug3(D_LOCK, "read %d from the lockfile\n", pid);
return(pid);
}

/*
** rmlocks() - remove lockfile(s)
*/

sig_t
rmlocks()
{
if (altlock != (char *) NULL)
(void) unlink(altlock);

(void) unlink(lock);
}

#endif /* UUGETTY */


/* end of main.c */
getty_ps/table.c 644 144 0 30376 5230041263 12526 0ustar stevewheel/*
** $Id: table.c,v 2.0 90/09/19 20:18:46 paul Rel $
**
** Routines to process the gettytab file.
*/

/*
** Copyright 1989,1990 by Paul Sutcliffe Jr.
**
** Permission is hereby granted to copy, reproduce, redistribute,
** or otherwise use this software as long as: there is no monetary
** profit gained specifically from the use or reproduction or this
** software, it is not sold, rented, traded or otherwise marketed,
** and this copyright notice is included prominently in any copy
** made.
**
** The author make no claims as to the fitness or correctness of
** this software for any use whatsoever, and it is provided as is.
** Any use of this software is at the user's own risk.
*/

/*
** $Log: table.c,v $
** Revision 2.0 90/09/19 20:18:46 paul
** Initial 2.0 release
**
*/


#include "getty.h"
#include "table.h"

#if defined(RCSID) && !defined(lint)
static char *RcsId =
"@(#)$Id: table.c,v 2.0 90/09/19 20:18:46 paul Rel $";
#endif


/* Sane conditions.
*/
#define ISANE ( BRKINT | IGNPAR | ISTRIP | ICRNL | IXON | IXANY )
#define OSANE ( OPOST | ONLCR )
#define CSANE ( DEF_CFL | CREAD | HUPCL )
#define LSANE ( ISIG | ICANON | ECHO | ECHOE | ECHOK )

#define CC_SANE { CINTR, CQUIT, CERASE, CKILL, CEOF, CNUL, CNUL, CNUL }


/* States for gtabvalue()
*/
#define ENTRY 0 /* looking for an entry line */
#define QUIT 1 /* error occurred */


#define NULLPTR (char *) NULL


/* All possible mode flags.
*/

SYMTAB imodes[] = {
{ "IGNBRK", IGNBRK },
{ "BRKINT", BRKINT },
{ "IGNPAR", IGNPAR },
{ "PARMRK", PARMRK },
{ "INPCK", INPCK },
{ "ISTRIP", ISTRIP },
{ "INLCR", INLCR },
{ "IGNCR", IGNCR },
{ "ICRNL", ICRNL },
{ "IUCLC", IUCLC },
{ "IXON", IXON },
{ "IXANY", IXANY },
{ "IXOFF", IXOFF },
{ NULLPTR, 0 }
};

SYMTAB omodes[] = {
{ "OPOST", OPOST },
{ "OLCUC", OLCUC },
{ "ONLCR", ONLCR },
{ "OCRNL", OCRNL },
{ "ONOCR", ONOCR },
{ "ONLRET", ONLRET },
{ "OFILL", OFILL },
{ "OFDEL", OFDEL },
{ "NLDLY", NLDLY },
{ "NL0", NL0 },
{ "NL1", NL1 },
{ "CRDLY", CRDLY },
{ "CR0", CR0 },
{ "CR1", CR1 },
{ "CR2", CR2 },
{ "CR3", CR3 },
{ "TABDLY", TABDLY },
{ "TAB0", TAB0 },
{ "TAB1", TAB1 },
{ "TAB2", TAB2 },
{ "TAB3", TAB3 },
{ "BSDLY", BSDLY },
{ "BS0", BS0 },
{ "BS1", BS1 },
{ "VTDLY", VTDLY },
{ "VT0", VT0 },
{ "VT1", VT1 },
{ "FFDLY", FFDLY },
{ "FF0", FF0 },
{ "FF1", FF1 },
{ NULLPTR, 0 }
};

SYMTAB cmodes[] = {
{ "B0", B0 },
{ "B50", B50 },
{ "B75", B75 },
{ "B110", B110 },
{ "B134", B134 },
{ "B150", B150 },
{ "B200", B200 },
{ "B300", B300 },
{ "B600", B600 },
{ "B1200", B1200 },
{ "B1800", B1800 },
{ "B2400", B2400 },
{ "B4800", B4800 },
{ "B9600", B9600 },
#ifdef B19200
{ "B19200", B19200 },
#endif /* B19200 */
#ifdef B38400
{ "B38400", B38400 },
#endif /* B38400 */
{ "EXTA", EXTA },
{ "EXTB", EXTB },
{ "CS5", CS5 },
{ "CS6", CS6 },
{ "CS7", CS7 },
{ "CS8", CS8 },
{ "CSTOPB", CSTOPB },
{ "CREAD", CREAD },
{ "PARENB", PARENB },
{ "PARODD", PARODD },
{ "HUPCL", HUPCL },
{ "CLOCAL", CLOCAL },
#ifdef LOBLK
{ "LOBLK", LOBLK },
#endif /* LOBLK */
{ NULLPTR, 0 },
};

SYMTAB lmodes[] = {
{ "ISIG", ISIG },
{ "ICANON", ICANON },
{ "XCASE", XCASE },
{ "ECHO", ECHO },
{ "ECHOE", ECHOE },
{ "ECHOK", ECHOK },
{ "ECHONL", ECHONL },
{ "NOFLSH", NOFLSH },
#ifdef XCLUDE
{ "XCLUDE", XCLUDE },
#endif /* XCLUDE */
{ NULLPTR, 0 }
};

SYMTAB ldiscs[] = {
{ "LDISC0", LDISC0 },
{ NULLPTR, 0 }
};

/*
* Gettytab entry to use if no other can be determined
*/
GTAB Default = {
"default",
{ 0, 0, ( SSPEED | CSANE ), 0, 0, CC_SANE, },
{ ISANE, OSANE, ( SSPEED | CSANE ), LSANE, LDISC0, CC_SANE, },
"login: ",
"default"
};

#define VALUE(cptr) ((cptr == (char *) NULL) ? "NULL" : cptr)

int errors = 0;

int nextentry(), parseGtab(), findsym();
char *nextword();
void addfield(), chkerr();


/*
** gtabvalue() - find a gettytab entry that matches "id."
**
** Returns (GTAB *)NULL if not found or an error occurs.
*/

GTAB *
gtabvalue(id, mode)
register char *id;
int mode;
{
register int state;
register char *p;
register char *gettytab; /* gettytab file to use */
STDCHAR buf[MAXLINE+1]; /* buffer for Gtab entries */
char buf_id[MAXID+1]; /* buffer to compare initial label */
char *this = "First"; /* First or Next entry */
static GTAB gtab; /* structure to be returned */
FILE *fp;

debug3(D_GTAB, "gtabvalue(%s) called\n", VALUE(id));

gettytab = (Check) ? CheckFile : GETTYTAB;
debug3(D_GTAB, "gettytab=%s\n", gettytab);

/* open the gettytab file
*/
if ((fp = fopen(gettytab, "r")) == (FILE *) NULL) {
(void) sprintf(MsgBuf, "cannot open %s", gettytab);
logerr(MsgBuf);
return(&Default);
}

/* search through the file for "id", unless
* id is NULL, in which case we drop down
* to get the 'default' entry.
*/
state = (!Check && (id == (char *) NULL)) ? QUIT : ENTRY;

while (state != QUIT && nextentry(buf, sizeof(buf), fp) == SUCCESS) {
if (buf[0] == '#' || buf[0] == '\n')
continue; /* keep looking */
if (Check) {
(void) printf("*** %s Entry ***\n", this);
(void) printf("%s\n", buf);
this = "Next";
}
if (buf[strlen(buf)-1] != '\n') {
/* last char not \n, line is too long */
chkerr("line too long", FAIL);
state = QUIT;
continue;
}
/* get the first (label) field
*/
(void) strncpy(buf_id, buf, MAXID);
if ((p = strtok(buf_id, "# \t")) != (char *) NULL)
*(--p) = '\0';
/* if Check is set, parse all entries;
* otherwise, parse only a matching entry
*/
if (Check || strequal(id, buf_id)) {
if (parseGtab(>ab, buf) == FAIL) {
chkerr("*** Invalid Entry ***", FAIL);
state = QUIT;
continue;
}
if (!Check) {
(void) fclose(fp);
goto success;
}
}
}

if (Check) {
if (errors)
(void) printf("*** %d errors found ***\n", errors);
(void) printf("*** Check Complete ***\n");
(void) fclose(fp);
return((GTAB *) NULL);
}

if (mode == G_FIND)
return((GTAB *) NULL);

if (id != (char *) NULL) {
(void) sprintf(MsgBuf, "%s entry for \"%s\" not found",
gettytab, id);
logerr(MsgBuf);
}

/* matching entry not found or defective;
* use the first line of the file
*/
rewind(fp);
(void) nextentry(buf, sizeof(buf), fp);
(void) fclose(fp);
if (parseGtab(>ab, buf) == FAIL)
return(&Default); /* punt: first line defective */

success:
debug2(D_GTAB, "gtabvalue() successful\n");
return(>ab);
}


/*
** nextentry() - retrieve next entry from gettytab file
**
** Returns FAIL if an error occurs.
*/

int
nextentry(buf, len, stream)
register char *buf;
register int len;
FILE *stream;
{
register int count = 0;
STDCHAR line[MAXLINE+1];

*buf = '\0'; /* erase buffer */

while (fgets(line, sizeof(line), stream) != (char *) NULL) {
debug2(D_GTAB, "line read = (");
debug1(D_GTAB, line);
debug2(D_GTAB, ")\n");
if (count)
buf[strlen(buf)-1] = '\0';
if ((count += strlen(line)) >= len)
return(FAIL); /* entry too long */
(void) strcat(buf, line);
if ((line[0] == '\n') || (line[0] == '#'))
return(SUCCESS); /* blank line */
}

return (*buf == '\0' ? QUIT : SUCCESS);
}


/*
** parseGtab() - fill in GTAB structure from buffer
**
** Returns FAIL if an error occurs.
*/

int
parseGtab(gtab, line)
GTAB *gtab;
register char *line;
{
register int field;
register char *p;
static int count;
static char p_cur[MAXID+1], p_next[MAXID+1];
static char p_login[MAXLOGIN+1];

debug2(D_GTAB, "parseGtab() called\n");

/* initialize gtab to empty
*/
gtab->cur_id = (char *) NULL;
gtab->itermio.c_iflag = 0;
gtab->itermio.c_oflag = 0;
gtab->itermio.c_cflag = 0;
gtab->itermio.c_lflag = 0;
gtab->itermio.c_line = 0;
gtab->ftermio.c_iflag = 0;
gtab->ftermio.c_oflag = 0;
gtab->ftermio.c_cflag = 0;
gtab->ftermio.c_lflag = 0;
gtab->ftermio.c_line = 0;
gtab->login = (char *) NULL;
gtab->next_id = (char *) NULL;

if (LineD != (char *) NULL) { /* line disc given on command line */
addfield(&(gtab->itermio), LineD);
addfield(&(gtab->ftermio), LineD);
}

/* parse the line
*/
debug2(D_GTAB, "parsing line:\n");
field = 1;
while (field != FAIL && field != SUCCESS) {
if ((p = nextword(line, &count)) == (char *) NULL) {
field = FAIL;
continue;
}
debug4(D_GTAB, "field=%d, nextword=(%s)\n", field, p);
switch (field) {
case 1:
/* cur_id label
*/
(void) strncpy(p_cur, p, MAXID);
gtab->cur_id = p_cur;
field++;
break;
case 2:
/* '#' field separator
*/
if (*p != '#') {
field = FAIL;
continue;
}
field++;
break;
case 3:
/* initial termio flags
*/
if (*p == '#')
field++;
else
addfield(&(gtab->itermio), p);
break;
case 4:
/* final termio flags
*/
if (*p == '#')
field++;
else
addfield(&(gtab->ftermio), p);
break;
case 5:
/* login message --
* nextword won't be the whole message; look
* ahead to the next '#' and terminate string there
*/
if ((p = index(line, '#')) == (char *) NULL) {
field = FAIL;
continue;
}
*p = '\0';
p = line; /* point p to line again */
count = strlen(p)+1; /* adjust count accordingly */
debug3(D_GTAB, "login=(%s)\n", p);
(void) strncpy(p_login, p, MAXLOGIN);
gtab->login = p_login;
field++;
break;
case 6:
/* next_id label
*/
(void) strncpy(p_next, p, MAXID);
gtab->next_id = p_next;
field = SUCCESS;
continue;
}
/* skip over word just processed
*/
line += count;
}

if (Check) {
(void) printf("id: \"%s\"\n", gtab->cur_id);
(void) printf("initial termio flags:\n");
(void) printf(" iflag: %o, oflag: %o, cflag: %o, lflag: %o\n",
gtab->itermio.c_iflag, gtab->itermio.c_oflag,
gtab->itermio.c_cflag, gtab->itermio.c_lflag);
(void) printf(" line disc: %o\n", gtab->itermio.c_line);
(void) printf("final termio flags:\n");
(void) printf(" iflag: %o, oflag: %o, cflag: %o, lflag: %o\n",
gtab->ftermio.c_iflag, gtab->ftermio.c_oflag,
gtab->ftermio.c_cflag, gtab->ftermio.c_lflag);
(void) printf(" line disc: %o\n", gtab->ftermio.c_line);
(void) printf("login prompt: \"%s\"\n", gtab->login);
(void) printf("next id: \"%s\"\n\n", gtab->next_id);
}

return(field);
}


/*
** nextword() - get next "word" from buffer
*/

char *
nextword(buf, count)
register char *buf;
register int *count;
{
register int num = 0;
register char *p;
static char word[MAXLINE+1];

while (*buf == ' ' || *buf == '\t' || *buf == '\\' ||
*buf == '\n') { /* skip leading whitespace */
buf++; num++;
}
p = word;
if (*buf == '#') { /* first char is '#' ? */
*p++ = *buf;
num++;
} else {
while (*buf != ' ' && *buf != '\t' && *buf != '\\' &&
*buf != '#' && *buf != '\n') {
*p++ = *buf++;
num++;
}
}
*p = '\0';
*count = num;
return(word);
}


#define TOGGLE(f,b) \
{if (inverted) (f) &= ~(b); else (f) |= (b);}

/*
** addfield() - add symbol to termio structure
*/

void
addfield(termio, field)
register TERMIO *termio;
register char *field;
{
register int val;
int inverted;

if (strequal(field, "SANE")) {
termio->c_iflag |= ISANE;
termio->c_oflag |= OSANE;
termio->c_cflag |= CSANE;
termio->c_lflag |= LSANE;
} else {
if (*field == '-'){
inverted = TRUE;
field++;
}
else inverted = FALSE;
if ((val = findsym(field, imodes)) != FAIL)
/* termio->c_iflag |= (ushort) val; */
TOGGLE (termio->c_iflag, val)
else if ((val = findsym(field, omodes)) != FAIL)
/* termio->c_oflag |= (ushort) val; */
TOGGLE (termio->c_oflag, val)
else if ((val = findsym(field, cmodes)) != FAIL)
/* termio->c_cflag |= (ushort) val; */
TOGGLE (termio->c_cflag, val)
else if ((val = findsym(field, lmodes)) != FAIL)
/* termio->c_lflag |= (ushort) val; */
TOGGLE (termio->c_lflag, val)
else if ((val = findsym(field, ldiscs)) != FAIL)
/* termio->c_line |= (ushort) val; */
TOGGLE (termio->c_line, val)
else if (Check) {
(void) sprintf(MsgBuf, "undefined symbol: %s", field);
chkerr(MsgBuf, OK);
}
}
}


/*
** findsym() - look for field in SYMTAB list
*/

int
findsym(field, symtab)
register char *field;
register SYMTAB *symtab;
{
for (; symtab->symbol != (char *) NULL; symtab++)
if (strequal(symtab->symbol, field))
return((int) symtab->value);

return(FAIL);
}


/*
** chkerr() - display error message from check routines
*/

void
chkerr(msg, status)
char *msg;
int status;
{
(void) printf("*** parsing error: %s ***\n", msg);
if (status)
(void) printf("*** checking halted ***\n");
else
(void) printf("*** checking continued ***\n");

errors++;
}


/* end of table.c */
getty_ps/release.h 644 144 0 365 5200627327 13027 0ustar stevewheel/*
** $Id: release.h,v 2.0 90/09/19 20:16:46 paul Rel $
**
** Getty release/date
*/


/* these are used by the man pages, too
*/
#define RELEASE "2.0" /* release number */
#define DATE "19-Sep-90" /* release date */


/* end of release.h */
getty_ps/Configure 755 144 0 141023 5210754144 13161 0ustar stevewheel#! /bin/sh
#
# If these # comments don't work, trim them. Don't worry about any other
# shell scripts, Configure will trim # comments from them for you.
#
# (If you are trying to port this package to a machine without sh, I would
# suggest you cut out the prototypical config.h from the end of Configure
# and edit it to reflect your system. Some packages may include samples
# of config.h for certain machines, so you might look for one of those.)
#
# $Id: Configure,v 2.0 90/09/19 19:23:44 paul Rel $
#
# Yes, you may rip this off to use in other distribution packages.
# (Note: this Configure script was generated automatically. Rather than
# working with this copy of Configure, you may wish to get metaconfig.)
#
# $Log: Configure,v $
# Revision 2.0 90/09/19 19:23:44 paul
# Initial 2.0 release
#
#

: sanity checks
PATH=".:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:/usr/new:/usr/new/bin:/usr/nbin:$PATH"
export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0; kill $$)

if test ! -t 0; then
echo "Say 'sh Configure', not 'sh exit 1
fi

(alias) >/dev/null 2>&1 && \
echo "(I see you are using the Korn shell. Some ksh's blow up on Configure," && \
echo "especially on exotic machines. If yours does, try the Bourne shell instead.)"

if test ! -d ../UU; then
if test ! -d UU; then
mkdir UU
fi
cd UU
fi

case "$1" in
-d) shift; fastread='yes';;
esac

d_getutent=''
d_strdup=''
d_putenv=''
d_ttytype=''
ttytype=''
gettytab=''
utmp=''
wtmp=''
uucpid=''
lock=''
d_asciipid=''
mailer=''
hostname=''
phostname=''
d_douname=''
d_phostname=''
d_portable=''
termlib=''
llib_termlib=''
xenix=''
d_eunice=''
define=''
undef=''
eunicefix=''
loclist=''
expr=''
sed=''
echo=''
cat=''
rm=''
mv=''
cp=''
tr=''
sort=''
uniq=''
grep=''
trylist=''
test=''
egrep=''
Mcc=''
cpp=''
mail=''
mailx=''
sendmail=''
uname=''
uuname=''
Log=''
Id=''
bin=''
contains=''
cppstdin=''
cppminus=''
d_fcntl=''
d_index=''
d_ioctl=''
d_varargs=''
d_voidsig=''
gidtype=''
i_fcntl=''
i_pwd=''
i_sysioctl=''
i_time=''
i_systime=''
d_systimekernel=''
i_varargs=''
libc=''
models=''
split=''
small=''
medium=''
large=''
huge=''
optimize=''
ccflags=''
cppflags=''
ldflags=''
cc=''
libs=''
n=''
c=''
package=''
spitshell=''
shsharp=''
sharpbang=''
startsh=''
stdchar=''
uidtype=''
voidflags=''
defvoidused=''
lib=''
CONFIG=''
: set package name
package=getty

echo " "
echo "Beginning of configuration questions for $package kit."
: Eunice requires " " instead of "", can you believe it
echo " "

define='define'
undef='undef'
: change the next line if compiling for Xenix/286 on Xenix/386
xlibpth='/usr/lib/386 /lib/386'
libpth='/usr/lib /usr/local/lib /usr/lib/large /lib '$xlibpth' /lib/large /usr/lib/small /lib/small'
# SMR - additions for linux's gcc:
libpth='/usr/lib/shared /usr/lib/static '$libpth
echo The lib path is $libpth
smallmach='pdp11 i8086 z8000 i80286 iAPX286'
rmlist='kit[1-9]isdone kit[1-9][0-9]isdone'
trap 'echo " "; rm -f $rmlist; exit 1' 1 2 3

: We must find out about Eunice early
eunicefix=':'
if test -f /etc/unixtovms; then
eunicefix=/etc/unixtovms
fi
if test -f /etc/unixtovms.exe; then
eunicefix=/etc/unixtovms.exe
fi

: Now test for existence of everything in MANIFEST

echo "First let's make sure your kit is complete. Checking..."
(cd ..; cat `awk 'NR>4{print $1}' MANIFEST` >/dev/null || kill $$)
echo "Looks good..."

attrlist="mc68000 sun gcos unix ibm gimpel interdata tss os mert pyr"
attrlist="$attrlist vax pdp11 i8086 z8000 u3b2 u3b5 u3b20 u3b200"
attrlist="$attrlist hpux hp9000s300 hp9000s500 hp9000s800"
attrlist="$attrlist ns32000 ns16000 iAPX286 mc300 mc500 mc700 sparc"
attrlist="$attrlist nsc32000 sinix xenix venix posix ansi M_XENIX"
attrlist="$attrlist $mc68k __STDC__ UTS M_I8086 M_I186 M_I286 M_I386"
attrlist="$attrlist i186 __m88k__ m88k DGUX __DGUX__"
pth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /usr/plx /usr/5bin /vol/local/bin /etc /usr/lib /lib /usr/local/lib /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/bin /bsd4.3/usr/ucb"
defvoidused=7
libswanted="x c_s"
inclwanted=''

: some greps do not return status, grrr.
echo "grimblepritz" >grimble
if grep blurfldyick grimble >/dev/null 2>&1 ; then
contains=contains
elif grep grimblepritz grimble >/dev/null 2>&1 ; then
contains=grep
else
contains=contains
fi
rm -f grimble
: the following should work in any shell
case "$contains" in
contains*)
echo " "
echo "AGH! Grep doesn't return a status. Attempting remedial action."
cat >contains <<'EOSS'
grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
EOSS
chmod +x contains
esac

: see if sh knows # comments
echo " "
echo "Checking your sh to see if it knows about # comments..."
if sh -c '#' >/dev/null 2>&1 ; then
echo "Your sh handles # comments correctly."
shsharp=true
spitshell=cat
echo " "
echo "Okay, let's see if #! works on this system..."
echo "#!/bin/echo hi" > try
$eunicefix try
chmod +x try
./try > today
if $contains hi today >/dev/null 2>&1; then
echo "It does."
sharpbang='#!'
else
echo "#! /bin/echo hi" > try
$eunicefix try
chmod +x try
./try > today
if test -s today; then
echo "It does."
sharpbang='#! '
else
echo "It doesn't."
sharpbang=': use '
fi
fi
else
echo "Your sh doesn't grok # comments--I will strip them later on."
shsharp=false
echo "exec grep -v '^#'" >spitshell
chmod +x spitshell
$eunicefix spitshell
spitshell=`pwd`/spitshell
echo "I presume that if # doesn't work, #! won't work either!"
sharpbang=': use '
fi

: figure out how to guarantee sh startup
echo " "
echo "Checking out how to guarantee sh startup..."
startsh=$sharpbang'/bin/sh'
echo "Let's see if '$startsh' works..."
cat >try < $startsh
set abc
test "$?abc" != 1
EOSS

chmod +x try
$eunicefix try
if ./try; then
echo "Yup, it does."
else
echo "Nope. You may have to fix up the shell scripts to make sure sh runs them."
fi
rm -f try today

: first determine how to suppress newline on echo command
echo "Checking echo to see how to suppress newlines..."
(echo "hi there\c" ; echo " ") >.echotmp
if $contains c .echotmp >/dev/null 2>&1 ; then
echo "...using -n."
n='-n'
c=''
else
cat <<'EOM'
...using \c
EOM
n=''
c='\c'
fi
echo $n "Type carriage return to continue. Your cursor should be here-->$c"
read ans
rm -f .echotmp

: now set up to do reads with possible shell escape and default assignment
cat <myread
case "\$fastread" in
yes) ans=''; echo " " ;;
*) ans='!';;
esac
while expr "X\$ans" : "X!" >/dev/null; do
read ans
case "\$ans" in
!)
sh
echo " "
echo $n "\$rp $c"
;;
!*)
set \`expr "X\$ans" : "X!\(.*\)\$"\`
sh -c "\$*"
echo " "
echo $n "\$rp $c"
;;
esac
done
rp='Your answer:'
case "\$ans" in
'') ans="\$dflt";;
esac
EOSC

: general instructions
cat <
This installation shell script will examine your system and ask you questions
to determine how the $package package should be installed. If you get stuck
on a question, you may use a ! shell escape to start a subshell or execute
a command. Many of the questions will have default answers in square
brackets--typing carriage return will give you the default.

On some of the questions which ask for file or directory names you are
allowed to use the ~name construct to specify the login directory belonging
to "name", even if you don't have a shell which knows about that. Questions
where this is allowed will be marked "(~name ok)".

EOH
rp="[Type carriage return to continue]"
echo $n "$rp $c"
. myread
cat <
Much effort has been expended to ensure that this shell script will run
on any Unix system. If despite that it blows up on you, your best bet is
to edit Configure and run it again. Also, let me ([email protected])
know how I blew it. If you can't run Configure for some reason, you'll have
to generate a config.sh file by hand.

This installation script affects things in two ways: 1) it may do direct
variable substitutions on some of the files included in this kit, and
2) it builds a config.h file for inclusion in C programs. You may edit
any of these files as the need arises after running this script.

If you make a mistake on a question, there is no easy way to back up to it
currently. The easiest thing to do is to edit config.sh and rerun all the
SH files. Configure will offer to let you do this before it runs the SH files.

EOH
rp="[Type carriage return to continue]"
echo $n "$rp $c"
. myread

: get old answers, if there is a config file out there
if test -f ../config.sh; then
echo " "
dflt=y
rp="I see a config.sh file. Did Configure make it on THIS system? [$dflt]"
echo $n "$rp $c"
. myread
case "$ans" in
n*) echo "OK, I'll ignore it.";;
*) echo "Fetching default answers from your old config.sh file..."
tmp="$n"
ans="$c"
. ../config.sh
n="$tmp"
c="$ans"
;;
esac
fi

: find out where common programs are
echo " "
echo "Locating common programs..."
cat <loc
$startsh
case \$# in
0) exit 1;;
esac
thing=\$1
shift
dflt=\$1
shift
for dir in \$*; do
case "\$thing" in
.)
if test -d \$dir/\$thing; then
echo \$dir
exit 0
fi
;;
*)
if test -f \$dir/\$thing; then
echo \$dir/\$thing
exit 0
elif test -f \$dir/\$thing.exe; then
: on Eunice apparently
echo \$dir/\$thing
exit 0
fi
;;
esac
done
echo \$dflt
exit 1
EOSC
chmod +x loc
$eunicefix loc
loclist="
cat
cp
echo
expr
grep
mv
rm
sed
sort
tr
uniq
"
trylist="
Mcc
cpp
egrep
mail
mailx
sendmail
test
"
for file in $loclist; do
xxx=`loc $file $file $pth`
eval $file=$xxx
eval _$file=$xxx
case "$xxx" in
/*)
echo $file is in $xxx.
;;
*)
echo "I don't know where $file is. I hope it's in everyone's PATH."
;;
esac
done
echo " "
echo "Don't worry if any of the following aren't found..."
ans=offhand
for file in $trylist; do
xxx=`loc $file $file $pth`
eval $file=$xxx
eval _$file=$xxx
case "$xxx" in
/*)
echo $file is in $xxx.
;;
*)
echo "I don't see $file out there, $ans."
ans=either
;;
esac
done
case "$egrep" in
egrep)
echo "Substituting grep for egrep."
egrep=$grep
;;
esac
case "$test" in
test)
echo "Hopefully test is built into your sh."
;;
/bin/test)
if sh -c "PATH= test true" >/dev/null 2>&1; then
echo "Using the test built into your sh."
test=test
fi
;;
*)
test=test
;;
esac
case "$echo" in
echo)
echo "Hopefully echo is built into your sh."
;;
/bin/echo)
echo " "
echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
$echo $n "hi there$c" >foo1
echo $n "hi there$c" >foo2
if cmp foo1 foo2 >/dev/null 2>&1; then
echo "They are compatible. In fact, they may be identical."
else
case "$n" in
'-n') n='' c='\c' ans='\c' ;;
*) n='-n' c='' ans='-n' ;;
esac
cat < They are not compatible! You are probably running ksh on a non-USG system.
I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
have echo built in and we may have to run some Bourne shell scripts. That
means I'll have to use $ans to suppress newlines now. Life is ridiculous.

FOO
rp="Your cursor should be here-->"
$echo $n "$rp$c"
. myread
fi
$rm -f foo1 foo2
;;
*)
: cross your fingers
echo=echo
;;
esac
rmlist="$rmlist loc"

: set up shell script to do ~ expansion
cat >filexp < $startsh
: expand filename
case "\$1" in
~/*|~)
echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
;;
~*)
if $test -f /bin/csh; then
/bin/csh -f -c "glob \$1"
echo ""
else
name=\`$expr x\$1 : '..\([^/]*\)'\`
dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' if $test ! -d "\$dir"; then
me=\`basename \$0\`
echo "\$me: can't locate home directory for: \$name" >&2
exit 1
fi
case "\$1" in
*/*)
echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
;;
*)
echo \$dir
;;
esac
fi
;;
*)
echo \$1
;;
esac
EOSS
chmod +x filexp
$eunicefix filexp

: determine where public executables go
case "$bin" in
'')
dflt=`loc . /etc /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
;;
*) dflt="$bin"
;;
esac
cont=true
while $test "$cont" ; do
echo " "
rp="Where do you want to put the public executables? (~name ok) [$dflt]"
$echo $n "$rp $c"
. myread
bin="$ans"
bin=`./filexp "$bin"`
if test -d $bin; then
cont=''
else
case "$fastread" in
yes) dflt=y;;
*) dflt=n;;
esac
rp="Directory $bin doesn't exist. Use that name anyway? [$dflt]"
$echo $n "$rp $c"
. myread
dflt=''
case "$ans" in
y*) cont='';;
esac
fi
done

: make some quick guesses about what we are up against
echo " "
$echo $n "Hmm... $c"
cat /usr/include/signal.h /usr/include/sys/signal.h >foo
if test `echo abc | tr a-z A-Z` = Abc ; then
echo "Looks kind of like a USG system, but we'll see..."
echo exit 1 >bsd
echo exit 0 >usg
echo exit 1 >v7
elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
echo "Looks kind of like a BSD system, but we'll see..."
echo exit 0 >bsd
echo exit 1 >usg
echo exit 1 >v7
else
echo "Looks kind of like a version 7 system, but we'll see..."
echo exit 1 >bsd
echo exit 1 >usg
echo exit 0 >v7
fi
case "$eunicefix" in
*unixtovms*)
cat <<'EOI'
There is, however, a strange, musty smell in the air that reminds me of
something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
EOI
echo "exit 0" >eunice
d_eunice="$define"
;;
*)
echo " "
echo "Congratulations. You aren't running Eunice."
d_eunice="$undef"
echo "exit 1" >eunice
;;
esac
if test -f /xenix; then
echo "Actually, this looks more like a XENIX system..."
echo "exit 0" >xenix
xenix="$define"
else
echo " "
echo "It's not Xenix..."
echo "exit 1" >xenix
xenix="$undef"
fi
chmod +x xenix
$eunicefix xenix
if test -f /venix; then
echo "Actually, this looks more like a VENIX system..."
echo "exit 0" >venix
else
echo " "
if xenix; then
: null
else
echo "Nor is it Venix..."
fi
echo "exit 1" >venix
fi
chmod +x bsd usg v7 eunice venix
$eunicefix bsd usg v7 eunice venix
rm -rf foo
rmlist="$rmlist bsd usg v7 eunice venix xenix"

: Warnings
if v7; then
cat <<'EOM'

NOTE: many V7 systems do not have a way to do a non-blocking read. If you
don't have any of FIONREAD, O_NDELAY, or rdchk(), the $package package
may not work as well as it might. It might not work at all.
EOM
fi

: see what memory models we can support
case "$models" in
'')
: We may not use Cppsym or we get a circular dependency through cc.
: But this should work regardless of which cc we eventually use.
cat >pdp11.c <<'EOP'
main() {
#ifdef pdp11
exit(0);
#else
exit(1);
#endif
}
EOP
cc -o pdp11 pdp11.c >/dev/null 2>&1
if pdp11 2>/dev/null; then
dflt='unsplit split'
else
ans=`loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
case "$ans" in
X) dflt='none';;
*) if $test -d /lib/small || $test -d /usr/lib/small; then
dflt='small'
else
dflt=''
fi
if $test -d /lib/medium || $test -d /usr/lib/medium; then
dflt="$dflt medium"
fi
if $test -d /lib/large || $test -d /usr/lib/large; then
dflt="$dflt large"
fi
if $test -d /lib/huge || $test -d /usr/lib/huge; then
dflt="$dflt huge"
fi
esac
fi
;;
*) dflt="$models" ;;
esac
$cat <
Some systems have different model sizes. On most systems they are called
small, medium, large, and huge. On the PDP11 they are called unsplit and
split. If your system doesn't support different memory models, say "none".
If you wish to force everything to one memory model, say "none" here and
put the appropriate flags later when it asks you for other cc and ld flags.
Venix systems may wish to put "none" and let the compiler figure things out.
(In the following question multiple model names should be space separated.)

EOM
rp="Which models are supported? [$dflt]"
$echo $n "$rp $c"
. myread
models="$ans"

case "$models" in
none)
small=''
medium=''
large=''
huge=''
unsplit=''
split=''
;;
*split)
case "$split" in
'') dflt='-i';;
*) dflt="$split";;
esac
rp="What flag indicates separate I and D space? [$dflt]"
$echo $n "$rp $c"
. myread
case "$ans" in
none) ans='';;
esac
split="$ans"
unsplit=''
;;
*large*|*small*|*medium*|*huge*)
case "$models" in
*large*)
case "$large" in
'') dflt='-Ml';;
*) dflt="$large";;
esac
rp="What flag indicates large model? [$dflt]"
$echo $n "$rp $c"
. myread
case "$ans" in
none) ans='';
esac
large="$ans"
;;
*) large='';;
esac
case "$models" in
*huge*)
case "$huge" in
'') dflt='-Mh';;
*) dflt="$huge";;
esac
rp="What flag indicates huge model? [$dflt]"
$echo $n "$rp $c"
. myread
case "$ans" in
none) ans='';
esac
huge="$ans"
;;
*) huge="$large";;
esac
case "$models" in
*medium*)
case "$medium" in
'') dflt='-Mm';;
*) dflt="$medium";;
esac
rp="What flag indicates medium model? [$dflt]"
$echo $n "$rp $c"
. myread
case "$ans" in
none) ans='';
esac
medium="$ans"
;;
*) medium="$large";;
esac
case "$models" in
*small*)
case "$small" in
'') dflt='none';;
*) dflt="$small";;
esac
rp="What flag indicates small model? [$dflt]"
$echo $n "$rp $c"
. myread
case "$ans" in
none) ans='';
esac
small="$ans"
;;
*) small='';;
esac
;;
*)
echo "Unrecognized memory models--you may have to edit Makefile.SH"
;;
esac

: see if we need a special compiler
echo " "
if usg; then
case "$cc" in
'') case "$Mcc" in
/*) dflt='Mcc';;
*) dflt='cc';;
esac
;;
*) dflt="$cc";;
esac
$cat <<'EOM'

On some systems the default C compiler will not resolve multiple global
references that happen to have the same name. On some such systems the
"Mcc" command may be used to force these to be resolved. On other systems
a "cc -M" command is required. (Note that the -M flag on other systems
indicates a memory model to use!) If you have the Gnu C compiler, you
might wish to use that instead. What command will force resolution on
EOM
$echo $n "this system? [$dflt] $c"
rp="Command to resolve multiple refs? [$dflt]"
. myread
cc="$ans"
else
case "$cc" in
'') dflt=cc;;
*) dflt="$cc";;
esac
rp="Use which C compiler? [$dflt]"
$echo $n "$rp $c"
. myread
cc="$ans"
fi
case "$cc" in
gcc*) cpp=`loc gcc-cpp $cpp $pth`;;
esac

: determine optimize, if desired, or use for debug flag also
case "$optimize" in
' ') dflt="none"
;;
'') dflt="-O";
;;
*) dflt="$optimize"
;;
esac
cat <
Some C compilers have problems with their optimizers, by default, $package
compiles with the -O flag to use the optimizer. Alternately, you might
want to use the symbolic debugger, which uses the -g flag (on traditional
Unix systems). Either flag can be specified here. To use neither flag,
specify the word "none".

EOH
rp="What optimizer/debugger flag should be used? [$dflt]"
$echo $n "$rp $c"
. myread
optimize="$ans"
case "$optimize" in
'none') optimize=" "
;;
esac

case "$ccflags" in
'') case "$cc" in
*gcc*) dflt='-fpcc-struct-return';;
*) dflt='';;
esac
;;
*) dflt="$ccflags";;
esac
for thisincl in $inclwanted; do
if test -d $thisincl; then
case "$dflt" in
*$thisincl*);;
*) dflt="$dflt -I$thisincl";;
esac
fi
done
case "$optimize" in
-g*)
case "$dflt" in
*DEBUGGING*);;
*) dflt="$dflt -DDEBUGGING";;
esac
;;
esac
if $contains 'LANGUAGE_C' /usr/include/signal.h >/dev/null 2>&1; then
case "$dflt" in
*LANGUAGE_C*);;
*) dflt="$dflt -DLANGUAGE_C";;
esac
fi
case "$dflt" in
'') dflt=none;;
esac
cat <
Your C compiler may want other flags. For this question you should
include -I/whatever and -DWHATEVER flags and any other flags used by
the C compiler, but you should NOT include libraries or ld flags like
-lwhatever. To use no flags, specify the word "none".

EOH
rp="Any additional cc flags? [$dflt]"
$echo $n "$rp $c"
. myread
case "$ans" in
none) ans='';
esac
ccflags="$ans"

: the following weeds options from ccflags that are of no interest to cpp
cppflags="$ccflags"
case "$cc" in
*gcc*) cppflags="$cppflags -D__GNUC__";;
esac
case "$cppflags" in
'');;
*) set X $cppflags
cppflags=''
for flag do
case $flag in
-D*|-I*) cppflags="$cppflags $flag";;
esac
done
case "$cppflags" in
*-*) echo "(C preprocessor flags: $cppflags)";;
esac
;;
esac

case "$ldflags" in
'') if venix; then
dflt='-i -z'
else
dflt='none'
fi
;;
*) dflt="$ldflags";;
esac
echo " "
rp="Any additional ld flags (NOT including libraries)? [$dflt]"
$echo $n "$rp $c"
. myread
case "$ans" in
none) ans='';
esac
ldflags="$ans"
rmlist="$rmlist pdp11"

: where do we get termlib routines from
echo " "
ans=`loc libcurses.a x $libpth`
case "$ans" in
/*)
ar t $ans >grimble
if $contains tputs.o grimble >/dev/null 2>&1; then
termlib='-lcurses'
echo "Terminfo library found."
else
ans=x
fi
rm -f grimble
;;
esac
case "$ans" in
x)
ans=`loc libtermlib.a x $libpth`
case "$ans" in
/usr/lib*|/lib*)
termlib='-ltermlib'
echo "Termlib library found."
;;
/*)
termlib="$ans"
echo "Termlib library found."
;;
*)
ans=`loc libtermcap.a x $libpth`
case "$ans" in
/usr/lib*|/lib*)
termlib='-ltermcap'
echo "Termcap library found."
;;
/*)
termlib="$ans"
echo "Termcap library found."
;;
*)
case "$termlib" in
'')
dflt=y
rp="Your system appears to NOT have termlib-style routines. Is this true? [$dflt]"
$echo $n "$rp $c"
. myread
case "$ans" in
n*|f*)
echo "Then where are the termlib-style routines kept (specify either -llibname"
$echo $n " or full pathname (~name ok))? $c"
rp='Specify termlib:'
. myread
termlib=`filexp $ans`
;;
*) termlib=''
echo "You will have to play around with main.c then."
;;
esac
echo " "
;;
*) echo "You said termlib was $termlib before."
;;
esac
;;
esac
;;
esac
;;
esac
ans=`loc llib${termlib}.ln x $libpth`
case "$ans" in
/usr/lib*|/lib*)
echo "Termlib lint library found."
llib_termlib="$termlib"
;;
esac

echo " "
echo "Checking for optional libraries..."
dflt=''
case "$libswanted" in
'') libswanted='c_s';;
esac
for thislib in $libswanted; do
case "$thislib" in
dbm) thatlib=ndbm;;
*_s) thatlib=NONE;;
*) thatlib="${thislib}_s";;
*) thatlib=NONE;;
esac
xxx=`loc lib$thislib.a X /usr/lib /usr/local/lib /lib`
if test -f $xxx; then
echo "Found -l$thislib."
case "$dflt" in
*-l$thislib*|*-l$thatlib*);;
*) dflt="$dflt -l$thislib";;
esac
else
xxx=`loc lib$thislib.a X $libpth`
if test -f $xxx; then
echo "Found $xxx."
case "$dflt" in
*$xxx*);;
*) dflt="$dflt $xxx";;
esac
else
xxx=`loc Slib$thislib.a X $xlibpth`
if test -f $xxx; then
echo "Found -l$thislib."
case "$dflt" in
*-l$thislib*|*-l$thatlib*);;
*) dflt="$dflt -l$thislib";;
esac
else
echo "No -l$thislib."
fi
fi
fi
done
set X $termlib $dflt
shift
dflt="$*"
case "$libs" in
'') dflt="$dflt";;
*) dflt="$libs";;
esac
case "$dflt" in
'') dflt='none';;
esac

$cat <
Some versions of Unix support shared libraries, which make
executables smaller but make load time slightly longer.

On some systems, mostly newer Unix System V's, the shared library
is included by putting the option "-lc_s" as the last thing on the
cc command line when linking. Other systems use shared libraries
by default. There may be other libraries needed to compile $package
on your machine as well. If your system needs the "-lc_s" option,
include it here. Include any other special libraries here as well.
Say "none" for none.
EOM

echo " "
rp="Any additional libraries? [$dflt]"
$echo $n "$rp $c"
. myread
case "$ans" in
none) ans='';
esac
libs="$ans"

: see how we invoke the C preprocessor
echo " "
echo "Now, how can we feed standard input to your C preprocessor..."
cat <<'EOT' >testcpp.c
#define ABC abc
#define XYZ xyz
ABC.XYZ
EOT
echo 'Maybe "'"$cc"' -E" will work...'
$cc -E testcpp.out 2>&1
: try to force gcc preprocessor if that is the compiler they are using
case $? in
0) cppstdin="$cc -E";;
*) case "$cc" in
*gcc*)
cd ..
echo 'Trying (cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c)'
echo 'cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c' >cppstdin
chmod 755 cppstdin
cppstdin=`pwd`/cppstdin
cppminus='';
cd UU
$cppstdin testcpp.out 2>&1
;;
esac
;;
esac
if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
echo "Yup, it does."
cppstdin="$cc -E"
cppminus='';
else
echo 'Nope, maybe "'$cpp'" will work...'
$cpp testcpp.out 2>&1
if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
echo "Yup, it does."
cppstdin="$cpp"
cppminus='';
else
echo 'No such luck...maybe "'$cpp' -" will work...'
$cpp - testcpp.out 2>&1
if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
echo "It works!"
cppstdin="$cpp"
cppminus='-';
else
echo 'Nixed again...maybe "'"$cc"' -E -" will work...'
$cc -E - testcpp.out 2>&1
if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
echo "Hooray, it works! I was beginning to wonder."
cppstdin="$cc -E"
cppminus='-';
else
echo 'Nope...maybe "'"$cc"' -P" will work...'
$cc -P testcpp.out 2>&1
if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
echo "Yup, that does."
cppstdin="$cc -P"
cppminus='';
else
echo 'Nope...maybe "'"$cc"' -P -" will work...'
$cc -P - testcpp.out 2>&1
if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
echo "Yup, that does."
cppstdin="$cc -P"
cppminus='-';
else
echo 'Hmm...perhaps you already told me...'
case "$cppstdin" in
'') ;;
*) $cppstdin $cppminus testcpp.out 2>&1;;
esac
if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
echo "Hooray, you did! I was beginning to wonder."
else
echo 'Uh-uh. Time to get fancy...'
cd ..
echo 'Trying (cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c)'
echo 'cat >/tmp/$$.c; '"$cc"' -E /tmp/$$.c; rm /tmp/$$.c' >cppstdin
chmod 755 cppstdin
cppstdin=`pwd`/cppstdin
cppminus='';
cd UU
$cppstdin testcpp.out 2>&1
if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
echo "Eureka!."
else
dflt=blurfl
$echo $n "No dice. I can't find a C preprocessor. Name one: $c"
rp='Name a C preprocessor:'
. myread
cppstdin="$ans"
$cppstdin testcpp.out 2>&1
if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
echo "OK, that will do."
else
echo "Sorry, I can't get that to work. Go find one."
exit 1
fi
fi
fi
fi
fi
fi
fi
fi
fi
rm -f testcpp.c testcpp.out

: get list of predefined functions in a handy place
echo " "
case "$libc" in
'') libc=unknown;;
esac
case "$libpth" in
'') libpth='/lib /usr/lib /usr/local/lib';;
esac
case "$libs" in
*-lc_s*) libc=`loc libc_s.a $libc $libpth`
esac
libnames='';
case "$libs" in
'') ;;
*) for thislib in $libs; do
case "$thislib" in
-l*) thislib=`expr X$thislib : 'X-l\(.*\)'`
try=`loc lib$thislib.a blurfl/dyick $libpth`
if test ! -f $try; then
try=`loc lib$thislib blurfl/dyick $libpth`
if test ! -f $try; then
try=`loc $thislib blurfl/dyick $libpth`
if test ! -f $try; then
try=`loc Slib$thislib.a blurfl/dyick $xlibpth`
if test ! -f $try; then
try=''
fi
fi
fi
fi
libnames="$libnames $try"
;;
*) libnames="$libnames $thislib" ;;
esac
done
;;
esac
set /usr/lib/libc.so.[0-9]*
eval set \$$#
if test -f "$1"; then
echo "Your shared C library is in $1."
libc="$1"
elif test -f $libc; then
echo "Your C library is in $libc, like you said before."
elif test -f /lib/libc.a; then
echo "Your C library is in /lib/libc.a. You're normal."
libc=/lib/libc.a
else
ans=`loc libc.a blurfl/dyick $libpth`
if test ! -f "$ans"; then
ans=`loc libc blurfl/dyick $libpth`
fi
if test ! -f "$ans"; then
ans=`loc clib blurfl/dyick $libpth`
fi
if test ! -f "$ans"; then
ans=`loc Slibc.a blurfl/dyick $xlibpth`
fi
if test ! -f "$ans"; then
ans=`loc Mlibc.a blurfl/dyick $xlibpth`
fi
if test ! -f "$ans"; then
ans=`loc Llibc.a blurfl/dyick $xlibpth`
fi
if test -f "$ans"; then
echo "Your C library is in $ans, of all places."
libc=$ans
else
cat <
I can't seem to find your C library. I've looked in the following places:

$libpth

None of these seems to contain your C library. What is the full name
EOM
dflt=None
$echo $n "of your C library? $c"
rp='C library full name?'
. myread
libc="$ans"
fi
fi
echo " "
set `echo $libc $libnames | tr ' ' '\012' | sort | uniq`
$echo $n "Extracting names from $* for later perusal...$c"
nm $* 2>/dev/null >libc.tmp
$sed -n -e 's/^.* [AT] *_[_.]*//p' -e 's/^.* [AT] //p' libc.list
if $contains '^printf$' libc.list >/dev/null 2>&1; then
echo "done"
else
$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' libc.list
$contains '^printf$' libc.list >/dev/null 2>&1 || \
$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p' libc.list
$contains '^printf$' libc.list >/dev/null 2>&1 || \
$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p' libc.list
$contains '^printf$' libc.list >/dev/null 2>&1 || \
$sed -n -e 's/^_//' \
-e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p' libc.list
$contains '^printf$' libc.list >/dev/null 2>&1 || \
$sed -n -e 's/^.*|FUNC |GLOB .*|//p' libc.list
if $contains '^printf$' libc.list >/dev/null 2>&1; then
echo "done"
else
echo " "
echo "nm didn't seem to work right."
echo "Trying ar instead..."
if ar t $libc > libc.tmp; then
for thisname in $libnames; do
ar t $thisname >>libc.tmp
done
$sed -e 's/\.o$//' < libc.tmp > libc.list
echo "Ok."
else
echo "ar didn't seem to work right."
echo "Maybe this is a Cray...trying bld instead..."
if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
for thisname in $libnames; do
bld t $libnames | \
$sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
ar t $thisname >>libc.tmp
done
echo "Ok."
else
echo "That didn't work either. Giving up."
exit 1
fi
fi
fi
fi
rmlist="$rmlist libc.tmp libc.list"

: see if this is an fcntl system
echo " "
if $test -r /usr/include/fcntl.h ; then
d_fcntl="$define"
i_fcntl="$define"
echo "fcntl.h found."
else
d_fcntl="$undef"
i_fcntl="$undef"
echo "No fcntl.h found, but that's ok."
fi

: index or strcpy
echo " "
case "$d_index" in
n) dflt=n;;
*) dflt=y;;
esac
if $contains '^index$' libc.list >/dev/null 2>&1 ; then
if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
echo "Your system has both index() and strchr(). Shall I use"
rp="index() rather than strchr()? [$dflt]"
$echo $n "$rp $c"
. myread
case "$ans" in
n*) d_index="$define" ;;
*) d_index="$undef" ;;
esac
else
d_index="$undef"
echo "index() found."
fi
else
if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
d_index="$define"
echo "strchr() found."
else
d_index="$undef"
echo "No index() or strchr() found!"
fi
fi

: see if ioctl defs are in termio or sys/ioctl
echo " "
if $test -r /usr/include/sys/ioctl.h ; then
d_ioctl="$define"
i_sysioctl="$define"
echo "sys/ioctl.h found."
else
d_ioctl="$undef"
i_sysioctl="$undef"
echo "sys/ioctl.h not found, assuming ioctl args are defined in termio.h."
fi

: see if this is a pwd system
echo " "
if $test -r /usr/include/pwd.h ; then
i_pwd="$define"
echo "pwd.h found."
else
i_pwd="$undef"
echo "No pwd.h found."
fi

: see if we should include time.h, sys/time.h, or both
cat <<'EOM'

Testing to see if we should include , or both.
I'm now running the test program...
EOM
$cat >try.c <<'EOCP'
#ifdef I_TIME
#include
#endif
#ifdef I_SYSTIME
#ifdef SYSTIMEKERNEL
#define KERNEL
#endif
#include
#endif
main()
{
struct tm foo;
#ifdef S_TIMEVAL
struct timeval bar;
#endif
if (foo.tm_sec == foo.tm_sec)
exit(0);
#ifdef S_TIMEVAL
if (bar.tv_sec == bar.tv_sec)
exit(0);
#endif
exit(1);
}
EOCP
flags=''
for s_timeval in '-DS_TIMEVAL' ''; do
for d_systimekernel in '' '-DSYSTIMEKERNEL'; do
for i_time in '' '-DI_TIME'; do
for i_systime in '-DI_SYSTIME' ''; do
case "$flags" in
'') echo Trying $i_time $i_systime $d_systimekernel $s_timeval
if $cc $ccflags \
$i_time $i_systime $d_systimekernel $s_timeval \
try.c -o try >/dev/null 2>&1 ; then
set X $i_time $i_systime $d_systimekernel $s_timeval
shift
flags="$*"
echo Succeeded with $flags
fi
;;
esac
done
done
done
done
case "$flags" in
*SYSTIMEKERNEL*) d_systimekernel="$define";;
*) d_systimekernel="$undef";;
esac
case "$flags" in
*I_TIME*) i_time="$define";;
*) i_time="$undef";;
esac
case "$flags" in
*I_SYSTIME*) i_systime="$define";;
*) i_systime="$undef";;
esac
$rm -f try.c try

: see if this is a varargs system
echo " "
if $test -r /usr/include/varargs.h ; then
d_varargs="$define"
echo "varargs.h found."
else
d_varargs="$undef"
echo "No varargs.h found, but that's ok (I hope)."
fi

: see if signal is declared as pointer to function returning int or void
echo " "
$cppstdin $cppflags < /usr/include/signal.h >$$.tmp
if $contains 'void.*signal' $$.tmp >/dev/null 2>&1 ; then
echo "You have void (*signal())() instead of int."
d_voidsig="$define"
else
echo "You have int (*signal())() instead of void."
d_voidsig="$undef"
fi
rm -f $$.tmp

: check for void type
echo " "
$cat < Checking to see how well your C compiler groks the void type...

Support flag bits are:
1: basic void declarations.
2: arrays of pointers to functions returning void.
4: operations between pointers to and addresses of void functions.

EOM
case "$voidflags" in
'')
$cat >try.c <<'EOCP'
#if TRY & 1
void main() {
#else
main() {
#endif
extern void moo(); /* function returning void */
void (*goo)(); /* ptr to func returning void */
#if TRY & 2
void (*foo[10])();
#endif

#if TRY & 4
if(goo == moo) {
exit(0);
}
#endif
exit(0);
}
EOCP
if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
voidflags=$defvoidused
echo "It appears to support void."
if $contains warning .out >/dev/null 2>&1; then
echo "However, you might get some warnings that look like this:"
$cat .out
fi
else
echo "Hmm, your compiler has some difficulty with void. Checking further..."
if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1 ; then
echo "It supports 1..."
if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1 ; then
voidflags=3
echo "And it supports 2 but not 4."
else
echo "It doesn't support 2..."
if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1 ; then
voidflags=5
echo "But it supports 4."
else
voidflags=1
echo "And it doesn't support 4."
fi
fi
else
echo "There is no support at all for void."
voidflags=0
fi
fi
esac
dflt="$voidflags";
rp="Your void support flags add up to what? [$dflt]"
$echo $n "$rp $c"
. myread
voidflags="$ans"
$rm -f try.* .out

: see what type uids are declared as in the kernel
case "$uidtype" in
'')
if $contains 'uid_t;' /usr/include/sys/types.h >/dev/null 2>&1 ; then
dflt='uid_t'
else
set `grep 'u_uid;' /usr/include/sys/user.h 2>/dev/null` unsigned short
case $1 in
unsigned) dflt="$1 $2" ;;
*) dflt="$1" ;;
esac
fi
;;
*) dflt="$uidtype"
;;
esac
cont=true
echo " "
rp="What type are user ids returned by getuid(), etc.? [$dflt]"
$echo $n "$rp $c"
. myread
uidtype="$ans"

: see what type gids are declared as in the kernel
case "$gidtype" in
'')
if $contains 'gid_t;' /usr/include/sys/types.h >/dev/null 2>&1 ; then
dflt='gid_t'
else
set `grep 'u_gid;' /usr/include/sys/user.h 2>/dev/null` unsigned short
case $1 in
unsigned) dflt="$1 $2" ;;
*) dflt="$1" ;;
esac
fi
;;
*) dflt="$gidtype"
;;
esac
cont=true
echo " "
rp="What type are group ids returned by getgid(), etc.? [$dflt]"
$echo $n "$rp $c"
. myread
gidtype="$ans"

: see if this is a varargs system
echo " "
if $test -r /usr/include/varargs.h ; then
i_varargs="$define"
echo "varargs.h found."
else
i_varargs="$undef"
echo "No varargs.h found, but that's ok (I hope)."
fi

: see what type of char stdio uses.
echo " "
if $contains 'unsigned.*char.*_ptr.*;' /usr/include/stdio.h >/dev/null 2>&1 ; then
echo "Your stdio uses unsigned chars."
stdchar="unsigned char"
else
echo "Your stdio uses signed chars."
stdchar="char"
fi

: see if there is the getut family
echo " "
if $contains '^getut' libc.list >/dev/null 2>&1 ; then
echo "getutent() found."
d_getutent="$define"
else
echo "No getutent() found--will use my own."
d_getutent="$undef"
fi

: see if there is a strdup
if $contains '^strdup$' libc.list >/dev/null 2>&1 ; then
echo "strdup() found."
d_strdup="$define"
else
echo "No strdup() found--will use my own."
d_strdup="$undef"
fi

: see if there is a putenv
if $contains '^putenv$' libc.list >/dev/null 2>&1 ; then
echo "putenv() found."
d_putenv="$define"
else
echo "No putenv() found--will use my own."
d_putenv="$undef"
fi

: now get the host name
echo " "
echo "Figuring out host name..."
echo 'Maybe "hostname" will work...'
if ans=`sh -c hostname 2>&1` ; then
hostname=$ans
phostname=hostname
else
echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
if ans=`cat /etc/systemid 2>&1` ; then
hostname=$ans
phostname='cat /etc/systemid'
if xenix; then
echo "Whadyaknow. Xenix always was a bit strange..."
else
echo "What is a non-Xenix system doing with /etc/systemid?"
fi
else
echo 'No, maybe "uuname -l" will work...'
if ans=`sh -c 'uuname -l' 2>&1` ; then
hostname=$ans
phostname='uuname -l'
else
echo 'Strange. Maybe "uname -n" will work...'
if ans=`sh -c 'uname -n' 2>&1` ; then
hostname=$ans
phostname='uname -n'
else
echo 'Oh well, maybe I can mine it out of whoami.h...'
if ans=`sh -c $contains' sysname /usr/include/whoami.h' 2>&1` ; then
hostname=`echo "$ans" | $sed 's/^.*"\(.*\)"/\1/'`
phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' else
case "$hostname" in
'') echo "Does this machine have an identity crisis or something?"
phostname=''
;;
*) echo "Well, you said $hostname before...";;
esac
fi
fi
fi
fi
fi
: you do not want to know about this
set $hostname
hostname=$1

: translate upper to lower if necessary
case "$hostname" in
*[A-Z]*)
hostname=`echo $hostname | $tr '[A-Z]' '[a-z]'`
echo "(Normalizing case in your host name)"
;;
esac

: verify guess
if $test "$hostname" ; then
dflt=y
echo 'Your host name appears to be "'$hostname'".'
$echo $n "Is this correct? [$dflt] $c"
rp="Sitename is $hostname? [$dflt]"
. myread
case "$ans" in
y*) ;;
*) hostname='' ;;
esac
fi

: bad guess or no guess
while $test "X$hostname" = X ; do
dflt=''
rp="Please type the (one word) name of your host:"
$echo $n "$rp $c"
. myread
hostname="$ans"
done

: a little sanity check here
case "$phostname" in
'') ;;
*) case `$phostname` in
$hostname) ;;
*)
case "$phostname" in
sed*)
echo "(That doesn't agree with your whoami.h file, by the way.)"
;;
*)
echo "(That doesn't agree with your $phostname command, by the way.)"
;;
esac
phostname=''
;;
esac
;;
esac

: see how we will look up host name
d_douname="$undef"
d_phostname="$undef"

# if xenix; then
# echo " "
# echo "(Assuming Xenix uname() is broken.)"
# el
if $contains '^uname$' libc.list >/dev/null 2>&1 ; then
echo "uname() found."
d_douname="$define"
ans=uname
fi

case "$d_douname" in
*define*)
dflt=n
cat <
Every now and then someone has a $ans() that lies about the hostname
but can't be fixed for political or economic reasons. Would you like to
EOM
rp="pretend $ans() isn't there and maybe compile in the hostname? [$dflt]"
$echo $n "$rp $c"
. myread
case "$ans" in
y*) d_douname="$undef"
$echo $n "Okay... $c"
;;
esac
;;
esac

case "$d_douname" in
*define*) ;;
*)
case "$phostname" in
'') ;;
*)
$cat <
There is no uname() on this system. You have two possibilities at this point:

1) You can have your host name ($hostname) compiled into $package, which
lets $package start up faster, but makes your binaries non-portable, or
2) you can have $package use a

popen("$phostname","r")

which will start slower but be more portable.

Option 1 will give you the option of using whoami.h if you have one. If you
want option 2 but with a different command, you can edit config.sh at the
end of this shell script.

EOT
case "$d_phostname" in
"$define") dflt=n;;
"$undef") dflt=y;;
'')
case "$d_portable" in
"$define") dflt=n ;;
*) dflt=y ;;
esac
;;
esac
rp="Do you want your host name compiled in? [$dflt]"
$echo $n "$rp $c"
. myread
case "$ans" in
n*) d_phostname="$define" ;;
*) phostname=''
d_phostname="$undef"
;;
esac
;;
esac
case "$phostname" in
'')
case "$d_whoami" in
"$define")
dflt=y
$cat <
No hostname function--you can either use the whoami.h file, which has this line:

`grep sysname /usr/include/whoami.h`

or you can have the name we came up with earlier ($hostname) hardwired in.
EOM
rp="Use whoami.h to get hostname? [$dflt]"
$echo $n "$rp $c"
. myread
case "$ans" in
n*) d_whoami="$undef";;
esac
;;
"$undef")
echo 'No hostname function and no whoami.h--hardwiring "'$hostname'".'
;;
esac
;;
esac
;;
esac

: see if there is a ttytype file
echo " "
if ttytype=`loc ttytype x /etc`; then
echo "Found $ttytype."
d_ttytype="$define"
else
d_ttytype="$undef"
fi

: see if there is a gettydefs file
if gettytab=`loc gettydefs x /etc`; then
echo "Found $gettytab."
else
dflt=/etc/gettydefs
echo " "
$echo "No /etc/gettydefs found. I'll let you create your own."
$echo $n "What do you want to call your gettytab file? [$dflt] $c"
rp='Specify gettytab:'
. myread
gettytab=$ans
echo " "
fi

: find the utmp file
if utmp=`loc utmp utmp /etc /usr/adm`; then
echo "Found $utmp."
else
dflt=/etc/utmp
echo " "
$echo $n "Where is your utmp file? [$dflt] $c"
rp="Utmp filename? [$dflt]"
. myread
utmp="$ans"
echo " "
fi

: find the wtmp file
if wtmp=`loc wtmp wtmp /etc /usr/adm`; then
echo "Found $wtmp."
else
dflt=/etc/wtmp
echo " "
$echo $n "Where is your wtmp file? [$dflt] $c"
rp="Wtmp filename? [$dflt]"
. myread
wtmp="$ans"
echo " "
fi

: decide how portable to be
case "$d_portable" in
"$define") dflt=y;;
*) dflt=n;;
esac
$cat <
I can set things up so that your $package binaries are more portable,
at what may be a noticable cost in performance. In particular, if you
ask to be portable, the system name will be determined at run time,
if at all possible.

EOH
rp="Do you expect to run the $package binaries on multiple machines? [$dflt]"
$echo $n "$rp $c"
. myread
case "$ans" in
y*) d_portable="$define" ;;
*) d_portable="$undef" ;;
esac

: determine uucp id
echo " "
uucpid=`$sed -e "/uucp:/{s/^[^:]*:[^:]*:\([^:]*\).*"'$'"/\1/" -e "q" -e "}" -e "d" case "$uucpid" in
'') uucpid=0 ;;
*) echo "uucp uid = $uucpid" ;;
esac

: determine uucp lock files scheme
case "$lock" in
'')
if $test -d /usr/spool/locks; then
dflt=/usr/spool/locks
else
dflt=/usr/spool/uucp
fi
;;
*) dflt="$lock";;
esac
cont=true
while $test "$cont" ; do
echo " "
$echo $n "Directory where UUCP lock files live: [$dflt] $c"
rp="Directory for UUCP lock files: [$dflt]"
. myread
lock="$ans"
if test -d $ans; then
cont=''
else
dflt=n
rp="Directory $ans doesn't exist. Use that name anyway? [$dflt]"
$echo $n "$rp $c"
. myread
dflt=''
case "$ans" in
y*) cont='';;
esac
fi
done

echo " "
case "$d_asciipid" in
"$define") dflt=y;;
*) dflt=n;;
esac
echo "The PID of the locking process is kept in the lock file."
$echo $n "Does your UUCP store the PID in ASCII format? [$dflt] $c"
rp="PID stored in ASCII? [$dflt]"
. myread
case "$ans" in
y*) d_asciipid="$define";;
*) d_asciipid="$undef";;
esac

: determine mailer to use
case "$mailer" in
'')
if $test -f $sendmail; then
dflt=$sendmail
elif Cppsym M_XENIX; then
dflt=/usr/lib/mail/execmail
elif $test -f $mailx; then
dflt="$mailx"
else
dflt=$mail
fi
;;
*) dflt="$mailer";;
esac
cont=true
while $test "$cont" ; do
echo " "
echo "Give the full path name of the program used to deliver mail on your"
$echo $n "system: [$dflt] $c"
rp="Preferred mailer: [$dflt]"
. myread
mailer="$ans"
if test -f $ans; then
cont=''
else
dflt=n
rp="File $ans doesn't exist. Use that name anyway? [$dflt]"
$echo $n "$rp $c"
. myread
dflt=''
case "$ans" in
y*) cont='';;
esac
fi
done

: preserve RCS keywords in files with variable substitution, grrr
Id='$Id'
Header='$Header'

echo " "
echo "End of configuration questions."
echo " "

: create config.sh file
echo " "
if test -d ../UU; then
cd ..
fi
echo "Creating config.sh..."
$spitshell <config.sh
$startsh
# config.sh
# This file was produced by running the Configure script.

d_getutent='$d_getutent'
d_strdup='$d_strdup'
d_putenv='$d_putenv'
d_ttytype='$d_ttytype'
ttytype='$ttytype'
gettytab='$gettytab'
utmp='$utmp'
wtmp='$wtmp'
uucpid='$uucpid'
lock='$lock'
d_asciipid='$d_asciipid'
mailer='$mailer'
hostname='$hostname'
phostname='$phostname'
d_douname='$d_douname'
d_phostname='$d_phostname'
d_portable='$d_portable'
termlib='$termlib'
llib_termlib='$llib_termlib'
xenix='$xenix'
d_eunice='$d_eunice'
define='$define'
undef='$undef'
eunicefix='$eunicefix'
loclist='$loclist'
expr='$expr'
sed='$sed'
echo='$echo'
cat='$cat'
rm='$rm'
mv='$mv'
cp='$cp'
tr='$tr'
sort='$sort'
uniq='$uniq'
grep='$grep'
trylist='$trylist'
test='$test'
egrep='$egrep'
Mcc='$Mcc'
cpp='$cpp'
mail='$mail'
mailx='$mailx'
sendmail='$sendmail'
uname='$uname'
uuname='$uuname'
Log='$Log'
Id='$Id'
bin='$bin'
contains='$contains'
cppstdin='$cppstdin'
cppminus='$cppminus'
d_fcntl='$d_fcntl'
d_index='$d_index'
d_ioctl='$d_ioctl'
d_varargs='$d_varargs'
d_voidsig='$d_voidsig'
gidtype='$gidtype'
i_fcntl='$i_fcntl'
i_pwd='$i_pwd'
i_sysioctl='$i_sysioctl'
i_time='$i_time'
i_systime='$i_systime'
d_systimekernel='$d_systimekernel'
i_varargs='$i_varargs'
libc='$libc'
models='$models'
split='$split'
small='$small'
medium='$medium'
large='$large'
huge='$huge'
optimize='$optimize'
ccflags='$ccflags'
cppflags='$cppflags'
ldflags='$ldflags'
cc='$cc'
libs='$libs'
n='$n'
c='$c'
package='$package'
spitshell='$spitshell'
shsharp='$shsharp'
sharpbang='$sharpbang'
startsh='$startsh'
stdchar='$stdchar'
uidtype='$uidtype'
voidflags='$voidflags'
defvoidused='$defvoidused'
lib='$lib'
CONFIG=true
EOT

CONFIG=true

echo " "
dflt=''
fastread=''
echo "If you didn't make any mistakes, then just type a carriage return here."
rp="If you need to edit config.sh, do it as a shell escape here:"
$echo $n "$rp $c"
. UU/myread
case "$ans" in
'') ;;
*) : in case they cannot read
eval $ans;;
esac
: if this fails, just run all the .SH files by hand
. ./config.sh

echo " "
echo "Doing variable substitutions on .SH files..."
set x `awk '{print $1}' shift
case $# in
0) set x *.SH; shift;;
esac
if test ! -f $1; then
shift
fi
for file in $*; do
case "$file" in
*/*)
dir=`$expr X$file : 'X\(.*\)/'`
file=`$expr X$file : 'X.*/\(.*\)'`
(cd $dir && . $file)
;;
*)
. $file
;;
esac
done
if test -f config.h.SH; then
if test ! -f config.h; then
: oops, they left it out of MANIFEST, probably, so do it anyway.
. config.h.SH
fi
fi

if $contains '^depend:' Makefile >/dev/null 2>&1; then
dflt=n
$cat <
Now you need to generate make dependencies by running "make depend".
You might prefer to run it in background: "make depend > makedepend.out &"
It can take a while, so you might not want to run it right now.

EOM
rp="Run make depend now? [$dflt]"
$echo $n "$rp $c"
. UU/myread
case "$ans" in
y*) make depend && echo "Now you must run a make."
;;
*) echo "You must run 'make depend' then 'make'."
;;
esac
elif test -f Makefile; then
echo " "
echo "Now you must run a make."
else
echo "Done."
fi

$rm -f kit*isdone
: the following is currently useless
cd UU && $rm -f $rmlist
: since this removes it all anyway
cd .. && $rm -rf UU
: end of Configure
getty_ps/config.sh 644 144 0 3117 5210754567 13065 0ustar stevewheel#!/bin/sh
# config.sh
# This file was produced by running the Configure script.

d_getutent='define'
d_strdup='define'
d_putenv='define'
d_ttytype='undef'
ttytype='x'
gettytab='/etc/gettydefs'
utmp='/etc/utmp'
wtmp='/etc/wtmp'
uucpid='5'
lock='/usr/spool/uucp'
d_asciipid='define'
mailer='/bin/mail'
hostname='nyongwa'
phostname=''
d_douname='define'
d_phostname='undef'
d_portable='define'
termlib='-ltermcap'
llib_termlib=''
xenix='undef'
d_eunice='undef'
define='define'
undef='undef'
eunicefix=':'
loclist='
cat
cp
echo
expr
grep
mv
rm
sed
sort
tr
uniq
'
expr='/usr/bin/expr'
sed='/usr/bin/sed'
echo='/bin/echo'
cat='/bin/cat'
rm='/bin/rm'
mv='/bin/mv'
cp='/bin/cp'
tr='/usr/bin/tr'
sort='/usr/bin/sort'
uniq='/usr/bin/uniq'
grep='/usr/bin/grep'
trylist='
Mcc
cpp
egrep
mail
mailx
sendmail
test
'
test='test'
egrep='/usr/bin/egrep'
Mcc='Mcc'
cpp='/usr/lib/cpp'
mail='/bin/mail'
mailx='mailx'
sendmail='sendmail'
uname=''
uuname=''
Log=''
Id='$Id'
bin='/bin'
contains='grep'
cppstdin='/usr/lib/cpp'
cppminus=''
d_fcntl='define'
d_index='define'
d_ioctl='define'
d_varargs='define'
d_voidsig='define'
gidtype='gid_t'
i_fcntl='define'
i_pwd='define'
i_sysioctl='define'
i_time='undef'
i_systime='define'
d_systimekernel='undef'
i_varargs='define'
libc='/usr/lib/shared/libc.a'
models='none'
split=''
small=''
medium=''
large=''
huge=''
optimize='-O'
ccflags='-fpcc-struct-return'
cppflags=' -D__GNUC__'
ldflags=''
cc='gcc'
libs='-ltermcap'
n=''
c='\c'
package='getty'
spitshell='cat'
shsharp='true'
sharpbang='#!'
startsh='#!/bin/sh'
stdchar='char'
uidtype='uid_t'
voidflags='7'
defvoidused='7'
lib=''
CONFIG=true
getty_ps/Makefile 644 144 0 5726 5225315603 12722 0ustar stevewheel#
# Makefile for getty distribution
#
# To recreate this file, make any changes in config.sh and then
# say "sh Makefile.SH"
#

SHELL= /bin/sh

# compiler stuff -- check these
CC= gcc
CFLAGS= -O -fpcc-struct-return
LFLAGS=

LIBS= -ltermcap
LINT= lint -abchuvx
LLIBS=

# where things go
BIN= /bin
UUBIN= /bin

# what are we making
SH= Makefile.SH config.h.SH makedep.SH
HDRS= config.h defaults.h extern.h funcs.h getty.h patchlevel.h \
table.h tune.h
SRC= main.c funcs.c defaults.c table.c
OBJ= main.o funcs.o defaults.o table.o
UUSRC= umain.c funcs.c defaults.c table.c
UUOBJ= umain.o funcs.o defaults.o table.o

# rules

all: getty uugetty manpages

clist:
@echo $(SRC) $(UUSRC) | /usr/bin/tr ' ' '\012' | /usr/bin/sort | /usr/bin/uniq > .clist

hlist:
@echo $(HDRS) | /usr/bin/tr ' ' '\012' > .hlist

shlist:
@echo $(SH) | /usr/bin/tr ' ' '\012' > .shlist

getty: $(OBJ)
$(CC) $(LFLAGS) -o [email protected] $(OBJ) $(LIBS)

uugetty: $(UUOBJ)
$(CC) $(LFLAGS) -o [email protected] $(UUOBJ) $(LIBS)

manpages:
cd man; make

install: getty uugetty
-mv $(BIN)/getty $(BIN)/getty-
-mv $(UUBIN)/uugetty $(UUBIN)/uugetty-
cp getty $(BIN)
cp uugetty $(UUBIN)
chmod 700 $(BIN)/getty $(UUBIN)/uugetty
strip $(BIN)/getty $(UUBIN)/uugetty

manistall: manpages
cd man; make install

lint: $(SRC) umain.c
@echo "linting getty sources..."
echo "GETTY" >lint.out
$(LINT) $(SRC) $(LLIBS) >>lint.out
@echo "linting uugetty sources..."
@echo ' ' >>lint.out
echo 'UUGETTY' >>lint.out
$(LINT) -DUUGETTY $(UUSRC) $(LLIBS) >>lint.out
@echo "lint output is in lint.out"

clean:
rm -f umain.c *.o core *.out .*list *.ln Makefile.old
cd man; make clean

clobber: clean
rm -f getty uugetty
cd man; make clobber

realclean: clobber

depend: makedep umain.c tune.h
chmod +x makedep
./makedep

# special dependancies follow

umain.c: main.c
-ln main.c umain.c

umain.o:
$(CC) $(CFLAGS) -DUUGETTY -c umain.c

tune.h: tune.H
@echo "------------------------------------------------"
@echo "Making a tune.h from the tune.H prototype file. "
@echo "You may wish to edit tune.h before making getty."
@echo "------------------------------------------------"
-cp tune.H tune.h

# AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
# If this runs make out of memory, delete /usr/include lines.
defaults.o : defaults.c getty.h config.h tune.h extern.h funcs.h mytermio.h \
defaults.h
funcs.o : funcs.c getty.h config.h tune.h extern.h funcs.h mytermio.h table.h
getutent.o : getutent.c getty.h config.h tune.h extern.h funcs.h mytermio.h
main.o : main.c getty.h config.h tune.h extern.h funcs.h mytermio.h defaults.h \
table.h release.h
putenv.o : putenv.c getty.h config.h tune.h extern.h funcs.h mytermio.h
strdup.o : strdup.c getty.h config.h tune.h extern.h funcs.h mytermio.h
table.o : table.c getty.h config.h tune.h extern.h funcs.h mytermio.h table.h
umain.o : umain.c getty.h config.h tune.h extern.h funcs.h mytermio.h defaults.h \
table.h release.h
# WARNING: Put nothing here or make depend will gobble it up!
getty_ps/funcs.c 644 144 0 42364 5230032047 12555 0ustar stevewheel/*
** $Id: funcs.c,v 2.0 90/09/19 19:53:19 paul Rel $
**
** Miscellaneous routines.
*/

/*
** Copyright 1989,1990 by Paul Sutcliffe Jr.
**
** Permission is hereby granted to copy, reproduce, redistribute,
** or otherwise use this software as long as: there is no monetary
** profit gained specifically from the use or reproduction or this
** software, it is not sold, rented, traded or otherwise marketed,
** and this copyright notice is included prominently in any copy
** made.
**
** The author make no claims as to the fitness or correctness of
** this software for any use whatsoever, and it is provided as is.
** Any use of this software is at the user's own risk.
*/

/*
** $Log: funcs.c,v $
** Revision 2.0 90/09/19 19:53:19 paul
** Initial 2.0 release
**
*/


#include "getty.h"
#include "table.h"
#include
#ifdef I_TIME
#include
#endif /* I_TIME */
#ifdef I_SYSTIME
#include
#endif /* I_SYSTIME */
#ifdef DOUNAME
#include
#endif /* DOUNAME */
#include
#include

#if defined(RCSID) && !defined(lint)
static char *RcsId =
"@(#)$Id: funcs.c,v 2.0 90/09/19 19:53:19 paul Rel $";
#endif

#ifndef MAXBUF
#define MAXBUF 512 /* buffer size */
#endif /* MAXBUF */

#ifndef EXPFAIL
#define EXPFAIL 30 /* default num seconds to wait for expected input */
#endif /* EXPFAIL */

#define EXPECT 0 /* states for chat() */
#define SEND 1

/* SMR - gcc uses signed characters, so I cast the following */
#define AUTOBD ((char)0376) /* marker for AutoBaud digits */

char *unquote();
int expect(), send();
boolean expmatch();
sig_t expalarm();


/*
** Fputs() - does fputs() with '\' and '@' expansion
**
** Returns EOF if an error occurs.
*/

int
Fputs(s, stream)
register char *s;
register FILE *stream;
{
char c, n, tbuf[16], ubuf[32];
time_t clock;
struct tm *lt, *localtime();
char *month_name[] = { "January", "February", "March", "April",
"May", "June", "July", "August", "September",
"October", "November", "December" };

while (c = *s++) {
if ((c == '@') && (n = *s++)) {
switch (n) {
case 'B': /* speed (baud rate) */
if (*Speed && Fputs(Speed, stream) == EOF)
return(EOF);
break;
case 'D': /* date */
(void) time(&clock);
lt = localtime(&clock);
(void) sprintf(tbuf, "%d %s %02d",
lt->tm_mday,
month_name[lt->tm_mon],
lt->tm_year);
if (Fputs(tbuf, stream) == EOF)
return(EOF);
break;
case 'L': /* line */
if (*Device && Fputs(Device, stream) == EOF)
return(EOF);
break;
case 'S': /* system node name */
if (*SysName && Fputs(SysName, stream) == EOF)
return(EOF);
break;
#ifdef M_XENIX
/* Special case applys here: SCO XENIX's
* /etc/gettydefs file has "\r\[email protected]!login: " as
* the login field value, and replaces the "@"
* with the system node name. This will do
* the same thing.
*/
case '!':
if (*SysName && Fputs(SysName, stream) == EOF)
return(EOF);
(void) fputc(n, stream);
break;
#endif /* M_XENIX */
case 'T': /* time */
(void) time(&clock);
lt = localtime(&clock);
(void) sprintf(tbuf, "%02d:%02d:%02d",
lt->tm_hour,
lt->tm_min, lt->tm_sec);
if (Fputs(tbuf, stream) == EOF)
return(EOF);
break;
case 'U': /* number of active users */
(void) sprintf(ubuf, "%d", Nusers);
if (Fputs(ubuf, stream) == EOF)
return(EOF);
break;
case 'V': /* version */
if (*Version && Fputs(Version, stream) == EOF)
return(EOF);
break;
case '@': /* in case '@@' was used */
if (fputc(n, stream) == EOF)
return(EOF);
break;
}
} else {
if (c == '\\')
s = unquote(s, &c);
/* we're in raw mode: send CR before every LF
*/
if (c == '\n' && (fputc('\r', stream) == EOF))
return(EOF);
if (c && fputc(c, stream) == EOF)
return(EOF);
}
}
return(SUCCESS);
}


/*
** getuname() - retrieve the system's node name
**
** Returns pointer to name or a zero-length string if not found.
*/

char *
getuname()
{
#ifdef HOSTNAME /* hardwire the name */

static char name[] = HOSTNAME;

return(name);

#else /* HOSTNAME */

#ifdef M_XENIX
#define SYSTEMID "/etc/systemid"
static FILE *fp;
#endif /* M_XENIX */

struct utsname uts;
static char name[80];

name[0] = '\0';

#ifdef DOUNAME /* dig it out of the kernel */

if (uname(&uts) != FAIL)
(void) strcpy(name, uts.nodename);

#endif /* DOUNAME */

#ifdef M_XENIX /* if Xenix's uts.nodename is empty */
if (strlen(name) == 0) {
if ((fp = fopen(SYSTEMID, "r")) != (FILE *) NULL) {
(void) fgets(name, sizeof(name), fp);
(void) fclose(fp);
name[strlen(name)-1] = '\0';
}
}
#endif /* M_XENIX */

#ifdef PHOSTNAME /* get it from the shell */

if (strlen(name) == 0) {
FILE *cmd;
if ((cmd = popen(PHOSTNAME, "r")) != (FILE *) NULL) {
(void) fgets(name, sizeof(name), cmd);
(void) pclose(cmd);
name[strlen(name)-1] = '\0';
}
}

#endif /* PHOSTNAME */

return(name);

#endif /* HOSTNAME */
}


/*
** settermio() - setup tty according to termio values
*/

void
settermio(termio, state)
register TERMIO *termio;
int state;
{
register int i;
static TERMIO setterm;

#ifdef TRS16
/* Tandy 16/6000 console's BREAK key sends ^C
*/
char Cintr = (strequal(Device, "console")) ? '\003' : CINTR;
#else
char Cintr = CINTR;
#endif /* TRS16 */

#ifdef MY_ERASE
char Cerase = MY_ERASE;
#else
char Cerase = CERASE;
#endif /* MY_ERASE */

#ifdef MY_KILL
char Ckill = MY_KILL;
#else
char Ckill = CKILL;
#endif /* MY_KILL */

(void) ioctl(STDIN, TCGETA, &setterm);

switch (state) {
case INITIAL:
setterm.c_iflag = termio->c_iflag;
setterm.c_oflag = termio->c_oflag;
setterm.c_cflag = termio->c_cflag;
setterm.c_lflag = termio->c_lflag;
setterm.c_line = termio->c_line;

/* single character processing
*/
setterm.c_lflag &= ~(ICANON);
setterm.c_cc[VMIN] = 1;
setterm.c_cc[VTIME] = 0;

/* sanity check
*/
if ((setterm.c_cflag & CBAUD) == 0)
setterm.c_cflag |= B9600;
if ((setterm.c_cflag & CSIZE) == 0)
setterm.c_cflag |= DEF_CFL;
setterm.c_cflag |= (CREAD | HUPCL);

(void) ioctl(STDIN, TCSETAF, &setterm);
break;

case FINAL:
setterm.c_iflag = termio->c_iflag;
setterm.c_oflag = termio->c_oflag;
setterm.c_cflag = termio->c_cflag;
setterm.c_lflag = termio->c_lflag;
setterm.c_line = termio->c_line;

/* sanity check
*/
if ((setterm.c_cflag & CBAUD) == 0)
setterm.c_cflag |= B9600;
if ((setterm.c_cflag & CSIZE) == 0)
setterm.c_cflag |= DEF_CFL;
setterm.c_cflag |= CREAD;

/* set c_cc[] chars to reasonable values
*/
for (i=0; i < NCC; i++)
setterm.c_cc[i] = CNUL;
setterm.c_cc[VINTR] = Cintr;
setterm.c_cc[VQUIT] = CQUIT;
setterm.c_cc[VERASE] = Cerase;
setterm.c_cc[VKILL] = Ckill;
setterm.c_cc[VEOF] = CEOF;
#ifdef CEOL
setterm.c_cc[VEOL] = CEOL;
#endif /* CEOL */

/*
* SMR - Linux does funny things if VMIN is zero (like more doesn't work),
* so I put it to one here.
*/
setterm.c_cc[VMIN] = 1;

(void) ioctl(STDIN, TCSETAW, &setterm);
break;

}
}


/*
** chat() - handle expect/send sequence to Device
**
** Returns FAIL if an error occurs.
*/

int
chat(s)
char *s;
{
register int state = EXPECT;
boolean finished = FALSE, if_fail = FALSE;
char c, *p;
char word[MAXLINE+1]; /* buffer for next word */

debug3(D_INIT, "chat(%s) called\n", s);

while (!finished) {
p = word;
while (((c = (*s++ & 0177)) != '\0') && c != ' ' && c != '-')
/*
* SMR - I don't understand this, because if c is \0
* then it is 0, isn't it? If so we end the loop and
* terminate the word anyway.
*
*p++ = (c) ? c : '\177';
*/
*p++ = c;

finished = (c == '\0');
if_fail = (c == '-');
*p = '\0';

switch (state) {
case EXPECT:
if (expect(word) == FAIL) {
if (if_fail == FALSE)
return(FAIL); /* no if-fail seq */
} else {
/* eat up rest of current sequence
*/
if (if_fail == TRUE) {
while ((c = (*s++ & 0177)) != '\0' &&
c != ' ')
;
if (c == '\0')
finished = TRUE;
if_fail = FALSE;
}
}
state = SEND;
break;
case SEND:
if (send(word) == FAIL)
return(FAIL);
state = EXPECT;
break;
}
continue;
}
debug2(D_INIT, "chat() successful\n");
return (SUCCESS);
}


/*
** unquote() - decode char(s) after a '\' is found.
**
** Returns the pointer s; decoded char in *c.
*/

char valid_oct[] = "01234567";
char valid_dec[] = "0123456789";
char valid_hex[] = "0123456789aAbBcCdDeEfF";

char *
unquote(s, c)
char *s, *c;
{
int value, base;
char n, *valid;

n = *s++;
switch (n) {
case 'b':
*c = '\b'; break;
case 'c':
if ((n = *s++) == '\n')
*c = '\0';
else
*c = n;
break;
case 'f':
*c = '\f'; break;
case 'n':
*c = '\n'; break;
case 'r':
*c = '\r'; break;
case 's':
*c = ' '; break;
case 't':
*c = '\t'; break;
case '\n':
*c = '\0'; break; /* ignore NL which follows a '\' */
case '\\':
*c = '\\'; break; /* '\\' will give a single '\' */
default:
if (isdigit(n)) {
value = 0;
if (n == '0') {
if (*s == 'x') {
valid = valid_hex;
base = 16;
s++;
} else {
valid = valid_oct;
base = 8;
}
} else {
valid = valid_dec;
base = 10;
s--;
}
while (strpbrk(s, valid) == s) {
value = (value * base) + (int) (n - '0');
s++;
}
*c = (char) (value & 0377);
} else {
*c = n;
}
break;
}
return(s);
}


/*
** send() - send a string to stdout
*/

int
send(s)
register char *s;
{
register int retval = SUCCESS;
char ch;

debug2(D_INIT, "SEND: (");

if (strequal(s, "\"\"")) { /* ("") used as a place holder */
debug2(D_INIT, "[nothing])\n");
return(retval);
}

while (ch = *s++) {
if (ch == '\\') {
switch (*s) {
case 'p': /* '\p' == pause */
debug2(D_INIT, "[pause]");
(void) sleep(1);
s++;
continue;
case 'd': /* '\d' == delay */
debug2(D_INIT, "[delay]");
(void) sleep(2);
s++;
continue;
case 'K': /* '\K' == BREAK */
debug2(D_INIT, "[break]");
(void) ioctl(STDOUT, TCSBRK, 0);
s++;
continue;
default:
s = unquote(s, &ch);
break;
}
}
debug3(D_INIT, ((ch < ' ') ? "^%c" : "%c"),
((ch < ' ') ? ch | 0100 : ch));
if (write(STDOUT, &ch, 1) == FAIL) {
retval = FAIL;
break;
}
}
debug3(D_INIT, ") -- %s\n", (retval == SUCCESS) ? "OK" : "Failed");
return(retval);
}


/*
** expect() - look for a specific string on stdin
*/

jmp_buf env; /* here so expalarm() sees it */

int
expect(s)
register char *s;
{
register int i;
register int expfail = EXPFAIL;
register retval = FAIL;
char ch, *p, word[MAXLINE+1], buf[MAXBUF];
sig_t (*oldalarm)();

if (strequal(s, "\"\"")) { /* ("") used as a place holder */
debug2(D_INIT, "EXPECT: ([nothing])\n");
return(SUCCESS);
}

#ifdef lint
/* shut lint up about 'warning: oldalarm may be used before set' */
oldalarm = signal(SIGALRM, SIG_DFL);
#endif /* lint */

/* look for escape chars in expected word
*/
for (p = word; ch = (*s++ & 0177);) {
if (ch == '\\') {
if (*s == 'A') { /* spot for AutoBaud digits */
*p++ = AUTOBD;
s++;
continue;
} else if (*s == 'T') { /* change expfail timeout */
if (isdigit(*++s)) {
s = unquote(s, &ch);
/* allow 3 - 255 second timeout */
if ((expfail = (int) ch) < 3)
expfail = 3;
}
continue;
} else
s = unquote(s, &ch);
}
*p++ = (ch) ? ch : '\177';
}
*p = '\0';

if (setjmp(env)) { /* expalarm returns non-zero here */
debug3(D_INIT, "[timed out after %d seconds]\n", expfail);
(void) signal(SIGALRM, oldalarm);
return(FAIL);
}

oldalarm = signal(SIGALRM, expalarm);
(void) alarm((unsigned) expfail);

debug3(D_INIT, "EXPECT: <%d> (", expfail);
debug1(D_INIT, word);
debug2(D_INIT, "), GOT:\n");
p = buf;
while (read(STDIN, &ch, 1) == 1) {
debug3(D_INIT, ((ch < ' ') ? "^%c" : "%c"),
((ch < ' ') ? ch | 0100 : ch));
*p++ = (char) ((int) ch & 0177);
*p = '\0';
if (strlen(buf) >= strlen(word)) {
for (i=0; buf[i]; i++)
if (expmatch(&buf[i], word)) {
retval = SUCCESS;
break;
}
}
if (retval == SUCCESS)
break;
}
(void) alarm((unsigned) 0);
(void) signal(SIGALRM, oldalarm);
debug3(D_INIT, " -- %s\n", (retval == SUCCESS) ? "got it" : "Failed");
return(retval);
}


/*
** expmatch() - compares expected string with the one gotten
*/

#ifdef TELEBIT
char valid[] = "0123456789FAST";
#else /* TELEBIT */
char valid[] = "0123456789";
#endif /* TELEBIT */

boolean
expmatch(got, exp)
register char *got;
register char *exp;
{
register int ptr = 0;

while (*exp) {
if (*exp == AUTOBD) { /* substitute real digits gotten */
while (*got && strpbrk(got, valid) == got) {
AutoBaud = TRUE;
if (ptr < (sizeof(AutoRate) - 2))
AutoRate[ptr++] = *got;
got++;
}
if (*got == '\0')
return(FALSE); /* didn't get it all yet */
AutoRate[ptr] = '\0';
exp++;
continue;
}
if (*got++ != *exp++)
return(FALSE); /* no match */
}
return(TRUE);
}


/*
** expalarm() - called when expect()'s SIGALRM goes off
*/

sig_t
expalarm()
{
longjmp(env, 1);
}


/*
** getlogname() - get the users login response
**
** Returns int value indicating success.
*/

int
getlogname(termio, name, size)
TERMIO *termio;
register char *name;
int size;
{
register int count;
register int lower = 0;
register int upper = 0;
char ch, *p;
ushort lflag;

#ifdef MY_ERASE
char Erase = MY_ERASE;
#else
char Erase = CERASE;
#endif /* MY_ERASE */
#ifdef MY_KILL
char Kill = MY_KILL;
#else
char Kill = CKILL;
#endif /* MY_KILL */

debug2(D_GETL, "getlogname() called\n");
/*
* SMR - Linux didn't flush the line in 0.95; this isn't necessary
* with 0.96a, but it shouldn't hurt.
*/
fflush(stdout);

debug2(D_STTY, "Getlogname:\n");
if (Debug & D_STTY) system("stty -a >&3");

(void) ioctl(STDIN, TCGETA, termio);
lflag = termio->c_lflag;

termio->c_iflag = 0;
termio->c_oflag = 0;
termio->c_cflag = 0;
termio->c_lflag = 0;

p = name; /* point to beginning of buffer */
count = 0; /* nothing entered yet */

do {
if (read(STDIN, &ch, 1) != 1) /* nobody home */
exit(0);
debug4(D_GETL, "Character entered = %c (%d).\n", ch, ch);
if ((ch = (char) ((int) ch & 0177)) == CEOF)
if (p == name) /* ctrl-d was first char */
exit(0);
if (ch == CQUIT) /* user wanted out, i guess */
exit(0);
if (ch == '\0') {
debug2(D_GETL, "returned (BADSPEED)\n");
return(BADSPEED);
}
if (!(lflag & ECHO)) {
(void) putc(ch, stdout);
(void) fflush(stdout);
}
if (ch == Erase) {
if (count) {
if (!(lflag & ECHOE)) {
(void) fputs(" \b", stdout);
(void) fflush(stdout);
}
--p;
--count;
}
} else if (ch == Kill) {
if (!(lflag & ECHOK)) {
(void) fputs("\r\n", stdout);
(void) fflush(stdout);
}
p = name;
count = 0;
} else {
*p++ = ch;
count++;
if (islower(ch))
lower++;
if (isupper(ch))
upper++;
}
} while ((ch != '\n') && (ch != '\r') && (count < size));

*(--p) = '\0'; /* terminate buffer */

if (ch == '\r') {
(void) putc('\n', stdout);
(void) fflush(stdout);
termio->c_iflag |= ICRNL; /* turn on cr/nl xlate */
termio->c_oflag |= ONLCR;
} else if (ch == '\n') {
(void) putc('\r', stdout);
(void) fflush(stdout);
}

if (strlen(name) == 0) {
debug2(D_GETL, "returned (NONAME)\n");
return(NONAME);
}

if (upper && !lower) {
#ifdef WARNCASE
if (WarnCase) {
WarnCase = FALSE;
debug2(D_GETL, "returned (BADCASE)\n");
return(BADCASE);
}
#endif /* WARNCASE */
for (p=name; *p; p++) /* make all chars UC */
*p = toupper(*p);
termio->c_iflag |= IUCLC;
termio->c_oflag |= OLCUC;
termio->c_lflag |= XCASE;
}

debug3(D_GETL, "returned (SUCCESS), name=(%s)\n", name);
return(SUCCESS);
}


/*
** logerr() - display an error message
*/

void
logerr(msg)
register char *msg;
{
register FILE *co;
char *errdev;
time_t clock;

errdev = (Check) ? "/dev/tty" : CONSOLE;

time (&clock);
if ((co = fopen(errdev, "w")) != (FILE *) NULL) {
(void) fprintf(co, "\r\n%s - %s (%s): %s\r\n",
asctime(localtime(&clock)), MyName, Device, msg);
(void) fclose(co);
}

#ifdef TRYMAIL
else {
char buf[MAXLINE];
FILE *popen();

(void) sprintf(buf, "%s %s", MAILER, NOTIFY);
if ((co = popen(buf, "w")) != (FILE *) NULL) {
(void) fprintf(co, "To: %s\n", NOTIFY);
(void) fprintf(co, "Subject: %s problem\n\n", MyName);
(void) fprintf(co, "%s: %s\n", Device, msg);
(void) pclose(co);
}
}
#endif /* TRYMAIL */

}


#ifdef DEBUG

/*
** debug() - an fprintf to the debug file
**
** Only does the output if the requested level is "set."
*/

#ifdef VARARGS

#include

/*VARARGS2*/
void
debug(lvl, fmt, va_alist)
int lvl;
char *fmt;
va_dcl
{
va_list args;

va_start(args);
if (Debug & lvl) {
(void) vfprintf(Dfp, fmt, args);
(void) fflush(Dfp);
}
va_end(args);
}

#else /* VARARGS */

/*VARARGS2*/
void
debug(lvl, fmt, arg1, arg2, arg3, arg4)
int lvl;
char *fmt;
{
if (Debug & lvl) {
(void) fprintf(Dfp, fmt, arg1, arg2, arg3, arg4);
(void) fflush(Dfp);
}
}

#endif /* VARARGS */

/*
** dprint() - like debug(), but shows control chars
*/

void
dprint(lvl, word)
int lvl;
char *word;
{
char *p, *fmt, ch;

if (Debug & lvl) {
p = word;
while (ch = *p++) {
if (ch == AUTOBD) {
(void) fputs("[speed]", Dfp);
(void) fflush(Dfp);
continue;
} else if (ch < ' ') {
fmt = "^%c";
ch = ch | 0100;
} else {
fmt = "%c";
}
(void) fprintf(Dfp, fmt, ch);
}
(void) fflush(Dfp);
}
}

#endif /* DEBUG */


/* end of funcs.c */
getty_ps/config.h 660 144 0 5472 5232344173 12676 0ustar stevewheel/*
** config.h
**
** Getty configuration.
*/

/*
** Copyright 1989,1990 by Paul Sutcliffe Jr.
**
** Permission is hereby granted to copy, reproduce, redistribute,
** or otherwise use this software as long as: there is no monetary
** profit gained specifically from the use or reproduction or this
** software, it is not sold, rented, traded or otherwise marketed,
** and this copyright notice is included prominently in any copy
** made.
**
** The author make no claims as to the fitness or correctness of
** this software for any use whatsoever, and it is provided as is.
** Any use of this software is at the user's own risk.
*/


#include "tune.h" /* defs needed below */


/* These are set by config.sh.
* If you change them here, they will be reset
* the next time you run Configure.
*/

#define PORTABLE /* compile for more than one site */
#define GETUTENT /* we have getutent() and friends */
#define STRDUP /* we have strdup() */
#define PUTENV /* we have putenv() */

#undef TTYTYPE "x" /* file used to identify terminals */
#define GETTYTAB "/etc/gettydefs" /* file used for speed/termio table */

#define STDCHAR char /* signed or unsigned chars in stdio */
#define UIDTYPE uid_t /* storage type of UID's */
#define GIDTYPE gid_t /* storage type of GID's */

#define FCNTL /* include fcntl.h? */
#define IOCTL /* include sys/ioctl.h? */
#define PWD /* include pwd.h? */
#undef I_TIME /* include time.h? */
#define I_SYSTIME /* include sys/time.h? */
#undef SYSTIMEKERNEL
#define VARARGS /* include varargs.h? */

#define index strchr /* use these instead */
#define rindex strrchr

#define VOIDSIG /* you have 'void (*signal)()' */

#ifdef VOIDSIG /* define sig_t appropriately */
typedef void sig_t;
#else /* VOIDSIG */
typedef int sig_t;
#endif /* VOIDSIG */

#ifndef VOIDUSED
#define VOIDUSED 7
#endif /* VOIDUSED */
#define VOIDFLAGS 7
#if (VOIDFLAGS & VOIDUSED) != VOIDUSED
#define void int /* is void to be avoided? */
#define M_VOID /* Xenix strikes again */
#endif /* VOIDFLAGS & VOIDUSED */

#ifndef PORTABLE
#define HOSTNAME "nyongwa" /* compile node name in */
#else /* PORTABLE */
#define DOUNAME /* use uname() to get node name */
#undef PHOSTNAME /* get node name from this command */
#endif /* PORTABLE */

#ifndef UTMP_FILE
#define UTMP_FILE "/etc/utmp" /* name of the utmp file */
#endif /* UTMP_FILE */

#ifdef LOGUTMP
#ifndef WTMP_FILE
#define WTMP_FILE "/etc/wtmp" /* name of the wtmp file */
#endif /* WTMP_FILE */
#endif /* LOGUTMP */

#ifdef TRYMAIL
#define MAILER "/bin/mail" /* mail agent */
#endif /* TRYMAIL */

#ifdef UUGETTY
#define ASCIIPID /* PID stored in ASCII in lock file */
#define BOTHPID /* ... or perhaps not */
#define LOCK "/usr/spool/uucp/LCK..%s" /* lock file name */
#define UUCPID 5 /* uid of UUCP account */
#endif /* UUGETTY */


/* end of config.h */
getty_ps/extern.h 644 144 0 5021 5210516417 12724 0ustar stevewheel/*
** $Id: extern.h,v 2.0 90/09/19 19:48:33 paul Rel $
**
** Defines all external values.
*/

/*
** Copyright 1989,1990 by Paul Sutcliffe Jr.
**
** Permission is hereby granted to copy, reproduce, redistribute,
** or otherwise use this software as long as: there is no monetary
** profit gained specifically from the use or reproduction or this
** software, it is not sold, rented, traded or otherwise marketed,
** and this copyright notice is included prominently in any copy
** made.
**
** The author make no claims as to the fitness or correctness of
** this software for any use whatsoever, and it is provided as is.
** Any use of this software is at the user's own risk.
*/

/*
** $Log: extern.h,v $
** Revision 2.0 90/09/19 19:48:33 paul
** Initial 2.0 release
**
*/


#ifdef MAIN /* define as "extern", except for MAIN, */
#define EXTERN /* which is defined only in main.c */
#else
#define EXTERN extern
#endif /* MAIN */


/* Global variables
*/

#ifdef MAIN
EXTERN STDCHAR MsgBuf[80]; /* message buffer */
#else
EXTERN STDCHAR MsgBuf[];
#endif /* MAIN */

EXTERN boolean AutoBaud; /* autobauding requested? */
EXTERN char AutoRate[16]; /* AutoBaud digits buffer */
EXTERN boolean Check; /* check a gettytab file? */
EXTERN char *CheckFile; /* gettytab-like file to check */
EXTERN char *Device; /* controlling line (minus "/dev/") */
EXTERN char *GtabId; /* current gettytab id */
EXTERN boolean NoHangUp; /* don't hangup line before setting speed */
EXTERN char *LineD; /* line discipline */
EXTERN char *MyName; /* this program name */
EXTERN int Nusers; /* number of users currently logged in */
EXTERN char *Speed; /* current baud rate (string literal) */
EXTERN char *SysName; /* nodename of system */
EXTERN int TimeOut; /* timeout value from command line */
EXTERN char *Version; /* value of VERSION */

#ifdef WARNCASE
EXTERN boolean WarnCase; /* controls display of bad case message */
#endif /* WARNCASE */

#ifdef DEBUG
EXTERN int Debug; /* debug value from command line */
EXTERN FILE *Dfp; /* debug output file pointer */
#endif /* DEBUG */


/* System routines
*/

#ifndef __STDC__
extern int fputc();
extern char *malloc(), *ttyname();
extern unsigned alarm(), sleep();
extern time_t time();
#endif

#ifndef STRDUP /* Is There In Truth No Strdup() ? */
extern char *strdup();
#endif /* STRDUP */

#ifndef GETUTENT /* How about getutent() ? */
extern struct utmp *getutent();
extern void setutent(), endutent();
#endif /* GETUTENT */

#ifndef PUTENV /* putenv() ? */
extern int putenv();
#endif /* PUTENV */

/* end of extern.h */
getty_ps/tune.H 644 144 0 4756 5205322274 12350 0ustar stevewheel/*
** $Id: tune.H,v 2.0 90/09/19 20:19:47 paul Rel $
**
** Getty tuneable parameters.
*/

/*
** Copyright 1989,1990 by Paul Sutcliffe Jr.
**
** Permission is hereby granted to copy, reproduce, redistribute,
** or otherwise use this software as long as: there is no monetary
** profit gained specifically from the use or reproduction or this
** software, it is not sold, rented, traded or otherwise marketed,
** and this copyright notice is included prominently in any copy
** made.
**
** The author make no claims as to the fitness or correctness of
** this software for any use whatsoever, and it is provided as is.
** Any use of this software is at the user's own risk.
*/

/*
** $Log: tune.H,v $
** Revision 2.0 90/09/19 20:19:47 paul
** Initial 2.0 release
**
*/


#define boolean int /* does your cc know about boolean? */

#define DEF_CFL (CS7 | PARENB) /* default word-len/parity */

#define DEF_CONNECT "CONNECT\\s\\A\r\n" /* default CONNECT string */


/* Feature selection
*/

#undef DEBUG /* include debugging code */
#define LOGUTMP /* need to update utmp/wtmp files */
#define MY_CANON /* use my own ERASE and KILL chars */
#define RCSID /* include RCS ID info in objects */
#define SETTERM /* need to set TERM in environment */
#define TELEBIT /* include Telebit FAST parsing */
#define TRYMAIL /* mail errors if CONSOLE unavailable */
#define WARNCASE /* warn user if login is UPPER case */

/* define your ERASE and KILL characters here
*/
#ifdef MY_CANON
#define MY_ERASE '\010' /* 010 = ^H, backspace */
#define MY_KILL '\025' /* 025 = ^U, nak */
#endif

/* define your Telebit FAST speed here
*/
#ifdef TELEBIT
#define TB_FAST "19200" /* CONNECT FAST == this speed */
#endif /* TELEBIT */

/* who should be notified of errors?
*/
#ifdef TRYMAIL
#define NOTIFY "root"
#endif


/* Where to find things
*/

#define CONSOLE "/dev/console" /* place to log errors */
#define DEFAULTS "/etc/default/%s" /* name of defaults file */
#define ISSUE "/etc/issue" /* name of the issue file;
say "#undef ISSUE" to turn off
the issue feature */
#define LOGIN "/bin/login" /* name of login program */


/* Special cases
*/

#undef TRS16 /* you are a Tandy 6000 or equivilent */


/* You probably shouldn't fool with these
*/

#define MAXDEF 100 /* max # lines in defaults file */
#define MAXLINE 256 /* max # chars in a line */
#define MAXID 12 /* max # chars in Gtab Id */
#define MAXLOGIN 80 /* max # chars in Gtab Login */


/* end of tune.h */
getty_ps/patchlevel.h 644 144 0 25 5200631244 13500 0ustar stevewheel#define PATCHLEVEL 0
getty_ps/makedep 755 144 0 7063 5210754574 12622 0ustar stevewheel#!/bin/sh
#
# makedep
#
# Creates dependencies for Makefile
#

export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh $0; kill $$)

cat='/bin/cat'
ccflags='-fpcc-struct-return'
cp='/bin/cp'
cpp='/usr/lib/cpp'
echo='/bin/echo'
egrep='/usr/bin/egrep'
expr='/usr/bin/expr'
mv='/bin/mv'
rm='/bin/rm'
sed='/usr/bin/sed'
sort='/usr/bin/sort'
test='test'
tr='/usr/bin/tr'
uniq='/usr/bin/uniq'

: the following weeds options from ccflags that are of no interest to cpp
case "$ccflags" in
'');;
*) set X $ccflags
ccflags=''
for flag do
case $flag in
-D*|-I*) ccflags="$ccflags $flag";;
esac
done
;;
esac

$cat /dev/null >.deptmp
$rm -f *.c.c c/*.c.c
if test -f Makefile; then
mf=Makefile
else
mf=makefile
fi
if test -f $mf; then
defrule=`<$mf sed -n \
-e '/^\.c\.o:.*;/{' \
-e 's/\$\*\.c//' \
-e 's/^[^;]*;[ ]*//p' \
-e q \
-e '}' \
-e '/^\.c\.o: *$/{' \
-e N \
-e 's/\$\*\.c//' \
-e 's/^.*\n[ ]*//p' \
-e q \
-e '}'`
fi
case "$defrule" in
'') defrule='$(CC) -c $(CFLAGS)' ;;
esac

make clist || ($echo "Searching for .c files..."; \
$echo *.c | $tr ' ' '\012' | $egrep -v '\*' >.clist)
for file in `$cat .clist`; do
# for file in `cat /dev/null`; do
case "$file" in
*.c) filebase=`basename $file .c` ;;
*.y) filebase=`basename $file .c` ;;
esac
$echo "Finding dependencies for $filebase.o."
$sed -n <$file >$file.c \
-e "/^${filebase}_init(/q" \
-e '/^#/{' \
-e 's|/\*.*$||' \
-e 's|\\$||' \
-e p \
-e '}'
$cpp -I. $ccflags $file.c | \
$sed \
-e '/^# *[0-9]/!d' \
-e 's/^.*"\(.*\)".*$/'$filebase'.o: \1/' \
-e 's|: \./|: |' \
-e 's|\.c\.c|.c|' | \
$uniq | $sort | $uniq >> .deptmp
done

$sed Makefile.new -e '1,/^# AUTOMATICALLY/!d'

make shlist || ($echo "Searching for .SH files..."; \
$echo *.SH | $tr ' ' '\012' | $egrep -v '\*' >.shlist)
if $test -s .deptmp; then
for file in `cat .shlist`; do
$echo `$expr X$file : 'X\(.*\).SH`: $file config.sh \; \
/bin/sh $file >> .deptmp
done
$echo "Updating Makefile..."
$echo "# If this runs make out of memory, delete /usr/include lines." \
>> Makefile.new
$sed 's|^\(.*\.o:\) *\(.*/.*\.c\) *$|\1 \2; '"$defrule \2|" .deptmp \
>>Makefile.new
else
make hlist || ($echo "Searching for .h files..."; \
$echo *.h | $tr ' ' '\012' | $egrep -v '\*' >.hlist)
$echo "You don't seem to have a proper C preprocessor. Using grep instead."
$egrep '^#include ' `cat .clist` `cat .hlist` >.deptmp
$echo "Updating Makefile..."
<.clist $sed -n \
-e '/\//{' \
-e 's|^\(.*\)/\(.*\)\.c|\2.o: \1/\2.c; '"$defrule \1/\2.c|p" \
-e d \
-e '}' \
-e 's|^\(.*\)\.c|\1.o: \1.c|p' >> Makefile.new
<.hlist $sed -n 's|\(.*/\)\(.*\)|s= \2= \1\2=|p' >.hsed
<.deptmp $sed -n 's|c:#include "\(.*\)".*$|o: \1|p' | \
$sed 's|^[^;]*/||' | \
$sed -f .hsed >> Makefile.new
<.deptmp $sed -n 's|c:#include <\(.*\)>.*$|o: /usr/include/\1|p' \
>> Makefile.new
<.deptmp $sed -n 's|h:#include "\(.*\)".*$|h: \1|p' | \
$sed -f .hsed >> Makefile.new
<.deptmp $sed -n 's|h:#include <\(.*\)>.*$|h: /usr/include/\1|p' \
>> Makefile.new
for file in `$cat .shlist`; do
$echo `$expr X$file : 'X\(.*\).SH`: $file config.sh \; \
/bin/sh $file >> Makefile.new
done
fi
$rm -f Makefile.old
$cp Makefile Makefile.old
$cp Makefile.new Makefile
$rm Makefile.new
$echo "# WARNING: Put nothing here or make depend will gobble it up!" >> Makefile
$rm -f .deptmp `sed 's/\.c/.c.c/' .clist` .shlist .clist .hlist .hsed

getty_ps/makedep.SH 644 144 0 10211 5200631250 13115 0ustar stevewheel:
# $Id: makedep.SH,v 2.0 90/09/19 20:04:37 paul Rel $
#
# $Log: makedep.SH,v $
# Revision 2.0 90/09/19 20:04:37 paul
# Initial 2.0 release
#
#

case $CONFIG in
'')
if test ! -f config.sh; then
ln ../config.sh . || \
ln ../../config.sh . || \
ln ../../../config.sh . || \
(echo "Can't find config.sh."; exit 1)
fi
. ./config.sh
;;
esac
case "$0" in
*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
esac
echo "Extracting makedep (with variable substitutions)"
$spitshell >makedep < $startsh
#
# makedep
#
# Creates dependencies for Makefile
#

export PATH || (echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh \$0; kill \$\$)

cat='$cat'
ccflags='$ccflags'
cp='$cp'
cpp='$cppstdin'
echo='$echo'
egrep='$egrep'
expr='$expr'
mv='$mv'
rm='$rm'
sed='$sed'
sort='$sort'
test='$test'
tr='$tr'
uniq='$uniq'
!GROK!THIS!

$spitshell >>makedep <<'!NO!SUBS!'

: the following weeds options from ccflags that are of no interest to cpp
case "$ccflags" in
'');;
*) set X $ccflags
ccflags=''
for flag do
case $flag in
-D*|-I*) ccflags="$ccflags $flag";;
esac
done
;;
esac

$cat /dev/null >.deptmp
$rm -f *.c.c c/*.c.c
if test -f Makefile; then
mf=Makefile
else
mf=makefile
fi
if test -f $mf; then
defrule=`<$mf sed -n \
-e '/^\.c\.o:.*;/{' \
-e 's/\$\*\.c//' \
-e 's/^[^;]*;[ ]*//p' \
-e q \
-e '}' \
-e '/^\.c\.o: *$/{' \
-e N \
-e 's/\$\*\.c//' \
-e 's/^.*\n[ ]*//p' \
-e q \
-e '}'`
fi
case "$defrule" in
'') defrule='$(CC) -c $(CFLAGS)' ;;
esac

make clist || ($echo "Searching for .c files..."; \
$echo *.c | $tr ' ' '\012' | $egrep -v '\*' >.clist)
for file in `$cat .clist`; do
# for file in `cat /dev/null`; do
case "$file" in
*.c) filebase=`basename $file .c` ;;
*.y) filebase=`basename $file .c` ;;
esac
$echo "Finding dependencies for $filebase.o."
$sed -n <$file >$file.c \
-e "/^${filebase}_init(/q" \
-e '/^#/{' \
-e 's|/\*.*$||' \
-e 's|\\$||' \
-e p \
-e '}'
$cpp -I. $ccflags $file.c | \
$sed \
-e '/^# *[0-9]/!d' \
-e 's/^.*"\(.*\)".*$/'$filebase'.o: \1/' \
-e 's|: \./|: |' \
-e 's|\.c\.c|.c|' | \
$uniq | $sort | $uniq >> .deptmp
done

$sed Makefile.new -e '1,/^# AUTOMATICALLY/!d'

make shlist || ($echo "Searching for .SH files..."; \
$echo *.SH | $tr ' ' '\012' | $egrep -v '\*' >.shlist)
if $test -s .deptmp; then
for file in `cat .shlist`; do
$echo `$expr X$file : 'X\(.*\).SH`: $file config.sh \; \
/bin/sh $file >> .deptmp
done
$echo "Updating Makefile..."
$echo "# If this runs make out of memory, delete /usr/include lines." \
>> Makefile.new
$sed 's|^\(.*\.o:\) *\(.*/.*\.c\) *$|\1 \2; '"$defrule \2|" .deptmp \
>>Makefile.new
else
make hlist || ($echo "Searching for .h files..."; \
$echo *.h | $tr ' ' '\012' | $egrep -v '\*' >.hlist)
$echo "You don't seem to have a proper C preprocessor. Using grep instead."
$egrep '^#include ' `cat .clist` `cat .hlist` >.deptmp
$echo "Updating Makefile..."
<.clist $sed -n \
-e '/\//{' \
-e 's|^\(.*\)/\(.*\)\.c|\2.o: \1/\2.c; '"$defrule \1/\2.c|p" \
-e d \
-e '}' \
-e 's|^\(.*\)\.c|\1.o: \1.c|p' >> Makefile.new
<.hlist $sed -n 's|\(.*/\)\(.*\)|s= \2= \1\2=|p' >.hsed
<.deptmp $sed -n 's|c:#include "\(.*\)".*$|o: \1|p' | \
$sed 's|^[^;]*/||' | \
$sed -f .hsed >> Makefile.new
<.deptmp $sed -n 's|c:#include <\(.*\)>.*$|o: /usr/include/\1|p' \
>> Makefile.new
<.deptmp $sed -n 's|h:#include "\(.*\)".*$|h: \1|p' | \
$sed -f .hsed >> Makefile.new
<.deptmp $sed -n 's|h:#include <\(.*\)>.*$|h: /usr/include/\1|p' \
>> Makefile.new
for file in `$cat .shlist`; do
$echo `$expr X$file : 'X\(.*\).SH`: $file config.sh \; \
/bin/sh $file >> Makefile.new
done
fi
$rm -f Makefile.old
$cp Makefile Makefile.old
$cp Makefile.new Makefile
$rm Makefile.new
$echo "# WARNING: Put nothing here or make depend will gobble it up!" >> Makefile
$rm -f .deptmp `sed 's/\.c/.c.c/' .clist` .shlist .clist .hlist .hsed

!NO!SUBS!
$eunicefix makedep
chmod +x makedep
case `pwd` in
*SH)
$rm -f ../makedep
ln makedep ../makedep
;;
esac
getty_ps/config.h.SH 644 144 0 7155 5205323150 13201 0ustar stevewheel:
# $Id: config.h.SH,v 2.0 90/09/19 19:37:01 paul Rel $
#
# Creates config.h file for getty distribution
#
# $Log: config.h.SH,v $
# Revision 2.0 90/09/19 19:37:01 paul
# Initial 2.0 release
#
#

case $CONFIG in
'')
if test ! -f config.sh; then
ln ../config.sh . || \
ln ../../config.sh . || \
ln ../../../config.sh . || \
(echo "Can't find config.sh."; exit 1)
fi
. config.sh
;;
esac
case "$0" in
*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
esac

case "$d_phostname" in
$define) phostname='\"$phostname\"' ;;
$undef) phostname='' ;;
esac

echo "Extracting config.h (with variable substitutions)"
$spitshell >config.h < /*
** config.h
**
** Getty configuration.
*/

/*
** Copyright 1989,1990 by Paul Sutcliffe Jr.
**
** Permission is hereby granted to copy, reproduce, redistribute,
** or otherwise use this software as long as: there is no monetary
** profit gained specifically from the use or reproduction or this
** software, it is not sold, rented, traded or otherwise marketed,
** and this copyright notice is included prominently in any copy
** made.
**
** The author make no claims as to the fitness or correctness of
** this software for any use whatsoever, and it is provided as is.
** Any use of this software is at the user's own risk.
*/


#include "tune.h" /* defs needed below */


/* These are set by config.sh.
* If you change them here, they will be reset
* the next time you run Configure.
*/

#$d_portable PORTABLE /* compile for more than one site */
#$d_getutent GETUTENT /* we have getutent() and friends */
#$d_strdup STRDUP /* we have strdup() */
#$d_putenv PUTENV /* we have putenv() */

#$d_ttytype TTYTYPE "$ttytype" /* file used to identify terminals */
#$define GETTYTAB "$gettytab" /* file used for speed/termio table */

#$define STDCHAR $stdchar /* signed or unsigned chars in stdio */
#$define UIDTYPE $uidtype /* storage type of UID's */
#$define GIDTYPE $gidtype /* storage type of GID's */

#$d_fcntl FCNTL /* include fcntl.h? */
#$d_ioctl IOCTL /* include sys/ioctl.h? */
#$i_pwd PWD /* include pwd.h? */
#$i_time I_TIME /* include time.h? */
#$i_systime I_SYSTIME /* include sys/time.h? */
#$d_systimekernel SYSTIMEKERNEL
#$d_varargs VARARGS /* include varargs.h? */

#$d_index index strchr /* use these instead */
#$d_index rindex strrchr

#$d_voidsig VOIDSIG /* you have 'void (*signal)()' */

#ifdef VOIDSIG /* define sig_t appropriately */
typedef void sig_t;
#else /* VOIDSIG */
typedef int sig_t;
#endif /* VOIDSIG */

#ifndef VOIDUSED
#$define VOIDUSED $defvoidused
#endif /* VOIDUSED */
#$define VOIDFLAGS $voidflags
#if (VOIDFLAGS & VOIDUSED) != VOIDUSED
#$define void int /* is void to be avoided? */
#$define M_VOID /* Xenix strikes again */
#endif /* VOIDFLAGS & VOIDUSED */

#ifndef PORTABLE
#$define HOSTNAME "$hostname" /* compile node name in */
#else /* PORTABLE */
#$d_douname DOUNAME /* use uname() to get node name */
#$d_phostname PHOSTNAME $phostname /* get node name from this command */
#endif /* PORTABLE */

#ifndef UTMP_FILE
#$define UTMP_FILE "$utmp" /* name of the utmp file */
#endif /* UTMP_FILE */

#ifdef LOGUTMP
#ifndef WTMP_FILE
#$define WTMP_FILE "$wtmp" /* name of the wtmp file */
#endif /* WTMP_FILE */
#endif /* LOGUTMP */

#ifdef TRYMAIL
#$define MAILER "$mailer" /* mail agent */
#endif /* TRYMAIL */

#ifdef UUGETTY
#$d_asciipid ASCIIPID /* PID stored in ASCII in lock file */
#$d_asciipid BOTHPID /* ... or perhaps not */
#$define LOCK "$lock/LCK..%s" /* lock file name */
#$define UUCPID $uucpid /* uid of UUCP account */
#endif /* UUGETTY */


/* end of config.h */
!GROK!THIS!
chmod 644 config.h
$eunicefix config.h
getty_ps/Makefile.SH 644 144 0 6213 5210514127 13217 0ustar stevewheel:
# $Id: Makefile.SH,v 2.0 90/09/19 19:28:46 paul Rel $
#
# Creates Makefile for getty distribution
#
# $Log: Makefile.SH,v $
# Revision 2.0 90/09/19 19:28:46 paul
# Initial 2.0 release
#
#

case $CONFIG in
'')
if test ! -f config.sh; then
ln ../config.sh . || \
ln ../../config.sh . || \
ln ../../../config.sh . || \
(echo "Can't find config.sh."; exit 1)
fi
. config.sh
;;
esac
case "$0" in
*/*) cd `expr X$0 : 'X\(.*\)/'` ;;
esac

: add necessary modules based on config.sh
case "$d_getutent" in
"$define")
src=""
obj=""
;;
"$undef")
src="getutent.c"
obj="getutent.o"
;;
esac
case "$d_strdup" in
"$undef")
src="$src strdup.c"
obj="$obj strdup.o"
;;
esac
case "$d_putenv" in
"$undef")
src="$src putenv.c"
obj="$obj putenv.o"
;;
esac

echo "Extracting Makefile (with variable substitutions)"
$spitshell >Makefile < #
# Makefile for getty distribution
#
# To recreate this file, make any changes in config.sh and then
# say "sh Makefile.SH"
#

SHELL= /bin/sh

# compiler stuff -- check these
CC= $cc
CFLAGS= $optimize $ccflags $small
LFLAGS= $ldflags $split
LIBS= $libs
LINT= lint -abchuvx
LLIBS= $llib_termlib

# where things go
BIN= $bin
UUBIN= $bin

# what are we making
SH= Makefile.SH config.h.SH makedep.SH
HDRS= config.h defaults.h extern.h funcs.h getty.h patchlevel.h \\
table.h tune.h
SRC= main.c funcs.c defaults.c table.c $src
OBJ= main.o funcs.o defaults.o table.o $obj
UUSRC= umain.c funcs.c defaults.c table.c $src
UUOBJ= umain.o funcs.o defaults.o table.o $obj

# rules

all: getty uugetty manpages

clist:
@echo \$(SRC) \$(UUSRC) | $tr ' ' '\012' | $sort | $uniq > .clist

hlist:
@echo \$(HDRS) | $tr ' ' '\012' > .hlist

shlist:
@echo \$(SH) | $tr ' ' '\012' > .shlist
!GROK!THIS!
$spitshell >>Makefile <<'!NO!SUBS!'

getty: $(OBJ)
$(CC) $(LFLAGS) -o [email protected] $(OBJ) $(LIBS)

uugetty: $(UUOBJ)
$(CC) $(LFLAGS) -o [email protected] $(UUOBJ) $(LIBS)

manpages:
cd man; make

install: getty uugetty
-mv $(BIN)/getty $(BIN)/getty-
-mv $(UUBIN)/uugetty $(UUBIN)/uugetty-
cp getty $(BIN)
cp uugetty $(UUBIN)
chmod 700 $(BIN)/getty $(UUBIN)/uugetty
strip $(BIN)/getty $(UUBIN)/uugetty
cd man; make install

lint: $(SRC) umain.c
@echo "linting getty sources..."
echo "GETTY" >lint.out
$(LINT) $(SRC) $(LLIBS) >>lint.out
@echo "linting uugetty sources..."
@echo ' ' >>lint.out
echo 'UUGETTY' >>lint.out
$(LINT) -DUUGETTY $(UUSRC) $(LLIBS) >>lint.out
@echo "lint output is in lint.out"

clean:
rm -f umain.c *.o core *.out .*list *.ln Makefile.old
cd man; make clean

clobber: clean
rm -f getty uugetty
cd man; make clobber

realclean: clobber

depend: makedep umain.c tune.h
chmod +x makedep
./makedep

# special dependancies follow

umain.c: main.c
-ln main.c umain.c

umain.o:
$(CC) $(CFLAGS) -DUUGETTY -c umain.c

tune.h: tune.H
@echo "------------------------------------------------"
@echo "Making a tune.h from the tune.H prototype file. "
@echo "You may wish to edit tune.h before making getty."
@echo "------------------------------------------------"
-cp tune.H tune.h

# AUTOMATICALLY GENERATED MAKE DEPENDENCIES--PUT NOTHING BELOW THIS LINE
!NO!SUBS!
chmod 644 Makefile
$eunicefix Makefile
getty_ps/mytermio.h 644 144 0 746 5211642025 13251 0ustar stevewheel/*
* Found this in termio.h on some unix machines.
* Changed to fit Linux's defaults.
*/

#define CNUL 0
#define CERASE 127 /* ^? */
#define CKILL 025 /* ^U */
#define CINTR 03 /* ^C */
#define CQUIT 034 /* ^\ */
#define CSTART 021 /* ^Q */
#define CSTOP 023 /* ^S */
#define CEOF 04 /* ^D */
#define CMIN 06 /* satisfy read at 6 chars */
#define CTIME 01 /* .1 sec inter-character timer */

#define SSPEED B9600 /* default speed */
getty_ps/getty.h 644 144 0 5105 5230027522 12552 0ustar stevewheel/*
** $Id: getty.h,v 2.0 90/09/19 19:59:15 paul Rel $
**
** Included by all getty modules
*/

/*
** Copyright 1989,1990 by Paul Sutcliffe Jr.
**
** Permission is hereby granted to copy, reproduce, redistribute,
** or otherwise use this software as long as: there is no monetary
** profit gained specifically from the use or reproduction or this
** software, it is not sold, rented, traded or otherwise marketed,
** and this copyright notice is included prominently in any copy
** made.
**
** The author make no claims as to the fitness or correctness of
** this software for any use whatsoever, and it is provided as is.
** Any use of this software is at the user's own risk.
*/

/*
** $Log: getty.h,v $
** Revision 2.0 90/09/19 19:59:15 paul
** Initial 2.0 release
**
*/


#include "config.h"

#include
#include
#include
#include
#ifdef IOCTL
#include
#endif /* IOCTL */
#ifdef FCNTL
#include
#endif /* FCNTL */
#include

#include "extern.h"
#include "funcs.h"
#include "mytermio.h" /* SMR - gcc was missing a few definitions */

/* General purpose defines
*/

#ifndef FALSE
#define FALSE (0)
#endif /* FALSE */
#ifndef TRUE
#define TRUE (1)
#endif /* TRUE */

#define OK (0)

#define SUCCESS (0) /* normal return */
#define FAIL (-1) /* error return */

#define STDIN fileno(stdin)
#define STDOUT fileno(stdout)

#define strequal(s1, s2) (strcmp(s1, s2) == 0)
#define strnequal(s1, s2, n) (strncmp(s1, s2, n) == 0)
#define strncopy(s1, s2) (strncpy(s1, s2, sizeof(s1)))

typedef struct termio TERMIO;


#ifdef DEBUG

/* debug levels
*/
#define D_OPT 0001 /* option settings */
#define D_DEF 0002 /* defaults file processing */
#define D_UTMP 0004 /* utmp/wtmp processing */
#define D_INIT 0010 /* line initialization (INIT) */
#define D_GTAB 0020 /* gettytab file processing */
#define D_GETL 0040 /* get login name routine */
#define D_RUN 0100 /* other runtime diagnostics */
#define D_STTY 0400 /* output of stty -a in various places */

#ifdef UUGETTY
#define D_LOCK 0200 /* uugetty lockfile processing */
#endif /* UUGETTY */

/* debug defs
*/
#define debug1(a,b) dprint(a,b)
#define debug2(a,b) debug(a,b)
#define debug3(a,b,c) debug(a,b,c)
#define debug4(a,b,c,d) debug(a,b,c,d)
#define debug5(a,b,c,d,e) debug(a,b,c,d,e)
#define debug6(a,b,c,d,e,f) debug(a,b,c,d,e,f)

#else /* DEBUG */

#define debug1(a,b) /* define to nothing, disables debugging */
#define debug2(a,b)
#define debug3(a,b,c)
#define debug4(a,b,c,d)
#define debug5(a,b,c,d,e)
#define debug6(a,b,c,d,e,f)

#endif /* DEBUG */


/* end of getty.h */
getty_ps/putenv.c 644 144 0 4506 5200631253 12735 0ustar stevewheel/*
** $Id: putenv.c,v 2.0 90/09/19 20:16:07 paul Rel $
**
** Implements putenv(3c).
*/

/*
** Copyright 1989,1990 by Paul Sutcliffe Jr.
**
** Permission is hereby granted to copy, reproduce, redistribute,
** or otherwise use this software as long as: there is no monetary
** profit gained specifically from the use or reproduction or this
** software, it is not sold, rented, traded or otherwise marketed,
** and this copyright notice is included prominently in any copy
** made.
**
** The author make no claims as to the fitness or correctness of
** this software for any use whatsoever, and it is provided as is.
** Any use of this software is at the user's own risk.
*/

/*
** $Log: putenv.c,v $
** Revision 2.0 90/09/19 20:16:07 paul
** Initial 2.0 release
**
*/


#include "getty.h"

#if defined(RCSID) && !defined(lint)
static char *RcsId =
"@(#)$Id: putenv.c,v 2.0 90/09/19 20:16:07 paul Rel $";
#endif

#ifndef MAXENV
#define MAXENV 64 /* max # lines in envorinment */
#endif /* MAXENV */


/*
** putenv() - change or add value to environment
**
** Returns non-zero if an error occurrs, zero otherwise.
*/

extern char **environ;

int
putenv(s)
char *s;
{
register int i;
register char *p;
char *q, **envp, *env[MAXENV];
boolean match = FALSE;

if (s == (char *) NULL)
return(FAIL); /* can't add NULL to the environment */

if ((p = malloc((unsigned) strlen(s)+1)) == (char *) NULL)
return(FAIL); /* malloc failed */

(void) strcpy(p, s);
if ((q = index(p, '=')) == (char *) NULL) {
free(p);
return(FAIL); /* not in the form ``name=value'' */
}

*q = '\0'; /* split into two fields, name & value */

/* copy the environ list, replacing `s' if a match is found
*/
for (i=0, envp=environ; *envp != (char *) NULL; i++, envp++) {
if (strnequal(*envp, p, strlen(p))) {
match = TRUE;
env[i] = s;
} else
env[i] = *envp;
}

if (!match) {
*q = '='; /* put back the equal sign */
env[i++] = p; /* add p to env list */
} else
free(p); /* not needed, s replaced old value */

env[i++] = (char *) NULL;

/* now dup env to make new environment
*/
if ((envp = (char **) malloc((unsigned) (i*sizeof(char *)))) ==
(char **) NULL) {
return(FAIL);
}
environ = envp; /* point to new area */
for (i=0; env[i] != (char *) NULL; i++)
*envp++ = env[i];
*envp = (char *) NULL;

return(SUCCESS);
}


/* end of putenv.c */
getty_ps/sample.files 644 144 0 4503 5200631254 13553 0ustar stevewheelThese examples are from the author's system.

Sample `/etc/issue' file:
+---------
| Devon Computer Services, Lancaster, PA (@S)
| Tandy XENIX/68000 Version @V
+---------

Sample `/etc/default/uugetty' file:
+---------
| ISSUE=[@D, @T]\nDevon Computer Services - Tandy 6000 (@S)\n
| INIT="" A\pA\pA\pAT\r OK\r\n-ATZ\r-OK\r\n ATZ\r OK\r\n
| TIMEOUT=60
| #
| # set S0=0 (no answer); wait for RING, then go to answer mode and
| # look for the right speed
| #
| WAITFOR=RING
| CONNECT="" ATA\r CONNECT\s\A
+---------

Sample `/etc/gettydefs' file:
+---------
| #
| # Sample /etc/gettydefs file; use at your own risk!
| #
| # default entry:
| 0# B9600 CS8 # B9600 CLOCAL TAB3 ECHO SANE #login: #0
|
| # to toggle between 300 and 1200 baud on a modem line:
| #
| 1# B300 ISTRIP CS8 CR1 # B300 HUPCL CS8 TAB3 SANE CR1 #login: #2
|
| 2# B1200 ISTRIP CS8 # B1200 HUPCL CS8 TAB3 SANE #login: #1
|
| # to toggle between 300, 1200 and 2400 baud on a modem line:
| #
| 3# B300 ISTRIP CS8 CR1 # B300 HUPCL CS8 TAB3 SANE CR1 #login: #4
|
| 4# B1200 ISTRIP CS8 # B1200 HUPCL CS8 TAB3 SANE #login: #5
|
| 5# B2400 ISTRIP CS8 # B2400 HUPCL CS8 TAB3 SANE #login: #3
|
| # a telebit tb plus:
| #
| 6# B9600 ISTRIP CS8 # B9600 HUPCL CS8 TAB3 SANE #FAST login: #7
|
| 7# B2400 ISTRIP CS8 # B2400 HUPCL CS8 TAB3 SANE #login: #8
|
| 8# B1200 ISTRIP CS8 # B1200 HUPCL CS8 TAB3 SANE #login: #6
|
| # various hard-wired speeds
| a# B50 ISTRIP CS8 NL1 CR3 TAB2 # B50 CS8 CLOCAL SANE NL1 CR3 TAB2 #login: #a
|
| b# B75 ISTRIP CS8 NL1 CR2 TAB2 # B75 CS8 CLOCAL SANE NL1 CR2 TAB2 #login: #b
|
| c# B110 ISTRIP CS8 NL1 CR1 TAB1 # B110 CS8 CLOCAL SANE NL1 CR1 TAB1 #login: #c
|
| d# B134 ISTRIP CS8 NL1 CR1 TAB1 # B134 CS8 CLOCAL SANE NL1 CR1 TAB1 #login: #d
|
| e# B150 ISTRIP CS8 NL1 CR1 # B150 CS8 CLOCAL TAB3 SANE NL1 CR1 #login: #e
|
| f# B200 ISTRIP CS8 NL1 CR1 # B200 CS8 CLOCAL TAB3 SANE NL1 CR1 #login: #f
|
| g# B300 ISTRIP CS8 CR1 # B300 CS8 CLOCAL TAB3 SANE CR1 #login: #g
|
| h# B600 ISTRIP CS8 # B600 CS8 CLOCAL TAB3 SANE #login: #h
|
| i# B1200 ISTRIP CS8 # B1200 CS8 CLOCAL TAB3 SANE #login: #i
|
| j# B1800 ISTRIP CS8 # B1800 CS8 CLOCAL TAB3 SANE #login: #j
|
| k# B2400 ISTRIP CS8 # B2400 CS8 CLOCAL TAB3 SANE #login: #k
|
| l# B4800 ISTRIP CS8 # B4800 CS8 CLOCAL TAB3 SANE #login: #l
|
| m# B9600 ISTRIP CS8 # B9600 CS8 CLOCAL TAB3 SANE #login: #m
|
+---------
getty_ps/getutent.c 644 144 0 4313 5200631254 13250 0ustar stevewheel/*
** $Id: getutent.c,v 2.0 90/09/19 20:00:51 paul Rel $
**
** Implements getutent(3).
*/

/*
** Copyright 1989,1990 by Paul Sutcliffe Jr.
**
** Permission is hereby granted to copy, reproduce, redistribute,
** or otherwise use this software as long as: there is no monetary
** profit gained specifically from the use or reproduction or this
** software, it is not sold, rented, traded or otherwise marketed,
** and this copyright notice is included prominently in any copy
** made.
**
** The author make no claims as to the fitness or correctness of
** this software for any use whatsoever, and it is provided as is.
** Any use of this software is at the user's own risk.
*/

/*
** $Log: getutent.c,v $
** Revision 2.0 90/09/19 20:00:51 paul
** Initial 2.0 release
**
*/


#include "getty.h"

#if defined(RCSID) && !defined(lint)
static char *RcsId =
"@(#)$Id: getutent.c,v 2.0 90/09/19 20:00:51 paul Rel $";
#endif

typedef struct utmp UTMP;

static char *utmpfil = UTMP_FILE; /* default utmp file */
static FILE *ufp = (FILE *) NULL; /* file pointer to utmp file */
/* NULL = no utmp file open */
static UTMP ut; /* buffer for utmp record */


/*
** getutent() - get next valid utmp entry
**
** Returns (UTMP*)NULL if no vaild entry found.
*/

UTMP *
getutent()
{
if (ufp == (FILE *) NULL)
if ((ufp = fopen(utmpfil, "r+")) == (FILE *) NULL)
return((UTMP *) NULL);

do {
if (fread((char *)&ut, sizeof(ut), 1, ufp) != 1)
return((UTMP *) NULL);

} while (ut.ut_name[0] == '\0'); /* valid entry? */

return(&ut);
}


/*
** getutline() - get utmp entry that matches line.
**
** Returns (UTMP*)NULL if no match found.
*/

UTMP *
getutline(line)
register UTMP *line;
{
do {
if (strequal(ut.ut_line, line->ut_line))
return(&ut); /* match! */

} while (getutent() != NULL);

return((UTMP *) NULL);
}


/*
** setutent() - rewind utmp back to beginning
*/

void
setutent()
{
if (ufp != (FILE *) NULL)
rewind(ufp);
}


/*
** endutent() - close utmp file
*/

void
endutent()
{
if (ufp != (FILE *) NULL) {
(void) fclose(ufp);
ufp = (FILE *) NULL;
}
}


/*
** utmpname() - change utmp file name to "file"
*/

void
utmpname(file)
register char *file;
{
endutent();
utmpfil = strdup(file);
}


/* end of getutent.c */
getty_ps/MANIFEST 644 144 0 3414 5200631255 12400 0ustar stevewheelAfter all the getty kits are run you should have the following files:

Filename Kit Description
-------- --- -----------
Configure 2 Determines system configuration.
MANIFEST 4 Packing list.
Makefile.SH 4 Creates Makefile file.
README 1 The Instructions.
config.h.SH 4 Creates config.h file.
defaults.c 3 Routines to access the runtime defaults file.
defaults.h 5 Defines the defaults file structures.
extern.h 3 Defines all external values.
funcs.c 3 Miscellaneous routines.
funcs.h 5 Definitions for miscellaneous routines.
getty.h 4 Common header for all modules.
getutent.c 4 Implements getutent(3).
main.c 1 Main body of program.
makedep.SH 4 Creates makedep file.
man/Makefile.SH 4 Creates man/Makefile file.
man/README 1 Notes about the manual pages.
man/getty.m4 3 M4 source to getty manpage.
man/gettytab.m4 4 M4 source to gettytab manpage.
man/getutent.m4 4 M4 source to getutent manpage.
man/issue.m4 4 M4 source to issue manpage.
man/makeconfig 4 Creates config.m4 file.
man/putenv.m4 4 M4 source to putenv manpage.
man/strdup.m4 4 M4 source to strdup manpage.
patchlevel.h 3 Getty patchlevel.
putenv.c 4 Implements putenv(3c).
release.h 1 Getty release/date.
sample.files 4 Sample ancillary files.
strdup.c 5 Implements strdup(3c).
table.c 1 Routines to process the gettytab file.
table.h 4 Defines the gettytab structures.
tune.H 4 Sample tune.h file.
getty_ps/table.h 644 144 0 3034 5200631255 12505 0ustar stevewheel/*
** $Id: table.h,v 2.0 90/09/19 20:19:21 paul Rel $
**
** Defines the structures and functions used to parse the
** gettytab file.
*/

/*
** Copyright 1989,1990 by Paul Sutcliffe Jr.
**
** Permission is hereby granted to copy, reproduce, redistribute,
** or otherwise use this software as long as: there is no monetary
** profit gained specifically from the use or reproduction or this
** software, it is not sold, rented, traded or otherwise marketed,
** and this copyright notice is included prominently in any copy
** made.
**
** The author make no claims as to the fitness or correctness of
** this software for any use whatsoever, and it is provided as is.
** Any use of this software is at the user's own risk.
*/

/*
** $Log: table.h,v $
** Revision 2.0 90/09/19 20:19:21 paul
** Initial 2.0 release
**
*/


#ifndef LDISC0
#define LDISC0 0 /* default line discipline */
#endif /* LDISC0 */

#ifndef GETTYTAB
#define GETTYTAB "/etc/gettydefs" /* default name of the gettytab file */
#endif /* GETTYTAB */

/* Modes for gtabvalue()
*/
#define G_CHECK 0 /* nothing */
#define G_FIND 1 /* find requested entry only */
#define G_FORCE 2 /* make alternate choices */

typedef struct Gettytab {
char *cur_id; /* current label */
TERMIO itermio; /* initial termio flags */
TERMIO ftermio; /* final termio flags */
char *login; /* login prompt */
char *next_id; /* next label */
} GTAB;

typedef struct SymTab {
char *symbol; /* symbolic name */
ushort value; /* actual value */
} SYMTAB;

GTAB *gtabvalue();


/* end of table.h */
getty_ps/README.linux 660 144 0 24246 5232345316 13316 0ustar stevewheel
Paul Sutcliffe's Getty for Linux


This is getty_ps for linux version 2.0.2: my second release of Mr. Sutcliffe's
version 2.0 kit.

This kit came from volume 11 of the comp.sources.misc archives.

This file exists to point out the idiosyncrasies and pitfalls of the linux
version. The second part details the modifications, bug fixes and changes
I made to the source.

Steve Robbins
[email protected]
19 July 1992


Recipe for Installing Getty

NOTE: The *only* difference between getty and uugetty is that the latter
creates and checks lockfiles. So whatever I say about 'getty' applies to
uugetty, and vice versa (except for lockfiles).

1. Compile
You can compile everything as is (with gcc 2.1 or better). Just do a make.
If you don't have 'm4', then the manual pages will fail, but don't worry about
that. This gives you getty and uugetty, which you can copy into /bin. But
before you do the copy, I strongly suggest you save the old getty as
/bin/getty.old or something.

2. Make /etc/gettydefs
Put the following into /etc/gettydefs:
--------------
# default entry:
#
9600# B9600 CS8 # B9600 SANE -ISTRIP CLOCAL ECHO #login: #9600

# to toggle between 300, 1200 and 2400 baud on a modem line:
# - SANE sets CS8 and ISTRIP (which I don't want)
# - the blank lines are important
#
2400# B2400 ISTRIP CS8 # B2400 SANE -ISTRIP HUPCL #login: #1200

1200# B1200 ISTRIP CS8 # B1200 SANE -ISTRIP HUPCL #login: #300

300# B300 ISTRIP CS8 CR1 # B300 HUPCL SANE CR1 #login: #2400
--------------

3. Edit /etc/inittab
At the very least you have to swap the two arguments given to getty. The
device comes first, and the gettydefs label (the first entry on a line in
/etc/gettydefs) second. For the modem ports that you want to be able to call
out on, use 'uugetty' instead of getty. Also note that some root disks use
ttys1 for DOS' COM1, and some use ttys0 (do 'ls -l /dev/ttys? and check the
second number before the date -- 64 is COM1, 65 is COM2, etc).

Here's my /etc/inittab:
-----------------
tty1:vt100:/bin/getty tty1 9600
[ ... etc. tty1 through tty8 are identical ... ]
tty8:vt100:/bin/getty tty8 9600
ttys3:vt100:/bin/uugetty ttys3 2400
-----------------

I strongly recommend you change one of your virtual consoles to use the
old getty (/bin/getty.old -- remember not to change the arguments for this
one!) until you are content that this new getty is working.


3. Set up the /etc/default directory
The files in this directory are used to set some variables for getty at
runtime. The way it works is that when getty starts up on line ttys3:
if /etc/default/getty.ttys3 exists, we use it
else if /etc/default/getty exists, we use it
If uugetty starts up, it looks for /etc/default/uugetty[.ttys3] in the same
order.

There are four categories of tty lines for getty purposes:
- virtual consoles (tty1..tty8)
- smart modems which talk to the computer at the same speed as the
incoming calls
- smart modems with the serial port baudrate locked
- dumb modems and terminals

Virtual consoles:

You don't need any special setup.


Smartmodems at variable baud rates:

I use the following file in /etc/default/uugetty.ttys3; if all your modems
are of this type, then you can put this in /etc/default/uugetty:
----------------------------
# This line is a hayes-type modem
#
# time in seconds it will wait for a username at the 'login:' prompt
TIMEOUT=60

# Initialization
# M0 - speaker off
# S0=0 - answer on zero rings (i.e. don't answer)
#
# NOTE: be sure to have trailing \r\n on the INIT sequence
# in fact, all the \r\n's appear to be necessary
#
INIT="" \r+++\dAT\r OK\r\n-\r+++\dAT\r-OK\r\n ATM0S0=0\r OK\r\n

WAITFOR=RING
CONNECT="" ATA\r CONNECT\s\A
----------------------------
The general form of this file is a bunch of lines like VARIABLE=value. There
are a number of variables that can be set (see man/getty.m4 for full
explanations). This is probably the minimum set useful for modems.

Here's what's going on: (TIMEOUT is explained in a comment)
The variables INIT and CONNECT are chat strings (just like uucp uses), which
are of the form 'expect send expect send...', meaning at the appropriate time,
getty will wait until it reads the first 'expect string' from the modem, then
it will write the first 'send string', and wait for the second expect...
A bunch of quoted characters are used (see getty.m4 for full list) among which
are \r=return \n=newline \s=space \d=delay for a bit, and '""' means nothing.

To make things more flexible, you are allowed alternate-send/expects. Normally,
if getty times in expect mode, the chat fails. If the expect string is like
'expect-altsend-altexpect send' (i.e. separated by '-') then if getty finds
'expect', it continues on with 'send'; but if it times out, it sends 'altsend',
and looks for 'altexpect', before continuing on with 'send' (if sucessful) or
failing. You can use as many multiple send/expect alternates as you patience
allows.

Decoding the INIT string, then what happens is that getty waits for nothing,
sends out "+++[delay]AT", and waits for the modem to say "OK". (If it
doesn't work, it will try the sequence again before giving up) Then it sends
out "ATM0S0=0" and waits for acknowledgement. As you see, you can use this
string to reset any modem parameters you want.

Now, when does getty use these strings?

When getty starts up, it runs the INIT chat. A failure here means that getty
dies, and will be restarted by init. This has always worked for me whenever
my modem gets into a weird state. You may want to put 'ATZ' at the beginning
of the INIT chat to make sure the modem is in a known state. However, this
means that if someone unplugs your modem power or it gets some hardware fault
somehow, getty will be continuously respawning. A check should be made for
the number of chat failures to stop this, but I haven't had any trouble yet.

If INIT succeeds, getty listens at the port for the WAITFOR string (not a
chat -- just a plain string). When it sees this, it runs the CONNECT chat.
As you see, the one I use sends ATA to pick up the phone and then waits for
a CONNECT message from the modem. The special quoted character \A stands for
the autobauding digits. If for example the call comes in at 2400 bps, my
modems sends "CONNECT 2400", which getty detects and sets the port to 2400.
If the call came in at 1200, getty would set the port to that speed.


Smartmodems at fixed baudrate:

Everything in the preceeding section applies. The small but CRUCIAL difference
is that since your modem's port rate is fixed, you don't care what the incoming
speed is, and you certainly don't want getty resetting the port rate to match
the line rate! Thus, simply omit the autobauding special character \A:
----------------------------
CONNECT="" ATA\r CONNECT
----------------------------
Getty flushes the line after the connect chat, so you don't have to worry about
the speed messing up the username entry.


Dumb modems and dedicated terminals:

For the terminals, you could do the same as for virtual consoles, i.e. nothing,
or you could use dumb modem settings.

For dumb modems, obviously INIT, WAITFOR, and CONNECT are useless. Instead,
set WAITCHAR=YES, and getty will wait for one character before locking the
line (uugetty) and giving the login: prompt. Getty will cycle through the
baud rates specified in the gettydefs when the user logging in sends a
break character (or maybe carriage return?).


Changing the settings

If you want to tinker a bit with the settings, you shouldn't have to do
anything more drastic than edit three files: tune.h, config.h, and mytermio.h.
Read Paul's README through for details on the first two. The latter has a
few defines for default characters for KILL, QUIT, START etc.

You can run Configure yourself if you like, but I don't think its necessary.
If you do, you can either ignore the message about 'Cppsym' not found, or
apply the patch in pat.Configure which allegedly fixes this. I tried it, but
then I get in even more trouble with 'tr', so I took it out again -- its not
very important in any case.

For the tune.h file I would recommend leaving SETTERM undefined. If you don't,
you have to specify the terminal type on the command line, or it will be set
to 'unknown', which screws up anything that uses termcap. All you should want
to change is the Telebit stuff, should you possess such a beast.


What I did to the source code

Changes required to make it work under linux:

- changed Configure to be able to find gcc's libraries
- stuck in #ifndef __STDC__ around some declarations of stuff in header files
- cast AUTOBD definition to (char), because gcc's are signed
- sets the VMIN entry in struct termio to 1 after login, because I found
that things like 'more' didn't work otherwise
- fflush(stdout) after "login:" - this isn't needed with 0.96a, but it was in
0.95, so I left it in
- created 'mytermio.h' to hold all the CKILL, CNULL, etc definitions,
included by 'getty.h'
- removed the code to check for an INIT_PROCESS in the wtmp file, because
linux's init doesn't put one there


There were also a bunch of bugs which I fixed. Very briefly they are:

- escaped a bunch of '$' signs in Makefile.SH
- changed the handling of gettdefs so that it would ignore comment lines
properly
- fixed a debug output, so that the username is printed, rather than the
pointer
- moved a line so that one-character WAITFOR strings work
- fixed default file reading so that it handled comment lines properly
- escaped the '\'s in DEF_CONNECT string
- multiple expect/send strings didn't work
- moved the utmp/wtmp update ahead of WAITFOR stuff


A few behaviours that I changed:

- changed the @D date style from '28/5/92' to '28 May 92'
- removed the code to display the system name if no default file is present
(this made no sense to me whatsoever -- if the issue file was missing, then
displaying the hostname might be appropriate, but the default file???)
- the hostname is displayed before the "login: " prompt, as the original
linux getty did (thus removing any shred of reason for the above)
- if BOTHPID is defined, a binary read of lockfiles is attempted after an
ascii read fails
- added option of turning off stty bits in /etc/gettydefs, by using '-',
so SANE -ISTRIP turns on the SANE things, but then turns off ISTRIP
getty_ps/strdup.c 644 144 0 2570 5210752164 12742 0ustar stevewheel/*
** $Id: strdup.c,v 2.0.1.1 90/10/09 02:35:49 paul Exp $
**
** Implements strdup(3c) [strdup(S) for you Xenix-types].
*/

/*
** Copyright 1989,1990 by Paul Sutcliffe Jr.
**
** Permission is hereby granted to copy, reproduce, redistribute,
** or otherwise use this software as long as: there is no monetary
** profit gained specifically from the use or reproduction or this
** software, it is not sold, rented, traded or otherwise marketed,
** and this copyright notice is included prominently in any copy
** made.
**
** The author make no claims as to the fitness or correctness of
** this software for any use whatsoever, and it is provided as is.
** Any use of this software is at the user's own risk.
*/

/*
** $Log: strdup.c,v $
** Revision 2.0.1.1 90/10/09 02:35:49 paul
** patch1: Added missing #include for getty.h.
**
** Revision 2.0 90/09/19 20:18:12 paul
** Initial 2.0 release
**
*/

#include "getty.h"

#if defined(RCSID) && !defined(lint)
static char *RcsId =
"@(#)$Id: strdup.c,v 2.0.1.1 90/10/09 02:35:49 paul Exp $";
#endif

/*
** strdup() - duplicates string s in memory.
**
** Returns a pointer to the new string, or NULL if an error occurrs.
*/

char *
strdup(s)
register char *s;
{
register char *p = (char *) NULL;

if (s != (char *) NULL)
if ((p = malloc((unsigned) (strlen(s)+1))) != (char *) NULL)
(void) strcpy(p, s);

return(p);
}


/* end of strdup.c */
getty_ps/defaults.h 644 144 0 2217 5200631261 13224 0ustar stevewheel/*
** $Id: defaults.h,v 2.0 90/09/19 19:45:49 paul Rel $
**
** Defines the structures and functions used to read runtime
** defaults.
*/

/*
** Copyright 1989,1990 by Paul Sutcliffe Jr.
**
** Permission is hereby granted to copy, reproduce, redistribute,
** or otherwise use this software as long as: there is no monetary
** profit gained specifically from the use or reproduction or this
** software, it is not sold, rented, traded or otherwise marketed,
** and this copyright notice is included prominently in any copy
** made.
**
** The author make no claims as to the fitness or correctness of
** this software for any use whatsoever, and it is provided as is.
** Any use of this software is at the user's own risk.
*/

/*
** $Log: defaults.h,v $
** Revision 2.0 90/09/19 19:45:49 paul
** Initial 2.0 release
**
*/


/* lines in defaults file are in the form "NAME=value"
*/

typedef struct Default {
char *name; /* name of the default */
char *value; /* value of the default */
} DEF;


DEF **defbuild(); /* user-level routines */
char *defvalue();

FILE *defopen(); /* low-level routines */
DEF *defread();
int defclose();


/* end of defaults.h */
getty_ps/funcs.h 644 144 0 2125 5200631262 12532 0ustar stevewheel/*
** $Id: funcs.h,v 2.0 90/09/19 19:56:17 paul Rel $
**
** Defines the miscellaneous functions.
*/

/*
** Copyright 1989,1990 by Paul Sutcliffe Jr.
**
** Permission is hereby granted to copy, reproduce, redistribute,
** or otherwise use this software as long as: there is no monetary
** profit gained specifically from the use or reproduction or this
** software, it is not sold, rented, traded or otherwise marketed,
** and this copyright notice is included prominently in any copy
** made.
**
** The author make no claims as to the fitness or correctness of
** this software for any use whatsoever, and it is provided as is.
** Any use of this software is at the user's own risk.
*/

/*
** $Log: funcs.h,v $
** Revision 2.0 90/09/19 19:56:17 paul
** Initial 2.0 release
**
*/


/* States for settermio()
*/
#define INITIAL 0
#define FINAL 1

/* Return values for getlogname()
*/
#define BADSPEED 1
#define BADCASE 2
#define NONAME 3

int Fputs(), chat(), getlogname();
char *getuname();
void settermio(), logerr();

#ifdef DEBUG
void debug(), dprint();
#endif /* DEBUG */


/* end of funcs.h */
getty_ps/tune.h 644 144 0 4744 5230044740 12402 0ustar stevewheel/*
** $Id: tune.H,v 2.0 90/09/19 20:19:47 paul Rel $
**
** Getty tuneable parameters.
*/

/*
** Copyright 1989,1990 by Paul Sutcliffe Jr.
**
** Permission is hereby granted to copy, reproduce, redistribute,
** or otherwise use this software as long as: there is no monetary
** profit gained specifically from the use or reproduction or this
** software, it is not sold, rented, traded or otherwise marketed,
** and this copyright notice is included prominently in any copy
** made.
**
** The author make no claims as to the fitness or correctness of
** this software for any use whatsoever, and it is provided as is.
** Any use of this software is at the user's own risk.
*/

/*
** $Log: tune.H,v $
** Revision 2.0 90/09/19 20:19:47 paul
** Initial 2.0 release
**
*/


#define boolean int /* does your cc know about boolean? */

#define DEF_CFL (CS8) /* default word-len/parity */

#define DEF_CONNECT "CONNECT\\s\\A\r\n" /* default CONNECT string */


/* Feature selection
*/

#define DEBUG /* include debugging code */
#define LOGUTMP /* need to update utmp/wtmp files */
#undef MY_CANON /* use my own ERASE and KILL chars */
#define RCSID /* include RCS ID info in objects */
#undef SETTERM /* need to set TERM in environment */
#undef TELEBIT /* include Telebit FAST parsing */
#define TRYMAIL /* mail errors if CONSOLE unavailable */
#define WARNCASE /* warn user if login is UPPER case */

/* define your ERASE and KILL characters here
*/
#ifdef MY_CANON
#define MY_ERASE '\010' /* 010 = ^H, backspace */
#define MY_KILL '\025' /* 025 = ^U, nak */
#endif

/* define your Telebit FAST speed here
*/
#ifdef TELEBIT
#define TB_FAST "19200" /* CONNECT FAST == this speed */
#endif /* TELEBIT */

/* who should be notified of errors?
*/
#ifdef TRYMAIL
#define NOTIFY "root"
#endif


/* Where to find things
*/

#define CONSOLE "/dev/console" /* place to log errors */
#define DEFAULTS "/etc/default/%s" /* name of defaults file */
#define ISSUE "/etc/issue" /* name of the issue file;
say "#undef ISSUE" to turn off
the issue feature */
#define LOGIN "/bin/login" /* name of login program */


/* Special cases
*/

#undef TRS16 /* you are a Tandy 6000 or equivilent */


/* You probably shouldn't fool with these
*/

#define MAXDEF 100 /* max # lines in defaults file */
#define MAXLINE 256 /* max # chars in a line */
#define MAXID 12 /* max # chars in Gtab Id */
#define MAXLOGIN 80 /* max # chars in Gtab Login */


/* end of tune.h */