--- rxvt-unicode/src/misc.C 2007/09/03 07:31:12 1.44 +++ rxvt-unicode/src/misc.C 2007/09/08 21:25:56 1.46 @@ -165,7 +165,7 @@ } char * -rxvt_r_basename (const char *str) NOTHROW +rxvt_basename (const char *str) NOTHROW { char *base = strrchr (str, '/'); @@ -238,7 +238,7 @@ * remove leading/trailing space in place. */ char * -rxvt_Str_trim (char *str) NOTHROW +rxvt_strtrim (char *str) NOTHROW { char *r, *s; @@ -262,91 +262,6 @@ } /* - * in-place interpretation of string: - * - * backslash-escaped: "\a\b\E\e\n\r\t", "\octal" - * Ctrl chars: ^@ .. ^_, ^? - * - * Emacs-style: "M-" prefix - * - * Also, - * "M-x" prefixed strings, append "\r" if needed - * "\E]" prefixed strings (XTerm escape sequence) append ST if needed - * - * returns the converted string length - */ -int -rxvt_Str_escaped (char *str) NOTHROW -{ - char ch, *s, *d; - int i, num, append = 0; - - if (!str || !*str) - return 0; - - d = s = str; - - if (*s == 'M' && s[1] == '-') - { - /* Emacs convenience, replace leading `M-..' with `\E..' */ - *d++ = C0_ESC; - s += 2; - if (toupper (*s) == 'X') - /* append carriage-return for `M-xcommand' */ - for (*d++ = 'x', append = '\r', s++; isspace (*s); s++) ; - } - for (; (ch = *s++);) - { - if (ch == '\\') - { - ch = *s++; - if (ch >= '0' && ch <= '7') - { /* octal */ - num = ch - '0'; - for (i = 0; i < 2; i++, s++) - { - ch = *s; - if (ch < '0' || ch > '7') - break; - num = num * 8 + ch - '0'; - } - ch = (char)num; - } - else if (ch == 'a') - ch = C0_BEL; /* bell */ - else if (ch == 'b') - ch = C0_BS; /* backspace */ - else if (ch == 'E' || ch == 'e') - ch = C0_ESC; /* escape */ - else if (ch == 'n') - ch = '\n'; /* newline */ - else if (ch == 'r') - ch = '\r'; /* carriage-return */ - else if (ch == 't') - ch = C0_HT; /* tab */ - } - else if (ch == '^') - { - ch = *s++; - ch = toupper (ch); - ch = (ch == '?' ? 127 : (ch - '@')); - } - *d++ = ch; - } - - /* ESC] is an XTerm escape sequence, must be terminated */ - if (*str == '\0' && str[1] == C0_ESC && str[2] == ']') - append = CHAR_ST; - - /* add trailing character as required */ - if (append && d[-1] != append) - *d++ = append; - *d = '\0'; - - return (d - str); -} - -/* * Split a comma-separated string into an array, stripping leading and * trailing spaces from each entry. Empty strings are properly returned * Caller should free each entry and array when done @@ -375,7 +290,7 @@ ret[l] = (char *)malloc (p + 1); strncpy (ret[l], s, p); ret[l][p] = '\0'; - rxvt_Str_trim (ret[l]); + rxvt_strtrim (ret[l]); s = ++t; }