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 bfd6ccf..524df5c 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 984a191..bf8b2a5 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 5031835..a188c6d 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 61ea55d..1db7790 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 7e207cd..964473a 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 e475a7c..2728100 100644 (file)
@@ -15,8 +15,6 @@
    General Public License for more details.
 */
 
-#include "includes.h"
-
 #include "nv_pair.h"
 #include "libbb/libbb.h"
 
index b6c8f8e..8baebb1 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 a8f85a9..38a536e 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 88a0b5f..4d2eb38 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 6d2f1ad..9ca42ff 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 28321c1..207f7fc 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 52498f5..6b34952 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 4aca0f0..719da5a 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 25236ae..ff01ff3 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 fc97d34..080326c 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 d98a311..24b7bcb 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 020b691..79bbd3c 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 81afc97..4a24039 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 71c8c11..bf7dab6 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 b5045ea..a866c04 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 0d4833a..d58a12b 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 d39690e..5ab5227 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 e541825..bd7e9f8 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 81f2f67..4450fd0 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 3a7c9ea..0e52d31 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 402288c..9c5da27 100644 (file)
@@ -20,7 +20,6 @@
 
 #include "pkg.h"
 #include "pkg_hash.h"
-#include "includes.h"
 
 enum depend_type {
     PREDEPEND,
index adc5e1f..d56dd78 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 e0840cc..cbc1ce6 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 b117bbb..f5f2e1d 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 fffb993..b7d924c 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 f5d4782..2fc539e 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 0ff18aa..d847b73 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 fd5ada5..c35eb1a 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 b8679c3..690fef6 100644 (file)
@@ -15,8 +15,6 @@
    General Public License for more details.
 */
 
-#include "includes.h"
-
 #include "pkg_src.h"
 #include "libbb/libbb.h"
 
index 13bff5f..7ad1b41 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 51b9bda..e541dcc 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 2e3200b..c55a016 100644 (file)
@@ -15,7 +15,6 @@
    GNU General Public License for more details.
 */
 
-#include "includes.h"
 #include <stdarg.h>
 
 #include "sprintf_alloc.h"
index 2323c8e..e99ef37 100644 (file)
@@ -15,7 +15,6 @@
    General Public License for more details.
 */
 
-#include "includes.h"
 #include "str_list.h"
 #include "libbb/libbb.h"
 
index 04066bf..8248dc1 100644 (file)
@@ -15,8 +15,6 @@
    General Public License for more details.
 */
 
-#include "includes.h"
-
 #include "void_list.h"
 #include "libbb/libbb.h"
 
index 639e3ef..2808dc6 100644 (file)
@@ -15,8 +15,6 @@
    GNU General Public License for more details.
 */
 
-#include "includes.h"
-
 #include "xregex.h"
 #include "libbb/libbb.h"
 
index fc7db69..ae7ca87 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 3c7a3d2..9bb082d 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 3bbcd42..f1c8f61 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 720e3e9..4d82a67 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;