r701 - trunk/varnish-cache/bin/varnishlog

phk at projects.linpro.no phk at projects.linpro.no
Sun Aug 6 18:55:58 CEST 2006


Author: phk
Date: 2006-08-06 18:55:58 +0200 (Sun, 06 Aug 2006)
New Revision: 701

Modified:
   trunk/varnish-cache/bin/varnishlog/varnishlog.c
Log:
Make 
	-w -
work as expected.


Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c
===================================================================
--- trunk/varnish-cache/bin/varnishlog/varnishlog.c	2006-08-06 15:02:57 UTC (rev 700)
+++ trunk/varnish-cache/bin/varnishlog/varnishlog.c	2006-08-06 16:55:58 UTC (rev 701)
@@ -232,7 +232,10 @@
 		Usage();
 
 	if (w_opt != NULL) {
-		wfile = fopen(w_opt, "w");
+		if (!strcmp(w_opt, "-"))
+			wfile = stdout;
+		else
+			wfile = fopen(w_opt, "w");
 		if (wfile == NULL) {
 			perror(w_opt);
 			exit (1);
@@ -249,10 +252,10 @@
 			if (w_opt == NULL) {
 				if (o_flag && ++v == 100)
 					clean_order();
-				fflush(stdout);
+				fflush(stderr);
 			} else if (++v == 100) {
 				fflush(wfile);
-				printf("\nFlushed\n");
+				fprintf(stderr, "\nFlushed\n");
 			}
 			usleep(50000);
 			continue;
@@ -264,8 +267,8 @@
 				perror(w_opt);
 			u++;
 			if (!(u % 1000)) {
-				printf("%u\r", u);
-				fflush(stdout);
+				fprintf(stderr, "%u\r", u);
+				fflush(stderr);
 			}
 			continue;
 		}




More information about the varnish-commit mailing list