aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Woodward2003-10-10 04:17:22 +0000
committerJason Woodward2003-10-10 04:17:22 +0000
commit4d1e3246139c2afcb7eaa82dce2a6bd5d3ee2ff7 (patch)
tree2e26a6027e35161a3f6e4df367396fbf34b64987
parent4521beadba82b5bee40b76a39932096109818e8a (diff)
downloadslapt-get-4d1e3246139c2afcb7eaa82dce2a6bd5d3ee2ff7.tar.gz
initial support for PACKAGE REQUIRED: data in PACKAGES.TXT, this also means we can support LINUXPACKAGES as MIRROR
-rw-r--r--ChangeLog2
-rw-r--r--src/package.c15
2 files changed, 17 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 4c19deb..109e471 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,8 @@
* actually call regfree() for all regex_t
* introduced a DO_NOT_UNLINK_BAD_FILES macro within include/main.h
* changed malloc back to calloc (src/package.c, line 423)
+ * initial support for PACKAGE REQUIRED: data in PACKAGES.TXT
+ this also means we can support LINUXPACKAGES as MIRROR
0.9.5c Oct 04, 2003
* removed bad free() in get_installed_pkgs()
diff --git a/src/package.c b/src/package.c
index c963bad..7c3c5be 100644
--- a/src/package.c
+++ b/src/package.c
@@ -25,6 +25,7 @@ struct pkg_list *get_available_pkgs(void){
FILE *pkg_list_fh;
pkg_info_t **realloc_tmp;
struct pkg_list *list;
+ long f_pos = 0;
size_t getline_len = 0;
char *getline_buffer = NULL;
char *size_c = NULL;
@@ -193,6 +194,17 @@ struct pkg_list *get_available_pkgs(void){
continue;
}
+ /* required, if provided */
+ f_pos = ftell(pkg_list_fh);
+ if(
+ (getline(&getline_buffer,&getline_len,pkg_list_fh) != EOF)
+ && (strstr(getline_buffer,"PACKAGE DESCRIPTION") != NULL)
+ /* add in support for the required data */
+ ){
+ /* required isn't provided... rewind one line */
+ fseek(pkg_list_fh, (ftell(pkg_list_fh) - f_pos) * -1, SEEK_CUR);
+ }
+
/* description */
if(
(getline(&getline_buffer,&getline_len,pkg_list_fh) != EOF)
@@ -249,6 +261,9 @@ char *gen_short_pkg_description(pkg_info_t *pkg){
string_size = strlen(pkg->description) - (strlen(pkg->name) + 2) - strlen( strchr(pkg->description,'\n') );
+ /* quit now if the description is going to be empty */
+ if( (int)string_size < 0 ) return NULL;
+
short_description = calloc( string_size + 1 , sizeof *short_description );
if( short_description == NULL ){
fprintf(stderr,"Failed to calloc short_description\n");