diff options
author | ticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2008-12-14 23:52:05 (EST) |
---|---|---|
committer | ticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358> | 2008-12-14 23:52:05 (EST) |
commit | dba0a0abdfbd89539090ccb41590e48fefc49c9b (patch) | |
tree | 528aae271d4af2a4a16a4ec397ebbb2fb4f44896 /libopkg/pkg.c | |
parent | d281eab6487605176bd20efcfe21dabbd1514735 (diff) |
opkg: add support for Tags attribute
git-svn-id: http://opkg.googlecode.com/svn/trunk@42 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358
Diffstat (limited to 'libopkg/pkg.c')
-rw-r--r-- | libopkg/pkg.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/libopkg/pkg.c b/libopkg/pkg.c index 93fd20a..af2dd83 100644 --- a/libopkg/pkg.c +++ b/libopkg/pkg.c @@ -206,6 +206,8 @@ void pkg_deinit(pkg_t *pkg) pkg->installed_files_ref_cnt = 1; pkg_free_installed_files(pkg); pkg->essential = 0; + free (pkg->tags); + pkg->tags = NULL; } int pkg_init_from_file(pkg_t *pkg, const char *filename) @@ -522,6 +524,10 @@ char * pkg_formatted_info(pkg_t *pkg ) strncat(buff ,line, strlen(line)); free(line); + line = pkg_formatted_field(pkg, "Tags"); + strncat(buff ,line, strlen(line)); + free(line); + return buff; } @@ -937,6 +943,21 @@ char * pkg_formatted_field(pkg_t *pkg, const char *field ) } } break; + case 't': + case 'T': + if (strcasecmp(field, "Tags") == 0) { + /* Tags */ + if (pkg->tags) { + temp = (char *)realloc(temp,strlen(pkg->tags)+8); + if ( temp == NULL ){ + fprintf(stderr, "%s: out of memory\n", __FUNCTION__); + return NULL; + } + temp[0]='\0'; + snprintf(temp, (strlen(pkg->tags)+8), "Tags: %s\n", pkg->tags); + } + } + break; case 'v': case 'V': { /* Version */ |