summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2008-12-08 09:58:04 -0800
committerMichael Vogt <michael.vogt@ubuntu.com>2008-12-08 09:58:04 -0800
commitd4cd303eae3d686b62b55e8a8202a3430b16f038 (patch)
tree9ffd2645d7190901ef08f096330f819478d0a36c /apt-pkg/contrib
parent99921bf936f050c77f424f85a658fcdbef98326e (diff)
* apt-pkg/indexrecords.cc:
- fix some i18n issues * apt-pkg/contrib/strutl.h: - add new strprintf() function to make i18n strings easier
Diffstat (limited to 'apt-pkg/contrib')
-rw-r--r--apt-pkg/contrib/strutl.cc15
-rw-r--r--apt-pkg/contrib/strutl.h1
2 files changed, 16 insertions, 0 deletions
diff --git a/apt-pkg/contrib/strutl.cc b/apt-pkg/contrib/strutl.cc
index bd374fd1e..cdd88827b 100644
--- a/apt-pkg/contrib/strutl.cc
+++ b/apt-pkg/contrib/strutl.cc
@@ -1032,6 +1032,21 @@ void ioprintf(ostream &out,const char *format,...)
out << S;
}
/*}}}*/
+// strprintf - C format string outputter to C++ strings /*{{{*/
+// ---------------------------------------------------------------------
+/* This is used to make the internationalization strings easier to translate
+ and to allow reordering of parameters */
+void strprintf(string &out,const char *format,...)
+{
+ va_list args;
+ va_start(args,format);
+
+ // sprintf the description
+ char S[1024];
+ vsnprintf(S,sizeof(S),format,args);
+ out = string(S);
+}
+ /*}}}*/
// safe_snprintf - Safer snprintf /*{{{*/
// ---------------------------------------------------------------------
/* This is a snprintf that will never (ever) go past 'End' and returns a
diff --git a/apt-pkg/contrib/strutl.h b/apt-pkg/contrib/strutl.h
index 53146ced7..d9972abf4 100644
--- a/apt-pkg/contrib/strutl.h
+++ b/apt-pkg/contrib/strutl.h
@@ -59,6 +59,7 @@ bool Hex2Num(const string &Str,unsigned char *Num,unsigned int Length);
bool TokSplitString(char Tok,char *Input,char **List,
unsigned long ListMax);
void ioprintf(ostream &out,const char *format,...) APT_FORMAT2;
+void strprintf(string &out,const char *format,...) APT_FORMAT2;
char *safe_snprintf(char *Buffer,char *End,const char *Format,...) APT_FORMAT3;
bool CheckDomainList(const string &Host, const string &List);