[Date Prev][Date Next] [Chronological] [Thread] [Top]

RE: (ITS#4269) ldapsearch no LDIF wrap option



At 04:07 PM 12/20/2005, mike.patnode@centrify.com wrote:
>> -----Original Message-----
>> From: Kurt D. Zeilenga [mailto:Kurt@OpenLDAP.org] 
>> 
>> At 06:45 AM 12/20/2005, ando@sys-net.it wrote:
>> >> The Netscape version could optionally turn off LDIF wrap.  
>> Handy for 
>> >> scripting and pipes etc.  I'm surprised no one has ever done this 
>> >> before. Is there a religious movement against it?
>> >
>> >It's so trivial to workout otherwise that it does not deserve the 
>> >coding effort.
>> 
>> Personally, I rather spend my time making other programs 
>> properly accepting conformant LDIF, including line wraps, 
>> than to modifying OpenLDAP Software to produce non-compliant 
>> LDIF files (note that some line wrapping is required by the 
>> open standard).
>> 
>
>OK, then why add the integer option?  

Note that my -r 0 suggestion was in response to Ando's suggestion
that ldapsearch handle -r with an optional integer.  Due to
getopt(3) restrictions, if there is an integer to be expected
with the flag, it cannot be optional.  That is, it has to
be getopt(argc,argv,"r" ...) or getopt(argc,argv,"r:" ...).

>> >> Diffs attached for ldapsearch -r (turn off line wrap)
>> >
>> >I suggest making the -r switch accept an optional arg that specifies 
>> >the wrap column, defaulting to LDIF_LINE_WIDTH; so
>> >
>> >(nothing) means wrap at column LDIF_LINE_WIDTH
>> >
>> >-r alone means don't wrap at all
>> 
>> -r 0 instead.
>> 
>> 
>> >-r <positive integer> means wrap at given column
>
>Is -r 3 really an interesting option, or is it just code/feature bloat?

Some would argue that adding a no-line-wrap option to ldapsearch(1)
is just code/feature bloat as, in general, any program purporting
to accept LDIF input (or output of ldapsearch(1)) is generally
expected to handle LDIF, including line wraps.

>Either you live in an LDIF conformant world and you want the standard
>wrap, or you're trying to write a one line script, and you'd rather not
>deal with it.

Well, if I was writing a one line script, I'd rather
that script (still only one line) properly handle LDIF
line wraps than to waste my time and others with getting
users and programs, not just ldapsearch(1), to produce
output without standard line-wraps.

>Is there really an interesting in-between usage case?

If a user say wants to view ldapsearch(1) output
on a terminal of width 50, I would think
having the capability to wrap at 50 would be useful
to that user.

Kurt