]> err.no Git - varnish/commitdiff
Make
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sun, 6 Aug 2006 16:55:58 +0000 (16:55 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sun, 6 Aug 2006 16:55:58 +0000 (16:55 +0000)
-w -
work as expected.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@701 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishlog/varnishlog.c

index 73834c3978c0ec17b8362846a9e6fd4079736df4..31d19d53dfc86a9255169d8794ddf381e382a0b1 100644 (file)
@@ -232,7 +232,10 @@ main(int argc, char **argv)
                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 @@ main(int argc, char **argv)
                        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 @@ main(int argc, char **argv)
                                perror(w_opt);
                        u++;
                        if (!(u % 1000)) {
-                               printf("%u\r", u);
-                               fflush(stdout);
+                               fprintf(stderr, "%u\r", u);
+                               fflush(stderr);
                        }
                        continue;
                }