groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] makeinfo problem


From: Keith MARSHALL
Subject: Re: [Groff] makeinfo problem
Date: Fri, 4 Nov 2005 10:10:26 +0000

In the following patch, proposed by Werner Lemberg:
--- aclocal.m4.old               2005-10-27 16:31:12.000000000 +0200
+++ aclocal.m4           2005-11-04 08:40:02.021538384 +0100
@@ -67,7 +67,7 @@
    else
      # We need an additional level of quoting to make sed's regexps work.
      [makeinfo_version=`$MAKEINFO --version 2>&1 \
-       | sed '1 {s/^.* \([^ ]\+\)$/\1/;q}'`]
+       | sed '1 { s/^.* \([^ ]\+\)$/\1/;q }'`]
      # Consider only the first two numbers in version number string.
      [makeinfo_version_major=`echo $makeinfo_version \
        | sed 's/^\([0-9]*\).*$/\1/'`]


This doesn't work, with GNU sed 3.02 MinGW/MSYS implementation; at
the very least, a semicolon is required after the `q' directive.

Since `{' and `}' are technically sed directives in their own right,
is it not safer to use semicolons to separate both of them from the
adjoining `s' and `q' directives?  Even better, might be to rewrite
the sed expression as 's/^.* \([^ ]\+\)$/\1/;1q', thus avoiding the
braces altogether.

I had a similar problem, just last week, in an install rule for an
optional MinGW header.  To remove a HAVE_PROCESS_H guard from

   #ifdef HAVE_PROCESS_H
   #include <process.h>
   #endif

I had, in my Makefile

   install-headers: $(HEADERS)
       if test -f ${includedir}/process.h; then \
         for f in $(HEADERS); \
         do sed '/HAVE_PROCESS_H/{N;h;N;g;D}' ${srcdir}/$$f \
              > ${includedir}/$$f; \
         done; \
       else \
         cp ${srcdir}/$$f ${includedir}/$$f; \
       fi

I found I had to rewrite that sed expression as

   sed '/HAVE_PROCESS_H/{;N;h;N;g;D;}' ${srcdir}/$$f \

to make it work reliably with the GNU sed 3.02, provided with MinGW/MSYS;
(actually, I didn't *need* the semicolon after the `{', but I *did* need
 the one after the `D').

BTW, this example is taken from `mingw-execwrap-1.0.0':
https://sourceforge.net/project/showfiles.php?group_id=2435&package_id=82725&release_id=366538
a GPL package I've provided, extending the original wrapper code that
Jeff Conrad and I provided for the Microsoft spawnvp() function, as
used in groff, to cover the entire spawn and exec function families.
It might also be useful to users of Microsoft's compiler suite.

Best regards,
Keith.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]