/* Return the node addressed by LABEL in NODE (usually one of "Prev:", "Next:", "Up:", "File:", or "Node:". After a call to this function, the global INFO_PARSED_NODENAME and INFO_PARSED_FILENAME contain the information. */ void info_parse_label (char *label, NODE *node) { register int i; char *nodeline; /* Default answer to failure. */ save_nodename (NULL); save_filename (NULL); /* Find the label in the first line of this node. */ nodeline = node->contents; i = string_in_line (label, nodeline); if (i == -1) return; nodeline += i; nodeline += skip_whitespace (nodeline); info_parse_node (nodeline, PARSE_NODE_DFLT); }
/* Return the absolute position of the node named NODENAME in BINDING. This is a brute force search, and we wish to avoid it when possible. This function is called when a tag (indirect or otherwise) doesn't really point to the right node. It returns the absolute position of the separator preceding the node. */ long find_node_in_binding (char *nodename, SEARCH_BINDING *binding) { long position; int offset, namelen; SEARCH_BINDING tmp_search; namelen = strlen (nodename); tmp_search.buffer = binding->buffer; tmp_search.start = binding->start; tmp_search.end = binding->end; tmp_search.flags = 0; while ((position = find_node_separator (&tmp_search)) != -1) { tmp_search.start = position; tmp_search.start += skip_node_separator (tmp_search.buffer + tmp_search.start); offset = string_in_line (INFO_NODE_LABEL, tmp_search.buffer + tmp_search.start); if (offset == -1) continue; tmp_search.start += offset; tmp_search.start += skip_whitespace (tmp_search.buffer + tmp_search.start); offset = skip_node_characters (tmp_search.buffer + tmp_search.start, DONT_SKIP_NEWLINES); /* Notice that this is an exact match. You cannot grovel through the buffer with this function looking for random nodes. */ if ((offset == namelen) && (tmp_search.buffer[tmp_search.start] == nodename[0]) && (strncmp (tmp_search.buffer + tmp_search.start, nodename, offset) == 0)) return position; } return -1; }