Russ Dill | 61fb489 | 2002-10-14 21:41:28 +0000 | [diff] [blame] | 1 | /* libbb_udhcp.h - busybox compatability wrapper */ |
| 2 | |
| 3 | #ifndef _LIBBB_UDHCP_H |
| 4 | #define _LIBBB_UDHCP_H |
| 5 | |
Russ Dill | 54fde9e | 2002-12-11 22:43:37 +0000 | [diff] [blame] | 6 | #ifdef IN_BUSYBOX |
Russ Dill | 4b77aca | 2003-12-16 02:28:20 +0000 | [diff] [blame^] | 7 | #include "busybox.h" |
Russ Dill | 61fb489 | 2002-10-14 21:41:28 +0000 | [diff] [blame] | 8 | |
| 9 | #ifdef CONFIG_FEATURE_UDHCP_SYSLOG |
| 10 | #define SYSLOG |
| 11 | #endif |
| 12 | |
| 13 | #ifdef CONFIG_FEATURE_UDHCP_DEBUG |
| 14 | #define DEBUG |
| 15 | #endif |
| 16 | |
| 17 | #define COMBINED_BINARY |
Russ Dill | da97085 | 2002-11-05 20:10:21 +0000 | [diff] [blame] | 18 | #include "version.h" |
Russ Dill | 61fb489 | 2002-10-14 21:41:28 +0000 | [diff] [blame] | 19 | |
Russ Dill | 4b77aca | 2003-12-16 02:28:20 +0000 | [diff] [blame^] | 20 | #ifdef CONFIG_INSTALL_NO_USR |
| 21 | #define DEFAULT_SCRIPT "/share/udhcpc/default.script" |
| 22 | #else |
| 23 | #define DEFAULT_SCRIPT "/usr/share/udhcpc/default.script" |
| 24 | #endif |
| 25 | |
| 26 | #define xfopen bb_xfopen |
| 27 | |
Russ Dill | 61fb489 | 2002-10-14 21:41:28 +0000 | [diff] [blame] | 28 | #else /* ! BB_VER */ |
| 29 | |
Russ Dill | 4b77aca | 2003-12-16 02:28:20 +0000 | [diff] [blame^] | 30 | #include <stdlib.h> |
| 31 | #include <stdio.h> |
| 32 | |
Russ Dill | 61fb489 | 2002-10-14 21:41:28 +0000 | [diff] [blame] | 33 | #define TRUE 1 |
| 34 | #define FALSE 0 |
| 35 | |
| 36 | #define xmalloc malloc |
Russ Dill | 4b77aca | 2003-12-16 02:28:20 +0000 | [diff] [blame^] | 37 | #define xcalloc calloc |
| 38 | |
| 39 | #define DEFAULT_SCRIPT "/usr/share/udhcpc/default.script" |
| 40 | |
| 41 | static inline FILE *xfopen(const char *file, const char *mode) |
| 42 | { |
| 43 | FILE *fp; |
| 44 | if (!(fp = fopen(file, mode))) { |
| 45 | perror("could not open input file"); |
| 46 | exit(0); |
| 47 | } |
| 48 | return fp; |
| 49 | } |
Russ Dill | 61fb489 | 2002-10-14 21:41:28 +0000 | [diff] [blame] | 50 | |
| 51 | #endif /* BB_VER */ |
| 52 | |
| 53 | #endif /* _LIBBB_UDHCP_H */ |