summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2014-01-24 23:07:10 +0100
committerMichael Vogt <mvo@debian.org>2014-01-24 23:07:10 +0100
commit3cfc6336251057cdebe5261addfe61bd89311335 (patch)
tree13e37426176bd1645ca035aa14cc4e463e73d56f /apt-pkg
parent48e48cbdc47a0b29ac1b9d2b7d4eef61be73d06d (diff)
parent17622532ce19a1bcebfebdfc9ec20a7e3df9dbff (diff)
Merge remote-tracking branch 'mvo/feature/apt-show-nice' into debian/experimental-no-abi-break
Conflicts: apt-private/private-cmndline.cc
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/tagfile.cc84
1 files changed, 43 insertions, 41 deletions
diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc
index bef3c76ba..b92b2c15a 100644
--- a/apt-pkg/tagfile.cc
+++ b/apt-pkg/tagfile.cc
@@ -567,52 +567,54 @@ bool TFRewrite(FILE *Output,pkgTagSection const &Tags,const char *Order[],
}
// Write all all of the tags, in order.
- for (unsigned int I = 0; Order[I] != 0; I++)
+ if (Order != NULL)
{
- bool Rewritten = false;
-
- // See if this is a field that needs to be rewritten
- for (unsigned int J = 0; Rewrite != 0 && Rewrite[J].Tag != 0; J++)
+ for (unsigned int I = 0; Order[I] != 0; I++)
{
- if (strcasecmp(Rewrite[J].Tag,Order[I]) == 0)
- {
- Visited[J] |= 2;
- if (Rewrite[J].Rewrite != 0 && Rewrite[J].Rewrite[0] != 0)
- {
- if (isspace(Rewrite[J].Rewrite[0]))
- fprintf(Output,"%s:%s\n",Rewrite[J].NewTag,Rewrite[J].Rewrite);
- else
- fprintf(Output,"%s: %s\n",Rewrite[J].NewTag,Rewrite[J].Rewrite);
- }
-
- Rewritten = true;
- break;
- }
- }
+ bool Rewritten = false;
+
+ // See if this is a field that needs to be rewritten
+ for (unsigned int J = 0; Rewrite != 0 && Rewrite[J].Tag != 0; J++)
+ {
+ if (strcasecmp(Rewrite[J].Tag,Order[I]) == 0)
+ {
+ Visited[J] |= 2;
+ if (Rewrite[J].Rewrite != 0 && Rewrite[J].Rewrite[0] != 0)
+ {
+ if (isspace(Rewrite[J].Rewrite[0]))
+ fprintf(Output,"%s:%s\n",Rewrite[J].NewTag,Rewrite[J].Rewrite);
+ else
+ fprintf(Output,"%s: %s\n",Rewrite[J].NewTag,Rewrite[J].Rewrite);
+ }
+ Rewritten = true;
+ break;
+ }
+ }
- // See if it is in the fragment
- unsigned Pos;
- if (Tags.Find(Order[I],Pos) == false)
- continue;
- Visited[Pos] |= 1;
-
- if (Rewritten == true)
- continue;
+ // See if it is in the fragment
+ unsigned Pos;
+ if (Tags.Find(Order[I],Pos) == false)
+ continue;
+ Visited[Pos] |= 1;
+
+ if (Rewritten == true)
+ continue;
- /* Write out this element, taking a moment to rewrite the tag
- in case of changes of case. */
- const char *Start;
- const char *Stop;
- Tags.Get(Start,Stop,Pos);
+ /* Write out this element, taking a moment to rewrite the tag
+ in case of changes of case. */
+ const char *Start;
+ const char *Stop;
+ Tags.Get(Start,Stop,Pos);
- if (fputs(Order[I],Output) < 0)
- return _error->Errno("fputs","IO Error to output");
- Start += strlen(Order[I]);
- if (fwrite(Start,Stop - Start,1,Output) != 1)
- return _error->Errno("fwrite","IO Error to output");
- if (Stop[-1] != '\n')
- fprintf(Output,"\n");
- }
+ if (fputs(Order[I],Output) < 0)
+ return _error->Errno("fputs","IO Error to output");
+ Start += strlen(Order[I]);
+ if (fwrite(Start,Stop - Start,1,Output) != 1)
+ return _error->Errno("fwrite","IO Error to output");
+ if (Stop[-1] != '\n')
+ fprintf(Output,"\n");
+ }
+ }
// Now write all the old tags that were missed.
for (unsigned int I = 0; I != Tags.Count(); I++)