rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* Re:  improving "~" builtin ?!
@ 1991-12-12 15:49 Byron Rakitzis
  0 siblings, 0 replies; 4+ messages in thread
From: Byron Rakitzis @ 1991-12-12 15:49 UTC (permalink / raw)
  To: rc

The nice thing about rc pattern matching is that it is (with the
exception of files beginning with '.', of course) identical to the
filename expansion rules. In fact, the matching is implemented by
the same subroutine! Even if it is difficult to express the "strncmp"
concept with the ~ builtin, I think it would be a mistake to twist
the meaning of ~ to fit this requirement.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re:  improving "~" builtin ?!
@ 1991-12-12 15:32 Rich Salz
  0 siblings, 0 replies; 4+ messages in thread
From: Rich Salz @ 1991-12-12 15:32 UTC (permalink / raw)
  To: malte, rc

I think it's a bad idea and adds lots of complexity for no general-purpose
gain.  For example:
	~ 2 foo.yacc [fg]oo* *.yacc
Does the first pattern become "[f" or is the 2 the number of pattern
tokens so that it becomes "[fg]o"?  If the first, then the pattern doesn't
match; if the second, then it does match.  Confusing, and requires
introducing a new concept "the pattern match token".

What about the second pattern -- it becomes "*."  When compared with "fo"
it now fails!  Counter-intuitive.  If strcmp succeeds you expect strncmp
to succeed.
	/r$


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re:  improving "~" builtin ?!
@ 1991-12-12 15:10 malte
  0 siblings, 0 replies; 4+ messages in thread
From: malte @ 1991-12-12 15:10 UTC (permalink / raw)
  To: rc

I'd like to extend "~" in a way that it compares

	~ subject patern pattern ...

by at most n characters, as does strncmp (3) with its first to arguments.
Now I ask for your opinion if that makes sense, or if not, what you'd
propose to do instead.

_______________________________________________________________________________
malte@techfak.uni-bielefeld.de

send mail reply to:	Universitaet Bielefeld, Technische Fakultaet
		z. Hd. Malte Uhl
		Postfach 8640
		4800 Bielefeld 1



^ permalink raw reply	[flat|nested] 4+ messages in thread

* improving "~" builtin ?!
@ 1991-12-12 13:06 malte
  0 siblings, 0 replies; 4+ messages in thread
From: malte @ 1991-12-12 13:06 UTC (permalink / raw)
  To: rc

What do you think about adding a numeric option to rc '~' builtin?
It should change the semantics from strcmp -> strncmp.


_______________________________________________________________________________
malte@techfak.uni-bielefeld.de

send mail reply to:	Universitaet Bielefeld, Technische Fakultaet
		z. Hd. Malte Uhl
		Postfach 8640
		4800 Bielefeld 1



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1991-12-12 16:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1991-12-12 15:49 improving "~" builtin ?! Byron Rakitzis
  -- strict thread matches above, loose matches on Subject: below --
1991-12-12 15:32 Rich Salz
1991-12-12 15:10 malte
1991-12-12 13:06 malte

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).