delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/10/10/13:56:05

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019