summaryrefslogtreecommitdiff
path: root/amiga/misc.c
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2010-03-16 23:55:39 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2010-03-16 23:55:39 +0000
commit7220e03e7d4cd21f27038b6ce73ab2c77390a348 (patch)
treebb7acf22ee1e86ac0723c7c0526825372de7e8d0 /amiga/misc.c
parent04769b3f076b00cc8ab5ad3cc0b2924af86acb1b (diff)
downloadnetsurf-7220e03e7d4cd21f27038b6ce73ab2c77390a348.tar.gz
netsurf-7220e03e7d4cd21f27038b6ce73ab2c77390a348.tar.bz2
Help hints, mainly for the tabs but also massage messages strings HelpToolbar0-4 & 14
into a format we can use on the main toolbar gadgets. A couple of gadgets still missing strings. svn path=/trunk/netsurf/; revision=10134
Diffstat (limited to 'amiga/misc.c')
-rwxr-xr-xamiga/misc.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/amiga/misc.c b/amiga/misc.c
index cedff5d77..cee6aa688 100755
--- a/amiga/misc.c
+++ b/amiga/misc.c
@@ -82,3 +82,40 @@ char *path_to_url(const char *path)
return r;
}
+
+/**
+ * returns a string without escape chars or |M chars.
+ * (based on remove_underscores from utils.c)
+ * \param translate true to insert a linebreak where there was |M,
+ * and capitalise initial characters after escape chars.
+ */
+
+char *remove_escape_chars(const char *s, bool translate)
+{
+ size_t i, ii, len;
+ char *ret;
+ bool nextcharupper = false;
+ len = strlen(s);
+ ret = malloc(len + 1);
+ if (ret == NULL)
+ return NULL;
+ for (i = 0, ii = 0; i < len; i++) {
+ if ((s[i] != '\\') && (s[i] != '|')) {
+ if(nextcharupper) {
+ ret[ii++] = toupper(s[i]);
+ nextcharupper = false;
+ }
+ else ret[ii++] = s[i];
+ }
+ else if ((translate) && (s[i] == '|') && (s[i+1] == 'M')) {
+ ret[ii++] = '\n';
+ i++;
+ }
+ else {
+ if(translate) nextcharupper = true;
+ i++;
+ }
+ }
+ ret[ii] = '\0';
+ return ret;
+}