Mailing-List: contact cygwin-help@sourceware.cygnus.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@sources.redhat.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@sources.redhat.com>
List-Help: <mailto:cygwin-help@sources.redhat.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@sources.redhat.com
Delivered-To: mailing list cygwin@sources.redhat.com
Message-ID: <00cf01c032e2$9eb9fa80$c4acb018@home.com>
From: "Erik Nolte" <enolte@campuspipeline.com>
To: <cygwin@sources.redhat.com>
References: <1001010143632.AA82047.SM@nike.ins.cwru.edu> <20001010124922.J3352@cygnus.com>
Subject: Re: getopts missing with latest cygwin
Date: Tue, 10 Oct 2000 11:50:46 -0600
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.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400


> On Tue, Oct 10, 2000 at 10:36:32AM -0400, Chet Ramey wrote:
> >> The "ash maintainer" is either me or Corinna.  FWIW, I don't plan on
> >> changing this.  I want ash to be small and fast when running configure
> >> scripts.  I've stripped ash down to support only the minimal set of
> >> functionality found in older versions of UNIX.  I use the /bin/sh on
> >> Digital UNIX 3.2 as a reference.
> >
> >You might as well use the V7 sh man page as your reference, since the
> >version you're using provides little more.  Does the cygwin sh support
> >shell functions?  (Those weren't in v7.)
>
> I might do that.  But I don't.

Shell functions are supported in ash.

So what should ash be?  A clone of Digital 3.2, V7, or modern unix's sh?

I'll probably never have to move a cygwin script to Digital 3.2 or V7, but I
regularly move scripts back and forth between Solaris, HP/UX, IRIX, and
cygwin.

I don't fully appreciate the problem with including getopts support.  I
compiled ash, stripped the executable and it's essentially the same size as
ash without getopts (67K vs 68K).  I've probably done something horrible by
stripping the executable, but everything seems to work fine and ash seems to
run just as fast with getopts as without.

- Erik

PS.  I hadn't thought about $OPTIND and $OPTARG until Chet pointed them out.
I typically do things like:

    while getopts 'j:' option
    do
        case "$option" in
        j) JVM="$OPTARG";;
        esac
    done
    shift `expr $OPTIND - 1`
    $JVM "$@"

This won't work with an external getopts since $OPTARG and $OPTIND would
always be unset.


--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com

