[Midnightbsd-cvs] src [11326] cleanup

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Wed Jul 4 20:53:42 EDT 2018


Revision: 11326
          http://svnweb.midnightbsd.org/src/?rev=11326
Author:   laffer1
Date:     2018-07-04 20:53:41 -0400 (Wed, 04 Jul 2018)
Log Message:
-----------
cleanup

Modified Paths:
--------------
    trunk/usr.bin/tftp/extern.h
    trunk/usr.bin/tftp/main.c
    trunk/usr.bin/tftp/tftp.1

Property Changed:
----------------
    trunk/usr.bin/tftp/tftp.1

Modified: trunk/usr.bin/tftp/extern.h
===================================================================
--- trunk/usr.bin/tftp/extern.h	2018-07-04 21:04:11 UTC (rev 11325)
+++ trunk/usr.bin/tftp/extern.h	2018-07-05 00:53:41 UTC (rev 11326)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 1993
  *	The Regents of the University of California.  All rights reserved.

Modified: trunk/usr.bin/tftp/main.c
===================================================================
--- trunk/usr.bin/tftp/main.c	2018-07-04 21:04:11 UTC (rev 11325)
+++ trunk/usr.bin/tftp/main.c	2018-07-05 00:53:41 UTC (rev 11326)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 1983, 1993
  *	The Regents of the University of California.  All rights reserved.
@@ -40,7 +41,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/usr.bin/tftp/main.c 287795 2015-09-14 18:57:50Z delphij $");
 
 /* Many bug fixes are from Jim Guyton <guyton at rand-unix> */
 
@@ -80,7 +81,7 @@
 typedef struct	sockaddr_storage peeraddr;
 static int	connected;
 static char	mode[32];
-jmp_buf		toplevel;
+static jmp_buf	toplevel;
 volatile int	txrx_error;
 static int	peer;
 
@@ -89,7 +90,7 @@
 static char	*margv[MAX_MARGV];
 
 int		verbose;
-char		*port = NULL;
+static char	*port = NULL;
 
 static void	get(int, char **);
 static void	help(int, char **);
@@ -223,7 +224,7 @@
 	char	line[MAXLINE];
 	int	i;
 
-	strncpy(uri, URI, ARG_MAX);
+	strlcpy(uri, URI, ARG_MAX);
 	host = uri + 7;
 
 	if ((s = strchr(host, '/')) == NULL) {
@@ -320,11 +321,10 @@
 		/* res->ai_addr <= sizeof(peeraddr) is guaranteed */
 		memcpy(&peer_sock, res->ai_addr, res->ai_addrlen);
 		if (res->ai_canonname) {
-			(void) strncpy(hostname, res->ai_canonname,
+			(void) strlcpy(hostname, res->ai_canonname,
 				sizeof(hostname));
 		} else
-			(void) strncpy(hostname, host, sizeof(hostname));
-		hostname[sizeof(hostname)-1] = 0;
+			(void) strlcpy(hostname, host, sizeof(hostname));
 		connected = 1;
 	}
 
@@ -437,16 +437,16 @@
 		return;
 	}
 	targ = argv[argc - 1];
-	if (rindex(argv[argc - 1], ':')) {
+	if (strrchr(argv[argc - 1], ':')) {
 		char *lcp;
 
 		for (n = 1; n < argc - 1; n++)
-			if (index(argv[n], ':')) {
+			if (strchr(argv[n], ':')) {
 				putusage(argv[0]);
 				return;
 			}
 		lcp = argv[argc - 1];
-		targ = rindex(lcp, ':');
+		targ = strrchr(lcp, ':');
 		*targ++ = 0;
 		if (lcp[0] == '[' && lcp[strlen(lcp) - 1] == ']') {
 			lcp[strlen(lcp) - 1] = '\0';
@@ -477,7 +477,7 @@
 	}
 				/* this assumes the target is a directory */
 				/* on a remote unix system.  hmmmm.  */
-	cp = index(targ, '\0');
+	cp = strchr(targ, '\0');
 	*cp++ = '/';
 	for (n = 1; n < argc - 1; n++) {
 		strcpy(cp, tail(argv[n]));
@@ -532,7 +532,7 @@
 	}
 	if (!connected) {
 		for (n = 1; n < argc ; n++)
-			if (rindex(argv[n], ':') == 0) {
+			if (strrchr(argv[n], ':') == 0) {
 				printf("No remote host specified and "
 				    "no host given for file '%s'\n", argv[n]);
 				getusage(argv[0]);
@@ -540,7 +540,7 @@
 			}
 	}
 	for (n = 1; n < argc ; n++) {
-		src = rindex(argv[n], ':');
+		src = strrchr(argv[n], ':');
 		if (src == NULL)
 			src = argv[n];
 		else {
@@ -681,7 +681,7 @@
 	char *s;
 
 	while (*filename) {
-		s = rindex(filename, '/');
+		s = strrchr(filename, '/');
 		if (s == NULL)
 			break;
 		if (s[1])
@@ -734,7 +734,7 @@
                         history(hist, &he, H_ENTER, bp);
 		} else {
 			line[0] = 0;
-			if (fgets(line, sizeof line , stdin) == 0) {
+			if (fgets(line, sizeof line , stdin) == NULL) {
 				if (feof(stdin)) {
 					exit(txrx_error);
 				} else {

Modified: trunk/usr.bin/tftp/tftp.1
===================================================================
--- trunk/usr.bin/tftp/tftp.1	2018-07-04 21:04:11 UTC (rev 11325)
+++ trunk/usr.bin/tftp/tftp.1	2018-07-05 00:53:41 UTC (rev 11326)
@@ -1,3 +1,4 @@
+.\" $MidnightBSD$
 .\" Copyright (c) 1990, 1993, 1994
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -26,7 +27,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)tftp.1	8.2 (Berkeley) 4/18/94
-.\" $MidnightBSD$
+.\" $FreeBSD: stable/10/usr.bin/tftp/tftp.1 235211 2012-05-10 02:07:00Z gjb $
 .\"
 .Dd June 22, 2011
 .Dt TFTP 1
@@ -112,9 +113,9 @@
 Enable or disable debugging levels during verbose output.  The value of
 .Ar level
 can be one of
-.Cm packet, simple, options,
+.Cm packet , simple , options ,
 or
-.Cm access.
+.Cm access .
 .Pp
 .It Cm get Oo Ar host : Oc Ns Ar file Op Ar localname
 .It Cm get Xo


Property changes on: trunk/usr.bin/tftp/tftp.1
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+MidnightBSD=%H
\ No newline at end of property


More information about the Midnightbsd-cvs mailing list