aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Woodward2004-11-28 03:49:56 +0000
committerJason Woodward2004-11-28 03:49:56 +0000
commitd1da102fc3eeaa15c2913df59c097e4393ac3cbb (patch)
treed30698f91a1d279aa324e1933284da5a36fe66a4 /src
parentf597bad0f9808e222776dcc8caa482a05fcaee95 (diff)
downloadslapt-get-d1da102fc3eeaa15c2913df59c097e4393ac3cbb.tar.gz
get_installed_pkgs() now parses out the packages description as well
Diffstat (limited to 'src')
-rw-r--r--src/action.c8
-rw-r--r--src/package.c17
2 files changed, 21 insertions, 4 deletions
diff --git a/src/action.c b/src/action.c
index a1a41f2..53c5950 100644
--- a/src/action.c
+++ b/src/action.c
@@ -263,12 +263,14 @@ void pkg_action_search(const char *pattern){
for(i=0;i<imatches->pkg_count;i++){
/* only if they didn't already show up from the available packages */
if( get_exact_pkg(matches,imatches->pkgs[i]->name,imatches->pkgs[i]->version) == NULL ){
- /* no package description parsed from installed pkg at the moment */
- printf("%s %s [inst=%s]\n",
+ char *short_description = gen_short_pkg_description(matches->pkgs[i]);
+ printf("%s %s [inst=%s]: %s\n",
imatches->pkgs[i]->name,
imatches->pkgs[i]->version,
- _("yes")
+ _("yes"),
+ short_description
);
+ free(short_description);
}
}
diff --git a/src/package.c b/src/package.c
index 9ef427c..01aa852 100644
--- a/src/package.c
+++ b/src/package.c
@@ -514,7 +514,22 @@ struct pkg_list *get_installed_pkgs(void){
tmp_pkg->size_u = strtol(size_u,(char **)NULL,10);
free(size_u);
}else{
- continue;
+ if(strstr(getline_buffer,"PACKAGE DESCRIPTION") != NULL){
+ tmp_pkg->description[0] = '\0';
+ while(1){
+ if((bytes_read = getline(&getline_buffer,&getline_len,pkg_f)) == EOF ) break;
+ if( strcmp(getline_buffer,"\n") != 0 &&
+ /* don't overflow the buffer */
+ (strlen(tmp_pkg->description) + bytes_read) < DESCRIPTION_LEN
+ ){
+ strncat(tmp_pkg->description,getline_buffer,bytes_read);
+ }else{
+ break;
+ }
+ }
+ }else{
+ continue;
+ }
}
}
fclose(pkg_f);