Provide new option "--debug" instead of using insecure environment variable DEBUG.

This commit is contained in:
Andrew Wood
2023-07-28 23:14:14 +01:00
parent 08a8c2ea70
commit b9f96d9508
4 changed files with 194 additions and 143 deletions
+86 -88
View File
@@ -27,90 +27,95 @@ struct optdesc_s {
void display_help(void)
{
struct optdesc_s optlist[] = {
{"-p", "--progress", 0,
N_("show progress bar")},
{"-t", "--timer", 0,
N_("show elapsed time")},
{"-e", "--eta", 0,
N_("show estimated time of arrival (completion)")},
{"-I", "--fineta", 0,
{ "-p", "--progress", 0,
N_("show progress bar") },
{ "-t", "--timer", 0,
N_("show elapsed time") },
{ "-e", "--eta", 0,
N_("show estimated time of arrival (completion)") },
{ "-I", "--fineta", 0,
N_("show absolute estimated time of arrival (completion)")
},
{ "-r", "--rate", 0,
N_("show data transfer rate counter") },
{ "-a", "--average-rate", 0,
N_("show data transfer average rate counter") },
{ "-m", "--average-rate-window", N_("SEC"),
N_
("show absolute estimated time of arrival (completion)")},
{"-r", "--rate", 0,
N_("show data transfer rate counter")},
{"-a", "--average-rate", 0,
N_("show data transfer average rate counter")},
{"-m", "--average-rate-window", N_("SEC"),
N_
("compute average rate over past SEC seconds (default 30s)")},
{"-b", "--bytes", 0,
N_("show number of bytes transferred")},
{"-8", "--bits", 0,
N_("show number of bits transferred")},
{"-T", "--buffer-percent", 0,
N_("show percentage of transfer buffer in use")},
{"-A", "--last-written", _("NUM"),
N_("show NUM bytes last written")},
{"-F", "--format", N_("FORMAT"),
N_("set output format to FORMAT")},
{"-n", "--numeric", 0,
N_("output percentages, not visual information")},
{"-q", "--quiet", 0,
N_("do not output any transfer information at all")},
{"", 0, 0, 0},
{"-W", "--wait", 0,
N_("display nothing until first byte transferred")},
{"-D", "--delay-start", N_("SEC"),
N_("display nothing until SEC seconds have passed")},
{"-s", "--size", N_("SIZE"),
N_("set estimated data size to SIZE bytes")},
{"-l", "--line-mode", 0,
N_("count lines instead of bytes")},
{"-0", "--null", 0,
N_("lines are null-terminated")},
{"-i", "--interval", N_("SEC"),
N_("update every SEC seconds")},
{"-w", "--width", N_("WIDTH"),
N_("assume terminal is WIDTH characters wide")},
{"-H", "--height", N_("HEIGHT"),
N_("assume terminal is HEIGHT rows high")},
{"-N", "--name", N_("NAME"),
N_("prefix visual information with NAME")},
{"-f", "--force", 0,
N_("output even if standard error is not a terminal")},
{"-c", "--cursor", 0,
N_("use cursor positioning escape sequences")},
{"", 0, 0, 0},
{"-L", "--rate-limit", N_("RATE"),
N_("limit transfer to RATE bytes per second")},
{"-B", "--buffer-size", N_("BYTES"),
N_("use a buffer size of BYTES")},
{"-C", "--no-splice", 0,
N_("never use splice(), always use read/write")},
{"-E", "--skip-errors", 0,
N_("skip read errors in input")},
{"-S", "--stop-at-size", 0,
N_("stop after --size bytes have been transferred")},
{"-Y", "--sync", 0,
N_("flush cache to disk after every write")},
{"-K", "--direct-io", 0,
N_("use direct I/O to bypass cache")},
("compute average rate over past SEC seconds (default 30s)")
},
{ "-b", "--bytes", 0,
N_("show number of bytes transferred") },
{ "-8", "--bits", 0,
N_("show number of bits transferred") },
{ "-T", "--buffer-percent", 0,
N_("show percentage of transfer buffer in use") },
{ "-A", "--last-written", _("NUM"),
N_("show NUM bytes last written") },
{ "-F", "--format", N_("FORMAT"),
N_("set output format to FORMAT") },
{ "-n", "--numeric", 0,
N_("output percentages, not visual information") },
{ "-q", "--quiet", 0,
N_("do not output any transfer information at all") },
{ "", 0, 0, 0 },
{ "-W", "--wait", 0,
N_("display nothing until first byte transferred") },
{ "-D", "--delay-start", N_("SEC"),
N_("display nothing until SEC seconds have passed") },
{ "-s", "--size", N_("SIZE"),
N_("set estimated data size to SIZE bytes") },
{ "-l", "--line-mode", 0,
N_("count lines instead of bytes") },
{ "-0", "--null", 0,
N_("lines are null-terminated") },
{ "-i", "--interval", N_("SEC"),
N_("update every SEC seconds") },
{ "-w", "--width", N_("WIDTH"),
N_("assume terminal is WIDTH characters wide") },
{ "-H", "--height", N_("HEIGHT"),
N_("assume terminal is HEIGHT rows high") },
{ "-N", "--name", N_("NAME"),
N_("prefix visual information with NAME") },
{ "-f", "--force", 0,
N_("output even if standard error is not a terminal") },
{ "-c", "--cursor", 0,
N_("use cursor positioning escape sequences") },
{ "", 0, 0, 0 },
{ "-L", "--rate-limit", N_("RATE"),
N_("limit transfer to RATE bytes per second") },
{ "-B", "--buffer-size", N_("BYTES"),
N_("use a buffer size of BYTES") },
{ "-C", "--no-splice", 0,
N_("never use splice(), always use read/write") },
{ "-E", "--skip-errors", 0,
N_("skip read errors in input") },
{ "-S", "--stop-at-size", 0,
N_("stop after --size bytes have been transferred") },
{ "-Y", "--sync", 0,
N_("flush cache to disk after every write") },
{ "-K", "--direct-io", 0,
N_("use direct I/O to bypass cache") },
#ifdef HAVE_IPC
{"-R", "--remote", N_("PID"),
N_("update settings of process PID")},
{ "-R", "--remote", N_("PID"),
N_("update settings of process PID") },
#endif /* HAVE_IPC */
{"", 0, 0, 0},
{"-P", "--pidfile", N_("FILE"),
N_("save process ID in FILE")},
{"", 0, 0, 0},
{"-d", "--watchfd", N_("PID[:FD]"),
N_("watch file FD opened by process PID")},
{"", 0, 0, 0},
{"-h", "--help", 0,
N_("show this help and exit")},
{"-V", "--version", 0,
N_("show version information and exit")},
{0, 0, 0, 0}
{ "", 0, 0, 0 },
{ "-P", "--pidfile", N_("FILE"),
N_("save process ID in FILE") },
{ "", 0, 0, 0 },
{ "-d", "--watchfd", N_("PID[:FD]"),
N_("watch file FD opened by process PID") },
{ "", 0, 0, 0 },
{ "-h", "--help", 0,
N_("show this help and exit") },
{ "-V", "--version", 0,
N_("show version information and exit") },
#ifdef ENABLE_DEBUGGING
{ "-!", "--debug", N_("FILE"),
N_("write debug logs to FILE") },
#endif
{ 0, 0, 0, 0 }
};
unsigned int i, col1max = 0, tw = 77;
char *optbuf;
@@ -208,13 +213,6 @@ void display_help(void)
printf("%s\n", start);
}
#ifdef ENABLE_DEBUGGING
printf("\n");
printf("%s",
_
("Debugging is enabled; export the DEBUG environment variable to define the\noutput filename.\n"));
#endif
printf("\n");
printf(_("Please report any bugs to %s."), BUG_REPORTS_TO);
printf("\n");