INN config file parsing infrastructure

Todd Olson tco2 at cornell.edu
Mon May 8 20:03:38 UTC 2000


Hi Russ

At 02:02 -0700 2000/05/06, Russ Allbery wrote:
>Todd Olson <tco2 at cornell.edu> writes:
>
> > Further, in #4 the \<newline> is retained in the parsed result,
>
>I've been convinced this is a bad idea.  The newline will disappear,
>although the whitespace will be retained.


Thanks!
Thanks also for sharing your ideas with us and opening the config parser
spec up for discussion.

If I may one more comment about retained whitespace....

I advocate that the leading whitespace after a \<newline> should 
*not* be retained.   The prime reason is that retaining such space
makes the config files very mess.  For example, suppose there was a
need to set a parameter to a three line string in sendmail header style
(ie leading tabs on second and third line).
That is, the resulting value should be

=========
X-comment: This is a three
	line, sendmail style
	comment

=========
How would we do this with the different schemes?
=========
Here is one example when whitespace *is* retained

              parameter:  "X-comment: This is a three\n\
	line, sendmail style\n\
	comment"

=========
Here is another

              parameter:  "X-comment: This is a three\n	\
line, sendmail style\n	\
comment"


=========
Here is a third

              parameter:  "X-comment: This is a three\n\tline, sendmail style\n\tcomment"

=========
Finally here is how it would look if leading whitespace is delete
              parameter:  "X-comment: This is a three\
                         \n	line, sendmail style\
                         \n	comment"

=========
To me the first three are very hard to read, while the fourth
is easy to read.  The fourth is only possible if leading white
space is deleted.

Also note, that if leading whitespace is not delete then to avoid
imbedding whitespace in strings that may not accept white space you
must put the continued lines at the beginning of a line, other wize
you will introduce hard to notice errors.


In fairness a problem does arise with deleting leadingwhite space ...
What happens if you don't want a newline but you want white space
where you are breaking a line .... 
That is, how do you avoid this

           parameter:  "this is a\
                        line of text"

from being the same as

           parameter:  "this is aline of text"

There are two answers
     a) put the white space at the end of first line .. ie

           parameter:  "this is a \
                        line of text"

     b) introduce escaped whitespace  '\ ' that is not deleted by the parser

           parameter:  "this is a\
                       \ line of text"

personally I think option (b) is a workable and good idea

To me, having leading whitespace following a \<newline> is an idea
that is consistant with the rest of the UNIX world in which I work.
To me, it is a natural idea.

Question is, is it natural and consistant in the framework of INN.
Is this a direction that the INN community wants to go.  I don't know
but I sure hope so...

Regards,
Todd Olson
Cornell E-Mail-List Admin Team 




More information about the inn-workers mailing list