public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
* Put refpurposes one line for easy manpage generation.
@ 2008-04-03 14:10 Mark Wielaard
  2008-04-03 14:25 ` Andrew Cagney
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Wielaard @ 2008-04-03 14:10 UTC (permalink / raw)
  To: frysk

Hi,

This puts all refpurpose tags and content on one line for better manpage
generation. Also did an upload-manpages. The currrent script expects
this tag and matching closing tag on one line, if it isn't the
description on the man index page will be empty (if someone knows some
sed foo to make this more flexible that would be appreciated).
http://sourceware.org/frysk/manpages/

    frysk-core/frysk/bindir/ChangeLog
    2008-04-03  Mark Wielaard  <mwielaard@redhat.com>
    
           * fdebuginfo.xml: Put refpurpose on one line.
           * ferror.xml: Likewise.
           * fexe.xml: Likewise.
           * fmaps.xml: Likewise.

diff --git a/frysk-core/frysk/bindir/fdebuginfo.xml b/frysk-core/frysk/bindir/fdebuginfo.xml
index c641219..3798c06 100644
--- a/frysk-core/frysk/bindir/fdebuginfo.xml
+++ b/frysk-core/frysk/bindir/fdebuginfo.xml
@@ -70,8 +70,7 @@
 
   <refnamediv>
     <refname>fdebuginfo</refname>
-    <refpurpose>display the debug-info paths for a process and its
-    shared modules</refpurpose>
+    <refpurpose>display the debug-info paths for a process and its shared modules</refpurpose>
   </refnamediv>
   
   <refsynopsisdiv>
diff --git a/frysk-core/frysk/bindir/ferror.xml b/frysk-core/frysk/bindir/ferror.xml
index 5a1cf8d..6d4bc90 100644
--- a/frysk-core/frysk/bindir/ferror.xml
+++ b/frysk-core/frysk/bindir/ferror.xml
@@ -70,8 +70,7 @@
 
   <refnamediv>
     <refname>ferror</refname>
-    <refpurpose>print a stack trace when the given message is printed
-    by the traced program</refpurpose>
+    <refpurpose>print a stack trace when the given message is printed by the traced program</refpurpose>
   </refnamediv>
   
   <refsynopsisdiv>
diff --git a/frysk-core/frysk/bindir/fexe.xml b/frysk-core/frysk/bindir/fexe.xml
index bb7d91c..2c7a4c7 100644
--- a/frysk-core/frysk/bindir/fexe.xml
+++ b/frysk-core/frysk/bindir/fexe.xml
@@ -70,8 +70,7 @@
 
   <refnamediv>
     <refname>fexe</refname>
-    <refpurpose>print a process or corefile's executable
-    path</refpurpose>
+    <refpurpose>print a process or corefile's executable path</refpurpose>
   </refnamediv>
   
   <refsynopsisdiv>
diff --git a/frysk-core/frysk/bindir/fmaps.xml b/frysk-core/frysk/bindir/fmaps.xml
index df0c35a..692967e 100644
--- a/frysk-core/frysk/bindir/fmaps.xml
+++ b/frysk-core/frysk/bindir/fmaps.xml
@@ -70,8 +70,7 @@
 
   <refnamediv>
     <refname>fmaps</refname>
-    <refpurpose>print the process or a corefile's address
-    maps.</refpurpose>
+    <refpurpose>print the process or a corefile's address maps.</refpurpose>
   </refnamediv>
   
   <refsynopsisdiv>



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Put refpurposes one line for easy manpage generation.
  2008-04-03 14:10 Put refpurposes one line for easy manpage generation Mark Wielaard
@ 2008-04-03 14:25 ` Andrew Cagney
  2008-04-03 14:40   ` Mark Wielaard
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Cagney @ 2008-04-03 14:25 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: frysk

Mark,

Our man pages are in XML for a reason; surely we can make use of that.  
A short script should do it.

Andrew


Mark Wielaard wrote:
> Hi,
>
> This puts all refpurpose tags and content on one line for better manpage
> generation. Also did an upload-manpages. The currrent script expects
> this tag and matching closing tag on one line, if it isn't the
> description on the man index page will be empty (if someone knows some
> sed foo to make this more flexible that would be appreciated).
> http://sourceware.org/frysk/manpages/
>
>     frysk-core/frysk/bindir/ChangeLog
>     2008-04-03  Mark Wielaard  <mwielaard@redhat.com>
>     
>            * fdebuginfo.xml: Put refpurpose on one line.
>            * ferror.xml: Likewise.
>            * fexe.xml: Likewise.
>            * fmaps.xml: Likewise.
>
> diff --git a/frysk-core/frysk/bindir/fdebuginfo.xml b/frysk-core/frysk/bindir/fdebuginfo.xml
> index c641219..3798c06 100644
> --- a/frysk-core/frysk/bindir/fdebuginfo.xml
> +++ b/frysk-core/frysk/bindir/fdebuginfo.xml
> @@ -70,8 +70,7 @@
>  
>    <refnamediv>
>      <refname>fdebuginfo</refname>
> -    <refpurpose>display the debug-info paths for a process and its
> -    shared modules</refpurpose>
> +    <refpurpose>display the debug-info paths for a process and its shared modules</refpurpose>
>    </refnamediv>
>    
>    <refsynopsisdiv>
> diff --git a/frysk-core/frysk/bindir/ferror.xml b/frysk-core/frysk/bindir/ferror.xml
> index 5a1cf8d..6d4bc90 100644
> --- a/frysk-core/frysk/bindir/ferror.xml
> +++ b/frysk-core/frysk/bindir/ferror.xml
> @@ -70,8 +70,7 @@
>  
>    <refnamediv>
>      <refname>ferror</refname>
> -    <refpurpose>print a stack trace when the given message is printed
> -    by the traced program</refpurpose>
> +    <refpurpose>print a stack trace when the given message is printed by the traced program</refpurpose>
>    </refnamediv>
>    
>    <refsynopsisdiv>
> diff --git a/frysk-core/frysk/bindir/fexe.xml b/frysk-core/frysk/bindir/fexe.xml
> index bb7d91c..2c7a4c7 100644
> --- a/frysk-core/frysk/bindir/fexe.xml
> +++ b/frysk-core/frysk/bindir/fexe.xml
> @@ -70,8 +70,7 @@
>  
>    <refnamediv>
>      <refname>fexe</refname>
> -    <refpurpose>print a process or corefile's executable
> -    path</refpurpose>
> +    <refpurpose>print a process or corefile's executable path</refpurpose>
>    </refnamediv>
>    
>    <refsynopsisdiv>
> diff --git a/frysk-core/frysk/bindir/fmaps.xml b/frysk-core/frysk/bindir/fmaps.xml
> index df0c35a..692967e 100644
> --- a/frysk-core/frysk/bindir/fmaps.xml
> +++ b/frysk-core/frysk/bindir/fmaps.xml
> @@ -70,8 +70,7 @@
>  
>    <refnamediv>
>      <refname>fmaps</refname>
> -    <refpurpose>print the process or a corefile's address
> -    maps.</refpurpose>
> +    <refpurpose>print the process or a corefile's address maps.</refpurpose>
>    </refnamediv>
>    
>    <refsynopsisdiv>
>
>
>
>   

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Put refpurposes one line for easy manpage generation.
  2008-04-03 14:25 ` Andrew Cagney
@ 2008-04-03 14:40   ` Mark Wielaard
  2008-04-03 21:03     ` Andrew Cagney
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Wielaard @ 2008-04-03 14:40 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: frysk

Hi Andrew,

On Thu, 2008-04-03 at 10:09 -0400, Andrew Cagney wrote:
> Mark Wielaard wrote:
> > This puts all refpurpose tags and content on one line for better manpage
> > generation. Also did an upload-manpages. The currrent script expects
> > this tag and matching closing tag on one line, if it isn't the
> > description on the man index page will be empty (if someone knows some
> > sed foo to make this more flexible that would be appreciated).
> > http://sourceware.org/frysk/manpages/
> 
> Our man pages are in XML for a reason; surely we can make use of that.  
> A short script should do it.

Then instead of someone with sed foo, we are looking for someone with
some xslt foo :) I am sure both could be used to generate the index
page, I am just not fluent in either. See common/manpages.sh for the
current script which currently uses just a simple sed invocation.

Cheers,

Mark

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Put refpurposes one line for easy manpage generation.
  2008-04-03 14:40   ` Mark Wielaard
@ 2008-04-03 21:03     ` Andrew Cagney
  2008-04-03 21:11       ` Mark Wielaard
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Cagney @ 2008-04-03 21:03 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: frysk

[-- Attachment #1: Type: text/plain, Size: 1124 bytes --]

Mark,

I'm not fluent in XML either, however I still managed to hack up the 
attached (from htdocs/bugzilla).  Can we do something with that?

Andrew



Mark Wielaard wrote:
> Hi Andrew,
>
> On Thu, 2008-04-03 at 10:09 -0400, Andrew Cagney wrote:
>   
>> Mark Wielaard wrote:
>>     
>>> This puts all refpurpose tags and content on one line for better manpage
>>> generation. Also did an upload-manpages. The currrent script expects
>>> this tag and matching closing tag on one line, if it isn't the
>>> description on the man index page will be empty (if someone knows some
>>> sed foo to make this more flexible that would be appreciated).
>>> http://sourceware.org/frysk/manpages/
>>>       
>> Our man pages are in XML for a reason; surely we can make use of that.  
>> A short script should do it.
>>     
>
> Then instead of someone with sed foo, we are looking for someone with
> some xslt foo :) I am sure both could be used to generate the index
> page, I am just not fluent in either. See common/manpages.sh for the
> current script which currently uses just a simple sed invocation.
>
> Cheers,
>
> Mark
>
>   


[-- Attachment #2: Bug.java --]
[-- Type: text/x-java, Size: 4750 bytes --]

import java.io.File;
import java.io.FilenameFilter;
import java.util.Map;
import java.util.TreeMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Iterator;
import java.util.Collection;
import javax.xml.parsers.DocumentBuilder; 
import javax.xml.parsers.DocumentBuilderFactory;  
import org.w3c.dom.Document;
import org.w3c.dom.Node;

public class Bug
    implements Comparable
{
    private final File file;
    private final String id;
    private final int hash;
    Bug (File file)
    {
	this.file = file;
	this.id = file.getName ().split ("\\.")[0];
	this.hash = Integer.parseInt (this.id);
    }
    /**
     * Is the object equals to this one.
     */
    public boolean equals (Object o)
    {
	return ((Bug)o).hash == hash;
    }
    /**
     * Return the hash code for this ID (hash on the underlying ID
     * value).
     */
    public int hashCode ()
    {
	return hash;
    }
    /**
     * Assuming that the two objects are the same, do a relative
     * comparison.
     */
    public int compareTo (Object o)
    {
	Bug rhs = (Bug)o;
	return rhs.hash - this.hash;
    }
    /**
     * The bug as a simplified string.
     */
    public String toString ()
    {
	return id;
    }
    public String toPrint ()
    {
	return ""
	    + id
	    + " " + reporter
	    + " " + duplicate
	    + " " + dependson
	    + " " + blocked
	    + " " + description;
    }


    String bug_id = "?";
    String description = "";
    List blocked = new LinkedList ();
    List dependson = new LinkedList ();
    boolean duplicate = false;
    String reporter;
    String assigned_to;

    private void walk (Map map, Node parent)
    {
	for (Node child = parent.getFirstChild ();
	     child != null;
	     child = child.getNextSibling ()) {
	    if (child.getNodeType () == Node.TEXT_NODE
		&& parent.getNodeType () == Node.ELEMENT_NODE) {
		// Grab the bug-id as it flies by.
		String name = parent.getNodeName ();
		String value = child.getNodeValue ();
		if (name.equals ("bug_id"))
		    bug_id = value;
		if (name.equals ("short_desc"))
		    description = description + value;
		// Print anything this blocks
		if (name.equals ("blocked"))
		    blocked.add (map.get (value));
		if (name.equals ("dependson"))
		    dependson.add (map.get (value));
		if (name.equals ("resolution"))
		    duplicate = value.equals("DUPLICATE");
		if (name.equals ("reporter"))
		    reporter = value;
		if (name.equals ("assigned_to"))
		    assigned_to = value;
	    }
	    walk (map, child);
	}
    }

    private static final DocumentBuilderFactory documentBuilderFactory
	= DocumentBuilderFactory.newInstance();
    public void parse (Map map)
    {
	try {
	    DocumentBuilder documentBuilder
		= documentBuilderFactory.newDocumentBuilder ();
	    String file = id + ".xml";
	    Document document = documentBuilder.parse (file);
	    walk (map, document);
	}
	catch (javax.xml.parsers.ParserConfigurationException e) {
	    throw new RuntimeException (e);
	}
	catch (org.xml.sax.SAXException e) {
	    throw new RuntimeException (e);
	}
	catch (java.io.IOException e)  {
	    throw new RuntimeException (e);
	}
	catch (gnu.xml.dom.ls.DomLSException e) {
	    System.err.println (id + " parse error");
	}
    }

    public static TreeMap slurp ()
    {
	TreeMap map = new TreeMap ();
	File[] dotXml = new File (".").listFiles (new FilenameFilter ()
	    {
		public boolean accept (File path, String filename)
		{
		    return filename.matches ("^[0-9]*.xml$");
		}
	    });
	System.out.println ("Loading bugs");
	for (int i = 0; i < dotXml.length; i++) {
	    File file = dotXml[i];
	    Bug bug = new Bug (file);
	    map.put (bug.id, bug);
	}
	System.out.println ("Parsing bugs");
	for (Iterator i = map.values ().iterator ();
	     i.hasNext (); ) {
	    Bug bug = (Bug)i.next ();
	    bug.parse (map);
	    System.out.println (bug.id + " " + bug.description);
	}
	return map;
    }

    public static void main (String[] args)
    {
	TreeMap map = slurp ();

	{
	    System.out.println ("Roots:");
	    Collection roots = ((Map) (map.clone())).values ();
	    for (Iterator i = roots.iterator ();
		 i.hasNext (); ) {
		Bug bug = (Bug)i.next ();
		if (bug.blocked.size () > 0)
		    i.remove ();
	    }
	    for (Iterator i = roots.iterator (); i.hasNext (); ) {
		Bug bug = (Bug)i.next ();
		System.out.println ("Root: " + bug.toPrint ());
	    }
	}

	{
	    System.out.println ("Duplicates:");
	    for (Iterator i = map.values ().iterator (); i.hasNext (); ) {
		Bug bug = (Bug)i.next ();
		if (!bug.duplicate)
		    continue;
		if (bug.dependson.size () > 0)
		    System.out.println ("dependson: " + bug.toPrint ());
		if (bug.blocked.size () != 1)
		    System.out.println ("blocked: " + bug.toPrint ());
	    }
	}
    }
}

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Put refpurposes one line for easy manpage generation.
  2008-04-03 21:03     ` Andrew Cagney
@ 2008-04-03 21:11       ` Mark Wielaard
  2008-04-04  8:32         ` Petr Machata
  0 siblings, 1 reply; 7+ messages in thread
From: Mark Wielaard @ 2008-04-03 21:11 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: frysk

[-- Attachment #1: Type: text/plain, Size: 1251 bytes --]

Hi Andrew,

On Thu, 2008-04-03 at 10:39 -0400, Andrew Cagney wrote:
> I'm not fluent in XML either, however I still managed to hack up the 
> attached (from htdocs/bugzilla).  Can we do something with that?

Yes, you probably could. Note that all the rest of the manpage index
generation is done with sed. You might need to replace all of that. But
I wouldn't put too much work into it unless you really want to. It does
work pretty well as is now.

I did add a quick detection of refpurpose tags that aren't on one line
to the Makefile. So when you do make manpages it immediately points them
out. It found two other occurrences which I also fixed.

    frysk-common/ChangeLog
    2008-04-03  Mark Wielaard  <mwielaard@redhat.com>
    
       * manpages.sh: Catch bad refpurpose tags.
    
    frysk-core/frysk/pkglibdir/ChangeLog
    2008-04-03  Mark Wielaard  <mwielaard@redhat.com>
    
       * funit-procmask.xml: Put refpurpose on one line by itself.
       * funit-exit.xml: Likewise.
    
    frysk-top/ChangeLog
    2008-04-03  Mark Wielaard  <mwielaard@redhat.com>
    
       * Makefile.am (manpages): Check for refpurpose errors.

Now all tools mentioned on http://sourceware.org/frysk/manpages/ have a
proper description.

Cheers,

Mark

[-- Attachment #2: patch --]
[-- Type: text/x-patch, Size: 2201 bytes --]

diff --git a/frysk-common/manpages.sh b/frysk-common/manpages.sh
index 63c1168..ac0c0b6 100755
--- a/frysk-common/manpages.sh
+++ b/frysk-common/manpages.sh
@@ -83,7 +83,10 @@ EOF
 	cat <<EOF
 <li><tt><a href="${name}.${n}.html">${name}.${n}</a></tt>
 EOF
-	sed -n 's/<refpurpose>\(.*\)<\/refpurpose>/\1/ p' $xmlfile
+	# Catch empty (aka not on one line) refpurpose tags.
+	desc=$(sed -n 's/<refpurpose>\(.*\)<\/refpurpose>/\1/ p' $xmlfile)
+	if test -z "$desc"; then exit 1; fi
+	echo "$desc"
 	echo "</li>"
     fi
 done
diff --git a/frysk-core/frysk/pkglibdir/funit-exit.xml b/frysk-core/frysk/pkglibdir/funit-exit.xml
index c442d85..d420b15 100644
--- a/frysk-core/frysk/pkglibdir/funit-exit.xml
+++ b/frysk-core/frysk/pkglibdir/funit-exit.xml
@@ -61,8 +61,8 @@
   </refmeta>
 
   <refnamediv>
-    <refname>funit-exit</refname> <refpurpose>exits with specified
-    status, or terminates with the specified signal</refpurpose>
+    <refname>funit-exit</refname>
+    <refpurpose>exits with specified status, or terminates with the specified signal</refpurpose>
   </refnamediv>
   
   <refsynopsisdiv>
diff --git a/frysk-sys/frysk/pkglibdir/funit-procmask.xml b/frysk-sys/frysk/pkglibdir/funit-procmask.xml
index 933b147..add4d7b 100644
--- a/frysk-sys/frysk/pkglibdir/funit-procmask.xml
+++ b/frysk-sys/frysk/pkglibdir/funit-procmask.xml
@@ -62,8 +62,7 @@
 
   <refnamediv>
     <refname>funit-procmask</refname>
-    <refpurpose>Test the processes signal mask for the presence (or
-    absence) of a list if signals</refpurpose>
+    <refpurpose>Test the processes signal mask for the presence (or absence) of a list if signals</refpurpose>
   </refnamediv>
   
   <refsynopsisdiv>
diff --git a/frysk-top/Makefile.am b/frysk-top/Makefile.am
index 6c45b4b..9f6a8c8 100644
--- a/frysk-top/Makefile.am
+++ b/frysk-top/Makefile.am
@@ -88,7 +88,8 @@ manpages manpages/index.html:
 		-"GNOME Interface" \
 		$(srcdir)/frysk-gui/frysk/bindir/*.xml \
 		-"Test framework" \
-		$(srcdir)/*/frysk/pkglibdir/*.xml
+		$(srcdir)/*/frysk/pkglibdir/*.xml \
+	    || (echo "Bad [not on one line] refpurpose tag found."; exit 1)
 	mv manpages/index.new manpages/index.html
 \f
 # Generate JAVADOC documentation.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Put refpurposes one line for easy manpage generation.
  2008-04-03 21:11       ` Mark Wielaard
@ 2008-04-04  8:32         ` Petr Machata
  2008-04-04  9:16           ` Mark Wielaard
  0 siblings, 1 reply; 7+ messages in thread
From: Petr Machata @ 2008-04-04  8:32 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: Andrew Cagney, frysk

[-- Attachment #1: Type: text/plain, Size: 919 bytes --]

On Thu, Apr 03, 2008 at 11:01:20PM +0200, Mark Wielaard wrote:
> Hi Andrew,
> 
> On Thu, 2008-04-03 at 10:39 -0400, Andrew Cagney wrote:
> > I'm not fluent in XML either, however I still managed to hack up the 
> > attached (from htdocs/bugzilla).  Can we do something with that?
> 
> Yes, you probably could. Note that all the rest of the manpage index
> generation is done with sed. You might need to replace all of that. But
> I wouldn't put too much work into it unless you really want to. It does
> work pretty well as is now.

While I agree xslt is the proper way, I also immediately know the sed
syntax.  So here goes:

/<refpurpose>/{
 :loop
   /<\/refpurpose>/b break
   N
   b loop

 :break
   s,^.*<refpurpose>,,
   s,</refpurpose>.*$,,
   s,\(^[[:space:]]*\|[[:space:]]*$\),,g
   s,[[:space:]]\+, ,g
   p
   q
}

Save to file and use like this:
$ sed -n -f foo.sed < foo.xml

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Put refpurposes one line for easy manpage generation.
  2008-04-04  8:32         ` Petr Machata
@ 2008-04-04  9:16           ` Mark Wielaard
  0 siblings, 0 replies; 7+ messages in thread
From: Mark Wielaard @ 2008-04-04  9:16 UTC (permalink / raw)
  To: Petr Machata; +Cc: Andrew Cagney, frysk

[-- Attachment #1: Type: text/plain, Size: 1431 bytes --]

Hi Petr,

On Fri, 2008-04-04 at 00:29 +0200, Petr Machata wrote:
> While I agree xslt is the proper way, I also immediately know the sed
> syntax.

Nice! That works like a charm. I even changed a couple of files to have
the tag embedded in other tags on the same line and split over several
lines to test it out. All looks fine:
http://sourceware.org/frysk/manpages.

Committed as follows:

    frysk-common/ChangeLog
    2008-04-04  Mark Wielaard  <mwielaard@redhat.com>
            Petr Machata <pmachata@redhat.com>
    
        * frysk.xml: Split refpurpose tag over multiple lines.
        * manpages.sh (refpurposegrep): New.
        (suffix): Use refpurposegrep.
    
    frysk-core/frysk/bindir/ChangeLog
    2008-04-04  Mark Wielaard  <mwielaard@redhat.com>
    
        * fdebuginfo.xml: Put refpurpose tag on multiple lines.
        * fexe.xml: Likewise.
        * fmaps.xml: Likewise.
    
    frysk-core/frysk/pkglibdir/ChangeLog
    2008-04-04  Mark Wielaard  <mwielaard@redhat.com>
    
        * funit-exit.xml: Put refpurpose tag on multiple lines.
        * fparser.xml: Likewise.
    
    frysk-sys/frysk/pkglibdir/ChangeLog
    2008-04-04  Mark Wielaard  <mwielaard@redhat.com>
    
        * funit-procmask.xml: Put refpurpose tag on multiple lines.
    
    frysk-top/ChangeLog
    2008-04-04  Mark Wielaard  <mwielaard@redhat.com>
    
        * Makefile.am (manpages): Clarify error message.

Cheers,

Mark

[-- Attachment #2: patch --]
[-- Type: text/x-patch, Size: 5147 bytes --]

diff --git a/frysk-common/frysk.xml b/frysk-common/frysk.xml
index 404b014..8991af9 100644
--- a/frysk-common/frysk.xml
+++ b/frysk-common/frysk.xml
@@ -62,7 +62,8 @@
 
   <refnamediv>
     <refname>frysk</refname>
-    <refpurpose>The Frysk Debugging, Tracing, and Monitoring Tool Suite</refpurpose>
+    <refpurpose>The Frysk Debugging, Tracing, and Monitoring
+                Tool Suite</refpurpose>
   </refnamediv>
   
   <refsect1>
diff --git a/frysk-common/manpages.sh b/frysk-common/manpages.sh
index ac0c0b6..c41513a 100755
--- a/frysk-common/manpages.sh
+++ b/frysk-common/manpages.sh
@@ -57,6 +57,24 @@ sed -n < ${template} \
 
 # Generate the body for the man pages.
 
+refpurposegrep=$(cat << EOF
+/<refpurpose>/{
+ :loop
+   /<\/refpurpose>/b break
+   N
+   b loop
+
+ :break
+   s,^.*<refpurpose>,,
+   s,</refpurpose>.*$,,
+   s,\(^[[:space:]]*\|[[:space:]]*$\),,g
+   s,[[:space:]]\+, ,g
+   p
+   q
+}
+EOF
+)
+
 suffix=
 for xmlfile in "$@" ; do
     if expr x"${xmlfile}" : "x-" > /dev/null ; then
@@ -84,7 +102,7 @@ EOF
 <li><tt><a href="${name}.${n}.html">${name}.${n}</a></tt>
 EOF
 	# Catch empty (aka not on one line) refpurpose tags.
-	desc=$(sed -n 's/<refpurpose>\(.*\)<\/refpurpose>/\1/ p' $xmlfile)
+	desc=$(sed -n "$refpurposegrep" $xmlfile)
 	if test -z "$desc"; then exit 1; fi
 	echo "$desc"
 	echo "</li>"
diff --git a/frysk-core/frysk/bindir/fdebuginfo.xml b/frysk-core/frysk/bindir/fdebuginfo.xml
index 3798c06..8f88f0b 100644
--- a/frysk-core/frysk/bindir/fdebuginfo.xml
+++ b/frysk-core/frysk/bindir/fdebuginfo.xml
@@ -70,7 +70,8 @@
 
   <refnamediv>
     <refname>fdebuginfo</refname>
-    <refpurpose>display the debug-info paths for a process and its shared modules</refpurpose>
+    <refpurpose>display the debug-info paths for a process
+                and its shared modules</refpurpose>
   </refnamediv>
   
   <refsynopsisdiv>
diff --git a/frysk-core/frysk/bindir/ferror.xml b/frysk-core/frysk/bindir/ferror.xml
index 6d4bc90..b8742b6 100644
--- a/frysk-core/frysk/bindir/ferror.xml
+++ b/frysk-core/frysk/bindir/ferror.xml
@@ -70,7 +70,8 @@
 
   <refnamediv>
     <refname>ferror</refname>
-    <refpurpose>print a stack trace when the given message is printed by the traced program</refpurpose>
+    <refpurpose>print a stack trace when the given message is printed
+                by the traced program</refpurpose>
   </refnamediv>
   
   <refsynopsisdiv>
diff --git a/frysk-core/frysk/bindir/fmaps.xml b/frysk-core/frysk/bindir/fmaps.xml
index 692967e..de7a3dd 100644
--- a/frysk-core/frysk/bindir/fmaps.xml
+++ b/frysk-core/frysk/bindir/fmaps.xml
@@ -69,9 +69,8 @@
   </refmeta>
 
   <refnamediv>
-    <refname>fmaps</refname>
-    <refpurpose>print the process or a corefile's address maps.</refpurpose>
-  </refnamediv>
+    <refname>fmaps</refname><refpurpose>print the process or a corefile's
+                                        address maps</refpurpose></refnamediv>
   
   <refsynopsisdiv>
     <cmdsynopsis>
diff --git a/frysk-core/frysk/pkglibdir/fparser.xml b/frysk-core/frysk/pkglibdir/fparser.xml
index 3635e45..352e330 100644
--- a/frysk-core/frysk/pkglibdir/fparser.xml
+++ b/frysk-core/frysk/pkglibdir/fparser.xml
@@ -62,7 +62,8 @@
 
   <refnamediv>
     <refname>fparser</refname>
-    <refpurpose>Runs the frysk standalone source code parser utility.</refpurpose>
+    <refpurpose>runs the frysk standalone source code parser
+                utility</refpurpose>
   </refnamediv>
   
   <refsynopsisdiv>
diff --git a/frysk-core/frysk/pkglibdir/funit-exit.xml b/frysk-core/frysk/pkglibdir/funit-exit.xml
index d420b15..513ab11 100644
--- a/frysk-core/frysk/pkglibdir/funit-exit.xml
+++ b/frysk-core/frysk/pkglibdir/funit-exit.xml
@@ -62,7 +62,8 @@
 
   <refnamediv>
     <refname>funit-exit</refname>
-    <refpurpose>exits with specified status, or terminates with the specified signal</refpurpose>
+    <refpurpose>exits with specified status,
+                or terminates with the specified signal</refpurpose>
   </refnamediv>
   
   <refsynopsisdiv>
diff --git a/frysk-sys/frysk/pkglibdir/funit-procmask.xml b/frysk-sys/frysk/pkglibdir/funit-procmask.xml
index add4d7b..9e82450 100644
--- a/frysk-sys/frysk/pkglibdir/funit-procmask.xml
+++ b/frysk-sys/frysk/pkglibdir/funit-procmask.xml
@@ -62,7 +62,8 @@
 
   <refnamediv>
     <refname>funit-procmask</refname>
-    <refpurpose>Test the processes signal mask for the presence (or absence) of a list if signals</refpurpose>
+    <refpurpose>test the processes signal mask for the presence
+                (or absence) of a list if signals</refpurpose>
   </refnamediv>
   
   <refsynopsisdiv>
diff --git a/frysk-top/Makefile.am b/frysk-top/Makefile.am
index 9f6a8c8..5a95c67 100644
--- a/frysk-top/Makefile.am
+++ b/frysk-top/Makefile.am
@@ -89,7 +89,7 @@ manpages manpages/index.html:
 		$(srcdir)/frysk-gui/frysk/bindir/*.xml \
 		-"Test framework" \
 		$(srcdir)/*/frysk/pkglibdir/*.xml \
-	    || (echo "Bad [not on one line] refpurpose tag found."; exit 1)
+	    || (echo "Bad xml file or no refpurpose tag found."; exit 1)
 	mv manpages/index.new manpages/index.html
 \f
 # Generate JAVADOC documentation.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2008-04-04  8:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-03 14:10 Put refpurposes one line for easy manpage generation Mark Wielaard
2008-04-03 14:25 ` Andrew Cagney
2008-04-03 14:40   ` Mark Wielaard
2008-04-03 21:03     ` Andrew Cagney
2008-04-03 21:11       ` Mark Wielaard
2008-04-04  8:32         ` Petr Machata
2008-04-04  9:16           ` Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).