change char *string = "foo" -> char string[] = "foo"
[oweals/busybox.git] / include / libbb.h
1 /* vi: set sw=4 ts=4: */
2 /*
3  * Busybox main internal header file
4  *
5  * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
6  *
7  * Based in part on code from sash, Copyright (c) 1999 by David I. Bell
8  * Permission has been granted to redistribute this code under the GPL.
9  *
10  */
11 #ifndef __LIBBUSYBOX_H__
12 #define __LIBBUSYBOX_H__    1
13
14 #include "bb_config.h"
15 #include "platform.h"
16
17 #include <ctype.h>
18 #include <dirent.h>
19 #include <errno.h>
20 #include <fcntl.h>
21 #include <inttypes.h>
22 #include <malloc.h>
23 #include <netdb.h>
24 #include <setjmp.h>
25 #include <signal.h>
26 #include <stdio.h>
27 #include <stdlib.h>
28 #include <stdarg.h>
29 #include <string.h>
30 #include <strings.h>
31 #include <sys/ioctl.h>
32 #include <sys/mman.h>
33 #include <sys/socket.h>
34 #include <sys/stat.h>
35 #include <sys/statfs.h>
36 #include <sys/time.h>
37 #include <sys/types.h>
38 #include <sys/wait.h>
39 #include <termios.h>
40 #include <time.h>
41 #include <unistd.h>
42 #include <utime.h>
43
44 #ifdef CONFIG_SELINUX
45 #include <selinux/selinux.h>
46 #endif
47
48 #ifdef CONFIG_LOCALE_SUPPORT
49 #include <locale.h>
50 #endif
51
52 #include "pwd_.h"
53 #include "grp_.h"
54 #include "shadow_.h"
55
56 /* Try to pull in PATH_MAX */
57 #include <limits.h>
58 #include <sys/param.h>
59 #ifndef PATH_MAX
60 #define  PATH_MAX         256
61 #endif
62
63 /* Some useful definitions */
64 #undef FALSE
65 #define FALSE   ((int) 0)
66 #undef TRUE
67 #define TRUE    ((int) 1)
68 #undef SKIP
69 #define SKIP    ((int) 2)
70
71 /* for mtab.c */
72 #define MTAB_GETMOUNTPT '1'
73 #define MTAB_GETDEVICE  '2'
74
75 #define BUF_SIZE        8192
76 #define EXPAND_ALLOC    1024
77
78 /* Macros for min/max.  */
79 #ifndef MIN
80 #define MIN(a,b) (((a)<(b))?(a):(b))
81 #endif
82
83 #ifndef MAX
84 #define MAX(a,b) (((a)>(b))?(a):(b))
85 #endif
86
87 /* buffer allocation schemes */
88 #ifdef CONFIG_FEATURE_BUFFERS_GO_ON_STACK
89 #define RESERVE_CONFIG_BUFFER(buffer,len)           char buffer[len]
90 #define RESERVE_CONFIG_UBUFFER(buffer,len) unsigned char buffer[len]
91 #define RELEASE_CONFIG_BUFFER(buffer)      ((void)0)
92 #else
93 #ifdef CONFIG_FEATURE_BUFFERS_GO_IN_BSS
94 #define RESERVE_CONFIG_BUFFER(buffer,len)  static          char buffer[len]
95 #define RESERVE_CONFIG_UBUFFER(buffer,len) static unsigned char buffer[len]
96 #define RELEASE_CONFIG_BUFFER(buffer)      ((void)0)
97 #else
98 #define RESERVE_CONFIG_BUFFER(buffer,len)           char *buffer=xmalloc(len)
99 #define RESERVE_CONFIG_UBUFFER(buffer,len) unsigned char *buffer=xmalloc(len)
100 #define RELEASE_CONFIG_BUFFER(buffer)      free (buffer)
101 #endif
102 #endif
103
104
105 typedef struct llist_s {
106         char *data;
107         struct llist_s *link;
108 } llist_t;
109 extern void llist_add_to(llist_t **old_head, void *data);
110 extern void llist_add_to_end(llist_t **list_head, void *data);
111 extern void *llist_pop(llist_t **elm);
112 extern void llist_free(llist_t *elm, void (*freeit)(void *data));
113
114
115 enum {
116         LOGMODE_NONE = 0,
117         LOGMODE_STDIO = 1<<0,
118         LOGMODE_SYSLOG = 1<<1,
119         LOGMODE_BOTH = LOGMODE_SYSLOG + LOGMODE_STDIO,
120 };
121 extern const char *msg_eol;
122 extern int logmode;
123 extern int die_sleep;
124
125 extern void bb_show_usage(void) ATTRIBUTE_NORETURN ATTRIBUTE_EXTERNALLY_VISIBLE;
126 extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
127 extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
128 extern void bb_perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
129 extern void bb_perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
130 extern void bb_vherror_msg(const char *s, va_list p);
131 extern void bb_herror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
132 extern void bb_herror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
133
134 extern void bb_perror_nomsg_and_die(void) ATTRIBUTE_NORETURN;
135 extern void bb_perror_nomsg(void);
136
137 extern void bb_info_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
138
139 /* These two are used internally -- you shouldn't need to use them */
140 extern void bb_verror_msg(const char *s, va_list p, const char *strerr) __attribute__ ((format (printf, 1, 0)));
141 extern void bb_vperror_msg(const char *s, va_list p)  __attribute__ ((format (printf, 1, 0)));
142 extern void bb_vinfo_msg(const char *s, va_list p) __attribute__ ((format (printf, 1, 0)));
143
144 extern int bb_echo(int argc, char** argv);
145 extern int bb_test(int argc, char** argv);
146
147 extern const char *bb_mode_string(int mode);
148 extern int is_directory(const char *name, int followLinks, struct stat *statBuf);
149 extern DIR *warn_opendir(const char *path);
150 extern DIR *xopendir(const char *path);
151
152 extern int remove_file(const char *path, int flags);
153 extern int copy_file(const char *source, const char *dest, int flags);
154 extern ssize_t safe_read(int fd, void *buf, size_t count);
155 extern ssize_t full_read(int fd, void *buf, size_t len);
156 extern ssize_t safe_write(int fd, const void *buf, size_t count);
157 extern ssize_t full_write(int fd, const void *buf, size_t len);
158 extern int recursive_action(const char *fileName, int recurse,
159           int followLinks, int depthFirst,
160           int (*fileAction) (const char *fileName, struct stat* statbuf, void* userData),
161           int (*dirAction) (const char *fileName, struct stat* statbuf, void* userData),
162           void* userData);
163
164 extern int bb_parse_mode( const char* s, mode_t* theMode);
165 extern long bb_xgetlarg(const char *arg, int base, long lower, long upper);
166
167 extern unsigned int tty_baud_to_value(speed_t speed);
168 extern speed_t tty_value_to_baud(unsigned int value);
169
170 extern int get_linux_version_code(void);
171
172 extern int get_console_fd(void);
173 extern struct mntent *find_mount_point(const char *name, const char *table);
174 extern void erase_mtab(const char * name);
175 extern long *find_pid_by_name( const char* pidName);
176 extern long *pidlist_reverse(long *pidList);
177 extern char *find_block_device(char *path);
178 extern char *bb_get_line_from_file(FILE *file);
179 extern char *bb_get_chomped_line_from_file(FILE *file);
180 extern char *bb_get_chunk_from_file(FILE *file, int *end);
181 extern int bb_copyfd_size(int fd1, int fd2, const off_t size);
182 extern int bb_copyfd_eof(int fd1, int fd2);
183 extern char  bb_process_escape_sequence(const char **ptr);
184 extern char *bb_get_last_path_component(char *path);
185 extern FILE *bb_wfopen(const char *path, const char *mode);
186 extern FILE *bb_wfopen_input(const char *filename);
187 extern FILE *xfopen(const char *path, const char *mode);
188
189 extern int   bb_fclose_nonstdin(FILE *f);
190 extern void  bb_fflush_stdout_and_exit(int retval) ATTRIBUTE_NORETURN;
191
192 extern void xstat(char *filename, struct stat *buf);
193 extern int  xsocket(int domain, int type, int protocol);
194 extern pid_t spawn(char **argv);
195 extern pid_t xspawn(char **argv);
196 extern int wait4pid(int pid);
197 extern void xdaemon(int nochdir, int noclose);
198 extern void xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen);
199 extern void xlisten(int s, int backlog);
200 extern void xchdir(const char *path);
201 extern void utoa_to_buf(unsigned n, char *buf, unsigned buflen);
202 extern char *utoa(unsigned n);
203 extern void itoa_to_buf(int n, char *buf, unsigned buflen);
204 extern char *itoa(int n);
205 extern void xsetgid(gid_t gid);
206 extern void xsetuid(uid_t uid);
207 extern off_t fdlength(int fd);
208
209 #define BB_GETOPT_ERROR 0x80000000UL
210 extern const char *bb_opt_complementally;
211 extern const struct option *bb_applet_long_options;
212 extern unsigned long bb_getopt_ulflags(int argc, char **argv, const char *applet_opts, ...);
213
214 extern int bb_vfprintf(FILE * __restrict stream, const char * __restrict format,
215                                            va_list arg) __attribute__ ((format (printf, 2, 0)));
216 extern int bb_vprintf(const char * __restrict format, va_list arg)
217         __attribute__ ((format (printf, 1, 0)));
218 extern int bb_fprintf(FILE * __restrict stream, const char * __restrict format, ...)
219         __attribute__ ((format (printf, 2, 3)));
220 extern int bb_printf(const char * __restrict format, ...)
221         __attribute__ ((format (printf, 1, 2)));
222
223 extern void xferror(FILE *fp, const char *fn);
224 extern void xferror_stdout(void);
225 extern void xfflush_stdout(void);
226
227 extern void bb_warn_ignoring_args(int n);
228
229 extern void chomp(char *s);
230 extern void trim(char *s);
231 extern char *skip_whitespace(const char *);
232
233 #ifndef BUILD_INDIVIDUAL
234 extern struct BB_applet *find_applet_by_name(const char *name);
235 void run_applet_by_name(const char *name, int argc, char **argv);
236 #endif
237
238 /* dmalloc will redefine these to it's own implementation. It is safe
239  * to have the prototypes here unconditionally.  */
240 extern void *xmalloc(size_t size);
241 extern void *xrealloc(void *old, size_t size);
242 extern void *xzalloc(size_t size);
243
244 extern char *xstrdup (const char *s);
245 extern char *xstrndup (const char *s, int n);
246 extern char *safe_strncpy(char *dst, const char *src, size_t size);
247 extern int safe_strtoi(char *arg, int* value);
248 extern int safe_strtod(char *arg, double* value);
249 extern int safe_strtol(char *arg, long* value);
250 extern int safe_strtoul(char *arg, unsigned long* value);
251
252 struct suffix_mult {
253         const char *suffix;
254         unsigned int mult;
255 };
256
257 extern unsigned long bb_xgetularg_bnd_sfx(const char *arg, int base,
258                                                                                   unsigned long lower,
259                                                                                   unsigned long upper,
260                                                                                   const struct suffix_mult *suffixes);
261 extern unsigned long bb_xgetularg_bnd(const char *arg, int base,
262                                                                           unsigned long lower,
263                                                                           unsigned long upper);
264 extern unsigned long bb_xgetularg10_bnd(const char *arg,
265                                                                                 unsigned long lower,
266                                                                                 unsigned long upper);
267 extern unsigned long bb_xgetularg10(const char *arg);
268
269 extern long bb_xgetlarg_bnd_sfx(const char *arg, int base,
270                                                                 long lower,
271                                                                 long upper,
272                                                                 const struct suffix_mult *suffixes);
273 extern long bb_xgetlarg10_sfx(const char *arg, const struct suffix_mult *suffixes);
274
275
276 extern unsigned long bb_xparse_number(const char *numstr,
277                 const struct suffix_mult *suffixes);
278
279
280 /* These parse entries in /etc/passwd and /etc/group.  This is desirable
281  * for BusyBox since we want to avoid using the glibc NSS stuff, which
282  * increases target size and is often not needed on embedded systems.  */
283 extern long bb_xgetpwnam(const char *name);
284 extern long bb_xgetgrnam(const char *name);
285 extern char * bb_getug(char *buffer, char *idname, long id, int bufsize, char prefix);
286 extern char * bb_getpwuid(char *name, long uid, int bufsize);
287 extern char * bb_getgrgid(char *group, long gid, int bufsize);
288 extern char *bb_askpass(int timeout, const char * prompt);
289
290 extern int device_open(const char *device, int mode);
291
292 extern char *query_loop(const char *device);
293 extern int del_loop(const char *device);
294 extern int set_loop(char **device, const char *file, int offset);
295
296 #if (__GLIBC__ < 2)
297 extern int vdprintf(int d, const char *format, va_list ap);
298 #endif
299
300 /* Include our own copy of struct sysinfo to avoid binary compatibility
301  * problems with Linux 2.4, which changed things.  Grumble, grumble. */
302 struct sysinfo {
303         long uptime;                    /* Seconds since boot */
304         unsigned long loads[3];         /* 1, 5, and 15 minute load averages */
305         unsigned long totalram;         /* Total usable main memory size */
306         unsigned long freeram;          /* Available memory size */
307         unsigned long sharedram;        /* Amount of shared memory */
308         unsigned long bufferram;        /* Memory used by buffers */
309         unsigned long totalswap;        /* Total swap space size */
310         unsigned long freeswap;         /* swap space still available */
311         unsigned short procs;           /* Number of current processes */
312         unsigned short pad;                     /* Padding needed for m68k */
313         unsigned long totalhigh;        /* Total high memory size */
314         unsigned long freehigh;         /* Available high memory size */
315         unsigned int mem_unit;          /* Memory unit size in bytes */
316         char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
317 };
318 extern int sysinfo (struct sysinfo* info);
319
320 enum {
321         KILOBYTE = 1024,
322         MEGABYTE = (KILOBYTE*1024),
323         GIGABYTE = (MEGABYTE*1024)
324 };
325 const char *make_human_readable_str(unsigned long long size,
326                 unsigned long block_size, unsigned long display_unit);
327
328 int bb_ask_confirmation(void);
329 int klogctl(int type, char * b, int len);
330
331 char *xgetcwd(char *cwd);
332 char *xreadlink(const char *path);
333 char *concat_path_file(const char *path, const char *filename);
334 char *concat_subpath_file(const char *path, const char *filename);
335 char *last_char_is(const char *s, int c);
336
337 char *fgets_str(FILE *file, const char *terminating_string);
338
339 extern int uncompress(int fd_in, int fd_out);
340 extern int inflate(int in, int out);
341
342 extern struct hostent *xgethostbyname(const char *name);
343 extern struct hostent *xgethostbyname2(const char *name, int af);
344 extern int create_icmp_socket(void);
345 extern int create_icmp6_socket(void);
346 extern int xconnect(struct sockaddr_in *s_addr);
347 extern unsigned short bb_lookup_port(const char *port, const char *protocol, unsigned short default_port);
348 extern void bb_lookup_host(struct sockaddr_in *s_in, const char *host);
349
350 // This is declared here rather than #including <libgen.h> in order to avoid
351 // confusing the two versions of basename.  See the dirname/basename man page
352 // for details.
353 char *dirname (char *path);
354
355 int bb_make_directory (char *path, long mode, int flags);
356
357 int get_signum(char *name);
358 char *get_signame(int number);
359
360 char *bb_simplify_path(const char *path);
361
362 enum {  /* DO NOT CHANGE THESE VALUES!  cp.c depends on them. */
363         FILEUTILS_PRESERVE_STATUS = 1,
364         FILEUTILS_DEREFERENCE = 2,
365         FILEUTILS_RECUR = 4,
366         FILEUTILS_FORCE = 8,
367         FILEUTILS_INTERACTIVE = 16
368 };
369
370 extern const char *bb_applet_name;
371
372 extern const char bb_msg_full_version[];
373 extern const char bb_msg_memory_exhausted[];
374 extern const char bb_msg_invalid_date[];
375 extern const char bb_msg_io_error[];
376 extern const char bb_msg_read_error[];
377 extern const char bb_msg_write_error[];
378 extern const char bb_msg_name_longer_than_foo[];
379 extern const char bb_msg_unknown[];
380 extern const char bb_msg_can_not_create_raw_socket[];
381 extern const char bb_msg_perm_denied_are_you_root[];
382 extern const char bb_msg_requires_arg[];
383 extern const char bb_msg_invalid_arg[];
384 extern const char bb_msg_standard_input[];
385 extern const char bb_msg_standard_output[];
386
387 extern const char bb_path_nologin_file[];
388 extern const char bb_path_passwd_file[];
389 extern const char bb_path_shadow_file[];
390 extern const char bb_path_gshadow_file[];
391 extern const char bb_path_group_file[];
392 extern const char bb_path_securetty_file[];
393 extern const char bb_path_motd_file[];
394 extern const char bb_path_wtmp_file[];
395 extern const char bb_dev_null[];
396
397 #ifndef BUFSIZ
398 #define BUFSIZ 4096
399 #endif
400 extern char bb_common_bufsiz1[BUFSIZ+1];
401
402 /*
403  * You can change LIBBB_DEFAULT_LOGIN_SHELL, but don`t use,
404  * use bb_default_login_shell and next defines,
405  * if you LIBBB_DEFAULT_LOGIN_SHELL change,
406  * don`t lose change increment constant!
407  */
408 #define LIBBB_DEFAULT_LOGIN_SHELL      "-/bin/sh"
409
410 extern const char bb_default_login_shell[];
411 /* "/bin/sh" */
412 #define DEFAULT_SHELL     (bb_default_login_shell+1)
413 /* "sh" */
414 #define DEFAULT_SHELL_SHORT_NAME     (bb_default_login_shell+6)
415
416
417 extern const char bb_path_mtab_file[];
418
419 extern int bb_default_error_retval;
420
421 #ifdef CONFIG_FEATURE_DEVFS
422 # define CURRENT_VC "/dev/vc/0"
423 # define VC_1 "/dev/vc/1"
424 # define VC_2 "/dev/vc/2"
425 # define VC_3 "/dev/vc/3"
426 # define VC_4 "/dev/vc/4"
427 # define VC_5 "/dev/vc/5"
428 #if defined(__sh__) || defined(__H8300H__) || defined(__H8300S__)
429 /* Yes, this sucks, but both SH (including sh64) and H8 have a SCI(F) for their
430    respective serial ports .. as such, we can't use the common device paths for
431    these. -- PFM */
432 #  define SC_0 "/dev/ttsc/0"
433 #  define SC_1 "/dev/ttsc/1"
434 #  define SC_FORMAT "/dev/ttsc/%d"
435 #else
436 #  define SC_0 "/dev/tts/0"
437 #  define SC_1 "/dev/tts/1"
438 #  define SC_FORMAT "/dev/tts/%d"
439 #endif
440 # define VC_FORMAT "/dev/vc/%d"
441 # define LOOP_FORMAT "/dev/loop/%d"
442 # define FB_0 "/dev/fb/0"
443 #else
444 # define CURRENT_VC "/dev/tty0"
445 # define VC_1 "/dev/tty1"
446 # define VC_2 "/dev/tty2"
447 # define VC_3 "/dev/tty3"
448 # define VC_4 "/dev/tty4"
449 # define VC_5 "/dev/tty5"
450 #if defined(__sh__) || defined(__H8300H__) || defined(__H8300S__)
451 #  define SC_0 "/dev/ttySC0"
452 #  define SC_1 "/dev/ttySC1"
453 #  define SC_FORMAT "/dev/ttySC%d"
454 #else
455 #  define SC_0 "/dev/ttyS0"
456 #  define SC_1 "/dev/ttyS1"
457 #  define SC_FORMAT "/dev/ttyS%d"
458 #endif
459 # define VC_FORMAT "/dev/tty%d"
460 # define LOOP_FORMAT "/dev/loop%d"
461 # define FB_0 "/dev/fb0"
462 #endif
463
464
465 /* The following devices are the same on devfs and non-devfs systems.  */
466 #define CURRENT_TTY "/dev/tty"
467 #define CONSOLE_DEV "/dev/console"
468
469 int is_in_ino_dev_hashtable(const struct stat *statbuf, char **name);
470 void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name);
471 void reset_ino_dev_hashtable(void);
472
473 char *xasprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
474 void xprint_and_close_file(FILE *file);
475
476 #define FAIL_DELAY    3
477 extern void bb_do_delay(int seconds);
478 extern void change_identity(const struct passwd *pw);
479 extern const char *change_identity_e2str(const struct passwd *pw);
480 extern void run_shell(const char *shell, int loginshell, const char *command, const char **additional_args);
481 #ifdef CONFIG_SELINUX
482 extern void renew_current_security_context(void);
483 extern void set_current_security_context(security_context_t sid);
484 #endif
485 extern int run_parts(char **args, const unsigned char test_mode, char **env);
486 extern int restricted_shell ( const char *shell );
487 extern void setup_environment ( const char *shell, int loginshell, int changeenv, const struct passwd *pw );
488 extern int correct_password ( const struct passwd *pw );
489 extern char *pw_encrypt(const char *clear, const char *salt);
490 extern int obscure(const char *old, const char *newval, const struct passwd *pwdp);
491
492 extern int xopen(const char *pathname, int flags);
493 extern int xopen3(const char *pathname, int flags, int mode);
494 extern void xread(int fd, void *buf, size_t count);
495 extern unsigned char xread_char(int fd);
496 extern void xlseek(int fd, off_t offset, int whence);
497 extern void xwrite(int fd, void *buf, size_t count);
498
499 extern const char bb_uuenc_tbl_base64[];
500 extern const char bb_uuenc_tbl_std[];
501 extern void bb_uuencode(const unsigned char *s, char *store, const int length, const char *tbl);
502
503 #ifndef COMM_LEN
504 #ifdef TASK_COMM_LEN
505 #define COMM_LEN TASK_COMM_LEN
506 #else
507 /* synchronize with sizeof(task_struct.comm) in /usr/include/linux/sched.h */
508 #define COMM_LEN 16
509 #endif
510 #endif
511 typedef struct {
512         int pid;
513         char user[9];
514         char state[4];
515         unsigned long rss;
516         int ppid;
517 #ifdef CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE
518         unsigned pcpu;
519         unsigned pscpu;
520         unsigned long stime, utime;
521 #endif
522         char *cmd;
523
524         /* basename of executable file in call to exec(2),
525                 size from kernel headers */
526         char short_cmd[COMM_LEN];
527 } procps_status_t;
528
529 extern procps_status_t * procps_scan(int save_user_arg0);
530 extern int compare_string_array(const char * const string_array[], const char *key);
531
532 extern void print_login_issue(const char *issue_file, const char *tty);
533 extern void print_login_prompt(void);
534
535 #ifdef BB_NOMMU
536 extern void vfork_daemon(int nochdir, int noclose);
537 extern void vfork_daemon_rexec(int nochdir, int noclose,
538                 int argc, char **argv, char *foreground_opt);
539 #endif
540
541 extern int get_terminal_width_height(int fd, int *width, int *height);
542 extern unsigned long get_ug_id(const char *s, long (*__bb_getxxnam)(const char *));
543
544 typedef struct _sha1_ctx_t_ {
545         uint32_t count[2];
546         uint32_t hash[5];
547         uint32_t wbuf[16];
548 } sha1_ctx_t;
549
550 void sha1_begin(sha1_ctx_t *ctx);
551 void sha1_hash(const void *data, size_t length, sha1_ctx_t *ctx);
552 void *sha1_end(void *resbuf, sha1_ctx_t *ctx);
553
554 typedef struct _md5_ctx_t_ {
555         uint32_t A;
556         uint32_t B;
557         uint32_t C;
558         uint32_t D;
559         uint64_t total;
560         uint32_t buflen;
561         char buffer[128];
562 } md5_ctx_t;
563
564 void md5_begin(md5_ctx_t *ctx);
565 void md5_hash(const void *data, size_t length, md5_ctx_t *ctx);
566 void *md5_end(void *resbuf, md5_ctx_t *ctx);
567
568 extern uint32_t *crc32_filltable (int endian);
569
570 #ifndef RB_POWER_OFF
571 /* Stop system and switch power off if possible.  */
572 #define RB_POWER_OFF   0x4321fedc
573 #endif
574
575 extern const char BB_BANNER[];
576
577 // Make sure we call functions instead of macros.
578 #undef isalnum
579 #undef isalpha
580 #undef isascii
581 #undef isblank
582 #undef iscntrl
583 #undef isdigit
584 #undef isgraph
585 #undef islower
586 #undef isprint
587 #undef ispunct
588 #undef isspace
589 #undef isupper
590 #undef isxdigit
591
592 #ifdef DMALLOC
593 #include <dmalloc.h>
594 #endif
595
596 #endif /* __LIBBUSYBOX_H__ */