summaryrefslogtreecommitdiff
path: root/lib/String.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/String.cc')
-rw-r--r--lib/String.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/String.cc b/lib/String.cc
index fa1db50..83adad7 100644
--- a/lib/String.cc
+++ b/lib/String.cc
@@ -71,7 +71,7 @@ String::~String() {
free(str);
}
-const char * String::set(char * s, ...) {
+const char * String::set(const char * s, ...) {
va_list ap;
va_start(ap, s);
@@ -83,6 +83,18 @@ const char * String::set(char * s, ...) {
return t;
}
+const char * String::set(const String & s, ...) {
+ va_list ap;
+
+ va_start(ap, s);
+ vsnprintf(t, BUFSIZ, s.str, ap);
+ free(str);
+ str = Base::strdup(t);
+ va_end(ap);
+ siz = ::strlen(str);
+ return t;
+}
+
const char * String::to_charp(size_t from, ssize_t to) const {
if (to < 0) {
strncpy(t, &(str[from]), BUFSIZ);