Commit 42ac0a19 authored by Dag Erling Smørgrav's avatar Dag Erling Smørgrav

Fix some style issues, and harmonize with varnishncsa(1).


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@2271 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 3d9c0909
...@@ -179,14 +179,14 @@ do_order(struct VSL_data *vd, int argc, char **argv) ...@@ -179,14 +179,14 @@ do_order(struct VSL_data *vd, int argc, char **argv)
match_tag = name2tag(argv[0]); match_tag = name2tag(argv[0]);
if (match_tag < 0) { if (match_tag < 0) {
fprintf(stderr, "Tag \"%s\" unknown\n", argv[0]); fprintf(stderr, "Tag \"%s\" unknown\n", argv[0]);
exit (2); exit(2);
} }
i = regcomp(&match_re, argv[1], REG_EXTENDED | REG_NOSUB); i = regcomp(&match_re, argv[1], REG_EXTENDED | REG_NOSUB);
if (i) { if (i) {
char buf[BUFSIZ]; char buf[BUFSIZ];
regerror(i, &match_re, buf, sizeof buf); regerror(i, &match_re, buf, sizeof buf);
fprintf(stderr, "%s\n", buf); fprintf(stderr, "%s\n", buf);
exit (2); exit(2);
} }
} }
if (!b_flag) { if (!b_flag) {
...@@ -235,7 +235,7 @@ open_log(const char *w_arg, int a_flag) ...@@ -235,7 +235,7 @@ open_log(const char *w_arg, int a_flag)
fd = open(w_arg, flags, 0644); fd = open(w_arg, flags, 0644);
if (fd < 0) { if (fd < 0) {
perror(w_arg); perror(w_arg);
exit (1); exit(1);
} }
return (fd); return (fd);
} }
...@@ -265,7 +265,7 @@ do_write(struct VSL_data *vd, const char *w_arg, int a_flag) ...@@ -265,7 +265,7 @@ do_write(struct VSL_data *vd, const char *w_arg, int a_flag)
reopen = 0; reopen = 0;
} }
} }
exit (0); exit(0);
} }
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
...@@ -281,7 +281,7 @@ usage(void) ...@@ -281,7 +281,7 @@ usage(void)
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
int i, c; int c;
int a_flag = 0, D_flag = 0, o_flag = 0; int a_flag = 0, D_flag = 0, o_flag = 0;
const char *n_arg = NULL; const char *n_arg = NULL;
const char *P_arg = NULL; const char *P_arg = NULL;
...@@ -358,12 +358,11 @@ main(int argc, char **argv) ...@@ -358,12 +358,11 @@ 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);
while (1) { while (VSL_Dispatch(vd, VSL_H_Print, stdout) >= 0) {
i = VSL_Dispatch(vd, VSL_H_Print, stdout); if (fflush(stdout) != 0) {
if (i == 0) perror("stdout");
fflush(stdout);
else if (i < 0)
break; break;
}
} }
if (pfh != NULL) if (pfh != NULL)
......
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