Date: Fri, 30 Jun 2023 17:51:13 +0200 From: tlaro...@polynum.com Message-ID: <zj758xmif+yah...@polynum.com>
| So what is established behavior in this case It depends upon the usage. But if you're processing escapes, you need to also process \\ to mean a literal '\' of course, and once you have that if the user wants to pass the string \000 to some application, they can simply write it as \\000 -- there's no need to assume that \000 as input must have been meant to be \000 as output that as inserting a literal '\0' is stupid. As to what to actually do if someone does write \000 (or \0 with 1, 2 or 3 0's) that's kind of up to you. You can do what the user said, insert a '\0', and by so doing terminate the input at that point, or you can simply throw it away, inserting nothing for that sequence, or generate an error if you want. Only someone idiotic enough to actually write \000 in their config file is going to notice. | ---and, BTW, most utilities | ignore errors with octal sequences (printf(1) for example). Historic practice, it is just what always has been done. kre