Skip to content

Commit

Permalink
675: Stdout command line options.
Browse files Browse the repository at this point in the history
'-v' now overrides stdout=0 in the config file, to be 1.
'-Q' now overrides stdout=1 in the config file, to be 0, and turns
off the progress counter.
'-v' used to be the version option - that is now '-V'.
Both '-v' and '-Q' utilise ziirish's command line overrides code
instead of implementing their own things.

Change-Id: I6c23b7d2e39c05641e3c666b6627eb5faf21ae06
  • Loading branch information
grke committed Sep 15, 2018
1 parent d73b2fb commit 915118b
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 27 deletions.
5 changes: 5 additions & 0 deletions UPGRADING
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
Things to watch out for when upgrading.

2.2.12
------
The command line option to print the version number, is now '-V'.
It has made way for the new '-v' option, which means 'log to stdout'.

2.2.10
------
The server side options 'address', 'port', 'status_address', and 'status_port'
Expand Down
14 changes: 10 additions & 4 deletions manpages/burp.8.in
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,27 @@ Print help and then exit.
\fB\-?\fR \fB\fR
Print help and then exit.
.TP
\fB\-o\fR \fB[option=value]\fR
Override a given option. You can use this flag several times to override multiple options.
You can even reset list options with the special syntax ':=' (example: '-o "include:=/tmp"').
.TP
\fB\-i\fR \fB\fR
Print an index table of symbols that humans may see @name@ produce, and exit.
.TP
\fB\-n\fR \fB\fR
No forking mode. The program will accept a single query, deal with it, and then
exit. This is useful for debugging. Implies '\-F'. If you intend to debug a protocol2 session, you will also want to run a separate champion chooser process ('\-a c' below).
.TP
\fB\-o\fR \fB[option=value]\fR
Override a given option. You can use this flag several times to override multiple options.
You can even reset list options with the special syntax ':=' (example: '-o "include:=/tmp"').
.TP
\fB\-Q\fR \fB\fR
Do not log to stdout (overrides config file 'stdout' setting).
.TP
\fB\-t\fR \fB\fR
Dry-run mode to test config file syntax.
.TP
\fB\-v\fR \fB\fR
Log to stdout (overrides config file 'stdout' setting).
.TP
\fB\-V\fR \fB\fR
Print version and exit.
.TP
ADDITIONAL SERVER OPTIONS TO USE WITH '\-a c'
Expand Down Expand Up @@ -111,6 +114,9 @@ For use with restores \- strip a number of leading path components.
\fB\-t\fR \fB\fR
Dry-run mode to test config file syntax.
.TP
\fB\-v\fR \fB\fR
Log to stdout (overrides config file 'stdout' setting).
.TP
\fB\-x\fR (on Windows)
On restore, do not use the Windows VSS API on restore - give this option when you are restoring a backup that contains no VSS data.
.TP
Expand Down
18 changes: 2 additions & 16 deletions src/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ static struct fzp *logfzp=NULL;
static int do_syslog=1;
static int do_stdout=1;
static int do_progress_counter=1;
static int force_quiet=0;
static int syslog_opened=0;
static int json=0;

Expand Down Expand Up @@ -150,16 +149,8 @@ int log_fzp_set(const char *path, struct conf **confs)
}
if(logfzp) fzp_setlinebuf(logfzp);
do_syslog=get_int(confs[OPT_SYSLOG]);
if(force_quiet)
{
do_stdout=0;
do_progress_counter=0;
}
else
{
do_stdout=get_int(confs[OPT_STDOUT]);
do_progress_counter=get_int(confs[OPT_PROGRESS_COUNTER]);
}
do_stdout=get_int(confs[OPT_STDOUT]);
do_progress_counter=get_int(confs[OPT_PROGRESS_COUNTER]);

if(syslog_opened)
{
Expand All @@ -174,11 +165,6 @@ int log_fzp_set(const char *path, struct conf **confs)
return 0;
}

void log_force_quiet(void)
{
force_quiet=1;
}

void log_fzp_set_direct(struct fzp *fzp)
{
fzp_close(&logfzp);
Expand Down
1 change: 0 additions & 1 deletion src/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ extern void log_set_json(int value);
extern void log_oom_w(const char *func, const char *orig_func);
extern int log_incexcs_buf(const char *incexc);
extern void log_recvd(struct iobuf *iobuf, struct cntr *cntr, int print);
extern void log_force_quiet(void);

#ifndef __GNUC__
#define __attribute__(x) /*NOTHING*/
Expand Down
18 changes: 12 additions & 6 deletions src/prog.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ static void usage_server(void)
printf(" -h|-? Print this text and exit.\n");
printf(" -i Print index of symbols and exit.\n");
printf(" -n Do not fork any children (implies '-F').\n");
printf(" -Q Do not log to stdout (overrides config file)\n");
printf(" -Q Do not log to stdout\n");
printf(" -t Dry-run to test config file syntax.\n");
printf(" -v Print version and exit.\n");
printf(" -v Log to stdout.\n");
printf(" -V Print version and exit.\n");
printf("Options to use with '-a c':\n");
printf(" -C <client> Run as if forked via a connection from this client.\n");
printf("\n");
Expand Down Expand Up @@ -69,11 +70,12 @@ static void usage_client(void)
printf(" -h|-? Print this text and exit.\n");
printf(" -i Print index of symbols and exit.\n");
printf(" -q <max secs> Randomised delay of starting a timed backup.\n");
printf(" -Q Do not log to stdout (overrides config file)\n");
printf(" -Q Do not log to stdout\n");
printf(" -r <regex> Specify a regular expression.\n");
printf(" -s <number> Number of leading path components to strip during restore.\n");
printf(" -t Dry-run to test config file syntax.\n");
printf(" -v Print version and exit.\n");
printf(" -v Log to stdout.\n");
printf(" -V Print version and exit.\n");
#ifdef HAVE_WIN32
printf(" -x Do not use the Windows VSS API when restoring.\n");
#else
Expand Down Expand Up @@ -309,7 +311,7 @@ int real_main(int argc, char *argv[])
return run_bsparse(argc, argv);
#endif

while((option=getopt(argc, argv, "a:b:c:C:d:o:fFghil:nq:Qr:s:tvxjz:?"))!=-1)
while((option=getopt(argc, argv, "a:b:c:C:d:o:fFghijl:nq:Qr:s:tvVxz:?"))!=-1)
{
switch(option)
{
Expand Down Expand Up @@ -360,7 +362,8 @@ int real_main(int argc, char *argv[])
randomise=atoi(optarg);
break;
case 'Q':
log_force_quiet();
strlist_add(&cli_overrides, "progress_counter=0", 0);
strlist_add(&cli_overrides, "stdout=0", 0);
break;
case 'r':
regex=optarg;
Expand All @@ -369,6 +372,9 @@ int real_main(int argc, char *argv[])
strip=atoi(optarg);
break;
case 'v':
strlist_add(&cli_overrides, "stdout=1", 0);
break;
case 'V':
printf("%s-%s\n", progname(), PACKAGE_VERSION);
ret=0;
goto end;
Expand Down

0 comments on commit 915118b

Please sign in to comment.