summaryrefslogtreecommitdiff
path: root/bpfc.c
diff options
context:
space:
mode:
authorTobias Klauser <tklauser@distanz.ch>2014-09-05 17:57:29 +0200
committerTobias Klauser <tklauser@distanz.ch>2014-09-05 17:57:29 +0200
commite46767f61986d982501ec59233fabddc2876f63d (patch)
tree7ca71aac900ffcff9504f6e7b9e538500e2312ab /bpfc.c
parent3014b89a4ba246bef6e35ac7411b57c0aec4676e (diff)
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 <tklauser@distanz.ch>
Diffstat (limited to 'bpfc.c')
-rw-r--r--bpfc.c25
1 files 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 <bugs@netsniff-ng.org>\n"
+ "Copyright (C) 2011-2013 Daniel Borkmann <dborkma@tik.ee.ethz.ch>,\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 <bugs@netsniff-ng.org>\n"
- "Copyright (C) 2011-2013 Daniel Borkmann <dborkma@tik.ee.ethz.ch>,\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 <bugs@netsniff-ng.org>\n"
- "Copyright (C) 2011-2013 Daniel Borkmann <dborkma@tik.ee.ethz.ch>,\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();
}