-
- // Get a pointer to start of Description field
- const unsigned char *DescP = (unsigned char*)strstr((char*)Buffer, "Description:");
-
- // Write all but Description
- if (fwrite(Buffer,1,DescP - Buffer-1,stdout) < (size_t)(DescP - Buffer-1))
- {
- delete [] Buffer;
- return false;
- }
-
- // Show the right description
- pkgRecords Recs(*GCache);
- pkgCache::DescIterator DescDefault = V.DescriptionList();
- pkgCache::DescIterator Desc = DescDefault;
- for (; Desc.end() == false; Desc++)
- if (pkgIndexFile::LanguageCode() == Desc.LanguageCode())
- break;
- if (Desc.end() == true) Desc = DescDefault;
-
- pkgRecords::Parser &P = Recs.Lookup(Desc.FileList());
- cout << "Description" << ( (strcmp(Desc.LanguageCode(),"") != 0) ? "-" : "" ) << Desc.LanguageCode() << ": " << P.LongDesc();
-
- // Find the first field after the description (if there is any)
- for(DescP++;DescP != &Buffer[V.FileList()->Size];DescP++)
- {
- if(*DescP == '\n' && *(DescP+1) != ' ')
- {
- // write the rest of the buffer
- const unsigned char *end=&Buffer[V.FileList()->Size];
- if (fwrite(DescP,1,end-DescP,stdout) < (size_t)(end-DescP))
- {
- delete [] Buffer;
- return false;
- }
-
- break;
- }
- }
- // write a final newline (after the description)
- cout<<endl;