Commit dfa42dce authored by Dag Erling Smørgrav's avatar Dag Erling Smørgrav

Minor style issues.


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@1416 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 51016c37
...@@ -224,5 +224,5 @@ main(int argc, char **argv) ...@@ -224,5 +224,5 @@ main(int argc, char **argv)
break; break;
} }
return (0); exit(0);
} }
...@@ -223,29 +223,29 @@ sighup(int sig) ...@@ -223,29 +223,29 @@ sighup(int sig)
} }
static int static int
open_log(const char *w_opt, int a_flag) open_log(const char *w_arg, int a_flag)
{ {
int fd, flags; int fd, flags;
flags = (a_flag ? O_APPEND : O_TRUNC) | O_WRONLY | O_CREAT; flags = (a_flag ? O_APPEND : O_TRUNC) | O_WRONLY | O_CREAT;
if (!strcmp(w_opt, "-")) if (!strcmp(w_arg, "-"))
fd = STDOUT_FILENO; fd = STDOUT_FILENO;
else else
fd = open(w_opt, flags, 0644); fd = open(w_arg, flags, 0644);
if (fd < 0) { if (fd < 0) {
perror(w_opt); perror(w_arg);
exit (1); exit (1);
} }
return (fd); return (fd);
} }
static void static void
do_write(struct VSL_data *vd, const char *w_opt, int a_flag) do_write(struct VSL_data *vd, const char *w_arg, int a_flag)
{ {
int fd, i; int fd, i;
unsigned char *p; unsigned char *p;
fd = open_log(w_opt, a_flag); fd = open_log(w_arg, a_flag);
signal(SIGHUP, sighup); signal(SIGHUP, sighup);
while (1) { while (1) {
i = VSL_NextLog(vd, &p); i = VSL_NextLog(vd, &p);
...@@ -254,13 +254,13 @@ do_write(struct VSL_data *vd, const char *w_opt, int a_flag) ...@@ -254,13 +254,13 @@ do_write(struct VSL_data *vd, const char *w_opt, int a_flag)
if (i > 0) { if (i > 0) {
i = write(fd, p, 5 + p[1]); i = write(fd, p, 5 + p[1]);
if (i < 0) { if (i < 0) {
perror(w_opt); perror(w_arg);
exit(1); exit(1);
} }
} }
if (reopen) { if (reopen) {
close(fd); close(fd);
fd = open_log(w_opt, a_flag); fd = open_log(w_arg, a_flag);
reopen = 0; reopen = 0;
} }
} }
...@@ -282,8 +282,8 @@ main(int argc, char **argv) ...@@ -282,8 +282,8 @@ main(int argc, char **argv)
{ {
int i, c; int i, c;
int a_flag = 0, D_flag = 0, o_flag = 0; int a_flag = 0, D_flag = 0, o_flag = 0;
const char *P_opt = NULL; const char *P_arg = NULL;
const char *w_opt = NULL; const char *w_arg = NULL;
struct pidfh *pfh = NULL; struct pidfh *pfh = NULL;
struct VSL_data *vd; struct VSL_data *vd;
...@@ -301,13 +301,13 @@ main(int argc, char **argv) ...@@ -301,13 +301,13 @@ main(int argc, char **argv)
o_flag = 1; o_flag = 1;
break; break;
case 'P': case 'P':
P_opt = optarg; P_arg = optarg;
break; break;
case 'V': case 'V':
varnish_version("varnishlog"); varnish_version("varnishlog");
exit(0); exit(0);
case 'w': case 'w':
w_opt = optarg; w_arg = optarg;
break; break;
case 'c': case 'c':
c_flag = 1; c_flag = 1;
...@@ -326,14 +326,14 @@ main(int argc, char **argv) ...@@ -326,14 +326,14 @@ main(int argc, char **argv)
} }
} }
if (o_flag && w_opt != NULL) if (o_flag && w_arg != NULL)
usage(); usage();
if (VSL_OpenLog(vd)) if (VSL_OpenLog(vd))
exit(1); exit(1);
if (P_opt && (pfh = vpf_open(P_opt, 0600, NULL)) == NULL) { if (P_arg && (pfh = vpf_open(P_arg, 0600, NULL)) == NULL) {
perror(P_opt); perror(P_arg);
exit(1); exit(1);
} }
...@@ -347,8 +347,8 @@ main(int argc, char **argv) ...@@ -347,8 +347,8 @@ main(int argc, char **argv)
if (pfh != NULL) if (pfh != NULL)
vpf_write(pfh); vpf_write(pfh);
if (w_opt != NULL) if (w_arg != NULL)
do_write(vd, w_opt, a_flag); do_write(vd, w_arg, a_flag);
if (o_flag) if (o_flag)
do_order(vd, argc - optind, argv + optind); do_order(vd, argc - optind, argv + optind);
...@@ -363,5 +363,5 @@ main(int argc, char **argv) ...@@ -363,5 +363,5 @@ main(int argc, char **argv)
if (pfh != NULL) if (pfh != NULL)
vpf_remove(pfh); vpf_remove(pfh);
return (0); exit(0);
} }
...@@ -169,6 +169,5 @@ main(int argc, char **argv) ...@@ -169,6 +169,5 @@ main(int argc, char **argv)
#undef MAC_STAT #undef MAC_STAT
} }
exit (0); exit(0);
} }
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