From 7d184b339172147ddad3e09ec4c3086df7531d35 Mon Sep 17 00:00:00 2001 From: gdr-ftp Date: Fri, 10 Apr 1998 16:18:06 +0000 Subject: [PATCH] Various changes to get getty compiling under GNO v2.0.6. In general they are: - changed the makefile - prototyped functions - eliminated pathnames.h since all it does is #include - used gettytab.h for various function declarations - verified stack usage at 712 bytes - eliminated dummy gethostname() function. Instead, get it from libc. This exposes a problem with gethostname. See PR#59 for details. - eliminated a dependancy on strftime for the moment by calling ctime() instead. - Added GNO-formatted versions of the man pages. --- usr.sbin/getty/Makefile | 35 +++-- usr.sbin/getty/getty.8G | 122 ++++++++++++++++ usr.sbin/getty/getty.desc | 10 ++ usr.sbin/getty/getty.rez | 18 +++ usr.sbin/getty/gettytab.5G | 287 +++++++++++++++++++++++++++++++++++++ usr.sbin/getty/gettytab.c | 45 +++--- usr.sbin/getty/gettytab.h | 37 ++++- usr.sbin/getty/init.c | 8 +- usr.sbin/getty/init.disasm | 192 ------------------------- usr.sbin/getty/linkfile | 8 -- usr.sbin/getty/main.c | 80 +++++++---- usr.sbin/getty/pathnames.h | 37 ----- usr.sbin/getty/subr.c | 61 +++++--- usr.sbin/getty/ttydeflts.c | 6 +- 14 files changed, 622 insertions(+), 324 deletions(-) create mode 100644 usr.sbin/getty/getty.8G create mode 100644 usr.sbin/getty/getty.desc create mode 100644 usr.sbin/getty/getty.rez create mode 100644 usr.sbin/getty/gettytab.5G delete mode 100644 usr.sbin/getty/init.disasm delete mode 100755 usr.sbin/getty/linkfile delete mode 100644 usr.sbin/getty/pathnames.h diff --git a/usr.sbin/getty/Makefile b/usr.sbin/getty/Makefile index 1195fb1..f9e166f 100644 --- a/usr.sbin/getty/Makefile +++ b/usr.sbin/getty/Makefile @@ -1,17 +1,28 @@ -main.a: main.c pathnames.h - compile -i main.c keep=main +# +# $Id: Makefile,v 1.2 1998/04/10 16:17:33 gdr-ftp Exp $ +# -init.a: init.c pathnames.h - compile -i init.c keep=init +PROG = getty +MAIN = main +SRCS = main.c gettytab.c init.c subr.c ttydeflts.c +LDADD = -lutil +CFLAGS += -DNO_STRFTIME +STACK = 1024 # 712 observed +BINDIR = /usr/sbin -subr.a: subr.c - compile -i subr.c keep=subr +CUSTOM_RELEASE = true -gettytab.a: gettytab.c pathnames.h - compile -i +w gettytab.c keep=gettytab +.INCLUDE: /src/gno/prog.mk -ttydflts.a: ttydefaults.c - compile -i ttydefaults.c keep=ttydflts +release: $(OBJ_DIR)$(PROG) gettytab.5G getty.8G $(DESC) + $(INSTALL) -d $(RELBIN) $(RELMAN)/man5 $(RELMAN)/man8 $(DESC_DIR) + $(INSTALL) $(OBJ_DIR)$(PROG) $(RELBIN) + $(INSTALL) gettytab.5G $(RELMAN)/man5/gettytab.5 + $(INSTALL) getty.8G $(RELMAN)/man8/getty.8 + $(DESCU) -o $(DESC_SRC) $(DESC_SRC) $(DESC) -getty: main.c init.c subr.c gettytab.c ttydefaults.c - compile linkfile +install: $(OBJ_DIR)$(PROG) gettytab.5G getty.8G + $(INSTALL) -d $(BINDIR) $(MANDIR)/man5 $(MANDIR)/man8 $(DESC_DIR) + $(INSTALL) $(OBJ_DIR)$(PROG) $(BINDIR) + $(INSTALL) gettytab.5G $(MANDIR)/man5/gettytab.5 + $(INSTALL) getty.8G $(MANDIR)/man8/getty.8 diff --git a/usr.sbin/getty/getty.8G b/usr.sbin/getty/getty.8G new file mode 100644 index 0000000..91f3847 --- /dev/null +++ b/usr.sbin/getty/getty.8G @@ -0,0 +1,122 @@ +.\" Copyright (c) 1980, 1991 Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)getty.8 6.6 (Berkeley) 4/25/91 +.\" +.TH GETTY 8 "8 April 1998" GNO "System Administration" +.SH NAME +.BR getty +\- set terminal mode +.SH SYNOPSIS +.BR getty +[ +.I type +[ +.I tty +] ] +.SH DESCRIPTION +The +.BR getty +program +is called by +.BR init (8) +to open and initialize the tty line, read a login name, and invoke +.BR login (1). +.LP +The argument +.BR tty +is the special device +to open for the terminal (for example, ``.ttyco''). +If there is no argument or the argument is +.IR \- , +the tty line is assumed to be open as file descriptor 0. +.LP +The +.BR type +argument can be used to make +.BR getty +treat the terminal line specially. +This argument is used as an index into the +.BR gettytab 5 +database, to determine the characteristics of the line. +If there is no argument, or there is no such table, the +.IR default +table is used. +If there is no +/etc/gettytab , +a set of system defaults is used. +If indicated by the table located, +.BR getty +will clear the terminal screen, +print a banner heading, +and prompt for a login name. +Usually either the banner or the login prompt will include +the system hostname. +.LP +Most of the default actions of +.BR getty +can be circumvented, or modified, by a suitable +.BR gettytab +table. +.LP +The +.BR getty +program +can be set to timeout after some interval, +which will cause dial up lines to hang up +if the login name is not entered reasonably quickly. +.SH DIAGNOSTICS +.I "ttyxx: No such device or address." +.br +.I "ttyxx: No such file or address." +.RS +A terminal which is turned +on in the +.BR ttys +file cannot be opened, likely because the requisite +lines are either not configured into the system, the associated device +was not attached during boot-time system configuration, +or the special device +does not exist. +.RE +.SH FILES +/etc/gettytab +.SH SEE ALSO +.BR gettytab (5), +.BR init (8), +.BR login (1), +.BR ioctl (2), +.BR tty (4), +.BR ttys (5) +.SH HISTORY +A +.BR getty +program appeared in Version 6 AT&T UNIX. diff --git a/usr.sbin/getty/getty.desc b/usr.sbin/getty/getty.desc new file mode 100644 index 0000000..c5705f5 --- /dev/null +++ b/usr.sbin/getty/getty.desc @@ -0,0 +1,10 @@ +Name: getty +Version: 2.1 +Author: Maintained by Devin Reade +Contact: gdr@trenco.gno.org +Where: /usr/sbin +FTP: ftp.gno.org + +Getty monitors serial lines and waits for users to log in, subsequently +passing control to login(1). It is not intended to be called by the +user. diff --git a/usr.sbin/getty/getty.rez b/usr.sbin/getty/getty.rez new file mode 100644 index 0000000..ba12ee0 --- /dev/null +++ b/usr.sbin/getty/getty.rez @@ -0,0 +1,18 @@ +/* + * $Id: getty.rez,v 1.1 1998/04/10 16:17:41 gdr-ftp Exp $ + */ + +#include "Types.Rez" +#include "/src/gno/build.tools/builddate.rez" + +resource rVersion (0x1, purgeable3, nocrossbank) { + + { 2, 1, 0, /* version */ + release, /* development|alpha|beta|final|release */ + 0 /* non-final release number */ + }, + verUS, + "getty", + "monitor ttys and wait for logins\n" + BUILD_DATE +}; diff --git a/usr.sbin/getty/gettytab.5G b/usr.sbin/getty/gettytab.5G new file mode 100644 index 0000000..ccc5997 --- /dev/null +++ b/usr.sbin/getty/gettytab.5G @@ -0,0 +1,287 @@ +.\" Copyright (c) 1983, 1991 The Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)gettytab.5 6.7 (Berkeley) 5/10/91 +.\" +.TH GETTYTAB 5 "8 April 1998" GNO "File Formats" +.SH NAME +.BR gettytab +\- terminal configuration data base +.SH SYNOPSIS +.BR gettytab +.SH DESCRIPTION +The +.BR gettytab +file +is a simplified version of the +.BR termcap (5) +data base +used to describe terminal lines. +The initial terminal login process +.BR getty (8) +accesses the +.BR gettytab +file each time it starts, allowing simpler +reconfiguration of terminal characteristics. +Each entry in the data base +is used to describe one class of terminals. +.LP +There is a default terminal class, +.IR default , +that is used to set global defaults for all other classes. +(That is, the +.IR default +entry is read, then the entry for the class required +is used to override particular settings.) +.SH CAPABILITIES +Refer to +.BR termcap (5) +for a description of the file layout. +The +.IR default +column below lists defaults obtained if there is +no entry in the table obtained, nor one in the special +.IR default +table. +.nf + +\fBName Type Default Description\fR + +ap bool false terminal uses any parity +bd num 0 backspace delay +bk str 0377 alternate end of line character (input break) +cb bool false use crt backspace mode +cd num 0 carriage-return delay +ce bool false use crt erase algorithm +ck bool false use crt kill algorithm +cl str NULL screen clear sequence +co bool false console - add '\en' after login prompt +ds str \`^Y\' delayed suspend character +dx bool false set DECCTLQ +ec bool false leave echo OFF +ep bool false terminal uses even parity +er str \`^?\' erase character +et str \`^D\' end of text (EOF character) +ev str NULL initial enviroment +f0 num unused tty mode flags to write messages +f1 num unused tty mode flags to read login name +f2 num unused tty mode flags to leave terminal as +fd num 0 form-feed (vertical motion) delay +fl str \`^O\' output flush character +hc bool false do NOT hangup line on last close +he str NULL hostname editing string +hn str hostname hostname +ht bool false terminal has real tabs +ig bool false ignore garbage characters in login name +im str NULL initial (banner) message +in str \`^C\' interrupt character +is num unused input speed +kl str \`^U\' kill character +lc bool false terminal has lower case +lm str login: login prompt +ln str \`^V\' ``literal next'' character +lo str /usr/bin/login program to exec when name obtained +nd num 0 newline (line-feed) delay +nl bool false terminal has (or might have) a newline character +nx str default next table (for auto speed selection) +op bool false terminal uses odd parity +os num unused output speed +pc str \`\e0\' pad character +pe bool false use printer (hard copy) erase algorithm +pf num 0 delay between first prompt and following flush (seconds) +ps bool false line connected to a MICOM port selector +qu str \`\&^\e\' quit character +rp str \`^R\' line retype character +rw bool false do NOT use raw for input, use cbreak +sp num unused line speed (input and output) +su str \`^Z\' suspend character +tc str none table continuation +to num 0 timeout (seconds) +tt str NULL terminal type (for environment) +ub bool false do unbuffered output (of prompts etc) +uc bool false terminal is known upper case only +we str \`^W\' word erase character +xc bool false do NOT echo control chars as \`^X\' +xf str \`^S\' XOFF (stop output) character +xn str \`^Q\' XON (start output) character +.fi +.LP +If no line speed is specified, speed will not be altered +from that which prevails when getty is entered. +Specifying an input or output speed will override +line speed for stated direction only. +.LP +Terminal modes to be used for the output of the message, +for input of the login name, +and to leave the terminal set as upon completion, +are derived from the boolean flags specified. +If the derivation should prove inadequate, +any (or all) of these three may be overriden +with one of the +.IR \&f0 , +.IR \&f1 , +or +.IR \&f2 +numeric specifications, which can be used to specify +(usually in octal, with a leading '0') +the exact values of the flags. +Local (new tty) flags are set in the top 16 bits +of this (32 bit) value. +.LP +Should +.BR getty +receive a null character +(presumed to indicate a line break) +it will restart using the table indicated by the +.IR nx +entry. If there is none, it will re-use its original table. +.LP +Delays are specified in milliseconds, the nearest possible +delay available in the tty driver will be used. +Should greater certainty be desired, delays +with values 0, 1, 2, and 3 are interpreted as +choosing that particular delay algorithm from the driver. +.LP +The +.IR \&cl +screen clear string may be preceded by a (decimal) number +of milliseconds of delay required (a la termcap). +This delay is simulated by repeated use of the pad character +.IR \&pc . +.LP +The initial message, and login message, +.IR \&im +and +.IR \&lm +may include the character sequence +.IR \&%h +or +.IR \&%t +to obtain +the hostname or tty name respectively. +.RI ( %% +obtains a single '%' character.) +The hostname is normally obtained from the system, +but may be set by the +.IR \&hn +table entry. +In either case it may be edited with +.IR \&he . +The +.IR \&he +string is a sequence of characters, each character that +is neither '@' nor '#' is copied into the final hostname. +A '@' in the +.IR \&he +string, causes one character from the real hostname to +be copied to the final hostname. +A '#' in the +.IR \&he +string, causes the next character of the real hostname +to be skipped. +Surplus '@' and '#' characters are ignored. +.LP +When getty execs the login process, given +in the +.IR \&lo +string (usually +.BR /usr/bin/login ), +it will have set +the enviroment to include the terminal type, as indicated +by the +.IR \&tt +string (if it exists). +The +.IR \&ev +string, can be used to enter additional data into +the environment. +It is a list of comma separated strings, each of which +will presumably be of the form +.IR name=value . +.LP +If a non-zero timeout is specified, with +.IR \&to , +then getty will exit within the indicated +number of seconds, either having +received a login name and passed control +to +.BR login , +or having received an alarm signal, and exited. +This may be useful to hangup dial in lines. +.LP +Output from +.BR getty +is even parity unless +.IR \&op +is specified. +The +.IR \&op +string +may be specified with +.IR \&ap +to allow any parity on input, but generate odd parity output. +Note: this only applies while getty is being run, +terminal driver limitations prevent a more complete +implementation. +.BR Getty +does not check parity of input characters in +.BR RAW +mode. +.SH SEE ALSO +.BR login (1), +.BR termcap (5), +.BR getty (8). +.SH BUGS +The special characters (erase, kill, etc.) are reset to system defaults +by +.BR login (1). +In +.IR all +cases, '#' or '^H' typed in a login name will be treated as +an erase character, and '@' will be treated as a kill character. +.LP +The delay stuff is a real crock. +Apart form its general lack of flexibility, some +of the delay algorithms are not implemented. +The terminal driver should support sane delay settings. +.LP +The +.IR \&he +capability is stupid. +.LP +The +.BR termcap +format is horrid, something more rational should +have been chosen. +.SH HISTORY +The +.BR gettytab +file format appeared in 4.2BSD. diff --git a/usr.sbin/getty/gettytab.c b/usr.sbin/getty/gettytab.c index f8e18bf..34cb3a6 100644 --- a/usr.sbin/getty/gettytab.c +++ b/usr.sbin/getty/gettytab.c @@ -1,8 +1,3 @@ -/*#pragma debug 25*/ -/*#define BUG(__s) {fprintf(stderr,"%s\n",__s);}*/ -#define BUG(__s) -#pragma optimize 31 - /* * Copyright (c) 1983 The Regents of the University of California. * All rights reserved. @@ -36,9 +31,11 @@ * SUCH DAMAGE. */ +#ifndef __GNO__ #ifndef lint static char sccsid[] = "@(#)gettytab.c 5.5 (Berkeley) 2/25/91"; #endif /* not lint */ +#endif #include #include @@ -46,23 +43,28 @@ static char sccsid[] = "@(#)gettytab.c 5.5 (Berkeley) 2/25/91"; #include #include #include -#include "pathnames.h" +#include +#include "gettytab.h" + +#ifndef _PATH_GETTYTAB +#define _PATH_GETTYTAB "/etc/gettytab" +#endif #define TABBUFSIZ 512 static char *tbuf; int hopcount; /* detect infinite loops in termcap, init 0 */ -char *skip(); -char *getstr(); -char *decode(); + +static char * skip (register char *bp); +static char * decode (register char *str, char **area); /* * Get an entry for terminal name in buffer bp, * from the termcap file. Parse is very rudimentary; * we just notice escaped newlines. */ -getent(bp, name) - char *bp, *name; +int +getent(char *bp, char *name) { register char *cp; register int c; @@ -120,7 +122,8 @@ getent(bp, name) * Note that this works because of the left to right scan. */ #define MAXHOP 32 -nchktc() +int +nchktc(void) { register char *p, *q; char tcname[16]; /* name of similar terminal */ @@ -176,6 +179,7 @@ nchktc() * against each such name. The normal : terminator after the last * name (before the first field) stops us. */ +int namatch(char *np) { register char *Np, *Bp; @@ -202,8 +206,7 @@ namatch(char *np) * into the termcap file in octal. */ static char * -skip(bp) - register char *bp; +skip(register char *bp) { while (*bp && *bp != ':') @@ -222,8 +225,7 @@ skip(bp) * Note that we handle octal numbers beginning with 0. */ long -getnum(id) - char *id; +getnum(char *id) { register long i, base; register char *bp = tbuf; @@ -255,8 +257,8 @@ getnum(id) * of the buffer. Return 1 if we find the option, or 0 if it is * not given. */ -getflag(id) - char *id; +int +getflag (char *id) { register char *bp = tbuf; @@ -284,8 +286,7 @@ getflag(id) * No checking on area overflow. */ char * -getstr(id, area) - char *id, **area; +getstr(char *id, char **area) { register char *bp = tbuf; @@ -309,9 +310,7 @@ getstr(id, area) * string capability escapes. */ static char * -decode(str, area) - register char *str; - char **area; +decode(register char *str, char **area) { register char *cp; register int c; diff --git a/usr.sbin/getty/gettytab.h b/usr.sbin/getty/gettytab.h index 2543c56..4a7c6d4 100644 --- a/usr.sbin/getty/gettytab.h +++ b/usr.sbin/getty/gettytab.h @@ -136,12 +136,41 @@ struct gettyflags { #define DX gettyflags[20].value #define NP gettyflags[21].value -int getent(); -long getnum(); -int getflag(); -char *getstr(); +struct delayval; + +void addenv (char *vdef); +int adelay (long ms, struct delayval *dp); +int delaybits (void); +void edithost (char *pat); +void gendefaults (void); +void gettable (char *name, char *buf, char *area); +void makeenv (void); +void setchars (void); +void setdefaults (void); +long setflags (int n); +int speed (long val); + + +char * portselector (void); +char * autobaud (void); +void set_ttydefaults (int fd); +int getent (char *bp, char *name); +int nchktc (void); +int namatch (char *np); +long getnum (char *id); +int getflag (char *id); +char * getstr (char *id, char **area); extern struct gettyflags gettyflags[]; extern struct gettynums gettynums[]; extern struct gettystrs gettystrs[]; extern int hopcount; + +#if 0 +#define BUG(__s) {fprintf(stderr,"%s\n",__s);} +#else +#define BUG(__s) +#endif + +#define rindex strrchr + diff --git a/usr.sbin/getty/init.c b/usr.sbin/getty/init.c index 38f2aa8..c9cf601 100644 --- a/usr.sbin/getty/init.c +++ b/usr.sbin/getty/init.c @@ -31,9 +31,11 @@ * SUCH DAMAGE. */ +#ifndef __GNO__ #ifndef lint static char sccsid[] = "@(#)init.c 5.6 (Berkeley) 3/27/91"; #endif /* not lint */ +#endif /* * Getty table initializations. @@ -41,8 +43,12 @@ static char sccsid[] = "@(#)init.c 5.6 (Berkeley) 3/27/91"; * Melbourne getty. */ #include +#include #include "gettytab.h" -#include "pathnames.h" + +#ifndef _PATH_LOGIN +#define _PATH_LOGIN "/usr/sbin/login" +#endif extern struct sgttyb tmode; extern struct tchars tc; diff --git a/usr.sbin/getty/init.disasm b/usr.sbin/getty/init.disasm deleted file mode 100644 index f78b96f..0000000 --- a/usr.sbin/getty/init.disasm +++ /dev/null @@ -1,192 +0,0 @@ -DumpOBJ 2.0 - -Byte count : $00000382 898 -Reserved space: $00000000 0 -Length : $00000165 357 -Label length : $00 0 -Number length : $04 4 -Version : $02 2 -Bank size : $00010000 65536 -Kind : $0000 0 (code,static) -Org : $00000000 0 -Alignment : $00000000 0 -Number sex : $00 0 -Segment number: $0000 0 -Segment entry : $00000000 0 -Disp to names : $0030 48 -Disp to body : $0044 68 -Load name : -Segment name : login_tty - -000044 000000 | LONGA ON -000044 000000 | LONGI ON -000044 000000 | login_tty START -000044 000000 | TSC -000046 000001 | SEC -000047 000002 | SBC #$0008 -00004A 000005 | TCS -00004B 000006 | PHD -00004C 000007 | TCD -00004D 000008 | TSC -00004E 000009 | STA $07 -000050 00000B | LDA $07 -000052 00000D | PHA -000053 00000E | PEA ((login_tty+$0000010A)|$FFFFFFF0) -000062 000011 | PEA (login_tty+$0000010A) -00006C 000014 | JSL printf -000079 000018 | BRK $00 -00007C 00001A | LDA $0C -00007E 00001C | PHA -00007F 00001D | JSL tcnewpgrp -00008E 000021 | LDX #$0000 -000092 000024 | CMP #$FFFF -000095 000027 | BNE (login_tty+$0000002A) -0000A2 000029 | INX -0000A4 00002A | TXA -0000A6 00002B | BNE (login_tty+$00000030) -0000B3 00002D | BRL (login_tty+$0000003A) -0000C1 000030 | PEA (((login_tty+$0000010A)+$00000010)|$FFFFFFF0) -0000D7 000033 | PEA ((login_tty+$0000010A)+$00000010) -0000E7 000036 | JSL printf -0000F4 00003A | LDA $0C -0000F7 00003C | PHA -0000F8 00003D | JSL settpgrp -000106 000041 | LDA #$FFFF -00010A 000044 | LDX #$0000 -00010D 000047 | TAY -00010E 000048 | BPL (login_tty+$0000004B) -00011B 00004A | DEX -00011D 00004B | LDY #$0001 -000121 00004E | CMP $01,S -000123 000050 | BEQ (login_tty+$00000053) -000130 000052 | DEY -000132 000053 | TXA -000134 000054 | CMP $03,S -000136 000056 | BEQ (login_tty+$0000005B) -000143 000058 | LDY #$0000 -000147 00005B | PLA -000149 00005C | PLA -00014A 00005D | TYA -00014B 00005E | BNE (login_tty+$00000063) -000158 000060 | BRL (login_tty+$0000006D) -000166 000063 | PEA (((login_tty+$0000010A)+$00000022)|$FFFFFFF0) -00017C 000066 | PEA ((login_tty+$0000010A)+$00000022) -00018C 000069 | JSL printf -000199 00006D | PEA $0000 -00019D 000070 | PEA $0000 -0001A0 000073 | PEA $2000 -0001A3 000076 | PEA $7461 -0001A6 000079 | LDA $0C -0001A8 00007B | PHA -0001A9 00007C | JSL ioctl -0001B4 000080 | LDX #$0000 -0001B8 000083 | CMP #$FFFF -0001BB 000086 | BNE (login_tty+$00000089) -0001C8 000088 | INX -0001CA 000089 | TXA -0001CC 00008A | BNE (login_tty+$0000008F) -0001D9 00008C | BRL (login_tty+$000000A1) -0001E7 00008F | PEA (((login_tty+$0000010A)+$00000033)|$FFFFFFF0) -0001FD 000092 | PEA ((login_tty+$0000010A)+$00000033) -00020D 000095 | JSL printf -00021A 000099 | LDA #$FFFF -00021E 00009C | STA $01 -000220 00009E | BRL (login_tty+$000000F7) -00022D 0000A1 | LDA #$0001 -000231 0000A4 | PHA -000232 0000A5 | LDA $0C -000234 0000A7 | PHA -000235 0000A8 | JSL dup2 -00023F 0000AC | LDA #$0002 -000243 0000AF | PHA -000244 0000B0 | LDA $0C -000246 0000B2 | PHA -000247 0000B3 | JSL dup2 -000251 0000B7 | LDA #$0003 -000255 0000BA | PHA -000256 0000BB | LDA $0C -000258 0000BD | PHA -000259 0000BE | JSL dup2 -000263 0000C2 | LDA $0C -000266 0000C4 | LDX #$0001 -000269 0000C7 | SEC -00026A 0000C8 | SBC #$0003 -00026D 0000CB | BEQ (login_tty+$000000D4) -00027A 0000CD | BVS (login_tty+$000000D2) -000288 0000CF | EOR #$8000 -00028C 0000D2 | BMI (login_tty+$000000D5) -00029A 0000D4 | DEX -00029C 0000D5 | TXA -00029E 0000D6 | BNE (login_tty+$000000DB) -0002AB 0000D8 | BRL (login_tty+$000000E2) -0002B9 0000DB | LDA $0C -0002BC 0000DD | PHA -0002BD 0000DE | JSL close -0002C8 0000E2 | TSC -0002CA 0000E3 | STA $07 -0002CC 0000E5 | LDA $07 -0002CE 0000E7 | PHA -0002CF 0000E8 | PEA (((login_tty+$0000010A)+$0000004B)|$FFFFFFF0) -0002E4 0000EB | PEA ((login_tty+$0000010A)+$0000004B) -0002F4 0000EE | JSL printf -000301 0000F2 | STZ $01 -000304 0000F4 | BRL (login_tty+$000000F7) -000311 0000F7 | LDA $0A -000314 0000F9 | STA $0C -000316 0000FB | LDA $09 -000318 0000FD | STA $0B -00031A 0000FF | LDY $01 -00031C 000101 | PLD -00031D 000102 | TSC -00031E 000103 | CLC -00031F 000104 | ADC #$000A -000322 000107 | TCS -000323 000108 | TYA -000324 000109 | RTL -000325 00010A | ADC ($74,S),Y -000328 00010C | ADC ($63,X) -00032A 00010E | RTL -00032B 00010F | JSR $7369 -00032E 000112 | DEC A -00032F 000113 | JSR $3025 -000332 000116 | BIT $58,X -000334 000118 | ASL A -000335 000119 | BRK $74 -000337 00011B | ADC $6E,S -000339 00011D | ADC $77 -00033B 00011F | BVS *+$69 -00033D 000121 | ADC ($70) -00033F 000123 | JSR $6166 -000342 000126 | ADC #$656C -000345 000129 | STZ $0A -000347 00012B | BRK $73 -000349 00012D | ADC $74 -00034B 00012F | STZ $70,X -00034D 000131 | ADC [$72] -00034F 000133 | BVS *+$22 -000351 000135 | ROR $61 -000353 000137 | ADC #$656C -000356 00013A | STZ $0A -000358 00013C | BRK $69 -00035A 00013E | ADC >$6C7463 -00035E 000142 | AND >$4F4954 -000362 000146 | EOR $53,S -000364 000148 | EOR $54,S -000366 00014A | MVN $59,$20 -000369 00014D | ROR $61 -00036B 00014F | ADC #$656C -00036E 000152 | STZ $0A -000370 000154 | BRK $73 -000372 000156 | STZ $61,X -000374 000158 | ADC $6B,S -000376 00015A | JSR $7369 -000379 00015D | DEC A -00037A 00015E | JSR $3025 -00037D 000161 | BIT $58,X -00037F 000163 | ASL A -000380 000164 | BRK ??? -000382 000166 | -000383 000166 | END - - - diff --git a/usr.sbin/getty/linkfile b/usr.sbin/getty/linkfile deleted file mode 100755 index eadfb8c..0000000 --- a/usr.sbin/getty/linkfile +++ /dev/null @@ -1,8 +0,0 @@ -main -init -subr -gettytab -ttydflts -../strftime/strftime -2/libgno -keep=getty diff --git a/usr.sbin/getty/main.c b/usr.sbin/getty/main.c index 07769b9..40edfca 100644 --- a/usr.sbin/getty/main.c +++ b/usr.sbin/getty/main.c @@ -1,9 +1,3 @@ -/*#define BUG(__s) {fprintf(stderr,"%s\n",__s);}*/ -#pragma optimize 31 -#pragma stacksize 1024 -#define BUG(__s) -#define rindex strrchr - /*- * Copyright (c) 1980 The Regents of the University of California. * All rights reserved. @@ -37,6 +31,7 @@ * SUCH DAMAGE. */ +#ifndef __GNO__ #ifndef lint char copyright[] = "@(#) Copyright (c) 1980 The Regents of the University of California.\n\ @@ -46,11 +41,11 @@ char copyright[] = #ifndef lint static char sccsid[] = "@(#)main.c 5.16 (Berkeley) 3/27/91"; #endif /* not lint */ +#endif #define USE_OLD_TTY #include -#include #include #include #include @@ -64,17 +59,19 @@ static char sccsid[] = "@(#)main.c 5.16 (Berkeley) 3/27/91"; #include #include #include +#include +#include +#include +#include #include "gettytab.h" -#include "pathnames.h" -#ifndef HOSTNAME -#define MAXHOSTNAMELEN 10 -gethostname(char *name, int namelen) -{ - strncpy(name,"apple",namelen); - return 0; -} -#endif +static int getname (void); +static void putpad (char *s); +static int puts (char *s); +static void putchr (int cc); +static void oflush (void); +static void prompt (void); +static void putf (char *cp); struct sgttyb tmode = { 0, 0, CERASE, CKILL, 0 @@ -94,7 +91,6 @@ char hostname[MAXHOSTNAMELEN]; char name[16]; char dev[] = _PATH_DEV; char ttyn[32]; -char *portselector(); #ifdef __ORCAC__ char *ttyname(int fino); @@ -158,9 +154,8 @@ interrupt(int sig, int code) longjmp(intrupt, 1); } -main(argc, argv) - int argc; - char **argv; +int +main(int argc, char **argv) { #ifndef __ORCAC__ extern char **environ; @@ -170,6 +165,9 @@ main(argc, argv) int repcnt = 0; int tmp; + __REPORT_STACK(); + + signal(SIGINT, SIG_IGN); /* signal(SIGQUIT, SIG_DFL); @@ -178,6 +176,7 @@ main(argc, argv) gethostname(hostname, sizeof(hostname)); if (hostname[0] == '\0') strcpy(hostname, "Amnesiac"); + /* * The following is a work around for vhangup interactions * which cause great problems getting window systems started. @@ -249,8 +248,6 @@ main(argc, argv) if (HC) ioctl(STDIN_FILENO, TIOCHPCL, 0); if (AB) { - extern char *autobaud(); - tname = autobaud(); continue; } @@ -323,7 +320,14 @@ main(argc, argv) { static char temp[256]; sprintf(temp,"login -p %s",name); - execve(LO,temp); +#ifdef __STACK_CHECK__ + /* + * Because we're doing the _execve, we won't get it from + * the atexit(3) registered function. + */ + warnx("stack usage: %d bytes", _endStackCheck()); +#endif + _execve(LO,temp); } #else execle(LO, "login", "-p", name, (char *) 0, env); @@ -339,7 +343,8 @@ main(argc, argv) } } -getname() +static int +getname(void) { register int c; register char *np; @@ -425,6 +430,7 @@ short tmspc10[] = { 0, 2000, 1333, 909, 743, 666, 500, 333, 166, 83, 55, 41, 20, 10, 5, 15 }; +static void putpad(char *s) { register pad = 0; @@ -466,17 +472,20 @@ putpad(char *s) } /* odd, another prototyping bug */ +int puts(char *s) /*register char *s;*/ { while (*s) putchr(*s++); + return 0; } char outbuf[OBUFSIZ]; int obufcnt = 0; -putchr(cc) +static void +putchr(int cc) { char c; @@ -494,14 +503,16 @@ putchr(cc) write(STDOUT_FILENO, &c, 1); } -oflush() +static void +oflush(void) { if (obufcnt) write(STDOUT_FILENO, outbuf, obufcnt); obufcnt = 0; } -prompt() +static void +prompt(void) { putf(LM); @@ -509,6 +520,7 @@ prompt() putchr('\n'); } +static void putf(char *cp) { extern char editedhost[]; @@ -536,12 +548,26 @@ putf(char *cp) break; case 'd': { +#ifdef NO_STRFTIME + (void)time(&t); + puts(ctime(&t)); +#else /* NO_STRFTIME */ +#ifdef __GNO__ + /* + * We don't use SCCS for the GNO sources, so we don't have + * to worry about a 'M' after a '%' character. As far as + * %P is concerned, it looks like it was just plain wrong. + */ + static char fmt[] = "%l:%M%p on %A, %d %B %Y"; +#else /* __GNO__ */ static char fmt[] = "%l:% %P on %A, %d %B %Y"; fmt[4] = 'M'; /* I *hate* SCCS... */ +#endif /* __GNO__ */ (void)time(&t); (void)strftime(db, sizeof(db), fmt, localtime(&t)); puts(db); +#endif /* NO_STRFTIME */ break; } diff --git a/usr.sbin/getty/pathnames.h b/usr.sbin/getty/pathnames.h deleted file mode 100644 index 07570e8..0000000 --- a/usr.sbin/getty/pathnames.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 1989 The Regents of the University of California. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)pathnames.h 5.3 (Berkeley) 6/1/90 - */ - -#include - diff --git a/usr.sbin/getty/subr.c b/usr.sbin/getty/subr.c index 8c78892..52ba78b 100644 --- a/usr.sbin/getty/subr.c +++ b/usr.sbin/getty/subr.c @@ -1,9 +1,3 @@ -/*#pragma debug 25 */ -/*#define BUG(__s) {fprintf(stderr,"%s\n",__s);} */ -#define BUG(__s) -#pragma optimize 31 -#define index strchr - /* * Copyright (c) 1983 The Regents of the University of California. * All rights reserved. @@ -46,12 +40,12 @@ static char sccsid[] = "@(#)subr.c 5.10 (Berkeley) 2/26/91"; */ #define USE_OLD_TTY #include -#include /* sleep... */ #include #include #include #include #include +#include #include "gettytab.h" extern struct sgttyb tmode; @@ -61,8 +55,8 @@ extern struct ltchars ltc; /* * Get a table entry. */ -gettable(name, buf, area) - char *name, *buf, *area; +void +gettable(char *name, char *buf, char *area) { register struct gettystrs *sp; register struct gettynums *np; @@ -95,7 +89,8 @@ gettable(name, buf, area) } } -gendefaults() +void +gendefaults(void) { register struct gettystrs *sp; register struct gettynums *np; @@ -114,7 +109,8 @@ gendefaults() fp->defalt = fp->invrt; } -setdefaults() +void +setdefaults(void) { register struct gettystrs *sp; register struct gettynums *np; @@ -146,7 +142,8 @@ charvars[] = { <c.t_werasc, <c.t_lnextc, 0 }; -setchars() +void +setchars(void) { register int i; register char *p; @@ -161,7 +158,7 @@ setchars() } long -setflags(n) +setflags(int n) { register long f; @@ -280,7 +277,8 @@ struct delayval tbdelay[] = { 0, TAB2, }; -delaybits() +int +delaybits (void) { register f; @@ -292,6 +290,7 @@ delaybits() return (f); } +int adelay(long ms, struct delayval *dp) { if (ms == 0) @@ -303,6 +302,7 @@ adelay(long ms, struct delayval *dp) char editedhost[32]; +void edithost(char *pat) { register char *host = HN; @@ -366,6 +366,7 @@ struct speedtab { 0 }; +int speed(long val) { register struct speedtab *sp; @@ -382,7 +383,9 @@ speed(long val) #ifdef __ORCAC__ -void addenv(char *vdef) +#if 0 +void +addenv(char *vdef) { char *q,*vdef2; static Set_VarPB setp; @@ -404,15 +407,36 @@ static ExportPB exp; } setp.var_name = vdef; setp.value = vdef2; - SET_VAR(setp); + SET_VAR(&setp); exp.name = vdef; exp.flags = 1; EXPORT(&exp); } } +#endif /* 0 */ void makeenv(void) { +#if 1 + char *p, *q; + + environPush(); + if (TT && *TT) { + setenv("TERM", TT, 1); + } + if ((p = EV) != NULL) { + q = p; + while (q = strchr(q, ',')) { + *q++ = '\0'; + putenv(p); + p = q; + } + if (*p) { + putenv(p); + } + } + +#else /* 1 */ #ifdef __ORCAC__ static char termbuf[128] = "TERM"; #else @@ -435,6 +459,7 @@ char *p, *q; if (*p) addenv(p); } +#endif /* 0 */ } #else @@ -491,7 +516,7 @@ struct portselect { }; char * -portselector() +portselector(void) { char c, baud[20], *type = "default"; register struct portselect *ps; @@ -528,7 +553,7 @@ portselector() #endif char * -autobaud() +autobaud(void) { char c, *type = "9600-baud"; #ifdef SYS_TIME diff --git a/usr.sbin/getty/ttydeflts.c b/usr.sbin/getty/ttydeflts.c index a44abd4..4214cde 100644 --- a/usr.sbin/getty/ttydeflts.c +++ b/usr.sbin/getty/ttydeflts.c @@ -41,8 +41,10 @@ static char sccsid[] = "@(#)ttydefaults.c 5.1 (Berkeley) 1/19/91"; #include #endif -set_ttydefaults(fd) - int fd; +#include "gettytab.h" + +void +set_ttydefaults(int fd) { #ifdef TERMIOS struct termios term;