bug-texinfo
[Top][All Lists]
Advanced

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

@refs to manual pages.


From: Sergey Poznyakoff
Subject: @refs to manual pages.
Date: Sun, 05 Oct 2008 18:03:02 +0300

Hello,

I have installed the following change that enables standalone info to follow
references to manpages from info nodes.

Regards,
Sergey

2008-10-05  Sergey Poznyakoff  <address@hidden>

        Follow @refs to manual pages.

        * info/info-utils.c (info_parse_node): Correctly handle nested
        parentheses.
        * info/nodes.c (info_get_node): If no file buffer is found, try to
        load man page.  Report an error if that fails as well.
Index: info/info-utils.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/info/info-utils.c,v
retrieving revision 1.12
diff -p -u -r1.12 info-utils.c
--- info/info-utils.c   11 Jun 2008 09:55:42 -0000      1.12
+++ info/info-utils.c   5 Oct 2008 14:53:11 -0000
@@ -74,14 +74,34 @@ info_parse_node (char *string, int newli
   /* Check for (FILENAME)NODENAME. */
   if (*string == '(')
     {
+      int bcnt;
+      int bfirst;
+      
       i = 0;
       /* Advance past the opening paren. */
       string++;
 
-      /* Find the closing paren. */
-      while (string[i] && string[i] != ')')
-        i++;
+      /* Find the closing paren. Handle nested parens correctly. */
+      for (bcnt = 0, bfirst = -1; string[i]; i++)
+       {
+         if (string[i] == ')')
+           {
+             if (bcnt == 0)
+               {
+                 bfirst = -1;
+                 break;
+               }
+             else if (!bfirst)
+               bfirst = i;
+             bcnt--;
+           } 
+         else if (string[i] == '(')
+           bcnt++;
+       }
 
+      if (bfirst >= 0)
+       i = bfirst;
+      
       /* Remember parsed filename. */
       saven_filename (string, i);
 
Index: info/nodes.c
===================================================================
RCS file: /cvsroot/texinfo/texinfo/info/nodes.c,v
retrieving revision 1.11
diff -p -u -r1.11 nodes.c
--- info/nodes.c        11 Jun 2008 09:55:42 -0000      1.11
+++ info/nodes.c        5 Oct 2008 14:53:11 -0000
@@ -106,14 +106,18 @@ info_get_node (char *filename, char *nod
   file_buffer = info_find_file (filename);
   if (!file_buffer)
     {
-      if (filesys_error_number)
-        info_recent_file_error =
-          filesys_error_string (filename, filesys_error_number);
-      return NULL;
+      node = make_manpage_node (filename);
+      if (!node)
+       {
+         if (filesys_error_number)
+           info_recent_file_error =
+             filesys_error_string (filename, filesys_error_number);
+         return NULL;
+       }
     }
-
-  /* Look for the node.  */
-  node = info_get_node_of_file_buffer (nodename, file_buffer);
+  else
+    /* Look for the node.  */
+    node = info_get_node_of_file_buffer (nodename, file_buffer);
 
   /* If the node not found was "Top", try again with different case,
      unless this was a man page.  */

reply via email to

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