Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Feb 2018 19:05:14 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r328858 - head/libexec/getty
Message-ID:  <201802041905.w14J5Eoe092670@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Sun Feb  4 19:05:13 2018
New Revision: 328858
URL: https://svnweb.freebsd.org/changeset/base/328858

Log:
  Sprinkle static; avoid nested externs.
  
  MFC after:	2 weeks
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/libexec/getty/extern.h
  head/libexec/getty/main.c
  head/libexec/getty/subr.c

Modified: head/libexec/getty/extern.h
==============================================================================
--- head/libexec/getty/extern.h	Sun Feb  4 18:40:36 2018	(r328857)
+++ head/libexec/getty/extern.h	Sun Feb  4 19:05:13 2018	(r328858)
@@ -35,6 +35,8 @@
 struct delayval;
 struct termios;
 
+extern	char **environ;
+extern	char editedhost[];
 extern	char hostname[];
 extern	struct termios tmode, omode;
 extern	struct gettyflags gettyflags[];

Modified: head/libexec/getty/main.c
==============================================================================
--- head/libexec/getty/main.c	Sun Feb  4 18:40:36 2018	(r328857)
+++ head/libexec/getty/main.c	Sun Feb  4 19:05:13 2018	(r328858)
@@ -93,23 +93,23 @@ struct termios omode;
 /* current mode */
 struct termios tmode;
 
-int crmod, digit, lower, upper;
+static int crmod, digit, lower, upper;
 
 char	hostname[MAXHOSTNAMELEN];
-char	name[MAXLOGNAME*3];
-char	dev[] = _PATH_DEV;
-char	ttyn[32];
+static char	name[MAXLOGNAME*3];
+static char	dev[] = _PATH_DEV;
+static char	ttyn[32];
 
 #define	OBUFSIZ		128
 #define	TABBUFSIZ	512
 
-char	defent[TABBUFSIZ];
-char	tabent[TABBUFSIZ];
-const	char *tname;
+static char	defent[TABBUFSIZ];
+static char	tabent[TABBUFSIZ];
+static const char	*tname;
 
-char	*env[128];
+static char	*env[128];
 
-char partab[] = {
+static char partab[] = {
 	0001,0201,0201,0001,0201,0001,0001,0201,
 	0202,0004,0003,0205,0005,0206,0201,0001,
 	0201,0001,0001,0201,0001,0201,0201,0001,
@@ -150,7 +150,7 @@ static char	*get_line(int);
 static void	setttymode(int);
 static int	opentty(const char *, int);
 
-jmp_buf timeout;
+static jmp_buf timeout;
 
 static void
 dingdong(int signo __unused)
@@ -159,7 +159,7 @@ dingdong(int signo __unused)
 	longjmp(timeout, 1);
 }
 
-jmp_buf	intrupt;
+static jmp_buf	intrupt;
 
 static void
 interrupt(int signo __unused)
@@ -181,7 +181,6 @@ timeoverrun(int signo __unused)
 int
 main(int argc, char *argv[])
 {
-	extern	char **environ;
 	int first_sleep = 1, first_time = 1;
 	struct rlimit limit;
 	int rval;
@@ -666,8 +665,8 @@ puts(const char *s)
 		putchr(*s++);
 }
 
-char	outbuf[OBUFSIZ];
-int	obufcnt = 0;
+static char	outbuf[OBUFSIZ];
+static int	obufcnt = 0;
 
 static void
 putchr(int cc)
@@ -733,7 +732,6 @@ get_line(int fd)
 static void
 putf(const char *cp)
 {
-	extern char editedhost[];
 	time_t t;
 	char *slash, db[100];
 

Modified: head/libexec/getty/subr.c
==============================================================================
--- head/libexec/getty/subr.c	Sun Feb  4 18:40:36 2018	(r328857)
+++ head/libexec/getty/subr.c	Sun Feb  4 19:05:13 2018	(r328858)
@@ -588,7 +588,7 @@ makeenv(char *env[])
  * baud rate. This string indicates the user's actual speed.
  * The routine below returns the terminal type mapped from derived speed.
  */
-struct	portselect {
+static struct	portselect {
 	const char	*ps_baud;
 	const char	*ps_type;
 } portspeeds[] = {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802041905.w14J5Eoe092670>