From 34129485bb94d210a744623f7542a9ec9153b3ae Mon Sep 17 00:00:00 2001 From: Keith Bostic Date: Mon, 17 May 1993 17:36:57 -0800 Subject: [PATCH] ANSI C prototypes SCCS-vsn: libexec/getty/gettytab.h 5.6 SCCS-vsn: libexec/getty/main.c 5.19 SCCS-vsn: libexec/getty/subr.c 5.11 SCCS-vsn: libexec/getty/ttydefaults.c 5.2 --- usr/src/libexec/getty/gettytab.h | 10 +-- usr/src/libexec/getty/main.c | 42 +++++++++--- usr/src/libexec/getty/subr.c | 102 ++++++++++++++++------------ usr/src/libexec/getty/ttydefaults.c | 5 +- 4 files changed, 97 insertions(+), 62 deletions(-) diff --git a/usr/src/libexec/getty/gettytab.h b/usr/src/libexec/getty/gettytab.h index dfb25e36d6..e026fdc31e 100644 --- a/usr/src/libexec/getty/gettytab.h +++ b/usr/src/libexec/getty/gettytab.h @@ -4,7 +4,7 @@ * * %sccs.include.redist.c% * - * @(#)gettytab.h 5.5 (Berkeley) %G% + * @(#)gettytab.h 5.6 (Berkeley) %G% */ /* @@ -108,10 +108,10 @@ struct gettyflags { #define DX gettyflags[20].value #define NP gettyflags[21].value -int getent(); -long getnum(); -int getflag(); -char *getstr(); +int getent __P((char *, char *)); +long getnum __P((char *)); +int getflag __P((char *)); +char *getstr __P((char *, char **)); extern struct gettyflags gettyflags[]; extern struct gettynums gettynums[]; diff --git a/usr/src/libexec/getty/main.c b/usr/src/libexec/getty/main.c index cef0fa4a96..d29522e6df 100644 --- a/usr/src/libexec/getty/main.c +++ b/usr/src/libexec/getty/main.c @@ -12,26 +12,29 @@ char copyright[] = #endif /* not lint */ #ifndef lint -static char sccsid[] = "@(#)main.c 5.18 (Berkeley) %G%"; +static char sccsid[] = "@(#)main.c 5.19 (Berkeley) %G%"; #endif /* not lint */ #define USE_OLD_TTY #include #include -#include -#include -#include -#include + #include -#include -#include -#include #include +#include +#include +#include +#include #include #include +#include +#include +#include + #include "gettytab.h" #include "pathnames.h" +#include "extern.h" struct sgttyb tmode = { 0, 0, CERASE, CKILL, 0 @@ -108,11 +111,20 @@ interrupt() longjmp(intrupt, 1); } +static int getname __P((void)); +static void oflush __P((void)); +static void prompt __P((void)); +static void putchr __P((int)); +static void putf __P((char *)); +static void putpad __P((char *)); +static void puts __P((char *)); + +int main(argc, argv) int argc; - char **argv; + char *argv[]; { - extern char **environ; + extern char **environ; char *tname; long allflags; int repcnt = 0; @@ -259,6 +271,7 @@ main(argc, argv) } } +static int getname() { register int c; @@ -344,6 +357,7 @@ short tmspc10[] = { 0, 2000, 1333, 909, 743, 666, 500, 333, 166, 83, 55, 41, 20, 10, 5, 15 }; +static void putpad(s) register char *s; { @@ -385,6 +399,7 @@ putpad(s) putchr(*PC); } +static void puts(s) register char *s; { @@ -395,7 +410,9 @@ puts(s) char outbuf[OBUFSIZ]; int obufcnt = 0; +static void putchr(cc) + int cc; { char c; @@ -413,6 +430,7 @@ putchr(cc) write(STDOUT_FILENO, &c, 1); } +static void oflush() { if (obufcnt) @@ -420,6 +438,7 @@ oflush() obufcnt = 0; } +static void prompt() { @@ -428,6 +447,7 @@ prompt() putchr('\n'); } +static void putf(cp) register char *cp; { @@ -443,7 +463,7 @@ putf(cp) switch (*++cp) { case 't': - slash = rindex(ttyn, '/'); + slash = strrchr(ttyn, '/'); if (slash == (char *) 0) puts(ttyn); else diff --git a/usr/src/libexec/getty/subr.c b/usr/src/libexec/getty/subr.c index 75ce0a49aa..6c062fe093 100644 --- a/usr/src/libexec/getty/subr.c +++ b/usr/src/libexec/getty/subr.c @@ -6,7 +6,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)subr.c 5.10 (Berkeley) %G%"; +static char sccsid[] = "@(#)subr.c 5.11 (Berkeley) %G%"; #endif /* not lint */ /* @@ -14,9 +14,11 @@ static char sccsid[] = "@(#)subr.c 5.10 (Berkeley) %G%"; */ #define USE_OLD_TTY #include -#include #include +#include + #include "gettytab.h" +#include "extern.h" extern struct sgttyb tmode; extern struct tchars tc; @@ -25,6 +27,7 @@ extern struct ltchars ltc; /* * Get a table entry. */ +void gettable(name, buf, area) char *name, *buf, *area; { @@ -59,6 +62,7 @@ gettable(name, buf, area) } } +void gendefaults() { register struct gettystrs *sp; @@ -78,6 +82,7 @@ gendefaults() fp->defalt = fp->invrt; } +void setdefaults() { register struct gettystrs *sp; @@ -110,6 +115,7 @@ charvars[] = { <c.t_werasc, <c.t_lnextc, 0 }; +void setchars() { register int i; @@ -126,6 +132,7 @@ setchars() long setflags(n) + int n; { register long f; @@ -209,44 +216,45 @@ struct delayval { */ struct delayval crdelay[] = { - 1, CR1, - 2, CR2, - 3, CR3, - 83, CR1, - 166, CR2, - 0, CR3, + { 1, CR1 }, + { 2, CR2 }, + { 3, CR3 }, + { 83, CR1 }, + { 166, CR2 }, + { 0, CR3 }, }; struct delayval nldelay[] = { - 1, NL1, /* special, calculated */ - 2, NL2, - 3, NL3, - 100, NL2, - 0, NL3, + { 1, NL1 }, /* special, calculated */ + { 2, NL2 }, + { 3, NL3 }, + { 100, NL2 }, + { 0, NL3 }, }; struct delayval bsdelay[] = { - 1, BS1, - 0, 0, + { 1, BS1 }, + { 0, 0 }, }; struct delayval ffdelay[] = { - 1, FF1, - 1750, FF1, - 0, FF1, + { 1, FF1 }, + { 1750, FF1 }, + { 0, FF1 }, }; struct delayval tbdelay[] = { - 1, TAB1, - 2, TAB2, - 3, XTABS, /* this is expand tabs */ - 100, TAB1, - 0, TAB2, + { 1, TAB1 }, + { 2, TAB2 }, + { 3, XTABS }, /* this is expand tabs */ + { 100, TAB1 }, + { 0, TAB2 }, }; +int delaybits() { - register f; + register int f; f = adelay(CD, crdelay); f |= adelay(ND, nldelay); @@ -256,6 +264,7 @@ delaybits() return (f); } +int adelay(ms, dp) register ms; register struct delayval *dp; @@ -269,6 +278,7 @@ adelay(ms, dp) char editedhost[32]; +void edithost(pat) register char *pat; { @@ -312,28 +322,30 @@ struct speedtab { int speed; int uxname; } speedtab[] = { - 50, B50, - 75, B75, - 110, B110, - 134, B134, - 150, B150, - 200, B200, - 300, B300, - 600, B600, - 1200, B1200, - 1800, B1800, - 2400, B2400, - 4800, B4800, - 9600, B9600, - 19200, EXTA, - 19, EXTA, /* for people who say 19.2K */ - 38400, EXTB, - 38, EXTB, - 7200, EXTB, /* alternative */ - 0 + { 50, B50 }, + { 75, B75 }, + { 110, B110 }, + { 134, B134 }, + { 150, B150 }, + { 200, B200 }, + { 300, B300 }, + { 600, B600 }, + { 1200, B1200 }, + { 1800, B1800 }, + { 2400, B2400 }, + { 4800, B4800 }, + { 9600, B9600 }, + { 19200, EXTA }, + { 19, EXTA }, /* for people who say 19.2K */ + { 38400, EXTB }, + { 38, EXTB }, + { 7200, EXTB }, /* alternative */ + { 0 } }; +int speed(val) + int val; { register struct speedtab *sp; @@ -347,13 +359,13 @@ speed(val) return (B300); /* default in impossible cases */ } +void makeenv(env) char *env[]; { static char termbuf[128] = "TERM="; register char *p, *q; register char **ep; - char *index(); ep = env; if (TT && *TT) { @@ -362,7 +374,7 @@ makeenv(env) } if (p = EV) { q = p; - while (q = index(q, ',')) { + while (q = strchr(q, ',')) { *q++ = '\0'; *ep++ = p; p = q; diff --git a/usr/src/libexec/getty/ttydefaults.c b/usr/src/libexec/getty/ttydefaults.c index b40afa94eb..d00ea92bdd 100644 --- a/usr/src/libexec/getty/ttydefaults.c +++ b/usr/src/libexec/getty/ttydefaults.c @@ -6,11 +6,14 @@ */ #ifndef lint -static char sccsid[] = "@(#)ttydefaults.c 5.1 (Berkeley) %G%"; +static char sccsid[] = "@(#)ttydefaults.c 5.2 (Berkeley) %G%"; #endif /* not lint */ #include +#include "extern.h" + +void set_ttydefaults(fd) int fd; { -- 2.20.1