I like the idea, but I'm not sure I like passing arguments directly to regex.
I'd add a 'case' argument to dportsearch, that defaults to ON (case
sensitive).
- landonf
Bryan Blackburn said:
> The two patches below make 'port search' insensitive to case, or am I
> the only one who thinks it shouldn't be that sensitive?
>
> Bryan
>
>
> --- base/src/port/port.tcl.orig Mon Feb 2 02:00:03 2004
> +++ base/src/port/port.tcl Thu Feb 5 01:05:15 2004
> @@ -309,7 +309,7 @@
> puts "You must specify a search pattern"
> exit 1
> }
> - if {[catch {set res [dportsearch $portname]} result]} {
> + if {[catch {set res [dportsearch $portname -nocase]} result]} {
> puts "port search failed: $result"
> exit 1
> }
> --- base/src/darwinports1.0/darwinports.tcl.orig Mon Feb 2 02:00:00 2004
> +++ base/src/darwinports1.0/darwinports.tcl Thu Feb 5 01:06:11 2004
> @@ -541,7 +541,7 @@
> }
> }
>
> -proc dportsearch {regexp} {
> +proc dportsearch {regexp args} {
> global darwinports::portdbpath darwinports::sources
> set matches [list]
>
> @@ -551,7 +551,12 @@
> }
> while {[gets $fd line] >= 0} {
> set name [lindex $line 0]
> - if {[regexp -- $regexp $name] == 1} {
> + if {[llength $args] > 0} {
> + set regexresult [regexp $args -- $regexp $name]
> + } else {
> + set regexresult [regexp -- $regexp $name]
> + }
> + if {$regexresult == 1} {
> gets $fd line
> array set portinfo $line
> if {[info exists portinfo(portarchive)]} {
|