aboutsummaryrefslogtreecommitdiff
path: root/networking/udhcp/dumpleases.c
diff options
context:
space:
mode:
authorRuss Dill <Russ.Dill@asu.edu>2003-12-16 02:28:20 +0000
committerRuss Dill <Russ.Dill@asu.edu>2003-12-16 02:28:20 +0000
commit4b77acafa6f8b907903ea4a140b7c4a314ed71b2 (patch)
treeeb9fcbf83020bdcc0f4cfbab13a22384cbec34a7 /networking/udhcp/dumpleases.c
parent7becf5987a1712e1366c6b7d3eeab70f3978a089 (diff)
downloadbusybox-w32-4b77acafa6f8b907903ea4a140b7c4a314ed71b2.tar.gz
busybox-w32-4b77acafa6f8b907903ea4a140b7c4a314ed71b2.tar.bz2
busybox-w32-4b77acafa6f8b907903ea4a140b7c4a314ed71b2.zip
start attempting to bring udhcp in busybox back to the state where it is (ideally) an exact copy of udhcp outside of busybox so that its easy to merge back and forth
Diffstat (limited to 'networking/udhcp/dumpleases.c')
-rw-r--r--networking/udhcp/dumpleases.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/networking/udhcp/dumpleases.c b/networking/udhcp/dumpleases.c
index 4c6107cf7..5cb3a156f 100644
--- a/networking/udhcp/dumpleases.c
+++ b/networking/udhcp/dumpleases.c
@@ -1,6 +1,7 @@
1#include <fcntl.h> 1#include <fcntl.h>
2#include <string.h> 2#include <string.h>
3#include <stdlib.h> 3#include <stdlib.h>
4#include <stdio.h>
4#include <sys/wait.h> 5#include <sys/wait.h>
5#include <arpa/inet.h> 6#include <arpa/inet.h>
6#include <netdb.h> 7#include <netdb.h>
@@ -12,12 +13,32 @@
12#include <time.h> 13#include <time.h>
13 14
14#include "leases.h" 15#include "leases.h"
15#include "busybox.h" 16#include "libbb_udhcp.h"
16 17
17#define REMAINING 0 18#define REMAINING 0
18#define ABSOLUTE 1 19#define ABSOLUTE 1
19 20
21
22#ifndef IN_BUSYBOX
23static void __attribute__ ((noreturn)) show_usage(void)
24{
25 printf(
26"Usage: dumpleases -f <file> -[r|a]\n\n"
27" -f, --file=FILENAME Leases file to load\n"
28" -r, --remaining Interepret lease times as time remaing\n"
29" -a, --absolute Interepret lease times as expire time\n");
30 exit(0);
31}
32#else
33#define show_usage bb_show_usage
34#endif
35
36
37#ifdef IN_BUSYBOX
20int dumpleases_main(int argc, char *argv[]) 38int dumpleases_main(int argc, char *argv[])
39#else
40int main(int argc, char *argv[])
41#endif
21{ 42{
22 FILE *fp; 43 FILE *fp;
23 int i, c, mode = REMAINING; 44 int i, c, mode = REMAINING;
@@ -42,14 +63,14 @@ int dumpleases_main(int argc, char *argv[])
42 case 'a': mode = ABSOLUTE; break; 63 case 'a': mode = ABSOLUTE; break;
43 case 'r': mode = REMAINING; break; 64 case 'r': mode = REMAINING; break;
44 case 'f': 65 case 'f':
45 file = optarg; 66 file = optarg;
46 break; 67 break;
47 default: 68 default:
48 bb_show_usage(); 69 show_usage();
49 } 70 }
50 } 71 }
51 72
52 fp = bb_xfopen(file, "r"); 73 fp = xfopen(file, "r");
53 74
54 printf("Mac Address IP-Address Expires %s\n", mode == REMAINING ? "in" : "at"); 75 printf("Mac Address IP-Address Expires %s\n", mode == REMAINING ? "in" : "at");
55 /* "00:00:00:00:00:00 255.255.255.255 Wed Jun 30 21:49:08 1993" */ 76 /* "00:00:00:00:00:00 255.255.255.255 Wed Jun 30 21:49:08 1993" */