This is the mail archive of the cygwin@sources.redhat.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: getopts missing with latest cygwin



> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]