summaryrefslogtreecommitdiffstats
path: root/tipc
diff options
context:
space:
mode:
authorMatteo Croce <mcroce@redhat.com>2019-05-17 15:38:28 +0200
committerDavid Ahern <dsahern@gmail.com>2019-05-20 14:35:07 -0700
commit8589eb4efdf2a6ba047ac193307695fc39133911 (patch)
tree1c10f13ba927dd939513ae4d3f7673c2c105b833 /tipc
parent2cc9b5f4fa2d01659d95175643939fddb324c5e8 (diff)
treewide: refactor help messages
Every tool in the iproute2 package have one or more function to show an help message to the user. Some of these functions print the help line by line with a series of printf call, e.g. ip/xfrm_state.c does 60 fprintf calls. If we group all the calls to a single one and just concatenate strings, we save a lot of libc calls and thus object size. The size difference of the compiled binaries calculated with bloat-o-meter is: ip/ip: add/remove: 0/0 grow/shrink: 5/15 up/down: 103/-4796 (-4693) Total: Before=672591, After=667898, chg -0.70% ip/rtmon: add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-54 (-54) Total: Before=48879, After=48825, chg -0.11% tc/tc: add/remove: 0/2 grow/shrink: 31/10 up/down: 882/-6133 (-5251) Total: Before=351912, After=346661, chg -1.49% bridge/bridge: add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-459 (-459) Total: Before=70502, After=70043, chg -0.65% misc/lnstat: add/remove: 0/1 grow/shrink: 1/0 up/down: 48/-486 (-438) Total: Before=9960, After=9522, chg -4.40% tipc/tipc: add/remove: 0/0 grow/shrink: 1/1 up/down: 18/-62 (-44) Total: Before=79182, After=79138, chg -0.06% While at it, indent some strings which were starting at column 0, and use tabs where possible, to have a consistent style across helps. Signed-off-by: Matteo Croce <mcroce@redhat.com> Signed-off-by: David Ahern <dsahern@gmail.com>
Diffstat (limited to 'tipc')
-rw-r--r--tipc/bearer.c44
1 files changed, 21 insertions, 23 deletions
diff --git a/tipc/bearer.c b/tipc/bearer.c
index 05dc84aa..1f3a4d44 100644
--- a/tipc/bearer.c
+++ b/tipc/bearer.c
@@ -40,19 +40,19 @@ static void _print_bearer_opts(void)
{
fprintf(stderr,
"OPTIONS\n"
- " priority - Bearer link priority\n"
- " tolerance - Bearer link tolerance\n"
- " window - Bearer link window\n"
- " mtu - Bearer link mtu\n");
+ " priority - Bearer link priority\n"
+ " tolerance - Bearer link tolerance\n"
+ " window - Bearer link window\n"
+ " mtu - Bearer link mtu\n");
}
void print_bearer_media(void)
{
fprintf(stderr,
"\nMEDIA\n"
- " udp - User Datagram Protocol\n"
- " ib - Infiniband\n"
- " eth - Ethernet\n");
+ " udp - User Datagram Protocol\n"
+ " ib - Infiniband\n"
+ " eth - Ethernet\n");
}
static void cmd_bearer_enable_l2_help(struct cmdl *cmdl, char *media)
@@ -60,25 +60,23 @@ static void cmd_bearer_enable_l2_help(struct cmdl *cmdl, char *media)
fprintf(stderr,
"Usage: %s bearer enable media %s device DEVICE [OPTIONS]\n"
"\nOPTIONS\n"
- " domain DOMAIN - Discovery domain\n"
- " priority PRIORITY - Bearer priority\n",
+ " domain DOMAIN - Discovery domain\n"
+ " priority PRIORITY - Bearer priority\n",
cmdl->argv[0], media);
}
static void cmd_bearer_enable_udp_help(struct cmdl *cmdl, char *media)
{
fprintf(stderr,
- "Usage: %s bearer enable [OPTIONS] media %s name NAME localip IP [UDP OPTIONS]\n\n",
- cmdl->argv[0], media);
- fprintf(stderr,
+ "Usage: %s bearer enable [OPTIONS] media %s name NAME localip IP [UDP OPTIONS]\n\n"
"OPTIONS\n"
- " domain DOMAIN - Discovery domain\n"
- " priority PRIORITY - Bearer priority\n\n");
- fprintf(stderr,
+ " domain DOMAIN - Discovery domain\n"
+ " priority PRIORITY - Bearer priority\n\n"
"UDP OPTIONS\n"
- " localport PORT - Local UDP port (default 6118)\n"
- " remoteip IP - Remote IP address\n"
- " remoteport PORT - Remote UDP port (default 6118)\n");
+ " localport PORT - Local UDP port (default 6118)\n"
+ " remoteip IP - Remote IP address\n"
+ " remoteport PORT - Remote UDP port (default 6118)\n",
+ cmdl->argv[0], media);
}
static int get_netid_cb(const struct nlmsghdr *nlh, void *data)
@@ -996,11 +994,11 @@ void cmd_bearer_help(struct cmdl *cmdl)
"\n"
"COMMANDS\n"
" add - Add data to existing bearer\n"
- " enable - Enable a bearer\n"
- " disable - Disable a bearer\n"
- " set - Set various bearer properties\n"
- " get - Get various bearer properties\n"
- " list - List bearers\n", cmdl->argv[0]);
+ " enable - Enable a bearer\n"
+ " disable - Disable a bearer\n"
+ " set - Set various bearer properties\n"
+ " get - Get various bearer properties\n"
+ " list - List bearers\n", cmdl->argv[0]);
}
int cmd_bearer(struct nlmsghdr *nlh, const struct cmd *cmd, struct cmdl *cmdl,