summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2014-09-05 17:55:06 +0200
committerTobias Klauser <tklauser@distanz.ch>2014-09-05 17:55:06 +0200
commit3014b89a4ba246bef6e35ac7411b57c0aec4676e (patch)
treed5bf95e2a8be151439ac878cb187e78c46a3d271
parentc5371dbd3bf60eb9ea2239dc2af009b61bdf933b (diff)
flowtop: Don't duplicate copyright/bug report/license string
Move the copyright/bug report/license string to an own constant and use it for the output of help() and version() to avoid duplication and prevent the strings from getting out of sync. This makes the text section of flowtop.o slightly smaller: before: text data bss dec hex filename 15601 4 48 15653 3d25 flowtop/flowtop.o after: text data bss dec hex filename 15228 4 48 15280 3bb0 flowtop/flowtop.o Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
-rw-r--r--flowtop.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/flowtop.c b/flowtop.c
index 01a5709..025e815 100644
--- a/flowtop.c
+++ b/flowtop.c
@@ -96,6 +96,14 @@ static const struct option long_options[] = {
{NULL, 0, NULL, 0}
};
+static const char *copyright = "Please report bugs to <bugs@netsniff-ng.org>\n"
+ "Copyright (C) 2011-2013 Daniel Borkmann <dborkma@tik.ee.ethz.ch>\n"
+ "Copyright (C) 2011-2012 Emmanuel Roullit <emmanuel.roullit@gmail.com>\n"
+ "Swiss federal institute of technology (ETH Zurich)\n"
+ "License: GNU GPL version 2.0\n"
+ "This is free software: you are free to change and redistribute it.\n"
+ "There is NO WARRANTY, to the extent permitted by law.\n";
+
static const char *const l3proto2str[AF_MAX] = {
[AF_INET] = "ipv4",
[AF_INET6] = "ipv6",
@@ -248,14 +256,8 @@ static void help(void)
"Note:\n"
" If netfilter is not running, you can activate it with e.g.:\n"
" iptables -A INPUT -p tcp -m state --state ESTABLISHED -j ACCEPT\n"
- " iptables -A OUTPUT -p tcp -m state --state NEW,ESTABLISHED -j ACCEPT\n\n"
- "Please report bugs to <bugs@netsniff-ng.org>\n"
- "Copyright (C) 2011-2013 Daniel Borkmann <dborkma@tik.ee.ethz.ch>\n"
- "Copyright (C) 2011-2012 Emmanuel Roullit <emmanuel.roullit@gmail.com>\n"
- "Swiss federal institute of technology (ETH Zurich)\n"
- "License: GNU GPL version 2.0\n"
- "This is free software: you are free to change and redistribute it.\n"
- "There is NO WARRANTY, to the extent permitted by law.\n");
+ " iptables -A OUTPUT -p tcp -m state --state NEW,ESTABLISHED -j ACCEPT\n\n");
+ puts(copyright);
die();
}
@@ -263,14 +265,8 @@ static void version(void)
{
printf("\nflowtop %s, Git id: %s\n", VERSION_LONG, GITVERSION);
puts("top-like netfilter TCP/UDP/SCTP/.. flow tracking\n"
- "http://www.netsniff-ng.org\n\n"
- "Please report bugs to <bugs@netsniff-ng.org>\n"
- "Copyright (C) 2011-2013 Daniel Borkmann <dborkma@tik.ee.ethz.ch>\n"
- "Copyright (C) 2011-2012 Emmanuel Roullit <emmanuel.roullit@gmail.com>\n"
- "Swiss federal institute of technology (ETH Zurich)\n"
- "License: GNU GPL version 2.0\n"
- "This is free software: you are free to change and redistribute it.\n"
- "There is NO WARRANTY, to the extent permitted by law.\n");
+ "http://www.netsniff-ng.org\n\n");
+ puts(copyright);
die();
}