diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 4 | ||||
-rw-r--r-- | src/query.c | 18 |
2 files changed, 13 insertions, 9 deletions
diff --git a/src/main.c b/src/main.c index a999d3bdb..8265068d5 100644 --- a/src/main.c +++ b/src/main.c @@ -110,7 +110,7 @@ Comparison operators for --compare-versions are:\n\ lt-nl le-nl ge-nl gt-nl (treat empty version as later than any version);\n\ < << <= = >= >> > (only for compatibility with control file syntax).\n\ \n\ -Use `dselect' or 'aptitude' for user-friendly package management.\n"), +Use `dselect' or `aptitude' for user-friendly package management.\n"), BACKEND, ADMINDIR) < 0) werr ("stdout"); } @@ -118,7 +118,7 @@ const char thisname[]= "dpkg"; const char architecture[]= ARCHITECTURE; const char printforhelp[]= N_("\ Type dpkg --help for help about installing and deinstalling packages [*];\n\ -Use dselect for user-friendly package management;\n\ +Use `dselect' or `aptitude' for user-friendly package management;\n\ Type dpkg -Dhelp for a list of dpkg debug flag values;\n\ Type dpkg --force-help for a list of forcing options;\n\ Type dpkg-deb --help for help about manipulating *.deb files;\n\ diff --git a/src/query.c b/src/query.c index b36dafce6..7c9b72556 100644 --- a/src/query.c +++ b/src/query.c @@ -183,9 +183,9 @@ Desired=Unknown/Install/Remove/Purge/Hold\n\ void listpackages(const char *const *argv) { struct pkgiterator *it; struct pkginfo *pkg; - struct pkginfo **pkgl; + struct pkginfo **pkgl, **pkgf; const char *thisarg; - int np, i, head, found; + int np, nf, i, head, found; modstatdb_init(admindir,msdbrw_readonly); @@ -199,14 +199,12 @@ void listpackages(const char *const *argv) { iterpkgend(it); assert(i==np); - qsort(pkgl,np,sizeof(struct pkginfo*),pkglistqsortcmp); - head=0; - + pkgf= m_malloc(sizeof(struct pkginfo*)*np); nf=0; if (!*argv) { for (i=0; i<np; i++) { pkg= pkgl[i]; if (pkg->status == stat_notinstalled) continue; - list1package(pkg,&head,pkgl,np); + pkgf[nf++] = pkg; } } else { while ((thisarg= *argv++)) { @@ -214,7 +212,7 @@ void listpackages(const char *const *argv) { for (i=0; i<np; i++) { pkg= pkgl[i]; if (fnmatch(thisarg,pkg->name,0)) continue; - list1package(pkg,&head,pkgl,np); found++; + pkgf[nf++] = pkg; found++; } if (!found) { fprintf(stderr,_("No packages found matching %s.\n"),thisarg); @@ -222,6 +220,12 @@ void listpackages(const char *const *argv) { } } } + + qsort(pkgf,nf,sizeof(struct pkginfo*),pkglistqsortcmp); + head=0; + for (i=0; i<nf; i++) + list1package(pkgf[i],&head,pkgf,nf); + if (ferror(stdout)) werr("stdout"); if (ferror(stderr)) werr("stderr"); modstatdb_shutdown(); |