diff options
author | Aurelien Foret <aurelien@archlinux.org> | 2005-08-20 05:54:45 +0000 |
---|---|---|
committer | Aurelien Foret <aurelien@archlinux.org> | 2005-08-20 05:54:45 +0000 |
commit | dacf0eccac32280f24c046553c6be3a2b282769d (patch) | |
tree | 2272b3d3e74551f099a822e2482d0d1a79de8ba1 | |
parent | a2192570fb187f4be900b24a880a85fd4dd125db (diff) |
changed license package field to a list
-rw-r--r-- | lib/libalpm/db.c | 10 | ||||
-rw-r--r-- | lib/libalpm/package.c | 4 |
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index 7f24224b..f7d04bfe 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -301,10 +301,9 @@ int db_read(pmdb_t *db, char *name, unsigned int inforeq, pmpkg_t *info) } _alpm_strtrim(info->url); } else if(!strcmp(line, "%LICENSE%")) { - if(fgets(info->license, sizeof(info->license), fp) == NULL) { - return(-1); + while(fgets(line, 512, fp) && strlen(_alpm_strtrim(line))) { + info->license = pm_list_add(info->license, strdup(line)); } - _alpm_strtrim(info->license); } else if(!strcmp(line, "%ARCH%")) { if(fgets(info->arch, sizeof(info->arch), fp) == NULL) { return(-1); @@ -473,7 +472,10 @@ int db_write(pmdb_t *db, pmpkg_t *info, unsigned int inforeq) fputs("%URL%\n", fp); fprintf(fp, "%s\n\n", info->url); fputs("%LICENSE%\n", fp); - fprintf(fp, "%s\n\n", info->license); + for(lp = info->license; lp; lp = lp->next) { + fprintf(fp, "%s\n", (char *)lp->data); + } + fprintf(fp, "\n"); fputs("%ARCH%\n", fp); fprintf(fp, "%s\n\n", info->arch); fputs("%BUILDDATE%\n", fp); diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index db6a8732..bf64a481 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -45,7 +45,7 @@ pmpkg_t *pkg_new() pkg->version[0] = '\0'; pkg->desc[0] = '\0'; pkg->url[0] = '\0'; - pkg->license[0] = '\0'; + pkg->license = NULL; pkg->builddate[0] = '\0'; pkg->installdate[0] = '\0'; pkg->packager[0] = '\0'; @@ -180,7 +180,7 @@ static int parse_descfile(char *descfile, pmpkg_t *info, int output) } else if(!strcmp(key, "URL")) { STRNCPY(info->url, ptr, sizeof(info->url)); } else if(!strcmp(key, "LICENSE")) { - STRNCPY(info->license, ptr, sizeof(info->license)); + info->license = pm_list_add(info->license, strdup(ptr)); } else if(!strcmp(key, "BUILDDATE")) { STRNCPY(info->builddate, ptr, sizeof(info->builddate)); } else if(!strcmp(key, "INSTALLDATE")) { |