summaryrefslogtreecommitdiff
path: root/ustring.c
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2004-04-01 17:08:59 +0000
committerSimon Tatham <anakin@pobox.com>2004-04-01 17:08:59 +0000
commitaf770784f1153b346a550363406c57b58d4c2552 (patch)
treedcafa0bcf013006b97df6d0d298b4dbf88ea4956 /ustring.c
parentefe1dfe08841eb96a97d224c4f975cdfb5107c27 (diff)
downloadhalibut-af770784f1153b346a550363406c57b58d4c2552.zip
halibut-af770784f1153b346a550363406c57b58d4c2552.tar.gz
halibut-af770784f1153b346a550363406c57b58d4c2552.tar.bz2
halibut-af770784f1153b346a550363406c57b58d4c2552.tar.xz
Add \cfg / -C directives to allow the user to choose the output file
name (or name schema, in HTML). [originally from svn r4017]
Diffstat (limited to 'ustring.c')
-rw-r--r--ustring.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/ustring.c b/ustring.c
index 0741dcf..a64d155 100644
--- a/ustring.c
+++ b/ustring.c
@@ -33,6 +33,21 @@ char *ustrtoa(wchar_t *s, char *outbuf, int size) {
return outbuf;
}
+char *utoa_dup(wchar_t *s) {
+ int len;
+ char *buf = NULL;
+
+ len = ustrlen(s) + 1;
+ do {
+ buf = resize(buf, len);
+ ustrtoa(s, buf, len);
+ len = (3 * len) / 2 + 1; /* this guarantees a strict increase */
+ } while ((int)strlen(buf) >= len-1);
+
+ buf = resize(buf, strlen(buf)+1);
+ return buf;
+}
+
int ustrlen(wchar_t *s) {
int len = 0;
while (*s++) len++;