Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Sep 2012 15:59:03 +0000 (UTC)
From:      Jaakko Heinonen <jh@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r240407 - stable/9/bin/cat
Message-ID:  <201209121559.q8CFx3BR000591@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jh
Date: Wed Sep 12 15:59:03 2012
New Revision: 240407
URL: http://svn.freebsd.org/changeset/base/240407

Log:
  MFC r238652: style(9).

Modified:
  stable/9/bin/cat/cat.c
Directory Properties:
  stable/9/bin/cat/   (props changed)

Modified: stable/9/bin/cat/cat.c
==============================================================================
--- stable/9/bin/cat/cat.c	Wed Sep 12 15:36:44 2012	(r240406)
+++ stable/9/bin/cat/cat.c	Wed Sep 12 15:59:03 2012	(r240407)
@@ -58,11 +58,11 @@ __FBSDID("$FreeBSD$");
 #include <err.h>
 #include <fcntl.h>
 #include <locale.h>
+#include <stddef.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <stddef.h>
 
 int bflag, eflag, nflag, sflag, tflag, vflag;
 int rval;
@@ -77,16 +77,20 @@ static void raw_cat(int);
 static int udom_open(const char *path, int flags);
 #endif
 
-/* Memory strategy threshold, in pages: if physmem is larger then this, use a 
- * large buffer */
-#define PHYSPAGES_THRESHOLD (32*1024)
-
-/* Maximum buffer size in bytes - do not allow it to grow larger than this */
-#define BUFSIZE_MAX (2*1024*1024)
-
-/* Small (default) buffer size in bytes. It's inefficient for this to be
- * smaller than MAXPHYS */
-#define BUFSIZE_SMALL (MAXPHYS)
+/*
+ * Memory strategy threshold, in pages: if physmem is larger than this,
+ * use a large buffer.
+ */
+#define	PHYSPAGES_THRESHOLD (32 * 1024)
+
+/* Maximum buffer size in bytes - do not allow it to grow larger than this. */
+#define	BUFSIZE_MAX (2 * 1024 * 1024)
+
+/*
+ * Small (default) buffer size in bytes. It's inefficient for this to be
+ * smaller than MAXPHYS.
+ */
+#define	BUFSIZE_SMALL (MAXPHYS)
 
 int
 main(int argc, char *argv[])
@@ -144,13 +148,12 @@ usage(void)
 static void
 scanfiles(char *argv[], int cooked)
 {
-	int i = 0;
+	int fd, i;
 	char *path;
 	FILE *fp;
 
+	i = 0;
 	while ((path = argv[i]) != NULL || i == 0) {
-		int fd;
-
 		if (path == NULL || strcmp(path, "-") == 0) {
 			filename = "stdin";
 			fd = STDIN_FILENO;
@@ -261,12 +264,12 @@ raw_cat(int rfd)
 		if (S_ISREG(sbuf.st_mode)) {
 			/* If there's plenty of RAM, use a large copy buffer */
 			if (sysconf(_SC_PHYS_PAGES) > PHYSPAGES_THRESHOLD)
-				bsize = MIN(BUFSIZE_MAX, MAXPHYS*8);
+				bsize = MIN(BUFSIZE_MAX, MAXPHYS * 8);
 			else
 				bsize = BUFSIZE_SMALL;
 		} else
-			bsize = MAX(sbuf.st_blksize, 
-					(blksize_t)sysconf(_SC_PAGESIZE));
+			bsize = MAX(sbuf.st_blksize,
+			    (blksize_t)sysconf(_SC_PAGESIZE));
 		if ((buf = malloc(bsize)) == NULL)
 			err(1, "malloc() failure of IO buffer");
 	}
@@ -327,7 +330,7 @@ udom_open(const char *path, int flags)
 			break;
 		}
 	}
-	return(fd);
+	return (fd);
 }
 
 #endif



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