[PATCH v2] testsuite: prune DOS drive letter in test outputs

Clément Chigot chigot@adacore.com
Wed Feb 22 16:13:22 GMT 2023


On Wed, Feb 22, 2023 at 4:42 PM Andreas Schwab <schwab@suse.de> wrote:
>
> On Feb 22 2023, Clément Chigot via Binutils wrote:
>
> > +     regsub -all "(^|\n)\[\[:alpha:\]\]:(/|\)" $output "\\1\\2" output
>
> If you want to match a backslash, you need to double it, and double it
> again to please the double quote syntax.  If you fear the leaning
> toothpick syndrom, change the quoting of the regexp by using {} instead
> of "".  Note that Tcl regexps support \n as an escape sequence for
> newline.

It seems that both are working.
  | $ cat ~/tmp/test.tcl
  | set output "C:\\home\\c"
  | regsub -all "(^|\n)\[\[:upper:\]\]:(/|\)" $output "\\1\\2" output
  | puts $output
  | regsub -all "(^|\n)\[\[:upper:\]\]:(/|\\\\)" $output "\\1\\2" output
  | puts $output

  | $ tclsh8.6 ~/tmp/test.tcl
  | \home\c
  | \home\c

Can it because of my tcl version (8.6.10) ?

Thanks,
Clément


More information about the Binutils mailing list