diff options
author | H. Peter Anvin <hpa@zytor.com> | 2008-06-15 18:33:03 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-06-15 18:33:03 -0700 |
commit | 19b741835f684191f35c05d21c1b098a80a96410 (patch) | |
tree | 99ed31df1b40d81f0d488c3b4ae408ad658de642 /syncfiles.pl | |
parent | 6f4252afeac7e11092601738b8f60e037245010b (diff) | |
download | nasm-19b741835f684191f35c05d21c1b098a80a96410.tar.gz nasm-19b741835f684191f35c05d21c1b098a80a96410.tar.bz2 nasm-19b741835f684191f35c05d21c1b098a80a96410.zip |
syncfiles: handle the case of the null path separator
Correctly handle the null path separator (meaning remove the directory
portion entirely.)
Diffstat (limited to 'syncfiles.pl')
-rwxr-xr-x | syncfiles.pl | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/syncfiles.pl b/syncfiles.pl index ea77ca4..bd40ff2 100755 --- a/syncfiles.pl +++ b/syncfiles.pl @@ -11,11 +11,19 @@ sub do_transform($$) { my($l, $h) = @_; + my($ps) = $$h{'path-separator'}; $l =~ s/\x01/$$h{'object-ending'}/g; - $l =~ s/\x02/$$h{'path-separator'}/g; $l =~ s/\x03/$$h{'continuation'}/g; + if ($ps eq '') { + # Remove the path separator and the preceeding directory + $l =~ s/\S*\x02//g; + } else { + # Convert the path separator + $l =~ s/\x02/$ps/g; + } + return $l; } @@ -31,7 +39,7 @@ foreach $file (@ARGV) { # First, read the syntax hints %hints = %def_hints; while (defined($line = <FILE>)) { - if ($line =~ /^\#\s+\@(\S+)\:\s*\"([^\"]+)\"/) { + if ($line =~ /^\#\s+\@(\S+)\:\s*\"([^\"]*)\"/) { $hints{$1} = $2; } } |