From owner-freebsd-current Tue Nov 12 16:37:45 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5353D37B401 for ; Tue, 12 Nov 2002 16:37:44 -0800 (PST) Received: from rootlabs.com (root.org [67.118.192.226]) by mx1.FreeBSD.org (Postfix) with SMTP id 667FE43E6E for ; Tue, 12 Nov 2002 16:37:40 -0800 (PST) (envelope-from nate@rootlabs.com) Received: (qmail 37511 invoked by uid 1000); 13 Nov 2002 00:37:41 -0000 Date: Tue, 12 Nov 2002 16:37:41 -0800 (PST) From: Nate Lawson To: current@freebsd.org Subject: sleep(1) behavior Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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? -Nate To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message