Commit eeb2cc44 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Add -u for unbuffered output.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@3104 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 233de4d9
...@@ -50,6 +50,7 @@ ...@@ -50,6 +50,7 @@
.Op Fl P Ar file .Op Fl P Ar file
.Op Fl r Ar file .Op Fl r Ar file
.Op Fl s Ar num .Op Fl s Ar num
.Op Fl u
.Op Fl V .Op Fl V
.Op Fl w Ar file .Op Fl w Ar file
.Op Fl X Ar regex .Op Fl X Ar regex
...@@ -136,6 +137,8 @@ instead of shared memory. ...@@ -136,6 +137,8 @@ instead of shared memory.
Skip the first Skip the first
.Ar num .Ar num
log records. log records.
.It Fl u
Unbuffered output.
.It Fl V .It Fl V
Display the version number and exit. Display the version number and exit.
.It Fl w Ar file .It Fl w Ar file
......
...@@ -317,7 +317,7 @@ int ...@@ -317,7 +317,7 @@ int
main(int argc, char **argv) main(int argc, char **argv)
{ {
int c; int c;
int a_flag = 0, D_flag = 0, o_flag = 0; int a_flag = 0, D_flag = 0, o_flag = 0, u_flag = 0;
const char *n_arg = NULL; const char *n_arg = NULL;
const char *P_arg = NULL; const char *P_arg = NULL;
const char *w_arg = NULL; const char *w_arg = NULL;
...@@ -326,7 +326,7 @@ main(int argc, char **argv) ...@@ -326,7 +326,7 @@ main(int argc, char **argv)
vd = VSL_New(); vd = VSL_New();
while ((c = getopt(argc, argv, VSL_ARGS "aDon:P:Vw:")) != -1) { while ((c = getopt(argc, argv, VSL_ARGS "aDon:P:uVw:")) != -1) {
switch (c) { switch (c) {
case 'a': case 'a':
a_flag = 1; a_flag = 1;
...@@ -351,6 +351,9 @@ main(int argc, char **argv) ...@@ -351,6 +351,9 @@ main(int argc, char **argv)
case 'P': case 'P':
P_arg = optarg; P_arg = optarg;
break; break;
case 'u':
u_flag = 1;
break;
case 'V': case 'V':
varnish_version("varnishlog"); varnish_version("varnishlog");
exit(0); exit(0);
...@@ -391,6 +394,9 @@ main(int argc, char **argv) ...@@ -391,6 +394,9 @@ main(int argc, char **argv)
if (o_flag) if (o_flag)
do_order(vd, argc - optind, argv + optind); do_order(vd, argc - optind, argv + optind);
if (u_flag)
setbuf(stdout, NULL);
while (VSL_Dispatch(vd, VSL_H_Print, stdout) >= 0) { while (VSL_Dispatch(vd, VSL_H_Print, stdout) >= 0) {
if (fflush(stdout) != 0) { if (fflush(stdout) != 0) {
perror("stdout"); perror("stdout");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment