Either output STR to stdout or if *PBUF is not null then append STR to *PBUF and update *PBUF to point to the end of the buffer and adjust *PLEN to reflect the remaining space. Return TRUE on failure. */
| 63 | and adjust *PLEN to reflect the remaining space. |
| 64 | Return TRUE on failure. */ |
| 65 | static bool |
| 66 | buffer_or_output (char const *str, char **pbuf, size_t *plen) |
| 67 | { |
| 68 | if (*pbuf) |
| 69 | { |
| 70 | size_t slen = strlen (str); |
| 71 | if (slen >= *plen) |
| 72 | return true; |
| 73 | memcpy (*pbuf, str, slen + 1); |
| 74 | *pbuf += slen; |
| 75 | *plen -= slen; |
| 76 | } |
| 77 | else |
| 78 | { |
| 79 | fputs (str, stdout); |
| 80 | } |
| 81 | |
| 82 | return false; |
| 83 | } |
| 84 | |
| 85 | /* Output the relative representation if possible. |
| 86 | If BUF is non-null, write to that buffer rather than to stdout. */ |