From 3014b89a4ba246bef6e35ac7411b57c0aec4676e Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Fri, 5 Sep 2014 17:55:06 +0200 Subject: [PATCH] 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 --- flowtop.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/flowtop.c b/flowtop.c index 01a5709b..025e815d 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 \n" + "Copyright (C) 2011-2013 Daniel Borkmann \n" + "Copyright (C) 2011-2012 Emmanuel Roullit \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 \n" - "Copyright (C) 2011-2013 Daniel Borkmann \n" - "Copyright (C) 2011-2012 Emmanuel Roullit \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 \n" - "Copyright (C) 2011-2013 Daniel Borkmann \n" - "Copyright (C) 2011-2012 Emmanuel Roullit \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(); } -- 2.11.4.GIT