From 15ad8696c7cf95059f163b4f7ed86ca697e8fe1e Mon Sep 17 00:00:00 2001 From: "Kelvin M. Klann" Date: Thu, 11 May 2023 18:51:02 -0300 Subject: Move usage text into usage_str var For consistency and readability. Note: This also makes exactly one extra blank line be printed at the end of every usage text, which is currently only done in the following files: * src/fcopy/main.c * src/fnettrace-dns/main.c * src/fnettrace-icmp/main.c * src/fnettrace-sni/main.c * src/fnettrace/main.c * src/profstats/main.c --- src/fnettrace/main.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'src/fnettrace') diff --git a/src/fnettrace/main.c b/src/fnettrace/main.c index 2f421562e..178ac3631 100644 --- a/src/fnettrace/main.c +++ b/src/fnettrace/main.c @@ -668,18 +668,20 @@ void logprintf(char *fmt, ...) { va_end(args); } +static const char *const usage_str = + "Usage: fnettrace [OPTIONS]\n" + "Options:\n" + " --help, -? - this help screen\n" + " --log=filename - netlocker logfile\n" + " --netfilter - build the firewall rules and commit them.\n" + " --tail - \"tail -f\" functionality\n" + "Examples:\n" + " # fnettrace - traffic trace\n" + " # fnettrace --netfilter --log=logfile - netlocker, dump output in logfile\n" + " # fnettrace --tail --log=logifile - similar to \"tail -f logfile\"\n"; + static void usage(void) { - printf("Usage: fnettrace [OPTIONS]\n"); - printf("Options:\n"); - printf(" --help, -? - this help screen\n"); - printf(" --log=filename - netlocker logfile\n"); - printf(" --netfilter - build the firewall rules and commit them.\n"); - printf(" --tail - \"tail -f\" functionality\n"); - printf("Examples:\n"); - printf(" # fnettrace - traffic trace\n"); - printf(" # fnettrace --netfilter --log=logfile - netlocker, dump output in logfile\n"); - printf(" # fnettrace --tail --log=logifile - similar to \"tail -f logfile\"\n"); - printf("\n"); + puts(usage_str); } int main(int argc, char **argv) { -- cgit v1.2.3-54-g00ecf