summaryrefslogtreecommitdiff
path: root/print-ahcp.c
diff options
context:
space:
mode:
authorDenis Ovsienko <infrastation@yandex.ru>2013-12-26 18:08:06 +0400
committerDenis Ovsienko <infrastation@yandex.ru>2013-12-26 18:19:50 +0400
commitd8acd8f5d0d7cac4881b5552eca5dc40a5d3c0d1 (patch)
tree5aeac16d418b595a76270d00a2cfb12ebcd31c6c /print-ahcp.c
parentae1fdebb647a437fbec8d3d4845da190da180dd8 (diff)
downloadtcpdump-d8acd8f5d0d7cac4881b5552eca5dc40a5d3c0d1.tar.gz
make consistent use of the "tstr" idiom
For each decoder that has more than one instance of truncation signaling and prints the same string in each instance make sure that the string is declared as "static const char tstr[]" right after the initial includes block. Where necessary, replace fputs(s, stdout) with equivalent printf("%s", s).
Diffstat (limited to 'print-ahcp.c')
-rw-r--r--print-ahcp.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/print-ahcp.c b/print-ahcp.c
index 738625e1..b3abaa7b 100644
--- a/print-ahcp.c
+++ b/print-ahcp.c
@@ -39,8 +39,8 @@
#include "extract.h"
#include "addrtoname.h"
-static const char *corrupt_str = "(corrupt)";
-static const char *trunc_str = "[|ahcp]";
+static const char tstr[] = " [|ahcp]";
+static const char cstr[] = "(corrupt)";
#define AHCP_MAGIC_NUMBER 43
#define AHCP_VERSION_1 1
@@ -117,11 +117,11 @@ ahcp_time_print(const u_char *cp, const u_char *ep) {
return 0;
corrupt:
- printf(": %s", corrupt_str);
+ printf(": %s", cstr);
TCHECK2(*cp, ep - cp);
return 0;
trunc:
- printf(" %s", trunc_str);
+ printf("%s", tstr);
return -1;
}
@@ -134,11 +134,11 @@ ahcp_seconds_print(const u_char *cp, const u_char *ep) {
return 0;
corrupt:
- printf(": %s", corrupt_str);
+ printf(": %s", cstr);
TCHECK2(*cp, ep - cp);
return 0;
trunc:
- printf(" %s", trunc_str);
+ printf("%s", tstr);
return -1;
}
@@ -163,11 +163,11 @@ ahcp_ipv6_addresses_print(const u_char *cp, const u_char *ep) {
return 0;
corrupt:
- printf(": %s", corrupt_str);
+ printf(": %s", cstr);
TCHECK2(*cp, ep - cp);
return 0;
trunc:
- printf(" %s", trunc_str);
+ printf("%s", tstr);
return -1;
}
@@ -186,11 +186,11 @@ ahcp_ipv4_addresses_print(const u_char *cp, const u_char *ep) {
return 0;
corrupt:
- printf(": %s", corrupt_str);
+ printf(": %s", cstr);
TCHECK2(*cp, ep - cp);
return 0;
trunc:
- printf(" %s", trunc_str);
+ printf("%s", tstr);
return -1;
}
@@ -215,11 +215,11 @@ ahcp_ipv6_prefixes_print(const u_char *cp, const u_char *ep) {
return 0;
corrupt:
- printf(": %s", corrupt_str);
+ printf(": %s", cstr);
TCHECK2(*cp, ep - cp);
return 0;
trunc:
- printf(" %s", trunc_str);
+ printf("%s", tstr);
return -1;
}
@@ -238,11 +238,11 @@ ahcp_ipv4_prefixes_print(const u_char *cp, const u_char *ep) {
return 0;
corrupt:
- printf(": %s", corrupt_str);
+ printf(": %s", cstr);
TCHECK2(*cp, ep - cp);
return 0;
trunc:
- printf(" %s", trunc_str);
+ printf("%s", tstr);
return -1;
}
@@ -298,11 +298,11 @@ ahcp1_options_print(const u_char *cp, const u_char *ep) {
return;
corrupt:
- printf(" %s", corrupt_str);
+ printf(" %s", cstr);
TCHECK2(*cp, ep - cp);
return;
trunc:
- printf(" %s", trunc_str);
+ printf("%s", tstr);
}
static void
@@ -342,11 +342,11 @@ ahcp1_body_print(const u_char *cp, const u_char *ep) {
return;
corrupt:
- printf(" %s", corrupt_str);
+ printf(" %s", cstr);
TCHECK2(*cp, ep - cp);
return;
trunc:
- printf(" %s", trunc_str);
+ printf("%s", tstr);
}
void
@@ -407,10 +407,10 @@ ahcp_print(const u_char *cp, const u_int len) {
return;
corrupt:
- printf(" %s", corrupt_str);
+ printf(" %s", cstr);
TCHECK2(*cp, ep - cp);
return;
trunc:
- printf(" %s", trunc_str);
+ printf("%s", tstr);
}