summaryrefslogtreecommitdiff
path: root/amiga/misc.c
diff options
context:
space:
mode:
Diffstat (limited to 'amiga/misc.c')
-rwxr-xr-xamiga/misc.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/amiga/misc.c b/amiga/misc.c
index bfb281718..affb65197 100755
--- a/amiga/misc.c
+++ b/amiga/misc.c
@@ -155,37 +155,26 @@ bool path_add_part(char *path, int length, const char *newpart)
}
/**
- * returns a string without escape chars or |M chars.
+ * returns a string with escape chars translated.
* (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)
+char *translate_escape_chars(const char *s)
{
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];
+ if (s[i] != '\\') {
+ ret[ii++] = s[i];
}
- else if ((translate) && (s[i] == '|') && (s[i+1] == 'M')) {
+ else if (s[i+1] == 'n') {
ret[ii++] = '\n';
i++;
}
- else {
- if(translate) nextcharupper = true;
- i++;
- }
}
ret[ii] = '\0';
return ret;