This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: genini: message field always emitted


Christopher Faylor wrote:
> On Thu, Mar 11, 2010 at 09:26:38PM -0500, Charles Wilson wrote:
>> @@ -87,8 +93,10 @@ sub get {
>>     my $val = shift;
>>
>>     if ($keyhint eq 'message') {
>> -	my ($kw, $rest) = /^(\S+)\s+(.*)$/;
>> -	return $kw . ' ' . get($FH, 'ldesc', $rest);
>> +	if ($val) {
>> +	    my ($kw, $rest) = $val =~ /^(\S+)\s+(.*)$/;
>> +	    return $kw . ' ' . get($FH, 'ldesc', $rest);
>> +	}
> 
> This should be checking that $val exists and issuing a syntax error
> if not.  Otherwise, it looks ok.

How about this, for that hunk:

 sub get {
+    my $FN = shift;
     my $FH = shift;
     my $keyhint = shift;
     my $val = shift;

     if ($keyhint eq 'message') {
-       my ($kw, $rest) = /^(\S+)\s+(.*)$/;
-       return $kw . ' ' . get($FH, 'ldesc', $rest);
+       if ($val ne "") {
+           my ($kw, $rest) = $val =~ /^(\S+)\s+(.*)$/;
+           if ($kw ne "" and $rest ne "" and $rest ne "\"\"") {
+               return $kw . ' ' . get($FN, $FH, 'ldesc', $rest);
+           }
+       }
+       die "$0: $FN invalid: message keyword is present, but has bad
value '$val'\n"

with matching change to (the only) caller?

--
Chuck


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]