From 618b0bba1feda5797cf464d890a4f3ae703ff6e1 Mon Sep 17 00:00:00 2001
From: Mark Murray <markm@FreeBSD.org>
Date: Sat, 28 Apr 2001 07:55:19 +0000
Subject: [PATCH] Change names of functions and variables with global scope
 that are in conflict with library values of the same name. This allows static
 linking.

---
 libexec/ftpd/extern.h |  2 +-
 libexec/ftpd/ftpcmd.y | 16 ++++++++--------
 libexec/ftpd/ftpd.c   | 20 ++++++++++----------
 3 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/libexec/ftpd/extern.h b/libexec/ftpd/extern.h
index 684703eee2f8..a490826eed4a 100644
--- a/libexec/ftpd/extern.h
+++ b/libexec/ftpd/extern.h
@@ -39,7 +39,7 @@ char  **copyblk __P((char **));
 void	cwd __P((char *));
 void	delete __P((char *));
 void	dologout __P((int));
-void	fatal __P((char *));
+void	fatalerror __P((char *));
 void    ftpd_logwtmp __P((char *, char *, char *));
 int	ftpd_pclose __P((FILE *));
 FILE   *ftpd_popen __P((char *, char *));
diff --git a/libexec/ftpd/ftpcmd.y b/libexec/ftpd/ftpcmd.y
index 9a4d125c9a46..1ae6e417cabf 100644
--- a/libexec/ftpd/ftpcmd.y
+++ b/libexec/ftpd/ftpcmd.y
@@ -81,7 +81,7 @@ extern 	int paranoid;
 extern	int logging;
 extern	int type;
 extern	int form;
-extern	int debug;
+extern	int ftpdebug;
 extern	int timeout;
 extern	int maxtimeout;
 extern  int pdata;
@@ -232,10 +232,10 @@ cmd
 
 			memset(&data_dest, 0, sizeof(data_dest));
 			tmp = strdup($4);
-			if (debug)
+			if (ftpdebug)
 				syslog(LOG_DEBUG, "%s", tmp);
 			if (!tmp) {
-				fatal("not enough core");
+				fatalerror("not enough core");
 				/*NOTREACHED*/
 			}
 			p = tmp;
@@ -255,7 +255,7 @@ cmd
 				}
 				*q++ = '\0';
 				result[i] = p;
-				if (debug)
+				if (ftpdebug)
 					syslog(LOG_DEBUG, "%d: %s", i, p);
 				p = q;
 			}
@@ -1159,7 +1159,7 @@ getline(s, n, iop)
 		*cs++ = tmpline[c];
 		if (tmpline[c] == '\n') {
 			*cs++ = '\0';
-			if (debug)
+			if (ftpdebug)
 				syslog(LOG_DEBUG, "command: %s", s);
 			tmpline[0] = '\0';
 			return(s);
@@ -1199,7 +1199,7 @@ getline(s, n, iop)
 	if (c == EOF && cs == s)
 		return (NULL);
 	*cs++ = '\0';
-	if (debug) {
+	if (ftpdebug) {
 		if (!guest && strncasecmp("pass ", s, 5) == 0) {
 			/* Don't syslog passwords */
 			syslog(LOG_DEBUG, "command: %.5s ???", s);
@@ -1448,7 +1448,7 @@ yylex()
 			break;
 
 		default:
-			fatal("Unknown state in scanner.");
+			fatalerror("Unknown state in scanner.");
 		}
 		yyerror((char *) 0);
 		state = CMD;
@@ -1475,7 +1475,7 @@ copy(s)
 
 	p = malloc((unsigned) strlen(s) + 1);
 	if (p == NULL)
-		fatal("Ran out of memory.");
+		fatalerror("Ran out of memory.");
 	(void) strcpy(p, s);
 	return (p);
 }
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index c7a74ee8e522..cfa1a43b4c50 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -131,7 +131,7 @@ int	data;
 jmp_buf	errcatch, urgcatch;
 int	logged_in;
 struct	passwd *pw;
-int	debug;
+int	ftpdebug;
 int	timeout = 900;    /* timeout after 15 minutes of inactivity */
 int	maxtimeout = 7200;/* don't allow idle time to be set beyond 2 hours */
 int	logging;
@@ -307,7 +307,7 @@ main(argc, argv, envp)
 			break;
 
 		case 'd':
-			debug++;
+			ftpdebug++;
 			break;
 
 		case 'E':
@@ -370,7 +370,7 @@ main(argc, argv, envp)
 			break;
 
 		case 'v':
-			debug = 1;
+			ftpdebug = 1;
 			break;
 
 		case '4':
@@ -597,7 +597,7 @@ main(argc, argv, envp)
 	}
 #ifndef VIRTUAL_HOSTING
 	if ((hostname = malloc(MAXHOSTNAMELEN)) == NULL)
-		fatal("Ran out of memory.");
+		fatalerror("Ran out of memory.");
 	(void) gethostname(hostname, MAXHOSTNAMELEN - 1);
 	hostname[MAXHOSTNAMELEN - 1] = '\0';
 #endif
@@ -613,7 +613,7 @@ lostconn(signo)
 	int signo;
 {
 
-	if (debug)
+	if (ftpdebug)
 		syslog(LOG_DEBUG, "lost connection");
 	dologout(1);
 }
@@ -639,7 +639,7 @@ inithosts()
 		line[0] = '\0';
 	if ((hrp = malloc(sizeof(struct ftphost))) == NULL ||
 	    (hrp->hostname = strdup(line)) == NULL)
-		fatal("Ran out of memory.");
+		fatalerror("Ran out of memory.");
 	hrp->hostinfo = NULL;
 
 	memset(&hints, 0, sizeof(hints));
@@ -1391,7 +1391,7 @@ skip:
 			free(ident);
 		ident = strdup(passwd);
 		if (ident == NULL)
-			fatal("Ran out of memory.");
+			fatalerror("Ran out of memory.");
 
 		reply(230, "Guest login ok, access restrictions apply.");
 #ifdef SETPROCTITLE
@@ -2095,7 +2095,7 @@ epsvonly:;
 }
 
 void
-fatal(s)
+fatalerror(s)
 	char *s;
 {
 
@@ -2125,7 +2125,7 @@ reply(n, fmt, va_alist)
 	(void)vprintf(fmt, ap);
 	(void)printf("\r\n");
 	(void)fflush(stdout);
-	if (debug) {
+	if (ftpdebug) {
 		syslog(LOG_DEBUG, "<--- %d ", n);
 		vsyslog(LOG_DEBUG, fmt, ap);
 	}
@@ -2151,7 +2151,7 @@ lreply(n, fmt, va_alist)
 	(void)vprintf(fmt, ap);
 	(void)printf("\r\n");
 	(void)fflush(stdout);
-	if (debug) {
+	if (ftpdebug) {
 		syslog(LOG_DEBUG, "<--- %d- ", n);
 		vsyslog(LOG_DEBUG, fmt, ap);
 	}