summaryrefslogtreecommitdiff
path: root/networking/udhcp/dumpleases.c
diff options
context:
space:
mode:
authorRuss Dill2003-12-16 02:28:20 +0000
committerRuss Dill2003-12-16 02:28:20 +0000
commit4b77acafa6f8b907903ea4a140b7c4a314ed71b2 (patch)
treeeb9fcbf83020bdcc0f4cfbab13a22384cbec34a7 /networking/udhcp/dumpleases.c
parent7becf5987a1712e1366c6b7d3eeab70f3978a089 (diff)
downloadbusybox-4b77acafa6f8b907903ea4a140b7c4a314ed71b2.zip
busybox-4b77acafa6f8b907903ea4a140b7c4a314ed71b2.tar.gz
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 4c6107c..5cb3a15 100644
--- a/networking/udhcp/dumpleases.c
+++ b/networking/udhcp/dumpleases.c
@@ -1,6 +1,7 @@
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
+#include <stdio.h>
#include <sys/wait.h>
#include <arpa/inet.h>
#include <netdb.h>
@@ -12,12 +13,32 @@
#include <time.h>
#include "leases.h"
-#include "busybox.h"
+#include "libbb_udhcp.h"
#define REMAINING 0
#define ABSOLUTE 1
+
+#ifndef IN_BUSYBOX
+static void __attribute__ ((noreturn)) show_usage(void)
+{
+ printf(
+"Usage: dumpleases -f <file> -[r|a]\n\n"
+" -f, --file=FILENAME Leases file to load\n"
+" -r, --remaining Interepret lease times as time remaing\n"
+" -a, --absolute Interepret lease times as expire time\n");
+ exit(0);
+}
+#else
+#define show_usage bb_show_usage
+#endif
+
+
+#ifdef IN_BUSYBOX
int dumpleases_main(int argc, char *argv[])
+#else
+int main(int argc, char *argv[])
+#endif
{
FILE *fp;
int i, c, mode = REMAINING;
@@ -42,14 +63,14 @@ int dumpleases_main(int argc, char *argv[])
case 'a': mode = ABSOLUTE; break;
case 'r': mode = REMAINING; break;
case 'f':
- file = optarg;
+ file = optarg;
break;
default:
- bb_show_usage();
+ show_usage();
}
}
- fp = bb_xfopen(file, "r");
+ fp = xfopen(file, "r");
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" */