You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Victor J. Orlikowski" <v....@gte.net> on 2000/11/17 15:40:53 UTC

[PATCH] 1.3 rotatelogs style patch

O.K. Cleaning up the tabs, so that we can match the style guide.

Index: src/support/rotatelogs.c
===================================================================
RCS file: /cvs/apache/apache-1.3/src/support/rotatelogs.c,v
retrieving revision 1.12
diff -u -d -r1.12 rotatelogs.c
--- rotatelogs.c	2000/06/21 22:54:45	1.12
+++ rotatelogs.c	2000/11/17 14:40:36
@@ -12,9 +12,9 @@
 #include <errno.h>
 #include <fcntl.h>
 
-#define BUFSIZE		65536
+#define BUFSIZE        65536
 #ifndef MAX_PATH
-#define MAX_PATH	1024
+#define MAX_PATH       1024
 #endif
 
 int main (int argc, char **argv)
@@ -27,59 +27,59 @@
     char *szLogRoot;
 
     if (argc != 3) {
-	fprintf(stderr,
-		"%s <logfile> <rotation time in seconds>\n\n",
-		argv[0]);
+        fprintf(stderr,
+                "%s <logfile> <rotation time in seconds>\n\n",
+                argv[0]);
 #ifdef OS2
-	fprintf(stderr,
-		"Add this:\n\nTransferLog \"|%s.exe /some/where 86400\"\n\n",
-		argv[0]);
+        fprintf(stderr,
+                "Add this:\n\nTransferLog \"|%s.exe /some/where 86400\"\n\n",
+                argv[0]);
 #else
-	fprintf(stderr,
-		"Add this:\n\nTransferLog \"|%s /some/where 86400\"\n\n",
-		argv[0]);
+        fprintf(stderr,
+                "Add this:\n\nTransferLog \"|%s /some/where 86400\"\n\n",
+                argv[0]);
 #endif
-	fprintf(stderr,
-		"to httpd.conf. The generated name will be /some/where.nnnn "
-		"where nnnn is the\nsystem time at which the log nominally "
-		"starts (N.B. this time will always be a\nmultiple of the "
-		"rotation time, so you can synchronize cron scripts with it).\n"
-		"At the end of each rotation time a new log is started.\n");
-	exit(1);
+        fprintf(stderr,
+                "to httpd.conf. The generated name will be /some/where.nnnn "
+                "where nnnn is the\nsystem time at which the log nominally "
+                "starts (N.B. this time will always be a\nmultiple of the "
+                "rotation time, so you can synchronize cron scripts with it).\n"
+                "At the end of each rotation time a new log is started.\n");
+        exit(1);
     }
 
     szLogRoot = argv[1];
     tRotation = atoi(argv[2]);
     if (tRotation <= 0) {
-	fprintf(stderr, "Rotation time must be > 0\n");
-	exit(6);
+        fprintf(stderr, "Rotation time must be > 0\n");
+        exit(6);
     }
 
     for (;;) {
-	nRead = read(0, buf, sizeof buf);
-	if (nRead == 0)
-	    exit(3);
-	if (nRead < 0)
-	    if (errno != EINTR)
-		exit(4);
-	if (nLogFD >= 0 && (time(NULL) >= tLogEnd || nRead < 0)) {
-	    close(nLogFD);
-	    nLogFD = -1;
-	}
-	if (nLogFD < 0) {
-	    time_t tLogStart = (time(NULL) / tRotation) * tRotation;
-	    sprintf(buf2, "%s.%010d", szLogRoot, (int) tLogStart);
-	    tLogEnd = tLogStart + tRotation;
-	    nLogFD = open(buf2, O_WRONLY | O_CREAT | O_APPEND, 0666);
-	    if (nLogFD < 0) {
-		perror(buf2);
-		exit(2);
-	    }
-	}
-	if (write(nLogFD, buf, nRead) != nRead) {
-	    perror(buf2);
-	    exit(5);
-	}
+        nRead = read(0, buf, sizeof buf);
+        if (nRead == 0)
+            exit(3);
+        if (nRead < 0)
+            if (errno != EINTR)
+                exit(4);
+        if (nLogFD >= 0 && (time(NULL) >= tLogEnd || nRead < 0)) {
+            close(nLogFD);
+            nLogFD = -1;
+        }
+        if (nLogFD < 0) {
+            time_t tLogStart = (time(NULL) / tRotation) * tRotation;
+            sprintf(buf2, "%s.%010d", szLogRoot, (int) tLogStart);
+            tLogEnd = tLogStart + tRotation;
+            nLogFD = open(buf2, O_WRONLY | O_CREAT | O_APPEND, 0666);
+            if (nLogFD < 0) {
+                perror(buf2);
+                exit(2);
+            }
+        }
+        if (write(nLogFD, buf, nRead) != nRead) {
+            perror(buf2);
+            exit(5);
+        }
     }
     /* We never get here, but surpress the compile warning */
     return (0);

Victor
-- 
Victor J. Orlikowski
======================
v.j.orlikowski@gte.net
vjo@raleigh.ibm.com
vjo@us.ibm.com


Re: [PATCH] 1.3 rotatelogs style patch

Posted by Tony Finch <do...@dotat.at>.
"William A. Rowe, Jr." <wr...@rowe-clan.net> wrote:
>
>I discovered this problem with mod_isapi, which was full of tabs.
>Touched the better part of the file, crossing them back to spaces
>(unintentionally) and the five lines of -real-changes- were completely
>obscured by cruft.

?! Don't you have an edtior that doesn't screw with white space? Or
alternatively use diff and patch in "don't mess up the white space"
mode.

Non-substantive changes, e.g. changing the whitespace, makes the CVS
history much less useful.

Tony.
-- 
f.a.n.finch     dot@dotat.at     fanf@covalent.net     Chad for President!

RE: [PATCH] 1.3 rotatelogs style patch

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
> From: Tony Finch [mailto:dot@dotat.at]
> Sent: Friday, November 17, 2000 6:30 PM
> 
> -1 this is pointless. There are tabs everywhere in the code.

Irrelevant.

I discovered this problem with mod_isapi, which was full of tabs.
Touched the better part of the file, crossing them back to spaces
(unintentionally) and the five lines of -real-changes- were completely
obscured by cruft.

I asked Victor to put this together before his -real- patch to fix
the full volume fixes, so that we see the real changes to the real
code, rather than the same sort of cruft that didn't matter to many
in Win32, but would matter to us all in rotatelogs.

Re: [PATCH] 1.3 rotatelogs style patch

Posted by Tony Finch <do...@dotat.at>.
"Victor J. Orlikowski" <v....@gte.net> wrote:
>O.K. Cleaning up the tabs, so that we can match the style guide.

-1 this is pointless. There are tabs everywhere in the code.

Tony.
-- 
en oeccget g mtcaa    f.a.n.finch
v spdlkishrhtewe y    dot@dotat.at
eatp o v eiti i d.    fanf@covalent.net