diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-11-18 19:51:32 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-11-18 19:51:32 +0000 |
commit | 5a3395bc01cd4b11309595a6ecdaf32f8279f378 (patch) | |
tree | 1e63aa591a05e9ec75aefdcd639ca4188e583648 /networking/udhcp/dumpleases.c | |
parent | abfc4cf6d8b9c59724aceb70df5081a1368fdb62 (diff) | |
download | busybox-w32-5a3395bc01cd4b11309595a6ecdaf32f8279f378.tar.gz busybox-w32-5a3395bc01cd4b11309595a6ecdaf32f8279f378.tar.bz2 busybox-w32-5a3395bc01cd4b11309595a6ecdaf32f8279f378.zip |
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.c | 29 |
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 @@ | |||
2 | /* | 2 | /* |
3 | * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. | 3 | * Licensed under the GPL v2 or later, see the file LICENSE in this tarball. |
4 | */ | 4 | */ |
5 | #include <fcntl.h> | ||
6 | #include <string.h> | ||
7 | #include <stdlib.h> | ||
8 | #include <stdio.h> | ||
9 | #include <sys/wait.h> | ||
10 | #include <arpa/inet.h> | ||
11 | #include <netdb.h> | ||
12 | #include <netinet/in.h> | ||
13 | #include <stdio.h> | ||
14 | #include <sys/socket.h> | ||
15 | #include <unistd.h> | ||
16 | #include <getopt.h> | 5 | #include <getopt.h> |
17 | #include <time.h> | ||
18 | 6 | ||
7 | #include "common.h" | ||
19 | #include "dhcpd.h" | 8 | #include "dhcpd.h" |
20 | #include "leases.h" | 9 | |
21 | #include "libbb_udhcp.h" | ||
22 | 10 | ||
23 | #define REMAINING 0 | 11 | #define REMAINING 0 |
24 | #define ABSOLUTE 1 | 12 | #define ABSOLUTE 1 |
@@ -60,17 +48,16 @@ int dumpleases_main(int argc, char *argv[]) | |||
60 | printf("Mac Address IP-Address Expires %s\n", mode == REMAINING ? "in" : "at"); | 48 | printf("Mac Address IP-Address Expires %s\n", mode == REMAINING ? "in" : "at"); |
61 | /* "00:00:00:00:00:00 255.255.255.255 Wed Jun 30 21:49:08 1993" */ | 49 | /* "00:00:00:00:00:00 255.255.255.255 Wed Jun 30 21:49:08 1993" */ |
62 | while (fread(&lease, sizeof(lease), 1, fp)) { | 50 | while (fread(&lease, sizeof(lease), 1, fp)) { |
63 | 51 | printf(":%02x"+1, lease.chaddr[0]); | |
64 | for (i = 0; i < 6; i++) { | 52 | for (i = 1; i < 6; i++) { |
65 | printf("%02x", lease.chaddr[i]); | 53 | printf(":%02x", lease.chaddr[i]); |
66 | if (i != 5) printf(":"); | ||
67 | } | 54 | } |
68 | addr.s_addr = lease.yiaddr; | 55 | addr.s_addr = lease.yiaddr; |
69 | printf(" %-15s", inet_ntoa(addr)); | 56 | printf(" %-15s ", inet_ntoa(addr)); |
70 | expires = ntohl(lease.expires); | 57 | expires = ntohl(lease.expires); |
71 | printf(" "); | ||
72 | if (mode == REMAINING) { | 58 | if (mode == REMAINING) { |
73 | if (!expires) printf("expired\n"); | 59 | if (!expires) |
60 | printf("expired\n"); | ||
74 | else { | 61 | else { |
75 | if (expires > 60*60*24) { | 62 | if (expires > 60*60*24) { |
76 | printf("%ld days, ", expires / (60*60*24)); | 63 | printf("%ld days, ", expires / (60*60*24)); |