ref: 845970d2c992db3356cc2eae0b4e678b44a577af
parent: 54aeeafab3117a7cbbcb5b96a21d22101f78eac2
author: Ali Gholami Rudi <ali@rudi.ir>
date: Sat Apr 27 17:02:55 EDT 2013
ren: handle special characters as request delimiters
--- a/ren.c
+++ b/ren.c
@@ -430,7 +430,8 @@
static void escarg_ren(char *d, int cmd, int (*next)(void), void (*back)(int))
{
- int c, q;
+ char delim[GNLEN];
+ int c;
if (strchr(ESC_P, cmd)) {
c = next();
if (cmd == 's' && (c == '-' || c == '+')) {
@@ -452,16 +453,13 @@
}
}
if (strchr(ESC_Q, cmd)) {
- q = next();
- while (1) {
- c = next();
- if (c == q || c < 0)
+ schar_read(delim, next);
+ while (schar_jump(delim, next, back)) {
+ if ((c = next()) < 0)
break;
*d++ = c;
}
}
- if (cmd == 'z')
- *d++ = next();
*d = '\0';
}