There are more than enough to deserve their own .c file, hence move them over.
This really deserves its own file, given how much code this is now.
- Really warn in all error cases, not just some. We need to make sure that all errors are logged to not confuse the user. - Explicitly check for EINVAL error code before claiming anything about invalid escapes, could be ENOMEM after all.
This is quite a lot of code these days, hence move it to its own source file.