Date: Thu, 24 Jan 2019 16:18:49 +0100 From: Joerg Sonnenberger <jo...@bec.de> Message-ID: <20190124151849.ga10...@britannica.bec.de>
| This is overcomplicated and fragile, IMO. ps: if the fragility referred to is that it might now switch mid-stream into sending messages in English rather than in the locale's language - then that is a valid concern, and I could certainly change it to use strtod_l() in that case to avoid that problem. Of course, that only becomes an issue when someone writes a messages catalog for sleep's usage message, and the SIGINFO messages, and provides all of the locale specific translations, and then fixes the code to cause them to be used. The only other message that sleep ever produces is from the err(EXIT_FAILURE, "nanosleep failed"); which should produce the strerror() result in a form appropriate for the local locale -- but that one only happens when sleep is given a very large argument, which would be better handled by simply not calling nanosleep, but using sleep(3) instead - anyone who believes that sleep 2000.25 is a useful thing to do is delusional (if we fall back to sleep the fractional seconds part would simply be ignored, not an error). Sleep doesn't have an error return, and nanosleep() would no longer ever fail, so the err() (the one place that a locale specific message is produced now) would no longer be needed in practice (it would still be in the code, just in case, but would never fire, so what language it might produce its message in would not matter.) For sleep durations outside the range of what sleep(3) permits, we should just pause(), no-one will ever know the difference. kre