[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[7444] xrefs_of_manpage
From: |
gavinsmith0123 |
Subject: |
[7444] xrefs_of_manpage |
Date: |
Sun, 9 Oct 2016 16:07:01 +0000 (UTC) |
Revision: 7444
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=7444
Author: gavin
Date: 2016-10-09 16:07:00 +0000 (Sun, 09 Oct 2016)
Log Message:
-----------
xrefs_of_manpage
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/man.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2016-10-08 22:34:41 UTC (rev 7443)
+++ trunk/ChangeLog 2016-10-09 16:07:00 UTC (rev 7444)
@@ -1,3 +1,8 @@
+2016-10-09 Gavin Smith <address@hidden>
+
+ * info/man.c (find_reference_section): Remove this unused function.
+ (xrefs_of_manpage): Allow only two characters in manpage section.
+
2016-10-08 Gavin Smith <address@hidden>
* tp/Texinfo/Parser.pm (_end_line) <def commands>: Remove parent
Modified: trunk/info/man.c
===================================================================
--- trunk/info/man.c 2016-10-08 22:34:41 UTC (rev 7443)
+++ trunk/info/man.c 2016-10-09 16:07:00 UTC (rev 7444)
@@ -471,64 +471,6 @@
return buffer;
}
-/* Search in the whole man page for references now. */
-#if 0
-static char *reference_section_starters[] =
-{
- "\nRELATED INFORMATION",
- "\nRELATED\tINFORMATION",
- "RELATED INFORMATION\n",
- "RELATED\tINFORMATION\n",
- "\nSEE ALSO",
- "\nSEE\tALSO",
- "SEE ALSO\n",
- "SEE\tALSO\n",
- NULL
-};
-
-static SEARCH_BINDING frs_binding;
-
-static SEARCH_BINDING *
-find_reference_section (NODE *node)
-{
- register int i;
- long position = -1;
-
- frs_binding.buffer = node->contents;
- frs_binding.start = 0;
- frs_binding.end = node->nodelen;
- frs_binding.flags = S_SkipDest;
-
- for (i = 0; reference_section_starters[i] != NULL; i++)
- {
- if (search_forward (reference_section_starters[i], &frs_binding,
- &position) == search_success)
- break;
- }
-
- if (position == -1)
- return NULL;
-
- /* We found the start of the reference section, and point is right after
- the string which starts it. The text from here to the next header
- (or end of buffer) contains the only references in this manpage. */
- frs_binding.start = position;
-
- for (i = frs_binding.start; i < frs_binding.end - 2; i++)
- {
- if ((frs_binding.buffer[i] == '\n') &&
- (!whitespace (frs_binding.buffer[i + 1])))
- {
- frs_binding.end = i;
- break;
- }
- }
-
- return &frs_binding;
-}
-
-#endif
-
static REFERENCE **
xrefs_of_manpage (NODE *node)
{
@@ -587,48 +529,46 @@
&& s.buffer[name_end] != '_'
&& s.buffer[name_end] != '.'
&& s.buffer[name_end] != '-')
- break;
+ goto skip;
section = position;
+ section_end = 0;
+
+ /* Look for one or two characters within the brackets, the
+ first of which must be a digit and the second a letter. */
if (!isdigit (s.buffer[section + 1]))
- goto skip; /* Could be ordinary text in parentheses. */
+ ;
+ else if (!s.buffer[section + 2])
+ ; /* end of buffer */
+ else if (s.buffer[section + 2] == ')')
+ section_end = section + 3;
+ else if (!isalpha(s.buffer[section + 3]))
+ ;
+ else if (s.buffer[section + 3] == ')')
+ section_end = section + 4;
- for (section_end = section + 1; section_end < s.end; section_end++)
+ if (section_end)
{
- if (whitespace (s.buffer[section_end]))
- {
- continue;
- break;
- }
+ REFERENCE *entry;
+ int len = name_end - name + section_end - section;
- if (s.buffer[section_end] == ')')
- {
- section_end++;
- break;
- }
- }
+ entry = xmalloc (sizeof (REFERENCE));
+ entry->label = xcalloc (1, 1 + len);
+ strncpy (entry->label, s.buffer + name, name_end - name);
+ strncpy (entry->label + strlen (entry->label),
+ s.buffer + section,
+ section_end - section);
- {
- REFERENCE *entry;
- int len = name_end - name + section_end - section;
+ entry->filename = xstrdup (MANPAGE_FILE_BUFFER_NAME);
+ entry->nodename = xstrdup (entry->label);
+ entry->line_number = 0;
+ entry->start = name;
+ entry->end = section_end;
+ entry->type = REFERENCE_XREF;
- entry = xmalloc (sizeof (REFERENCE));
- entry->label = xcalloc (1, 1 + len);
- strncpy (entry->label, s.buffer + name, name_end - name);
- strncpy (entry->label + strlen (entry->label),
- s.buffer + section,
- section_end - section);
+ add_pointer_to_array (entry, refs_index, refs, refs_slots, 10);
+ }
- entry->filename = xstrdup (MANPAGE_FILE_BUFFER_NAME);
- entry->nodename = xstrdup (entry->label);
- entry->line_number = 0;
- entry->start = name;
- entry->end = section_end;
- entry->type = REFERENCE_XREF;
-
- add_pointer_to_array (entry, refs_index, refs, refs_slots, 10);
- }
-
skip:
s.start = position + 1;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [7444] xrefs_of_manpage,
gavinsmith0123 <=