git: 64e8b27096fe - main - ipfilter: Adjust example returns to conform to style(9)

From: Cy Schubert <cy_at_FreeBSD.org>
Date: Tue, 04 Jan 2022 02:07:40 UTC
The branch main has been updated by cy:

URL: https://cgit.FreeBSD.org/src/commit/?id=64e8b27096fecf94d7f9255eae097e44abf4f8ce

commit 64e8b27096fecf94d7f9255eae097e44abf4f8ce
Author:     Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2021-12-22 02:38:17 +0000
Commit:     Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-01-04 02:06:43 +0000

    ipfilter: Adjust example returns to conform to style(9)
    
    Adjust ipfilter's example return statements to conform to style(9).
    
    MFC after:      1 month
---
 share/examples/ipfilter/l4check/l4check.c | 26 +++++++++++++-------------
 share/examples/ipfilter/mlfk_rule.c       |  2 +-
 share/examples/ipfilter/samples/relay.c   | 14 +++++++-------
 3 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/share/examples/ipfilter/l4check/l4check.c b/share/examples/ipfilter/l4check/l4check.c
index 961eeab934fd..3fc194ee5a3e 100644
--- a/share/examples/ipfilter/l4check/l4check.c
+++ b/share/examples/ipfilter/l4check/l4check.c
@@ -92,7 +92,7 @@ copystr(char *dst, char *src)
 		else
 			esc = 1;
 	*t = '\0';
-	return dst;
+	return(dst);
 }
 
 void
@@ -372,7 +372,7 @@ runconfig(void)
 	i = select(mfd + 1, &rfd, &wfd, NULL, &tv);
 	if (i == -1) {
 		perror("select");
-		return -1;
+		return(-1);
 	}
 
 	now1 = time(NULL);
@@ -396,7 +396,7 @@ runconfig(void)
 			i--;
 		}
 	}
-	return 0;
+	return(0);
 }
 
 
@@ -424,7 +424,7 @@ gethostport(char *str, int lnum, u_32_t *ipp, u_short *portp)
 		if (!(hp = gethostbyname(host))) {
 			fprintf(stderr, "%d: can't resolve hostname: %s\n",
 				lnum, host);
-			return 0;
+			return(0);
 		}
 		*ipp = *(u_32_t *)hp->h_addr;
 	}
@@ -439,12 +439,12 @@ gethostport(char *str, int lnum, u_32_t *ipp, u_short *portp)
 			else {
 				fprintf(stderr, "%d: unknown service %s\n",
 					lnum, port);
-				return 0;
+				return(0);
 			}
 		}
 	} else
 		*portp = 0;
-	return 1;
+	return(1);
 }
 
 
@@ -458,24 +458,24 @@ mapfile(char *file, size_t *sizep)
 	fd = open(file, O_RDONLY);
 	if (fd == -1) {
 		perror("open(mapfile)");
-		return NULL;
+		return(NULL);
 	}
 
 	if (fstat(fd, &sb) == -1) {
 		perror("fstat(mapfile)");
 		close(fd);
-		return NULL;
+		return(NULL);
 	}
 
 	addr = mmap(NULL, sb.st_size, PROT_READ, MAP_SHARED, fd, 0);
 	if (addr == (caddr_t)-1) {
 		perror("mmap(mapfile)");
 		close(fd);
-		return NULL;
+		return(NULL);
 	}
 	close(fd);
 	*sizep = sb.st_size;
-	return (char *)addr;
+	return(char *)addr;
 }
 
 
@@ -491,7 +491,7 @@ readconfig(char *filename)
 	fp = fopen(filename, "r");
 	if (!fp) {
 		perror("open(configfile)");
-		return -1;
+		return(-1);
 	}
 
 	bzero((char *)&template, sizeof(template));
@@ -507,7 +507,7 @@ readconfig(char *filename)
 		if  (!s) {
 			fprintf(stderr, "%d: line too long\n", num);
 			fclose(fp);
-			return -1;
+			return(-1);
 		}
 
 		*s = '\0';
@@ -743,7 +743,7 @@ readconfig(char *filename)
 	if (errtxt)
 		fprintf(stderr, "%d: syntax error at \"%s\"\n", num, errtxt);
 	fclose(fp);
-	return err;
+	return(err);
 }
 
 
diff --git a/share/examples/ipfilter/mlfk_rule.c b/share/examples/ipfilter/mlfk_rule.c
index 9f951cf6c31d..7d10d119595f 100644
--- a/share/examples/ipfilter/mlfk_rule.c
+++ b/share/examples/ipfilter/mlfk_rule.c
@@ -53,7 +53,7 @@ ipfrule_modevent(module_t mod, int type, void *unused)
 		error = EINVAL;
 		break;
 	}
-	return error;
+	return(error);
 }
 
 static moduledata_t ipfrulemod = {
diff --git a/share/examples/ipfilter/samples/relay.c b/share/examples/ipfilter/samples/relay.c
index 11b76b07c509..67ee13a0e534 100644
--- a/share/examples/ipfilter/samples/relay.c
+++ b/share/examples/ipfilter/samples/relay.c
@@ -60,37 +60,37 @@ int relay(ifd, ofd, rfd)
 		{
 		case -1 :
 		case 0 :
-			return -1;
+			return(-1);
 		default :
 			if (FD_ISSET(ifd, &rfds)) {
 				rw = read(ifd, irh, ibuff + RELAY_BUFSZ - irh);
 				if (rw == -1)
-					return -1;
+					return(-1);
 				if (rw == 0)
-					return 0;
+					return(0);
 				irh += rw;
 				n--;
 			}
 			if (n && FD_ISSET(ofd, &wfds)) {
 				rw = write(ofd, iwt, iwh  - iwt);
 				if (rw == -1)
-					return -1;
+					return(-1);
 				iwt += rw;
 				n--;
 			}
 			if (n && FD_ISSET(rfd, &rfds)) {
 				rw = read(rfd, iwh, obuff + RELAY_BUFSZ - iwh);
 				if (rw == -1)
-					return -1;
+					return(-1);
 				if (rw == 0)
-					return 0;
+					return(0);
 				iwh += rw;
 				n--;
 			}
 			if (n && FD_ISSET(rfd, &wfds)) {
 				rw = write(rfd, irt, irh  - irt);
 				if (rw == -1)
-					return -1;
+					return(-1);
 				irt += rw;
 				n--;
 			}