ANSI C prototypes
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Tue, 18 May 1993 01:36:57 +0000 (17:36 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Tue, 18 May 1993 01:36:57 +0000 (17:36 -0800)
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
usr/src/libexec/getty/main.c
usr/src/libexec/getty/subr.c
usr/src/libexec/getty/ttydefaults.c

index dfb25e3..e026fdc 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %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
 
 #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[];
 
 extern struct gettyflags gettyflags[];
 extern struct gettynums gettynums[];
index cef0fa4..d29522e 100644 (file)
@@ -12,26 +12,29 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #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 <sys/param.h>
 #include <sys/stat.h>
 #endif /* not lint */
 
 #define USE_OLD_TTY
 
 #include <sys/param.h>
 #include <sys/stat.h>
-#include <signal.h>
-#include <fcntl.h>
-#include <sgtty.h>
-#include <time.h>
+
 #include <ctype.h>
 #include <ctype.h>
-#include <setjmp.h>
-#include <syslog.h>
-#include <unistd.h>
 #include <ctype.h>
 #include <ctype.h>
+#include <fcntl.h>
+#include <setjmp.h>
+#include <sgtty.h>
+#include <signal.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdlib.h>
 #include <string.h>
+#include <syslog.h>
+#include <time.h>
+#include <unistd.h>
+
 #include "gettytab.h"
 #include "pathnames.h"
 #include "gettytab.h"
 #include "pathnames.h"
+#include "extern.h"
 
 struct sgttyb tmode = {
        0, 0, CERASE, CKILL, 0
 
 struct sgttyb tmode = {
        0, 0, CERASE, CKILL, 0
@@ -108,11 +111,20 @@ interrupt()
        longjmp(intrupt, 1);
 }
 
        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;
 main(argc, argv)
        int argc;
-       char **argv;
+       char *argv[];
 {
 {
-       extern  char **environ;
+       extern char **environ;
        char *tname;
        long allflags;
        int repcnt = 0;
        char *tname;
        long allflags;
        int repcnt = 0;
@@ -259,6 +271,7 @@ main(argc, argv)
        }
 }
 
        }
 }
 
+static int
 getname()
 {
        register int c;
 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
 };
 
        0, 2000, 1333, 909, 743, 666, 500, 333, 166, 83, 55, 41, 20, 10, 5, 15
 };
 
+static void
 putpad(s)
        register char *s;
 {
 putpad(s)
        register char *s;
 {
@@ -385,6 +399,7 @@ putpad(s)
                putchr(*PC);
 }
 
                putchr(*PC);
 }
 
+static void
 puts(s)
        register char *s;
 {
 puts(s)
        register char *s;
 {
@@ -395,7 +410,9 @@ puts(s)
 char   outbuf[OBUFSIZ];
 int    obufcnt = 0;
 
 char   outbuf[OBUFSIZ];
 int    obufcnt = 0;
 
+static void
 putchr(cc)
 putchr(cc)
+       int cc;
 {
        char c;
 
 {
        char c;
 
@@ -413,6 +430,7 @@ putchr(cc)
                write(STDOUT_FILENO, &c, 1);
 }
 
                write(STDOUT_FILENO, &c, 1);
 }
 
+static void
 oflush()
 {
        if (obufcnt)
 oflush()
 {
        if (obufcnt)
@@ -420,6 +438,7 @@ oflush()
        obufcnt = 0;
 }
 
        obufcnt = 0;
 }
 
+static void
 prompt()
 {
 
 prompt()
 {
 
@@ -428,6 +447,7 @@ prompt()
                putchr('\n');
 }
 
                putchr('\n');
 }
 
+static void
 putf(cp)
        register char *cp;
 {
 putf(cp)
        register char *cp;
 {
@@ -443,7 +463,7 @@ putf(cp)
                switch (*++cp) {
 
                case 't':
                switch (*++cp) {
 
                case 't':
-                       slash = rindex(ttyn, '/');
+                       slash = strrchr(ttyn, '/');
                        if (slash == (char *) 0)
                                puts(ttyn);
                        else
                        if (slash == (char *) 0)
                                puts(ttyn);
                        else
index 75ce0a4..6c062fe 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)subr.c     5.10 (Berkeley) %G%";
+static char sccsid[] = "@(#)subr.c     5.11 (Berkeley) %G%";
 #endif /* not lint */
 
 /*
 #endif /* not lint */
 
 /*
@@ -14,9 +14,11 @@ static char sccsid[] = "@(#)subr.c   5.10 (Berkeley) %G%";
  */
 #define USE_OLD_TTY
 #include <sgtty.h>
  */
 #define USE_OLD_TTY
 #include <sgtty.h>
-#include <unistd.h>
 #include <string.h>
 #include <string.h>
+#include <unistd.h>
+
 #include "gettytab.h"
 #include "gettytab.h"
+#include "extern.h"
 
 extern struct sgttyb tmode;
 extern struct tchars tc;
 
 extern struct sgttyb tmode;
 extern struct tchars tc;
@@ -25,6 +27,7 @@ extern        struct ltchars ltc;
 /*
  * Get a table entry.
  */
 /*
  * Get a table entry.
  */
+void
 gettable(name, buf, area)
        char *name, *buf, *area;
 {
 gettable(name, buf, area)
        char *name, *buf, *area;
 {
@@ -59,6 +62,7 @@ gettable(name, buf, area)
        }
 }
 
        }
 }
 
+void
 gendefaults()
 {
        register struct gettystrs *sp;
 gendefaults()
 {
        register struct gettystrs *sp;
@@ -78,6 +82,7 @@ gendefaults()
                        fp->defalt = fp->invrt;
 }
 
                        fp->defalt = fp->invrt;
 }
 
+void
 setdefaults()
 {
        register struct gettystrs *sp;
 setdefaults()
 {
        register struct gettystrs *sp;
@@ -110,6 +115,7 @@ charvars[] = {
        &ltc.t_werasc, &ltc.t_lnextc, 0
 };
 
        &ltc.t_werasc, &ltc.t_lnextc, 0
 };
 
+void
 setchars()
 {
        register int i;
 setchars()
 {
        register int i;
@@ -126,6 +132,7 @@ setchars()
 
 long
 setflags(n)
 
 long
 setflags(n)
+       int n;
 {
        register long f;
 
 {
        register long f;
 
@@ -209,44 +216,45 @@ struct delayval {
  */
 
 struct delayval        crdelay[] = {
  */
 
 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[] = {
 };
 
 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[] = {
 };
 
 struct delayval        bsdelay[] = {
-       1,              BS1,
-       0,              0,
+       { 1,            BS1 },
+       { 0,            0 },
 };
 
 struct delayval        ffdelay[] = {
 };
 
 struct delayval        ffdelay[] = {
-       1,              FF1,
-       1750,           FF1,
-       0,              FF1,
+       { 1,            FF1 },
+       { 1750,         FF1 },
+       { 0,            FF1 },
 };
 
 struct delayval        tbdelay[] = {
 };
 
 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()
 {
 delaybits()
 {
-       register f;
+       register int f;
 
        f  = adelay(CD, crdelay);
        f |= adelay(ND, nldelay);
 
        f  = adelay(CD, crdelay);
        f |= adelay(ND, nldelay);
@@ -256,6 +264,7 @@ delaybits()
        return (f);
 }
 
        return (f);
 }
 
+int
 adelay(ms, dp)
        register ms;
        register struct delayval *dp;
 adelay(ms, dp)
        register ms;
        register struct delayval *dp;
@@ -269,6 +278,7 @@ adelay(ms, dp)
 
 char   editedhost[32];
 
 
 char   editedhost[32];
 
+void
 edithost(pat)
        register char *pat;
 {
 edithost(pat)
        register char *pat;
 {
@@ -312,28 +322,30 @@ struct speedtab {
        int     speed;
        int     uxname;
 } 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)
 speed(val)
+       int val;
 {
        register struct speedtab *sp;
 
 {
        register struct speedtab *sp;
 
@@ -347,13 +359,13 @@ speed(val)
        return (B300);          /* default in impossible cases */
 }
 
        return (B300);          /* default in impossible cases */
 }
 
+void
 makeenv(env)
        char *env[];
 {
        static char termbuf[128] = "TERM=";
        register char *p, *q;
        register char **ep;
 makeenv(env)
        char *env[];
 {
        static char termbuf[128] = "TERM=";
        register char *p, *q;
        register char **ep;
-       char *index();
 
        ep = env;
        if (TT && *TT) {
 
        ep = env;
        if (TT && *TT) {
@@ -362,7 +374,7 @@ makeenv(env)
        }
        if (p = EV) {
                q = p;
        }
        if (p = EV) {
                q = p;
-               while (q = index(q, ',')) {
+               while (q = strchr(q, ',')) {
                        *q++ = '\0';
                        *ep++ = p;
                        p = q;
                        *q++ = '\0';
                        *ep++ = p;
                        p = q;
index b40afa9..d00ea92 100644 (file)
@@ -6,11 +6,14 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)ttydefaults.c      5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)ttydefaults.c      5.2 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/termios.h>
 
 #endif /* not lint */
 
 #include <sys/termios.h>
 
+#include "extern.h"
+
+void
 set_ttydefaults(fd)
        int fd;
 {
 set_ttydefaults(fd)
        int fd;
 {