aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Woodward2004-11-14 16:49:33 +0000
committerJason Woodward2004-11-14 16:49:33 +0000
commit18dd40524f5d15c6efc862a16e0907e2d1c902c8 (patch)
treeab46a6b4c4f93433f23e04697b6efc05d3859147 /src
parent90fb7b6fa52fb6cccff4a7a133f9ae6ce1ff91f5 (diff)
downloadslapt-get-18dd40524f5d15c6efc862a16e0907e2d1c902c8.tar.gz
made head_mirror_data clear_head_cache write_head_cache read_head_cache gen_filename_from_url gen_head_cache_filename get_md5sum non static. moved str_replace_chr to common.[ch]
Diffstat (limited to 'src')
-rw-r--r--src/common.c17
-rw-r--r--src/common.h1
-rw-r--r--src/package.c44
-rw-r--r--src/package.h14
4 files changed, 39 insertions, 37 deletions
diff --git a/src/common.c b/src/common.c
index 8c5a03d..68ff6fe 100644
--- a/src/common.c
+++ b/src/common.c
@@ -212,3 +212,20 @@ int ask_yes_no(const char *format, ...)
return 0;
return -1;
}
+
+char *str_replace_chr(const char *string,const char find, const char replace){
+ int i;
+ char *clean = calloc( strlen(string) + 1, sizeof *clean);;
+
+ for(i = 0;i < (int)strlen(string);i++){
+ if(string[i] == find ){
+ clean[i] = replace;
+ }else{
+ clean[i] = string[i];
+ }
+ }
+ clean[ strlen(string) ] = '\0';
+
+ return clean;
+}
+
diff --git a/src/common.h b/src/common.h
index 2af6b52..f863b80 100644
--- a/src/common.h
+++ b/src/common.h
@@ -42,3 +42,4 @@ void gen_md5_sum_of_file(FILE *f,char *result_sum);
* return 1 on yes, 0 on no, else -1.
*/
int ask_yes_no(const char *format, ...);
+char *str_replace_chr(const char *string,const char find, const char replace);
diff --git a/src/package.c b/src/package.c
index 827e112..59b56d1 100644
--- a/src/package.c
+++ b/src/package.c
@@ -17,26 +17,12 @@
*/
#include <main.h>
-static char *gen_filename_from_url(const char *url,const char *file);
-static char *str_replace_chr(const char *string,const char find, const char replace);
-/* do a head request on the mirror data to find out if it's new */
-static char *head_mirror_data(const char *wurl,const char *file);
-/* lookup md5sum of file */
-static void get_md5sum(pkg_info_t *pkg,FILE *checksum_file);
/* analyze the pkg version hunk by hunk */
static struct pkg_version_parts *break_down_pkg_version(const char *version);
/* parse the meta lines */
static pkg_info_t *parse_meta_entry(struct pkg_list *avail_pkgs,struct pkg_list *installed_pkgs,char *dep_entry);
/* called by is_required_by */
static struct pkg_list *required_by(const rc_config *global_config,struct pkg_list *avail, pkg_info_t *pkg,struct pkg_list *parent_required_by);
-/* generate the head cache filename */
-static char *gen_head_cache_filename(const char *filename_from_url);
-/* clear head cache storage file */
-static void clear_head_cache(const char *cache_filename);
-/* cache the head request */
-static void write_head_cache(const char *cache, const char *cache_filename);
-/* read the cached head request */
-static char *read_head_cache(const char *cache_filename);
/* free pkg_version_parts struct */
static void free_pkg_version_parts(struct pkg_version_parts *parts);
/* find dependency from "or" requirement */
@@ -701,7 +687,7 @@ int is_excluded(const rc_config *global_config,pkg_info_t *pkg){
return pkg_not_excluded;
}
-static void get_md5sum(pkg_info_t *pkg,FILE *checksum_file){
+void get_md5sum(pkg_info_t *pkg,FILE *checksum_file){
sg_regex md5sum_regex;
ssize_t getline_read;
size_t getline_len = 0;
@@ -1441,7 +1427,7 @@ pkg_info_t *get_pkg_by_details(struct pkg_list *list,char *name,char *version,ch
}
/* do a head request on the mirror data to find out if it's new */
-static char *head_mirror_data(const char *wurl,const char *file){
+char *head_mirror_data(const char *wurl,const char *file){
char *request_header = NULL;
char *request_header_ptr = NULL;
char *delim_ptr = NULL;
@@ -1488,7 +1474,7 @@ static char *head_mirror_data(const char *wurl,const char *file){
return request_header;
}
-static void write_head_cache(const char *cache, const char *cache_filename){
+void write_head_cache(const char *cache, const char *cache_filename){
char *head_filename;
FILE *tmp;
@@ -1504,7 +1490,7 @@ static void write_head_cache(const char *cache, const char *cache_filename){
}
-static char *read_head_cache(const char *cache_filename){
+char *read_head_cache(const char *cache_filename){
char *head_filename;
FILE *tmp;
char *getline_buffer = NULL;
@@ -1527,7 +1513,7 @@ static char *read_head_cache(const char *cache_filename){
return getline_buffer;
}
-static char *gen_head_cache_filename(const char *filename_from_url){
+char *gen_head_cache_filename(const char *filename_from_url){
char *head_filename;
head_filename = calloc( strlen(filename_from_url) + strlen(HEAD_FILE_EXT) + 1, sizeof *head_filename );
@@ -1538,7 +1524,7 @@ static char *gen_head_cache_filename(const char *filename_from_url){
}
-static void clear_head_cache(const char *cache_filename){
+void clear_head_cache(const char *cache_filename){
char *head_filename;
FILE *tmp;
@@ -1916,23 +1902,7 @@ int verify_downloaded_pkg(const rc_config *global_config,pkg_info_t *pkg){
}
-static char *str_replace_chr(const char *string,const char find, const char replace){
- int i;
- char *clean = calloc( strlen(string) + 1, sizeof *clean);;
-
- for(i = 0;i < (int)strlen(string);i++){
- if(string[i] == find ){
- clean[i] = replace;
- }else{
- clean[i] = string[i];
- }
- }
- clean[ strlen(string) ] = '\0';
-
- return clean;
-}
-
-static char *gen_filename_from_url(const char *url,const char *file){
+char *gen_filename_from_url(const char *url,const char *file){
char *filename,*cleaned;
filename = calloc( strlen(url) + strlen(file) + 2 , sizeof *filename );
diff --git a/src/package.h b/src/package.h
index 48c7369..fa9072b 100644
--- a/src/package.h
+++ b/src/package.h
@@ -94,6 +94,14 @@ void free_pkg_list(struct pkg_list *);
/* update the local package cache */
int update_pkg_cache(const rc_config *global_config);
+/* do a head request on the mirror data to find out if it's new */
+char *head_mirror_data(const char *wurl,const char *file);
+/* clear head cache storage file */
+void clear_head_cache(const char *cache_filename);
+/* cache the head request */
+void write_head_cache(const char *cache, const char *cache_filename);
+/* read the cached head request */
+char *read_head_cache(const char *cache_filename);
/* parse the PACKAGES.TXT file */
struct pkg_list *parse_packages_txt(FILE *);
struct pkg_list *get_available_pkgs(void);
@@ -123,14 +131,20 @@ int remove_pkg(const rc_config *,pkg_info_t *);
/* generate a short description */
char *gen_short_pkg_description(pkg_info_t *);
+/* generate the filename from the url */
+char *gen_filename_from_url(const char *url,const char *file);
/* generate the package file name */
char *gen_pkg_file_name(const rc_config *global_config,pkg_info_t *pkg);
+/* generate the head cache filename */
+char *gen_head_cache_filename(const char *filename_from_url);
/* generate the download url for a package */
char *gen_pkg_url(pkg_info_t *pkg);
/* exclude pkg based on pkg name */
int is_excluded(const rc_config *,pkg_info_t *);
/* package is already downloaded and cached, md5sum if applicable is ok */
int verify_downloaded_pkg(const rc_config *global_config,pkg_info_t *pkg);
+/* lookup md5sum of file */
+void get_md5sum(pkg_info_t *pkg,FILE *checksum_file);
/* find out the pkg file size (post download) */
size_t get_pkg_file_size(const rc_config *global_config,pkg_info_t *pkg);