Bruno Haible wrote: >> +func_wrap () >> +{ >> + prefix=$2 >> + plen=`echo "$prefix" |wc -c` >> + if test -z "$3"; then >> + len=80 >> + fi >> + len=`expr $len - $plen` >> + echo "$1" |sed -e "s#.\\{1,$len\\} #&\\n$prefix#g" -e "s#^#$prefix&#" >> +} > > This is an interesting use of 'sed'. Btw, I think it would be useful to have > a library of shell script functions, not limited to those needed by autoconf. > Is it possible to implement the entire 'fmt' in 'sed'?
Glancing over `info coreutils "fmt invocation"', I would say yes, mostly. --crown-margin would be challenging, but I think doable. I'm not sure what --tagged-paragraph is getting at, but if I understand the documentation correctly, then its implementation should be similar to --crown-margin. Finally, I would probably leave out "[trying] to avoid line breaks after the first word of a sentence or before the last word of a sentence". Otherwise, it looks like a workable idea. Where would this library of shell script functions reside? > I've applied this. It yields tabular formatting: > > gnulib-tool: *** incompatible license on modules: > areadlink-with-size GPL > canonicalize GPL > chdir-long GPL > chown GPL > ... > xstrndup GPL > gnulib-tool: *** Stop. > > > 2008-09-25 Derek Price <[EMAIL PROTECTED]> > Bruno Haible <[EMAIL PROTECTED]> > > * gnulib-tool (func_import): Report all license incompatibilities, not > just the first one. Thanks! Derek -- Derek R. Price Solutions Architect Ximbiot, LLC <http://ximbiot.com> Get CVS and Subversion Support from Ximbiot! v: +1 248.835.1260 f: +1 248.246.1176