Commit 2fcd93d4 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@3104 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 5ac7358d
......@@ -50,6 +50,7 @@
.Op Fl P Ar file
.Op Fl r Ar file
.Op Fl s Ar num
.Op Fl u
.Op Fl V
.Op Fl w Ar file
.Op Fl X Ar regex
......@@ -136,6 +137,8 @@ instead of shared memory.
Skip the first
.Ar num
log records.
.It Fl u
Unbuffered output.
.It Fl V
Display the version number and exit.
.It Fl w Ar file
......
......@@ -317,7 +317,7 @@ int
main(int argc, char **argv)
{
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 *P_arg = NULL;
const char *w_arg = NULL;
......@@ -326,7 +326,7 @@ main(int argc, char **argv)
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) {
case 'a':
a_flag = 1;
......@@ -351,6 +351,9 @@ main(int argc, char **argv)
case 'P':
P_arg = optarg;
break;
case 'u':
u_flag = 1;
break;
case 'V':
varnish_version("varnishlog");
exit(0);
......@@ -391,6 +394,9 @@ main(int argc, char **argv)
if (o_flag)
do_order(vd, argc - optind, argv + optind);
if (u_flag)
setbuf(stdout, NULL);
while (VSL_Dispatch(vd, VSL_H_Print, stdout) >= 0) {
if (fflush(stdout) != 0) {
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