diff options
author | erik <erik@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2000-04-28 00:18:56 +0000 |
---|---|---|
committer | erik <erik@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2000-04-28 00:18:56 +0000 |
commit | 623d40315b6ba428a8f56adce8fea6e4c5a52d24 (patch) | |
tree | d986e9bb9f03bf1f83465c274c35c0d58ed544e4 /internal.h | |
parent | 2c7baef120eb02dd71fc71c1864a17214036a49f (diff) | |
download | busybox-w32-623d40315b6ba428a8f56adce8fea6e4c5a52d24.tar.gz busybox-w32-623d40315b6ba428a8f56adce8fea6e4c5a52d24.tar.bz2 busybox-w32-623d40315b6ba428a8f56adce8fea6e4c5a52d24.zip |
Latest and greatest. Some effort at libc5 (aiming towards newlib)
compatability.
-Erik
git-svn-id: svn://busybox.net/trunk/busybox@499 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'internal.h')
-rw-r--r-- | internal.h | 63 |
1 files changed, 41 insertions, 22 deletions
diff --git a/internal.h b/internal.h index 1c267cbbb..a81651bec 100644 --- a/internal.h +++ b/internal.h | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <string.h> | 31 | #include <string.h> |
32 | #include <unistd.h> | 32 | #include <unistd.h> |
33 | #include <sys/stat.h> | 33 | #include <sys/stat.h> |
34 | //#include <sys/param.h> | 34 | #include <sys/param.h> |
35 | #include <mntent.h> | 35 | #include <mntent.h> |
36 | 36 | ||
37 | 37 | ||
@@ -52,6 +52,36 @@ | |||
52 | #define isOctal(ch) (((ch) >= '0') && ((ch) <= '7')) | 52 | #define isOctal(ch) (((ch) >= '0') && ((ch) <= '7')) |
53 | #define isWildCard(ch) (((ch) == '*') || ((ch) == '?') || ((ch) == '[')) | 53 | #define isWildCard(ch) (((ch) == '*') || ((ch) == '?') || ((ch) == '[')) |
54 | 54 | ||
55 | /* Macros for min/max. */ | ||
56 | #ifndef MIN | ||
57 | #define MIN(a,b) (((a)<(b))?(a):(b)) | ||
58 | #endif | ||
59 | |||
60 | #ifndef MAX | ||
61 | #define MAX(a,b) (((a)>(b))?(a):(b)) | ||
62 | #endif | ||
63 | |||
64 | |||
65 | /* I don't like nested includes, but the string and io functions are used | ||
66 | * too often | ||
67 | */ | ||
68 | #include <stdio.h> | ||
69 | #if !defined(NO_STRING_H) || defined(STDC_HEADERS) | ||
70 | # include <string.h> | ||
71 | # if !defined(STDC_HEADERS) && !defined(NO_MEMORY_H) && !defined(__GNUC__) | ||
72 | # include <memory.h> | ||
73 | # endif | ||
74 | # define memzero(s, n) memset ((void *)(s), 0, (n)) | ||
75 | #else | ||
76 | # include <strings.h> | ||
77 | # define strchr index | ||
78 | # define strrchr rindex | ||
79 | # define memcpy(d, s, n) bcopy((s), (d), (n)) | ||
80 | # define memcmp(s1, s2, n) bcmp((s1), (s2), (n)) | ||
81 | # define memzero(s, n) bzero((s), (n)) | ||
82 | #endif | ||
83 | |||
84 | |||
55 | enum Location { | 85 | enum Location { |
56 | _BB_DIR_ROOT = 0, | 86 | _BB_DIR_ROOT = 0, |
57 | _BB_DIR_BIN, | 87 | _BB_DIR_BIN, |
@@ -136,6 +166,7 @@ extern int rmdir_main(int argc, char **argv); | |||
136 | extern int rmmod_main(int argc, char** argv); | 166 | extern int rmmod_main(int argc, char** argv); |
137 | extern int sed_main(int argc, char** argv); | 167 | extern int sed_main(int argc, char** argv); |
138 | extern int sfdisk_main(int argc, char** argv); | 168 | extern int sfdisk_main(int argc, char** argv); |
169 | extern int setkeycodes_main(int argc, char** argv); | ||
139 | extern int shell_main(int argc, char** argv); | 170 | extern int shell_main(int argc, char** argv); |
140 | extern int sleep_main(int argc, char** argv); | 171 | extern int sleep_main(int argc, char** argv); |
141 | extern int sort_main(int argc, char** argv); | 172 | extern int sort_main(int argc, char** argv); |
@@ -243,27 +274,15 @@ int nfsmount(const char *spec, const char *node, unsigned long *flags, | |||
243 | #endif | 274 | #endif |
244 | 275 | ||
245 | #if defined (BB_FSCK_MINIX) || defined (BB_MKFS_MINIX) | 276 | #if defined (BB_FSCK_MINIX) || defined (BB_MKFS_MINIX) |
246 | 277 | /* Bit map related macros. */ | |
247 | static inline int bit(char * addr,unsigned int nr) | 278 | #ifndef setbit |
248 | { | 279 | #define CHAR_BITS 8 /* Number of bits in a `char'. */ |
249 | return (addr[nr >> 3] & (1<<(nr & 7))) != 0; | 280 | #define setbit(a,i) ((a)[(i)/CHAR_BITS] |= 1<<((i)%CHAR_BITS)) |
250 | } | 281 | #define clrbit(a,i) ((a)[(i)/CHAR_BITS] &= ~(1<<((i)%CHAR_BITS))) |
251 | 282 | #define isset(a,i) ((a)[(i)/CHAR_BITS] & (1<<((i)%CHAR_BITS))) | |
252 | static inline int setbit(char * addr,unsigned int nr) | 283 | #define isclr(a,i) (((a)[(i)/CHAR_BITS] & (1<<((i)%CHAR_BITS))) == 0) |
253 | { | 284 | #endif |
254 | int __res = bit(addr, nr); | 285 | #endif |
255 | addr[nr >> 3] |= (1<<(nr & 7)); | ||
256 | return __res != 0; | ||
257 | } | ||
258 | |||
259 | static inline int clrbit(char * addr,unsigned int nr) | ||
260 | { | ||
261 | int __res = bit(addr, nr); | ||
262 | addr[nr >> 3] &= ~(1<<(nr & 7)); | ||
263 | return __res != 0; | ||
264 | } | ||
265 | |||
266 | #endif /* inline bitops junk */ | ||
267 | 286 | ||
268 | 287 | ||
269 | #ifndef RB_POWER_OFF | 288 | #ifndef RB_POWER_OFF |