A small cleanup by Vladimir
[oweals/busybox.git] / busybox.h
index fc5e8d8744f2eb5797a6282fb96376315725bd9a..aef537b2b516206e47fc8bf436bf1491fa723a4e 100644 (file)
--- a/busybox.h
+++ b/busybox.h
@@ -72,7 +72,7 @@ struct BB_applet {
        const   char*   name;
        int     (*main)(int argc, char** argv);
        enum    Location        location;
-       const   char*   usage;
+       int     usage_index;
 };
 /* From busybox.c */
 extern const struct BB_applet applets[];
@@ -87,9 +87,15 @@ extern const struct BB_applet applets[];
 #include "applets.h"
 #undef PROTOTYPES
 
+#define APPLET_ENUM
+enum APPLET_INDEX_NUMBERS {
+#include "applets.h"
+};
+#undef APPLET_ENUM
+
 extern const char *applet_name;
 
-extern void usage(const char *usage) __attribute__ ((noreturn));
+extern void show_usage(void) __attribute__ ((noreturn));
 extern void error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
 extern void error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
 extern void perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
@@ -153,6 +159,7 @@ extern FILE *wfopen(const char *path, const char *mode);
 extern FILE *xfopen(const char *path, const char *mode);
 extern void chomp(char *s);
 extern struct BB_applet *find_applet_by_name(const char *name);
+void run_applet_by_name(const char *name, int argc, char **argv);
 
 #ifndef DMALLOC
 extern void *xmalloc (size_t size);
@@ -161,13 +168,15 @@ extern void *xcalloc(size_t nmemb, size_t size);
 extern char *xstrdup (const char *s);
 #endif
 extern char *xstrndup (const char *s, int n);
+extern char * safe_strncpy(char *dst, const char *src, size_t size);
 
 struct suffix_mult {
        char *suffix;
        int mult;
 };
 
-extern unsigned long parse_number(const char *numstr, struct suffix_mult *suffixes);
+extern unsigned long parse_number(const char *numstr,
+               const struct suffix_mult *suffixes);
 
 
 /* These parse entries in /etc/passwd and /etc/group.  This is desirable
@@ -231,7 +240,7 @@ extern int sysinfo (struct sysinfo* info);
 #endif
 
 #ifdef BB_FEATURE_HUMAN_READABLE
-char *format(unsigned long val, unsigned long hr);
+const char *format(unsigned long val, unsigned long hr);
 #define KILOBYTE 1024
 #define MEGABYTE (KILOBYTE*1024)
 #define GIGABYTE (MEGABYTE*1024)