Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void AddString(U **buf_p, size_t &maxlen, const cell *string, int width, int prec)
- {
- int size = 0;
- U *buf;
- static cell nlstr[] = {'(','n','u','l','l',')','\0'};
- buf = *buf_p;
- if (string == NULL)
- {
- string = nlstr;
- prec = -1;
- }
- if (prec >= 0)
- {
- for (size = 0; size < prec; size++)
- {
- if (string[size] == '\0')
- break;
- }
- } else {
- while (string[size++]) ;
- size--;
- }
- if (size > (int)maxlen)
- size = maxlen;
- maxlen -= size;
- width -= size;
- while (size--)
- *buf++ = static_cast<U>(*string++);
- while (width-- > 0 && maxlen)
- {
- *buf++ = ' ';
- maxlen--;
- }
- *buf_p = buf;
- }
Advertisement
Add Comment
Please, Sign In to add comment