r2271 - trunk/varnish-cache/bin/varnishlog

des at projects.linpro.no des at projects.linpro.no
Tue Nov 20 15:56:21 CET 2007


Author: des
Date: 2007-11-20 15:56:21 +0100 (Tue, 20 Nov 2007)
New Revision: 2271

Modified:
   trunk/varnish-cache/bin/varnishlog/varnishlog.c
Log:
Fix some style issues, and harmonize with varnishncsa(1).


Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c
===================================================================
--- trunk/varnish-cache/bin/varnishlog/varnishlog.c	2007-11-20 14:55:49 UTC (rev 2270)
+++ trunk/varnish-cache/bin/varnishlog/varnishlog.c	2007-11-20 14:56:21 UTC (rev 2271)
@@ -179,14 +179,14 @@
 		match_tag = name2tag(argv[0]);
 		if (match_tag < 0) {
 			fprintf(stderr, "Tag \"%s\" unknown\n", argv[0]);
-			exit (2);
+			exit(2);
 		}
 		i = regcomp(&match_re, argv[1], REG_EXTENDED | REG_NOSUB);
 		if (i) {
 			char buf[BUFSIZ];
 			regerror(i, &match_re, buf, sizeof buf);
 			fprintf(stderr, "%s\n", buf);
-			exit (2);
+			exit(2);
 		}
 	}
 	if (!b_flag) {
@@ -235,7 +235,7 @@
 		fd = open(w_arg, flags, 0644);
 	if (fd < 0) {
 		perror(w_arg);
-		exit (1);
+		exit(1);
 	}
 	return (fd);
 }
@@ -265,7 +265,7 @@
 			reopen = 0;
 		}
 	}
-	exit (0);
+	exit(0);
 }
 
 /*--------------------------------------------------------------------*/
@@ -281,7 +281,7 @@
 int
 main(int argc, char **argv)
 {
-	int i, c;
+	int c;
 	int a_flag = 0, D_flag = 0, o_flag = 0;
 	const char *n_arg = NULL;
 	const char *P_arg = NULL;
@@ -358,12 +358,11 @@
 	if (o_flag)
 		do_order(vd, argc - optind, argv + optind);
 
-	while (1) {
-		i = VSL_Dispatch(vd, VSL_H_Print, stdout);
-		if (i == 0)
-			fflush(stdout);
-		else if (i < 0)
+	while (VSL_Dispatch(vd, VSL_H_Print, stdout) >= 0) {
+		if (fflush(stdout) != 0) {
+			perror("stdout");
 			break;
+		}
 	}
 
 	if (pfh != NULL)




More information about the varnish-commit mailing list