ANSI C prototypes
[unix-history] / usr / src / libexec / getty / main.c
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