Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int _expand_format_str(char *restrict buffer, const char *restrict format)
- {
- const char *fpos;
- char *bpos;
- int is_bold = 0;
- int len = strlen(format)+20;
- if (!buffer)
- return len;
- for (fpos = format, bpos = buffer; *fpos != '\0'; ++fpos)
- {
- switch (*fpos)
- {
- case '*':
- if (!is_bold)
- {
- *bpos++ = 0x1b;
- *bpos++ = 0x5b;
- *bpos++ = 0x31;
- *bpos++ = 0x6d;
- } else
- {
- *bpos++ = 0x1b;
- *bpos++ = 0x28;
- *bpos++ = 0x42;
- *bpos++ = 0x1b;
- *bpos++ = 0x5b;
- *bpos++ = 0x6d;
- }
- is_bold = !is_bold;
- break;
- default:
- *bpos = *fpos;
- bpos++;
- break;
- }
- }
- return len;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement