On 02-Apr-21 6:46 PM, Stephen Hemminger wrote:
On Thu, 1 Apr 2021 15:05:17 +0000 Anatoly Burakov <anatoly.bura...@intel.com> wrote:+ /* fgets puts null terminator in, but do this just in case */ + buf[BUFSIZ - 1] = '\0'; + + /* strip off any terminating newlines */ + if (strlen(buf)) + strtok(buf, "\n");Why not the simpler/shorter strchrnul(buf, '\n') = '\0';
How many more string functions are there that i don't know about :D -- Thanks, Anatoly