[m-dev.] diff: use .nocopyright files to control copyright checks.

Tyson Dowd trd at cs.mu.OZ.AU
Mon Aug 21 11:19:56 AEST 2000


On 17-Aug-2000, Peter Schachte <schachte at cs.mu.OZ.AU> wrote:
> On Thu, Aug 17, 2000 at 03:31:26PM +1000, Zoltan Somogyi wrote:
> > > +				if ($_ =~ /^$file/) {
> > > +					print "no copyright check required for `$file' (from `$directory')\n";
> > > +					return 0;
> > > +				}
> > 
> > You should anchor the pattern match not only on the left (start of line),
> > but also on the right (end of line).
> 
> Good point.  But it would be sporting to allow whitespace at least at the
> end of the line, since it can't be readily seen in a text editor, and so
> could easily lead to hair loss.  Better still, allow multiple file names on
> a line, like the .cvsignore file, using the pattern
> 
> 	/\b$file\b$/

I think you mean
	/\b$file\b/

(any sufficiently advanced regular expression is indistinguishable from
magic).

> Handling wildcards would take a bit more work.

Not to mention a motivated worker.

===================================================================


Estimated hours taken: 0.3

CVSROOT/check.pl:
	Modify the .nocopyright check so that it accepts any space
	separated word as a filename.  Start and end of file count as
	spaces for this purpose. 


Index: check.pl
===================================================================
RCS file: /home/mercury1/repository/CVSROOT/check.pl,v
retrieving revision 1.15
diff -u -r1.15 check.pl
--- check.pl	2000/08/17 04:08:36	1.15
+++ check.pl	2000/08/21 01:07:47
@@ -148,7 +148,7 @@
 	if ($directory =~ m^$cvsroot/mercury^) {
 		if (open NOCOPYRIGHT, ".nocopyright") {
 			while (<NOCOPYRIGHT>) {
-				if ($_ =~ /^$file/) {
+				if ($_ =~ /\b$file\b/) {
 					print "no copyright check required for `$file' (from `$directory')\n";
 					return 0;
 				}


-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't everyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list