summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2016-02-01 11:56:47 +0100
committerGravatar Christian Hesse <mail@eworm.de>2016-02-01 11:56:47 +0100
commitfcd79f550b23182705d86ca3520db5ea60e37453 (patch)
treedd25eaec787c56c0cafa0ce273d80067c95134da
parentd570aa8a2881ac121a9b2af3b69a13a281d7f234 (diff)
downloaddyndhcpd-fcd79f550b23182705d86ca3520db5ea60e37453.tar.gz
dyndhcpd-fcd79f550b23182705d86ca3520db5ea60e37453.tar.zst
add padding to output
-rw-r--r--dyndhcpd.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/dyndhcpd.c b/dyndhcpd.c
index 353fd7a..5cbfb79 100644
--- a/dyndhcpd.c
+++ b/dyndhcpd.c
@@ -190,17 +190,23 @@ int main(int argc, char ** argv) {
inet_ntop(AF_INET, &bootp.minhost.i, bootp.minhost.c, INET_ADDRSTRLEN) != NULL &&
inet_ntop(AF_INET, &bootp.maxhost.i, bootp.maxhost.c, INET_ADDRSTRLEN) != NULL) {
/* print information */
- if (verbose)
- printf("Interface: %s\n"
+ if (verbose) {
+ int pad = strlen(dhcp.minhost.c) > strlen(bootp.minhost.c) ?
+ strlen(dhcp.minhost.c) : strlen(bootp.minhost.c);
+ printf( "Interface: %s\n"
"Domain: %s\n"
"Host Address: %s\n"
"Network: %s\n"
"Broadcast: %s\n"
"Netmask: %s\n"
- "Hosts DHCP: %s - %s\n"
- "Hosts BOOTP: %s - %s\n",
- interface, domainname, network.address.c, network.netaddress.c, network.broadcast.c, network.netmask.c,
- dhcp.minhost.c, dhcp.maxhost.c, bootp.minhost.c, bootp.maxhost.c);
+ "Hosts DHCP: %-*s - %s\n"
+ "Hosts BOOTP: %-*s - %s\n",
+ interface, domainname,
+ network.address.c, network.netaddress.c,
+ network.broadcast.c, network.netmask.c,
+ pad, dhcp.minhost.c, dhcp.maxhost.c,
+ pad, bootp.minhost.c, bootp.maxhost.c);
+ }
/* open the template for reading */
if (templatefilename == NULL)