static int get_piece (const char *p, char *chr) { const char *q = p; if (!p) return 0; while (*p && *p != '\n' && !is_ansi_seq(p)) p++; if (p && chr) *chr = *p; return p - q; }
static int get_piece(const char *p, char *chr) { const char *q = p; if (!p) { return 0; } while (p && *p && *p != '\n' && !is_ansi_seq (p)) { p++; } if (chr) { *chr = *p; } return p - q; }
static const char *set_attr(RConsCanvas *c, const char *s) { const char *p; char *color; /* check for ANSI sequences and use them as attr */ if (is_ansi_seq(s)) { p = s + 2; for (p = s; *p && *p != 'J' && *p != 'm' && *p != 'H'; ++p); p++; color = r_str_ndup(s, p - s); c->attr = color; s = p; } return s; }
/* check for ANSI sequences and use them as attr */ static const char *set_attr(RConsCanvas *c, const char *s) { const char *p = s; char *color; while (is_ansi_seq (p)) { p += 2; while (*p && *p != 'J' && *p != 'm' && *p != 'H') { p++; } p++; } if (p != s) { color = r_str_ndup (s, p - s); c->attr = color; } return p; }