Michael Forney 948e516190 libutil/unescape: Stop octal escape at 3 digits
unescape() is used by several tools, in particular printf(1) and
tr(1), which should stop the octal escape at a maximum of 3 digits:

printf(1)
> In addition to the escape sequences shown in XBD 5. File Format
> Notation ('\\', '\a', '\b', '\f', '\n', '\r', '\t', '\v'), "\ddd",
> where ddd is a one, two, or three-digit octal number, shall be
> written as a byte with the numeric value specified by the octal
> number.

tr(1)
> An octal sequence shall consist of a <backslash> followed by the
> longest sequence of one, two, or three-octal-digit characters.

Previously, the maximum was set to 4 (possibly a typo?), which meant
that printf '\0123' printed `S` instead of `<newline>3`.

To check that this doesn't break any other tools using unescape:

- cut: used for -d parameter, escapes are non-standard
- join: used for -t parameter, escapes are non-standard
- nl: used for -s parameter, escapes are non-standard
- paste: used for -d parameter, POSIX specifies \n, \t, \\, and \0,
  \0 followed by a digit is unspecified
- sort: used for -t parameter, escapes are non-standard
2025-04-23 21:10:51 +02:00
..
2025-04-20 09:20:02 +02:00
2025-04-22 13:57:36 +02:00
2015-02-11 01:17:21 +00:00
2025-04-20 09:20:02 +02:00
2015-09-30 19:44:10 +01:00
2014-11-17 16:48:34 +00:00
2015-10-26 16:53:28 +00:00
2019-12-31 13:39:08 -08:00
2016-07-09 10:09:50 +01:00
2014-11-17 16:48:34 +00:00
2025-03-17 14:32:36 +01:00
2019-04-16 17:41:39 -07:00
2014-11-17 16:48:34 +00:00
2016-02-24 10:15:16 +00:00
2016-02-24 10:15:16 +00:00
2016-02-24 10:15:16 +00:00
2016-02-24 10:15:16 +00:00
2015-09-30 19:44:10 +01:00
2015-03-17 11:24:49 +01:00
2015-03-17 11:24:49 +01:00
2015-01-25 17:48:11 +00:00