* Re: zparseopts (Re: PATCH: _urls and _rpm)
@ 2000-06-06 7:15 Sven Wischnowsky
0 siblings, 0 replies; 4+ messages in thread
From: Sven Wischnowsky @ 2000-06-06 7:15 UTC (permalink / raw)
To: zsh-workers
Bart Schaefer wrote:
> ...
>
> What I can't decide is whether I like the behavior of emptying the array
> when no matching option is found. E.g. sometimes I think I'd like to be
> able to say
>
> glob=(-g '*(^/)')
> zparseopts -D -E g:=glob
>
> and have $glob be unchanged unless a -g really was given. Then I think
> about it some more and decide maybe not. Then I think about it some more
> and ...
<Grin> I once had that, then took it out again, then put it in again,
then...
Should we add an option for this?
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: zparseopts (Re: PATCH: _urls and _rpm)
2000-06-06 9:58 ` Oliver Kiddle
@ 2000-06-07 5:55 ` Bart Schaefer
0 siblings, 0 replies; 4+ messages in thread
From: Bart Schaefer @ 2000-06-07 5:55 UTC (permalink / raw)
To: Oliver Kiddle, Zsh workers
On Jun 6, 10:58am, Oliver Kiddle wrote:
} Subject: Re: zparseopts (Re: PATCH: _urls and _rpm)
}
} On the subject of my IRIX 5.3 compilation warnings, Bart Schaefer wrote:
} > What does line 111 of sys/types.h look like?
}
} typedef unsigned long ino_t; /* <inode> type */
}
} If you look back it my previous message (11755), you'll see that I had
} stuck a section of types.h in at the end.
Oops, I thought that was part of the diff and never even looked at it.
} after a preprocessor check for _MIPS_SZLONG == 32.
Where does _MIPS_SZLONG come from?
The test for ino_t passes this:
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif
through the preprocessor and then egreps to find ino_t. From the snippet
you sent, the egrep should fail only if _MIPS_SZLONG is neither 32 nor 64.
Unless IRIX's egrep is broken, which is not impossible ...
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: zparseopts (Re: PATCH: _urls and _rpm)
2000-06-06 4:08 ` zparseopts (Re: PATCH: _urls and _rpm) Bart Schaefer
@ 2000-06-06 9:58 ` Oliver Kiddle
2000-06-07 5:55 ` Bart Schaefer
0 siblings, 1 reply; 4+ messages in thread
From: Oliver Kiddle @ 2000-06-06 9:58 UTC (permalink / raw)
To: Zsh workers
On the subject of my IRIX 5.3 compilation warnings, Bart Schaefer wrote:
> What does line 111 of sys/types.h look like?
typedef unsigned long ino_t; /* <inode> type */
If you look back it my previous message (11755), you'll see that I had
stuck a section of types.h in at the end. The line is after a
preprocessor check for _MIPS_SZLONG == 32.
I'll try your sed suggestion out this evening, thanks.
Bart Schaefer wrote:
>
> No, that's no good. The whole point of calling it zparseOPTS is that the
> things it is parsing are *optional*.
Fair enough.
> } +zparseopts -D -E 'g:=glob'
> ^ ^ Why the quotes?
Because I cut and paste the line from the example in 11532 without
thinking much about it.
> } +(( $#glob )) || glob=( -g '' )
> You could use
> : ${(A)=glob:=-g '*(^/)'}
Very true, I forgot about that, I'll commit those changes sometime
later.
> What I can't decide is whether I like the behavior of emptying the array
> when no matching option is found.
Actually, this is how I initially assumed it would work and I tried it
out as you suggested.
and Sven wrote:
> Should we add an option for this?
An option seems slightly over-kill but I really can't decide which
behaviour I prefer either so maybe. You could also allow
g:=glob:-'*(^/)' but I'm not sure that wouldn't only be unnecessary
bloat to zparseopts.
Oliver
Index: Completion/User/_urls
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_urls,v
retrieving revision 1.11
diff -u -r1.11 _urls
--- Completion/User/_urls 2000/06/05 23:20:48 1.11
+++ Completion/User/_urls 2000/06/06 09:55:41
@@ -52,8 +52,8 @@
_wanted -C -f files expl file _files "$@" && return 0
fi
-zparseopts -D -E 'g:=glob'
-(( $#glob )) || glob=( -g '*(^/)' )
+zparseopts -D -E g:=glob
+: ${(A)=glob:=-g '*(^/)'}
ipre="$IPREFIX"
^ permalink raw reply [flat|nested] 4+ messages in thread
* zparseopts (Re: PATCH: _urls and _rpm)
2000-06-05 22:09 PATCH: _urls and _rpm Oliver Kiddle
@ 2000-06-06 4:08 ` Bart Schaefer
2000-06-06 9:58 ` Oliver Kiddle
0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2000-06-06 4:08 UTC (permalink / raw)
To: Zsh workers
On Jun 5, 11:09pm, Oliver Kiddle wrote:
} Subject: PATCH: _urls and _rpm
}
} It would be useful if zparseopts returned 0 only if it found the option
} specified so I didn't need to use (( $#glob )) but we'd have to decide
} how it would act with more than one option specified.
No, that's no good. The whole point of calling it zparseOPTS is that the
things it is parsing are *optional*. It returns nonzero only for things
that are real mistakes.
} +zparseopts -D -E 'g:=glob'
^ ^ Why the quotes?
} +(( $#glob )) || glob=( -g '*(^/)' )
You could use
: ${(A)=glob:=-g '*(^/)'}
instead.
What I can't decide is whether I like the behavior of emptying the array
when no matching option is found. E.g. sometimes I think I'd like to be
able to say
glob=(-g '*(^/)')
zparseopts -D -E g:=glob
and have $glob be unchanged unless a -g really was given. Then I think
about it some more and decide maybe not. Then I think about it some more
and ...
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2000-06-07 5:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-06 7:15 zparseopts (Re: PATCH: _urls and _rpm) Sven Wischnowsky
-- strict thread matches above, loose matches on Subject: below --
2000-06-05 22:09 PATCH: _urls and _rpm Oliver Kiddle
2000-06-06 4:08 ` zparseopts (Re: PATCH: _urls and _rpm) Bart Schaefer
2000-06-06 9:58 ` Oliver Kiddle
2000-06-07 5:55 ` Bart Schaefer
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).