Date: Wed, 13 Nov 2002 10:04:25 +0200 From: Sheldon Hearn <sheldonh@starjuice.net> To: Nate Lawson <nate@root.org> Cc: current@freebsd.org Subject: Re: sleep(1) behavior Message-ID: <20021113080425.GO1278@starjuice.net> In-Reply-To: <Pine.BSF.4.21.0211121633330.37340-100000@root.org> References: <Pine.BSF.4.21.0211121633330.37340-100000@root.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On (2002/11/12 16:37), Nate Lawson wrote: > I've found an interesting contradiction and was wondering what behavior > sleep should have. It checks for a command line flag with getopt(3) and > exits with usage() if it finds one. However, it then checks for a '-' or > '+' sign. If negative, it behaves like "sleep 0" and exits > immediately. This case can almost never be triggered since the > getopt(3) will catch the minus sign, even if a digit follows it. > > Current behavior: > sleep 0 = exits immediately > sleep -1 = exits with usage() > sleep -f = exits with usage() > sleep " -1" = exits immediately and is the only way I know to trigger > the negative case. > > What is the standard, desired behavior? IEEE Std 1003.2-1992 says: time A nonnegative decimal integer specifying the number of seconds for which to suspend execution. I think it's pretty clear that negative time arguments to sleep(1) are not portable. Ciao, Sheldon. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021113080425.GO1278>