Initial stab at untangling the #include maze. Probably needs a second pass.
authorgraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Mon, 21 Dec 2009 00:13:22 +0000 (00:13 +0000)
committergraham.gower <graham.gower@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Mon, 21 Dec 2009 00:13:22 +0000 (00:13 +0000)
git-svn-id: http://opkg.googlecode.com/svn/trunk@504 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

45 files changed:
libopkg/Makefile.am
libopkg/conffile.c
libopkg/conffile.h
libopkg/conffile_list.c
libopkg/file_util.c
libopkg/includes.h [deleted file]
libopkg/nv_pair.c
libopkg/nv_pair_list.c
libopkg/opkg.c
libopkg/opkg_cmd.c
libopkg/opkg_cmd.h
libopkg/opkg_conf.c
libopkg/opkg_conf.h
libopkg/opkg_configure.c
libopkg/opkg_configure.h
libopkg/opkg_download.c
libopkg/opkg_download.h
libopkg/opkg_install.c
libopkg/opkg_message.c
libopkg/opkg_pathfinder.c
libopkg/opkg_remove.c
libopkg/opkg_upgrade.c
libopkg/opkg_utils.c
libopkg/pkg.c
libopkg/pkg.h
libopkg/pkg_depends.c
libopkg/pkg_depends.h
libopkg/pkg_dest.c
libopkg/pkg_dest.h
libopkg/pkg_dest_list.c
libopkg/pkg_extract.c
libopkg/pkg_hash.c
libopkg/pkg_hash.h
libopkg/pkg_parse.c
libopkg/pkg_src.c
libopkg/pkg_src_list.c
libopkg/pkg_vec.c
libopkg/sprintf_alloc.c
libopkg/str_list.c
libopkg/void_list.c
libopkg/xregex.c
libopkg/xsystem.c
libopkg/xsystem.h
src/opkg-cl.c
tests/libopkg_test.c

index bfd6ccf371a3061c5d8606b5e154a4b298ce559f..524df5cb0a5c7e814f3dc79d5899c60fab2cc059 100644 (file)
@@ -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 \
index 984a191f0f95bc9be4894cab23f037957dcebf16..bf8b2a562a5f4f7d8ba6d046ecf08aba42bf371e 100644 (file)
    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)
 {
index 5031835ba2111629141b12c4e37232b627bebfc6..a188c6d6e38e662344c1c076a12ddba380734337 100644 (file)
@@ -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);
index 61ea55dd2f5909f7a750836502cf5c05062ae9bc..1db77902e9d27a459df6a9cc4c2bfeef651064ca 100644 (file)
@@ -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)
index 7e207cd25776ed85a375eb533fb27eb2b47b9650..964473a51b60183fe38cdc856f69f899cd379745 100644 (file)
    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 (file)
index cac9a41..0000000
+++ /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
index e475a7c55f3d7d3773c9f06bcfd03bdb87ece7da..2728100c2a07b75bae713901d51b8413d368db58 100644 (file)
@@ -15,8 +15,6 @@
    General Public License for more details.
 */
 
-#include "includes.h"
-
 #include "nv_pair.h"
 #include "libbb/libbb.h"
 
index b6c8f8e84cc6517d97d70e561f313d22588ffe39..8baebb114c112bc0a3a3ee7a41c4f1e3cd6a6c93 100644 (file)
@@ -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"
index a8f85a95fb21f86e4c1518091737b68fc6d446da..38a536e62d11c51e5673ad5126f896d14337eda6 100644 (file)
    General Public License for more details.
  */
 
-#include <config.h>
+#include "config.h"
+
+#include <stdio.h>
+#include <unistd.h>
 #include <fnmatch.h>
 
 #include "opkg.h"
index 88a0b5f13fb5e8baae7200dbb78b9ce83e6ef478..4d2eb383026c430a978b32e0b22d96a452ed553e 100644 (file)
    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"
index 6d2f1adbe2f5233692d4351dbb6bb13cbd45a3b9..9ca42ff82b85443cab8a821a0bfe3d05d698334f 100644 (file)
@@ -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;
 
index 28321c12c566fa9cf975bb368b5e613db590d90e..207f7fcbff30ccf04bfe1d493af09786fad0fab9 100644 (file)
    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"
 #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;
 
index 52498f58eb15284fd10b1cb30a1b77ef51343792..6b3495295e8eb5c448a9f3a07aa6bab178d296f6 100644 (file)
@@ -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);
index 4aca0f07111141e64a02c38a5c916e1bf866c753..719da5a459af949e81844f658e3633e607f1b318 100644 (file)
@@ -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"
index 25236aea4237d0127b42e4a553a5c9c4318052a1..ff01ff3bd0e33a0902bd575ba05b3389dd7b79aa 100644 (file)
@@ -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);
 
index fc97d34d8ebbe889de92024a6bd87b46ce1fd03f..080326cae4a153a0da6efef11c10f4399b0ace2f 100644 (file)
    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"
 
index d98a311308e59284f2ec6a90a39d64b225baff64..24b7bcb29b79184ecc778930bfc8fb43d3c52459 100644 (file)
@@ -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);
index 020b691877e70edd6cc59443de2b3d09eb1a19f9..79bbd3c9e5f1b6beb3a754f872b3321c965f77da 100644 (file)
    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"
index 81afc97eaace49998de2895d0156da26e67c1f2f..4a24039bbd2fbdf1bcaf70c030c7c1f6ac1c9969 100644 (file)
@@ -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"
index 71c8c1183af34996d635b574ae5a55363e5334e5..bf7dab68a55dff1061fd72df4f2c9416dabf09b5 100644 (file)
 
 #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"
 
index b5045ea9905263cdc5ce0bcd149c82e5043d759e..a866c04aa0bd3f7f75e1bf2143ab1562064b200a 100644 (file)
    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"
index 0d4833a93088f4c1f7b5f7e46383cc03523cdf05..d58a12b376055e39fb0d6f2e01b737c3c48fe9cd 100644 (file)
@@ -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"
index d39690eeda1e8d3f667f83c492144eeaaa633337..5ab5227035231901dec753db882bfd14f582fc8a 100644 (file)
    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)
 {
index e54182500d8798e05f09c29292902bf9ff661e70..bd7e9f8866fba6e01b25b9a6233b3de3bd2745df 100644 (file)
    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);
index 81f2f67f92af523f2c529ef6020b4fc605bf2ca2..4450fd061f9a4d73c00be630e02d709b573e2ec1 100644 (file)
@@ -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"
index 3a7c9ea535ecc2c241abfee836c2e57823345a3c..0e52d31ed391d099a4fc0858240fb01b6f99afd5 100644 (file)
    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"
index 402288ce7b8c17e36fbf3a5d5919620e50e0890f..9c5da27ff66dd6b52a87cbaa602c19189a94276e 100644 (file)
@@ -20,7 +20,6 @@
 
 #include "pkg.h"
 #include "pkg_hash.h"
-#include "includes.h"
 
 enum depend_type {
     PREDEPEND,
index adc5e1f2a475621485b47ec6bafea5a97754aa88..d56dd78b84c956f5cf01e19fd143ee7b9b206a05 100644 (file)
@@ -15,7 +15,7 @@
    General Public License for more details.
 */
 
-#include "includes.h"
+#include <stdio.h>
 
 #include "pkg_dest.h"
 #include "file_util.h"
index e0840cc737b69a50b669a5927da80f7388cfac9d..cbc1ce689f04f7c8d27cc0ac91177624d3a41cd3 100644 (file)
@@ -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
 {
index b117bbba2949ca127f6a18bd295febf366a0af51..f5f2e1d7eab728abf247feba8d655babff2488be 100644 (file)
@@ -15,7 +15,7 @@
    General Public License for more details.
 */
 
-#include "includes.h"
+#include <stdio.h>
 
 #include "pkg_dest.h"
 #include "void_list.h"
index fffb993b8e013e7c0ea554f164d81fb9484d0397..b7d924c7d56cc8932379bd86805d076647d54b23 100644 (file)
    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"
index f5d478221c96d3bbdabded40103c976b41a79c4a..2fc539ea88ec1411db51de3692114e648cfb5848 100644 (file)
    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"
index 0ff18aa5e355eb1ece2b596895148643fda6dad0..d847b73a1c5aad4b17b94e1d3cf3c152861d2373 100644 (file)
@@ -21,7 +21,6 @@
 #include "pkg.h"
 #include "pkg_src.h"
 #include "pkg_dest.h"
-#include "pkg_vec.h"
 #include "hash_table.h"
 
 
index fd5ada5534eaf14a7457979f7bb22453a3b28978..c35eb1a30d67fef0a555e86db58ace33cd6c0365 100644 (file)
    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"
index b8679c3a3d5054487f99fa086eb073f181bbb326..690fef6720139b5c458ef05b72ad38b0995b3c88 100644 (file)
@@ -15,8 +15,6 @@
    General Public License for more details.
 */
 
-#include "includes.h"
-
 #include "pkg_src.h"
 #include "libbb/libbb.h"
 
index 13bff5fe25d5f79c2902300e7cbc865660b18bd7..7ad1b415db6a8461e927bd2bdb6132f6b8ce3710 100644 (file)
@@ -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"
index 51b9bda132c51c7836b9a6b85f3dcc95135576c4..e541dccab7cf3075cbd97bd32383bdb6e4f50fe9 100644 (file)
@@ -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"
index 2e3200b78542e9ec776735275bb477a9174fc60a..c55a0162916955364f1c55025545a2b554645635 100644 (file)
@@ -15,7 +15,6 @@
    GNU General Public License for more details.
 */
 
-#include "includes.h"
 #include <stdarg.h>
 
 #include "sprintf_alloc.h"
index 2323c8ecd32df291702c154cf091130cf265df81..e99ef37fa2ad736ea0f2825f42a0563b97ab7fb0 100644 (file)
@@ -15,7 +15,6 @@
    General Public License for more details.
 */
 
-#include "includes.h"
 #include "str_list.h"
 #include "libbb/libbb.h"
 
index 04066bfa021fcdb31335570b289da44f2cc30ece..8248dc19cffc92e6e1be7b435e6ea759a07b4e06 100644 (file)
@@ -15,8 +15,6 @@
    General Public License for more details.
 */
 
-#include "includes.h"
-
 #include "void_list.h"
 #include "libbb/libbb.h"
 
index 639e3efb71af29fd90ecaf202282b40a3030f841..2808dc63007016807e70efb3e3a1c75827ea2f50 100644 (file)
@@ -15,8 +15,6 @@
    GNU General Public License for more details.
 */
 
-#include "includes.h"
-
 #include "xregex.h"
 #include "libbb/libbb.h"
 
index fc7db69d9d2ee26716de197575d2f8f12d598f61..ae7ca87fe7ac2ee2221da1d529e20848ba58345d 100644 (file)
@@ -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"
index 3c7a3d2c24dcdc9f2fbb92e975b568a1dfa8fd57..9bb082dee4e8e693ea159d508c88edfc6bb6bd0d 100644 (file)
@@ -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:
index 3bbcd42cb77a75293077d8810d119f41d3789f01..f1c8f61853fd86ca17be47f7ea03efe2cc3c56b9 100644 (file)
    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"
index 720e3e9516e221c1c810c5246a40191747431e9b..4d82a6721ae4898c6fb543eac9362251753dddd5 100644 (file)
@@ -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;