str_list_prev: remove unused function
[oweals/opkg-lede.git] / libbb / libbb.h
index 879786ebae3aceab607082d02c9af428fdadd815..bc1ae21049361913863fc44f52df4552f1c3f36c 100644 (file)
 #include <stdarg.h>
 #include <sys/stat.h>
 #include <sys/types.h>
-
+#include <stdlib.h>
 #include <netdb.h>
 
-#include <features.h>
+#include "../libopkg/opkg_message.h"
 
+#ifndef FALSE
 #define FALSE   ((int) 0)
+#endif
+
+#ifndef TRUE
 #define TRUE    ((int) 1)
+#endif
+
+#define error_msg(fmt, args...) opkg_msg(ERROR, fmt"\n", ##args)
+#define perror_msg(fmt, args...) opkg_perror(ERROR, fmt, ##args)
+#define error_msg_and_die(fmt, args...) \
+       do { \
+               error_msg(fmt, ##args); \
+               exit(EXIT_FAILURE); \
+       } while (0)
+#define perror_msg_and_die(fmt, args...) \
+       do { \
+               perror_msg(fmt, ##args); \
+               exit(EXIT_FAILURE); \
+       } while (0)
 
-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, ...);
-extern void perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn));
 extern void archive_xread_all(int fd, char *buf, size_t count);
 
-/* These two are used internally -- you shouldn't need to use them */
-extern void verror_msg(const char *s, va_list p);
-extern void vperror_msg(const char *s, va_list p);
-
 const char *mode_string(int mode);
 const char *time_string(time_t timeVal);
 
 int copy_file(const char *source, const char *dest, int flags);
-int copy_file_chunk(FILE *src_file, FILE *dst_file, unsigned long long chunksize);
+int copy_file_chunk(FILE * src_file, FILE * dst_file,
+                   unsigned long long chunksize);
 ssize_t safe_read(int fd, void *buf, size_t count);
 ssize_t full_read(int fd, char *buf, int len);
 
-extern int parse_mode( const char* s, mode_t* theMode);
+extern int parse_mode(const char *s, mode_t * theMode);
 
 extern FILE *wfopen(const char *path, const char *mode);
 extern FILE *xfopen(const char *path, const char *mode);
 
-extern void *xmalloc (size_t size);
+extern void *xmalloc(size_t size);
 extern void *xrealloc(void *old, size_t size);
 extern void *xcalloc(size_t nmemb, size_t size);
-extern char *xstrdup (const char *s);
-extern char *xstrndup (const char *s, int n);
+extern char *xstrdup(const char *s);
+extern char *xstrndup(const char *s, int n);
 extern char *safe_strncpy(char *dst, const char *src, size_t size);
 
 char *xreadlink(const char *path);
@@ -93,15 +104,15 @@ enum extract_functions_e {
        extract_exclude_list = 4096
 };
 
-char *deb_extract(const char *package_filename, FILE *out_stream,
-               const int extract_function, const char *prefix,
-               const char *filename, int *err);
+char *deb_extract(const char *package_filename, FILE * out_stream,
+                 const int extract_function, const char *prefix,
+                 const char *filename, int *err);
 
-extern int unzip(FILE *l_in_file, FILE *l_out_file);
-extern void gz_close(int gunzip_pid);
-extern FILE *gz_open(FILE *compressed_file, int *pid);
+extern int unzip(FILE * l_in_file, FILE * l_out_file);
+extern int gz_close(int gunzip_pid);
+extern FILE *gz_open(FILE * compressed_file, int *pid);
 
-int make_directory (const char *path, long mode, int flags);
+int make_directory(const char *path, long mode, int flags);
 
 enum {
        FILEUTILS_PRESERVE_STATUS = 1,
@@ -110,7 +121,4 @@ enum {
        FILEUTILS_FORCE = 8,
 };
 
-extern const char *applet_name;
-extern const char * const memory_exhausted;
-
 #endif /* __LIBBB_H__ */