aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/dumpleases.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-11-18 19:51:32 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-11-18 19:51:32 +0000
commit5a3395bc01cd4b11309595a6ecdaf32f8279f378 (patch)
tree1e63aa591a05e9ec75aefdcd639ca4188e583648 /networking/udhcp/dumpleases.c
parentabfc4cf6d8b9c59724aceb70df5081a1368fdb62 (diff)
downloadbusybox-5a3395bc01cd4b11309595a6ecdaf32f8279f378.tar.gz
udhcp: fix indentation and style.
Eliminate (group) a lot of smallish *.h files Remove lots of unneeded #includes
Diffstat (limited to 'networking/udhcp/dumpleases.c')
-rw-r--r--networking/udhcp/dumpleases.c29
1 files changed, 8 insertions, 21 deletions
diff --git a/networking/udhcp/dumpleases.c b/networking/udhcp/dumpleases.c
index 60e6b7edf..4422d3099 100644
--- a/networking/udhcp/dumpleases.c
+++ b/networking/udhcp/dumpleases.c
@@ -2,23 +2,11 @@
/*
* Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
*/
-#include <fcntl.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <sys/wait.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <netinet/in.h>
-#include <stdio.h>
-#include <sys/socket.h>
-#include <unistd.h>
#include <getopt.h>
-#include <time.h>
+#include "common.h"
#include "dhcpd.h"
-#include "leases.h"
-#include "libbb_udhcp.h"
+
#define REMAINING 0
#define ABSOLUTE 1
@@ -60,17 +48,16 @@ int dumpleases_main(int argc, char *argv[])
printf("Mac Address IP-Address Expires %s\n", mode == REMAINING ? "in" : "at");
/* "00:00:00:00:00:00 255.255.255.255 Wed Jun 30 21:49:08 1993" */
while (fread(&lease, sizeof(lease), 1, fp)) {
-
- for (i = 0; i < 6; i++) {
- printf("%02x", lease.chaddr[i]);
- if (i != 5) printf(":");
+ printf(":%02x"+1, lease.chaddr[0]);
+ for (i = 1; i < 6; i++) {
+ printf(":%02x", lease.chaddr[i]);
}
addr.s_addr = lease.yiaddr;
- printf(" %-15s", inet_ntoa(addr));
+ printf(" %-15s ", inet_ntoa(addr));
expires = ntohl(lease.expires);
- printf(" ");
if (mode == REMAINING) {
- if (!expires) printf("expired\n");
+ if (!expires)
+ printf("expired\n");
else {
if (expires > 60*60*24) {
printf("%ld days, ", expires / (60*60*24));