From owner-freebsd-bugs Sat Apr 3 14:30:22 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 3E41514D67; Sat, 3 Apr 1999 14:30:21 -0800 (PST) (envelope-from cracauer@FreeBSD.org) Received: (from cracauer@localhost) by freefall.freebsd.org (8.9.2/8.9.2) id OAA09764; Sat, 3 Apr 1999 14:28:26 -0800 (PST) (envelope-from cracauer@FreeBSD.org) Date: Sat, 3 Apr 1999 14:28:26 -0800 (PST) From: Message-Id: <199904032228.OAA09764@freefall.freebsd.org> To: bob@pmr.com, cracauer@FreeBSD.org, freebsd-bugs@FreeBSD.org Subject: Re: bin/5845 Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Synopsis: in sh, set -- `getopt ...` always returns zero State-Changed-From-To: open->closed State-Changed-By: cracauer State-Changed-When: Sun Apr 4 00:26:22 MEST 1999 State-Changed-Why: Fixed in 4.0-current from today. Will be fixed in 3.x in a few days. Releases 3.2 and 4.0 should have this change. The problem wasn't with getopt, but with the example in the manpage. Here's the log: 1) Fix the case where a shellscript using getopt is called with a parameter that has space in it, both in getopt.c and in the manpage example. 2) Fix the example in the manpage. The set(1) command is required to return 0 (POSIX 1003.2, section 3.14.11), so you can't test for getopt's exit status like the example did: #! /bin/sh set -- `getopt abo: $*` if test $? != 0 # wrong, tests for set's exit status, which is # always zero, no for getopt(1)'s. Fixes PR bin/5845, which thought it was getopt's fault, but in fact the manpage was wrong. I also updated the example to be more useful and updated the BUGS section. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message