From e46767f61986d982501ec59233fabddc2876f63d Mon Sep 17 00:00:00 2001 From: Tobias Klauser Date: Fri, 5 Sep 2014 17:57:29 +0200 Subject: bpfc: 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 bpfc.o slightly smaller: before: text data bss dec hex filename 3594 0 0 3594 e0a bpfc/bpfc.o after: text data bss dec hex filename 3313 0 0 3313 cf1 bpfc/bpfc.o Signed-off-by: Tobias Klauser --- bpfc.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/bpfc.c b/bpfc.c index a107bc8..f56ec0d 100644 --- a/bpfc.c +++ b/bpfc.c @@ -31,6 +31,13 @@ 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" + "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"; + extern int compile_filter(char *file, int verbose, int bypass, int format, bool invoke_cpp); @@ -56,13 +63,8 @@ static void __noreturn help(void) " iptables -A INPUT -m bpf --bytecode \"`./bpfc -f xt_bpf -i fubar`\" -j LOG\n" " bpfc - (read from stdin)\n" "Note:\n" - " Generation of seccomp-BPF filters are fully supported as well.\n\n" - "Please report bugs to \n" - "Copyright (C) 2011-2013 Daniel Borkmann ,\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"); + " Generation of seccomp-BPF filters are fully supported as well.\n\n"); + puts(copyright); die(); } @@ -70,13 +72,8 @@ static void __noreturn version(void) { printf("\nbpfc %s, Git id: %s\n", VERSION_LONG, GITVERSION); puts("a tiny BPF compiler\n" - "http://www.netsniff-ng.org\n\n" - "Please report bugs to \n" - "Copyright (C) 2011-2013 Daniel Borkmann ,\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(); } -- cgit v1.2.3-54-g00ecf