summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-12-20 19:13:22 (EST)
committer graham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>2009-12-20 19:13:22 (EST)
commit599cc259280ccde97b2a3b459c3f015db6390127 (patch)
tree6447c3ee9a08d4de07f875145ba7b10d8bb103ff
parent46b5b8779dbb8e5e03622fc34dbc943a4400c436 (diff)
Initial stab at untangling the #include maze. Probably needs a second pass.
git-svn-id: http://opkg.googlecode.com/svn/trunk@504 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
-rw-r--r--libopkg/Makefile.am1
-rw-r--r--libopkg/conffile.c5
-rw-r--r--libopkg/conffile.h2
-rw-r--r--libopkg/conffile_list.c2
-rw-r--r--libopkg/file_util.c4
-rw-r--r--libopkg/includes.h46
-rw-r--r--libopkg/nv_pair.c2
-rw-r--r--libopkg/nv_pair_list.c2
-rw-r--r--libopkg/opkg.c5
-rw-r--r--libopkg/opkg_cmd.c5
-rw-r--r--libopkg/opkg_cmd.h2
-rw-r--r--libopkg/opkg_conf.c17
-rw-r--r--libopkg/opkg_conf.h6
-rw-r--r--libopkg/opkg_configure.c3
-rw-r--r--libopkg/opkg_configure.h2
-rw-r--r--libopkg/opkg_download.c5
-rw-r--r--libopkg/opkg_download.h2
-rw-r--r--libopkg/opkg_install.c6
-rw-r--r--libopkg/opkg_message.c2
-rw-r--r--libopkg/opkg_pathfinder.c3
-rw-r--r--libopkg/opkg_remove.c7
-rw-r--r--libopkg/opkg_upgrade.c4
-rw-r--r--libopkg/opkg_utils.c7
-rw-r--r--libopkg/pkg.c16
-rw-r--r--libopkg/pkg.h2
-rw-r--r--libopkg/pkg_depends.c5
-rw-r--r--libopkg/pkg_depends.h1
-rw-r--r--libopkg/pkg_dest.c2
-rw-r--r--libopkg/pkg_dest.h2
-rw-r--r--libopkg/pkg_dest_list.c2
-rw-r--r--libopkg/pkg_extract.c4
-rw-r--r--libopkg/pkg_hash.c6
-rw-r--r--libopkg/pkg_hash.h1
-rw-r--r--libopkg/pkg_parse.c5
-rw-r--r--libopkg/pkg_src.c2
-rw-r--r--libopkg/pkg_src_list.c2
-rw-r--r--libopkg/pkg_vec.c3
-rw-r--r--libopkg/sprintf_alloc.c1
-rw-r--r--libopkg/str_list.c1
-rw-r--r--libopkg/void_list.c2
-rw-r--r--libopkg/xregex.c2
-rw-r--r--libopkg/xsystem.c3
-rw-r--r--libopkg/xsystem.h2
-rw-r--r--src/opkg-cl.c6
-rw-r--r--tests/libopkg_test.c5
45 files changed, 68 insertions, 147 deletions
diff --git a/libopkg/Makefile.am b/libopkg/Makefile.am
index bfd6ccf..524df5c 100644
--- a/libopkg/Makefile.am
+++ b/libopkg/Makefile.am
@@ -6,7 +6,6 @@ libopkg_include_HEADERS= *.h
opkg_libcore_sources = \
- includes.h \
opkg.c opkg.h \
opkg_defines.h
opkg_cmd_sources = opkg_cmd.c opkg_cmd.h \
diff --git a/libopkg/conffile.c b/libopkg/conffile.c
index 984a191..bf8b2a5 100644
--- a/libopkg/conffile.c
+++ b/libopkg/conffile.c
@@ -15,15 +15,14 @@
General Public License for more details.
*/
-#include <string.h>
+#include <stdio.h>
#include <stdlib.h>
-#include "includes.h"
#include "opkg_message.h"
-
#include "conffile.h"
#include "file_util.h"
#include "sprintf_alloc.h"
+#include "opkg_conf.h"
int conffile_init(conffile_t *conffile, const char *file_name, const char *md5sum)
{
diff --git a/libopkg/conffile.h b/libopkg/conffile.h
index 5031835..a188c6d 100644
--- a/libopkg/conffile.h
+++ b/libopkg/conffile.h
@@ -21,8 +21,6 @@
#include "nv_pair.h"
typedef struct nv_pair conffile_t;
-#include "opkg_conf.h"
-
int conffile_init(conffile_t *conffile, const char *file_name, const char *md5sum);
void conffile_deinit(conffile_t *conffile);
int conffile_has_been_modified(conffile_t *conffile);
diff --git a/libopkg/conffile_list.c b/libopkg/conffile_list.c
index 61ea55d..1db7790 100644
--- a/libopkg/conffile_list.c
+++ b/libopkg/conffile_list.c
@@ -15,8 +15,6 @@
General Public License for more details.
*/
-#include "includes.h"
-
#include "conffile_list.h"
void conffile_list_init(conffile_list_t *list)
diff --git a/libopkg/file_util.c b/libopkg/file_util.c
index 7e207cd..964473a 100644
--- a/libopkg/file_util.c
+++ b/libopkg/file_util.c
@@ -16,16 +16,16 @@
General Public License for more details.
*/
-#include "includes.h"
+#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
+#include <unistd.h>
#include "sprintf_alloc.h"
#include "file_util.h"
#include "md5.h"
#include "libbb/libbb.h"
-#undef strlen
#if defined HAVE_SHA256
#include "sha256.h"
diff --git a/libopkg/includes.h b/libopkg/includes.h
deleted file mode 100644
index cac9a41..0000000
--- a/libopkg/includes.h
+++ /dev/null
@@ -1,46 +0,0 @@
-#ifndef INCLUDES_H
-#define INCLUDES_H
-
-#include "config.h"
-#include <stdio.h>
-
-#if STDC_HEADERS
-# include <stdlib.h>
-# include <stdarg.h>
-# include <stddef.h>
-# include <ctype.h>
-# include <errno.h>
-#else
-# if HAVE_STDLIB_H
-# include <stdlib.h>
-# endif
-#endif
-
-#if HAVE_REGEX_H
-# include <regex.h>
-#endif
-
-#if HAVE_STRING_H
-# include <string.h>
-#endif
-
-#if HAVE_STRINGS_H
-# include <strings.h>
-#endif
-
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-
-#if HAVE_SYS_WAIT_H
-# include <sys/wait.h>
-#endif
-
-#if HAVE_UNISTD_H
-# include <sys/types.h>
-# include <unistd.h>
-#endif
-
-// #include "replace/replace.h"
-
-#endif
diff --git a/libopkg/nv_pair.c b/libopkg/nv_pair.c
index e475a7c..2728100 100644
--- a/libopkg/nv_pair.c
+++ b/libopkg/nv_pair.c
@@ -15,8 +15,6 @@
General Public License for more details.
*/
-#include "includes.h"
-
#include "nv_pair.h"
#include "libbb/libbb.h"
diff --git a/libopkg/nv_pair_list.c b/libopkg/nv_pair_list.c
index b6c8f8e..8baebb1 100644
--- a/libopkg/nv_pair_list.c
+++ b/libopkg/nv_pair_list.c
@@ -15,8 +15,6 @@
General Public License for more details.
*/
-#include "includes.h"
-
#include "nv_pair.h"
#include "void_list.h"
#include "nv_pair_list.h"
diff --git a/libopkg/opkg.c b/libopkg/opkg.c
index a8f85a9..38a536e 100644
--- a/libopkg/opkg.c
+++ b/libopkg/opkg.c
@@ -15,7 +15,10 @@
General Public License for more details.
*/
-#include <config.h>
+#include "config.h"
+
+#include <stdio.h>
+#include <unistd.h>
#include <fnmatch.h>
#include "opkg.h"
diff --git a/libopkg/opkg_cmd.c b/libopkg/opkg_cmd.c
index 88a0b5f..4d2eb38 100644
--- a/libopkg/opkg_cmd.c
+++ b/libopkg/opkg_cmd.c
@@ -15,11 +15,12 @@
General Public License for more details.
*/
-
-#include "includes.h"
+#include <stdio.h>
#include <dirent.h>
#include <glob.h>
#include <fnmatch.h>
+#include <signal.h>
+#include <unistd.h>
#include "opkg_conf.h"
#include "opkg_cmd.h"
diff --git a/libopkg/opkg_cmd.h b/libopkg/opkg_cmd.h
index 6d2f1ad..9ca42ff 100644
--- a/libopkg/opkg_cmd.h
+++ b/libopkg/opkg_cmd.h
@@ -25,7 +25,7 @@ struct opkg_cmd
const char *name;
int requires_args;
opkg_cmd_fun_t fun;
- uint pfm; /* package field mask */
+ unsigned int pfm; /* package field mask */
};
typedef struct opkg_cmd opkg_cmd_t;
diff --git a/libopkg/opkg_conf.c b/libopkg/opkg_conf.c
index 28321c1..207f7fc 100644
--- a/libopkg/opkg_conf.c
+++ b/libopkg/opkg_conf.c
@@ -16,9 +16,16 @@
General Public License for more details.
*/
-#include "includes.h"
-#include "opkg_conf.h"
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <glob.h>
+#include <unistd.h>
+#include "opkg_conf.h"
+#include "pkg_vec.h"
+#include "pkg.h"
#include "xregex.h"
#include "sprintf_alloc.h"
#include "opkg_message.h"
@@ -26,12 +33,6 @@
#include "opkg_defines.h"
#include "libbb/libbb.h"
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <glob.h>
-
static int lock_fd;
static char *lock_file = NULL;
diff --git a/libopkg/opkg_conf.h b/libopkg/opkg_conf.h
index 52498f5..6b34952 100644
--- a/libopkg/opkg_conf.h
+++ b/libopkg/opkg_conf.h
@@ -21,9 +21,9 @@
typedef struct opkg_conf opkg_conf_t;
extern opkg_conf_t *conf;
+#include <stdarg.h>
+
#include "hash_table.h"
-#include "pkg.h"
-#include "pkg_hash.h"
#include "pkg_src_list.h"
#include "pkg_dest_list.h"
#include "nv_pair_list.h"
@@ -55,7 +55,7 @@ struct opkg_conf
char *tmp_dir;
char *lists_dir;
- uint pfm; /* package field mask */
+ unsigned int pfm; /* package field mask */
/* For libopkg users to capture messages. */
void (*opkg_vmessage)(int, const char *fmt, va_list ap);
diff --git a/libopkg/opkg_configure.c b/libopkg/opkg_configure.c
index 4aca0f0..719da5a 100644
--- a/libopkg/opkg_configure.c
+++ b/libopkg/opkg_configure.c
@@ -15,7 +15,8 @@
General Public License for more details.
*/
-#include "includes.h"
+#include <stdio.h>
+
#include "sprintf_alloc.h"
#include "opkg_configure.h"
#include "opkg_message.h"
diff --git a/libopkg/opkg_configure.h b/libopkg/opkg_configure.h
index 25236ae..ff01ff3 100644
--- a/libopkg/opkg_configure.h
+++ b/libopkg/opkg_configure.h
@@ -18,7 +18,7 @@
#ifndef OPKG_CONFIGURE_H
#define OPKG_CONFIGURE_H
-#include "opkg_conf.h"
+#include "pkg.h"
int opkg_configure(pkg_t *pkg);
diff --git a/libopkg/opkg_download.c b/libopkg/opkg_download.c
index fc97d34..080326c 100644
--- a/libopkg/opkg_download.c
+++ b/libopkg/opkg_download.c
@@ -16,9 +16,12 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
*/
+
#include "config.h"
-#include "includes.h"
+#include <stdio.h>
+#include <unistd.h>
+
#include "opkg_download.h"
#include "opkg_message.h"
diff --git a/libopkg/opkg_download.h b/libopkg/opkg_download.h
index d98a311..24b7bcb 100644
--- a/libopkg/opkg_download.h
+++ b/libopkg/opkg_download.h
@@ -18,7 +18,7 @@
#ifndef OPKG_DOWNLOAD_H
#define OPKG_DOWNLOAD_H
-#include "opkg_conf.h"
+#include "pkg.h"
typedef void (*opkg_download_progress_callback)(int percent, char *url);
typedef int (*curl_progress_func)(void *data, double t, double d, double ultotal, double ulnow);
diff --git a/libopkg/opkg_install.c b/libopkg/opkg_install.c
index 020b691..79bbd3c 100644
--- a/libopkg/opkg_install.c
+++ b/libopkg/opkg_install.c
@@ -15,12 +15,10 @@
General Public License for more details.
*/
-#include "includes.h"
-#include <errno.h>
-#include <dirent.h>
-#include <glob.h>
+#include <stdio.h>
#include <time.h>
#include <signal.h>
+#include <unistd.h>
#include "pkg.h"
#include "pkg_hash.h"
diff --git a/libopkg/opkg_message.c b/libopkg/opkg_message.c
index 81afc97..4a24039 100644
--- a/libopkg/opkg_message.c
+++ b/libopkg/opkg_message.c
@@ -14,8 +14,8 @@
General Public License for more details.
*/
+#include <stdio.h>
-#include "includes.h"
#include "opkg_conf.h"
#include "opkg_message.h"
#include "libbb/libbb.h"
diff --git a/libopkg/opkg_pathfinder.c b/libopkg/opkg_pathfinder.c
index 71c8c11..bf7dab6 100644
--- a/libopkg/opkg_pathfinder.c
+++ b/libopkg/opkg_pathfinder.c
@@ -17,12 +17,11 @@
#include <openssl/ssl.h>
#include <libpathfinder.h>
-
+#include <stdlib.h>
#if defined(HAVE_SSLCURL)
#include <curl/curl.h>
#endif
-#include "includes.h"
#include "libbb/libbb.h"
#include "opkg_message.h"
diff --git a/libopkg/opkg_remove.c b/libopkg/opkg_remove.c
index b5045ea..a866c04 100644
--- a/libopkg/opkg_remove.c
+++ b/libopkg/opkg_remove.c
@@ -15,14 +15,13 @@
General Public License for more details.
*/
-#include "includes.h"
-#include "opkg_message.h"
-
+#include <stdio.h>
#include <glob.h>
+#include <unistd.h>
+#include "opkg_message.h"
#include "opkg_remove.h"
#include "opkg_cmd.h"
-
#include "file_util.h"
#include "sprintf_alloc.h"
#include "libbb/libbb.h"
diff --git a/libopkg/opkg_upgrade.c b/libopkg/opkg_upgrade.c
index 0d4833a..d58a12b 100644
--- a/libopkg/opkg_upgrade.c
+++ b/libopkg/opkg_upgrade.c
@@ -16,7 +16,9 @@
General Public License for more details.
*/
-#include "includes.h"
+#include <stdio.h>
+#include <stdlib.h>
+
#include "opkg_install.h"
#include "opkg_upgrade.h"
#include "opkg_message.h"
diff --git a/libopkg/opkg_utils.c b/libopkg/opkg_utils.c
index d39690e..5ab5227 100644
--- a/libopkg/opkg_utils.c
+++ b/libopkg/opkg_utils.c
@@ -15,18 +15,11 @@
General Public License for more details.
*/
-#include "includes.h"
-#include <errno.h>
#include <ctype.h>
#include <sys/statvfs.h>
-#include "opkg_utils.h"
-#include "pkg.h"
-#include "pkg_hash.h"
#include "libbb/libbb.h"
-void print_pkg_status(pkg_t * pkg, FILE * file);
-
unsigned long
get_available_kbytes(char * filesystem)
{
diff --git a/libopkg/pkg.c b/libopkg/pkg.c
index e541825..bd7e9f8 100644
--- a/libopkg/pkg.c
+++ b/libopkg/pkg.c
@@ -15,12 +15,12 @@
General Public License for more details.
*/
-#include "includes.h"
-#include <ctype.h>
-#include <alloca.h>
+#include "config.h"
+
+#include <stdio.h>
#include <string.h>
-#include <stdbool.h>
-#include <errno.h>
+#include <ctype.h>
+#include <unistd.h>
#include "pkg.h"
@@ -274,15 +274,17 @@ pkg_init_from_file(pkg_t *pkg, const char *filename)
{
int fd, err = 0;
FILE *control_file;
- char *control_path;
+ char *control_path, *tmp;
pkg_init(pkg);
pkg->local_filename = xstrdup(filename);
+ tmp = xstrdup(filename);
sprintf_alloc(&control_path, "%s/%s.control.XXXXXX",
conf->tmp_dir,
- basename(filename));
+ basename(tmp));
+ free(tmp);
fd = mkstemp(control_path);
if (fd == -1) {
opkg_perror(ERROR, "Failed to make temp file %s", control_path);
diff --git a/libopkg/pkg.h b/libopkg/pkg.h
index 81f2f67..4450fd0 100644
--- a/libopkg/pkg.h
+++ b/libopkg/pkg.h
@@ -19,8 +19,6 @@
#define PKG_H
#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
#include "pkg_vec.h"
#include "str_list.h"
diff --git a/libopkg/pkg_depends.c b/libopkg/pkg_depends.c
index 3a7c9ea..0e52d31 100644
--- a/libopkg/pkg_depends.c
+++ b/libopkg/pkg_depends.c
@@ -15,10 +15,9 @@
General Public License for more details.
*/
-#include "includes.h"
-#include <errno.h>
+#include <stdio.h>
#include <ctype.h>
-
+
#include "pkg.h"
#include "opkg_utils.h"
#include "pkg_hash.h"
diff --git a/libopkg/pkg_depends.h b/libopkg/pkg_depends.h
index 402288c..9c5da27 100644
--- a/libopkg/pkg_depends.h
+++ b/libopkg/pkg_depends.h
@@ -20,7 +20,6 @@
#include "pkg.h"
#include "pkg_hash.h"
-#include "includes.h"
enum depend_type {
PREDEPEND,
diff --git a/libopkg/pkg_dest.c b/libopkg/pkg_dest.c
index adc5e1f..d56dd78 100644
--- a/libopkg/pkg_dest.c
+++ b/libopkg/pkg_dest.c
@@ -15,7 +15,7 @@
General Public License for more details.
*/
-#include "includes.h"
+#include <stdio.h>
#include "pkg_dest.h"
#include "file_util.h"
diff --git a/libopkg/pkg_dest.h b/libopkg/pkg_dest.h
index e0840cc..cbc1ce6 100644
--- a/libopkg/pkg_dest.h
+++ b/libopkg/pkg_dest.h
@@ -18,8 +18,6 @@
#ifndef PKG_DEST_H
#define PKG_DEST_H
-#include "includes.h"
-
typedef struct pkg_dest pkg_dest_t;
struct pkg_dest
{
diff --git a/libopkg/pkg_dest_list.c b/libopkg/pkg_dest_list.c
index b117bbb..f5f2e1d 100644
--- a/libopkg/pkg_dest_list.c
+++ b/libopkg/pkg_dest_list.c
@@ -15,7 +15,7 @@
General Public License for more details.
*/
-#include "includes.h"
+#include <stdio.h>
#include "pkg_dest.h"
#include "void_list.h"
diff --git a/libopkg/pkg_extract.c b/libopkg/pkg_extract.c
index fffb993..b7d924c 100644
--- a/libopkg/pkg_extract.c
+++ b/libopkg/pkg_extract.c
@@ -15,11 +15,9 @@
General Public License for more details.
*/
-#include "includes.h"
-#include <errno.h>
+#include <stdio.h>
#include "pkg_extract.h"
-
#include "libbb/libbb.h"
#include "file_util.h"
#include "sprintf_alloc.h"
diff --git a/libopkg/pkg_hash.c b/libopkg/pkg_hash.c
index f5d4782..2fc539e 100644
--- a/libopkg/pkg_hash.c
+++ b/libopkg/pkg_hash.c
@@ -15,11 +15,7 @@
General Public License for more details.
*/
-#include "includes.h"
-#include <errno.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
+#include <stdio.h>
#include "hash_table.h"
#include "pkg.h"
diff --git a/libopkg/pkg_hash.h b/libopkg/pkg_hash.h
index 0ff18aa..d847b73 100644
--- a/libopkg/pkg_hash.h
+++ b/libopkg/pkg_hash.h
@@ -21,7 +21,6 @@
#include "pkg.h"
#include "pkg_src.h"
#include "pkg_dest.h"
-#include "pkg_vec.h"
#include "hash_table.h"
diff --git a/libopkg/pkg_parse.c b/libopkg/pkg_parse.c
index fd5ada5..c35eb1a 100644
--- a/libopkg/pkg_parse.c
+++ b/libopkg/pkg_parse.c
@@ -16,10 +16,9 @@
General Public License for more details.
*/
-#include "includes.h"
-#include <errno.h>
+#include <stdio.h>
#include <ctype.h>
-
+
#include "pkg.h"
#include "opkg_utils.h"
#include "pkg_parse.h"
diff --git a/libopkg/pkg_src.c b/libopkg/pkg_src.c
index b8679c3..690fef6 100644
--- a/libopkg/pkg_src.c
+++ b/libopkg/pkg_src.c
@@ -15,8 +15,6 @@
General Public License for more details.
*/
-#include "includes.h"
-
#include "pkg_src.h"
#include "libbb/libbb.h"
diff --git a/libopkg/pkg_src_list.c b/libopkg/pkg_src_list.c
index 13bff5f..7ad1b41 100644
--- a/libopkg/pkg_src_list.c
+++ b/libopkg/pkg_src_list.c
@@ -15,8 +15,6 @@
General Public License for more details.
*/
-#include "includes.h"
-
#include "pkg_src_list.h"
#include "void_list.h"
#include "libbb/libbb.h"
diff --git a/libopkg/pkg_vec.c b/libopkg/pkg_vec.c
index 51b9bda..e541dcc 100644
--- a/libopkg/pkg_vec.c
+++ b/libopkg/pkg_vec.c
@@ -15,8 +15,9 @@
General Public License for more details.
*/
-#include "includes.h"
+#include <stdio.h>
#include <fnmatch.h>
+
#include "xregex.h"
#include "pkg.h"
#include "opkg_message.h"
diff --git a/libopkg/sprintf_alloc.c b/libopkg/sprintf_alloc.c
index 2e3200b..c55a016 100644
--- a/libopkg/sprintf_alloc.c
+++ b/libopkg/sprintf_alloc.c
@@ -15,7 +15,6 @@
GNU General Public License for more details.
*/
-#include "includes.h"
#include <stdarg.h>
#include "sprintf_alloc.h"
diff --git a/libopkg/str_list.c b/libopkg/str_list.c
index 2323c8e..e99ef37 100644
--- a/libopkg/str_list.c
+++ b/libopkg/str_list.c
@@ -15,7 +15,6 @@
General Public License for more details.
*/
-#include "includes.h"
#include "str_list.h"
#include "libbb/libbb.h"
diff --git a/libopkg/void_list.c b/libopkg/void_list.c
index 04066bf..8248dc1 100644
--- a/libopkg/void_list.c
+++ b/libopkg/void_list.c
@@ -15,8 +15,6 @@
General Public License for more details.
*/
-#include "includes.h"
-
#include "void_list.h"
#include "libbb/libbb.h"
diff --git a/libopkg/xregex.c b/libopkg/xregex.c
index 639e3ef..2808dc6 100644
--- a/libopkg/xregex.c
+++ b/libopkg/xregex.c
@@ -15,8 +15,6 @@
GNU General Public License for more details.
*/
-#include "includes.h"
-
#include "xregex.h"
#include "libbb/libbb.h"
diff --git a/libopkg/xsystem.c b/libopkg/xsystem.c
index fc7db69..ae7ca87 100644
--- a/libopkg/xsystem.c
+++ b/libopkg/xsystem.c
@@ -15,8 +15,9 @@
General Public License for more details.
*/
-#include "includes.h"
+#include <sys/types.h>
#include <sys/wait.h>
+#include <unistd.h>
#include "xsystem.h"
#include "libbb/libbb.h"
diff --git a/libopkg/xsystem.h b/libopkg/xsystem.h
index 3c7a3d2..9bb082d 100644
--- a/libopkg/xsystem.h
+++ b/libopkg/xsystem.h
@@ -18,8 +18,6 @@
#ifndef XSYSTEM_H
#define XSYSTEM_H
-#include <stdlib.h>
-
/* Like system(3), but with error messages printed if the fork fails
or if the child process dies due to an uncaught signal. Also, the
return value is a bit simpler:
diff --git a/src/opkg-cl.c b/src/opkg-cl.c
index 3bbcd42..f1c8f61 100644
--- a/src/opkg-cl.c
+++ b/src/opkg-cl.c
@@ -19,12 +19,10 @@
opkg command line frontend using libopkg
*/
-#include "includes.h"
+#include "config.h"
+#include <stdio.h>
#include <getopt.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
#include "opkg_conf.h"
#include "opkg_cmd.h"
diff --git a/tests/libopkg_test.c b/tests/libopkg_test.c
index 720e3e9..4d82a67 100644
--- a/tests/libopkg_test.c
+++ b/tests/libopkg_test.c
@@ -1,9 +1,10 @@
-#include <opkg.h>
-#include <stdlib.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <libgen.h>
+#include <opkg.h>
+
pkg_t *find_pkg = NULL;