From owner-freebsd-hackers Wed Sep 25 18:58:49 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1295837B401 for ; Wed, 25 Sep 2002 18:58:48 -0700 (PDT) Received: from tomts24-srv.bellnexxia.net (tomts24.bellnexxia.net [209.226.175.187]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4C08243E42 for ; Wed, 25 Sep 2002 18:58:47 -0700 (PDT) (envelope-from matt@gsicomp.on.ca) Received: from xena.gsicomp.on.ca ([65.95.177.134]) by tomts24-srv.bellnexxia.net (InterMail vM.5.01.04.19 201-253-122-122-119-20020516) with ESMTP id <20020926015845.OKQN15836.tomts24-srv.bellnexxia.net@xena.gsicomp.on.ca> for ; Wed, 25 Sep 2002 21:58:45 -0400 Received: from hermes (hermes.gsicomp.on.ca [192.168.0.18]) by xena.gsicomp.on.ca (8.11.3/8.11.3) with SMTP id g8Q0itX17465 for ; Wed, 25 Sep 2002 20:44:55 -0400 (EDT) (envelope-from matt@gsicomp.on.ca) Message-ID: <009b01c26500$3f7e91a0$1200a8c0@gsicomp.on.ca> From: "Matthew Emmerton" To: Subject: perceived strangeness with getopt(1,3) Date: Wed, 25 Sep 2002 21:58:43 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Maybe I'm missing something huge, but getopt(1,3) aren't working the way I think they should. I have a script that I want to take two options, both of which have required arguments. gabby# getopt k:s: -k getopt: option requires an argument -- k -- gabby# getopt k:s: -s getopt: option requires an argument -- s -- gabby# Ok, so far, so good. But now let's combine them: gabby# getopt k:s: -k arg1 -s arg2 -k arg1 -s arg2 -- Ok, looks fine. gabby# getopt k:s: -k -s -k -s -- gabby# Wha? Neither of these options specified arguments! I guess you could consider that -k's argument was '-s', but I was pretty sure that an option's argument couldn't start with a dash character (to avoid the ambiguity that I'm hitting right now.) I'm pretty sure I'm the one that's confused (not getopt), since I get the same behaviour on -STABLE and -CURRENT. Can someone tell me how to accomplish what I want to do? Basically, I want this: gabby# getopt k:s: -k arg1 -s getopt: option requires an argument -- k -k arg1 -- gabby# getopt k:s: -k -s arg2 getopt: option requires an argument -- k -s arg2 -- gabby# -- Matt Emmerton To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message