]> err.no Git - varnish/commitdiff
Fix some style issues, and harmonize with varnishncsa(1).
authordes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 20 Nov 2007 14:56:21 +0000 (14:56 +0000)
committerdes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 20 Nov 2007 14:56:21 +0000 (14:56 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2271 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishlog/varnishlog.c

index 78ee0f3be47c4a85b4e286b90567ec63340aaeaf..8175e7f7d2a12b5110490a052a88c7965da15d3e 100644 (file)
@@ -179,14 +179,14 @@ do_order(struct VSL_data *vd, int argc, char **argv)
                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 @@ open_log(const char *w_arg, int a_flag)
                fd = open(w_arg, flags, 0644);
        if (fd < 0) {
                perror(w_arg);
-               exit (1);
+               exit(1);
        }
        return (fd);
 }
@@ -265,7 +265,7 @@ do_write(struct VSL_data *vd, const char *w_arg, int a_flag)
                        reopen = 0;
                }
        }
-       exit (0);
+       exit(0);
 }
 
 /*--------------------------------------------------------------------*/
@@ -281,7 +281,7 @@ usage(void)
 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 @@ main(int argc, char **argv)
        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)