📄 info.c
字号:
} /* Special cases for when the user specifies multiple nodes. If we are dumping to an output file, dump all of the nodes specified. Otherwise, attempt to create enough windows to handle the nodes that this user wants displayed. */ if (user_nodenames_index > 1) { free (initial_node); if (user_output_filename) dump_nodes_to_file (user_filename, user_nodenames, user_output_filename, dump_subnodes); else begin_multiple_window_info_session (user_filename, user_nodenames); exit (0); } /* If the user specified `--index-search=STRING', start the info session in the node corresponding to the first match. */ if (index_search_p) { int status = 0; initialize_info_session (initial_node, 0); if (index_entry_exists (windows, index_search_string)) { terminal_clear_screen (); terminal_prep_terminal (); display_update_display (windows); info_last_executed_command = (VFunction *)NULL; do_info_index_search (windows, 0, index_search_string); info_read_and_dispatch (); terminal_unprep_terminal (); /* On program exit, leave the cursor at the bottom of the window, and restore the terminal IO. */ terminal_goto_xy (0, screenheight - 1); terminal_clear_to_eol (); fflush (stdout); } else { fputs (_("no entries found\n"), stderr); status = 2; } close_dribble_file (); exit (status); } /* If there are arguments remaining, they are the names of menu items in sequential info files starting from the first one loaded. That file name is either "dir", or the contents of user_filename if one was specified. */ while (optind != argc) { REFERENCE **menu; REFERENCE *entry; NODE *node; char *arg; static char *first_arg = (char *)NULL; /* Remember the name of the menu entry we want. */ arg = argv[optind++]; if (!first_arg) first_arg = arg; /* Build and return a list of the menu items in this node. */ menu = info_menu_of_node (initial_node); /* If there wasn't a menu item in this node, stop here, but let the user continue to use Info. Perhaps they wanted this node and didn't realize it. */ if (!menu) {#if defined (HANDLE_MAN_PAGES) if (first_arg == arg) { node = make_manpage_node (first_arg); if (node) goto maybe_got_node; }#endif /* HANDLE_MAN_PAGES */ begin_info_session_with_error (initial_node, _("There is no menu in this node.")); exit (0); } /* Find the specified menu item. */ entry = info_get_labeled_reference (arg, menu); /* If the item wasn't found, search the list sloppily. Perhaps this user typed "buffer" when they really meant "Buffers". */ if (!entry) { register int i; int best_guess = -1; for (i = 0; (entry = menu[i]); i++) { if (strcasecmp (entry->label, arg) == 0) break; else if (strncasecmp (entry->label, arg, strlen (arg)) == 0) best_guess = i; } if (!entry && best_guess != -1) entry = menu[best_guess]; } /* If we failed to find the reference, start Info with the current node anyway. It is probably a misspelling. */ if (!entry) { char *error_message = _("There is no menu item \"%s\" in this node.");#if defined (HANDLE_MAN_PAGES) if (first_arg == arg) { node = make_manpage_node (first_arg); if (node) goto maybe_got_node; }#endif /* HANDLE_MAN_PAGES */ info_free_references (menu); /* If we were supposed to dump this node, complain. */ if (user_output_filename) info_error (error_message, arg); else begin_info_session_with_error (initial_node, error_message, arg); exit (0); } /* We have found the reference that the user specified. Clean it up a little bit. */ if (!entry->filename) { if (initial_node->parent) entry->filename = xstrdup (initial_node->parent); else entry->filename = xstrdup (initial_node->filename); } /* Find this node. If we can find it, then turn the initial_node into this one. If we cannot find it, try using the label of the entry as a file (i.e., "(LABEL)Top"). Otherwise the Info file is malformed in some way, and we will just use the current value of initial node. */ node = info_get_node (entry->filename, entry->nodename);#if defined (HANDLE_MAN_PAGES) if ((first_arg == arg) && !node) { node = make_manpage_node (first_arg); if (node) goto maybe_got_node; }#endif /* HANDLE_MAN_PAGES */ if (!node && entry->nodename && (strcmp (entry->label, entry->nodename) == 0)) node = info_get_node (entry->label, "Top"); maybe_got_node: if (node) { free (initial_node); initial_node = node; info_free_references (menu); } else { char *temp = xstrdup (entry->label); char *error_message; error_message = _("Unable to find the node referenced by \"%s\"."); info_free_references (menu); /* If we were trying to dump the node, then give up. Otherwise, start the session with an error message. */ if (user_output_filename) info_error (error_message, temp); else begin_info_session_with_error (initial_node, error_message, temp); exit (0); } } /* If the user specified that this node should be output, then do that now. Otherwise, start the Info session with this node. */ if (user_output_filename) dump_node_to_file (initial_node, user_output_filename, dump_subnodes); else begin_info_session (initial_node); exit (0);}/* Return a string describing the current version of Info. */char *version_string (){ static char *vstring = (char *)NULL; if (!vstring) { vstring = (char *)xmalloc (50); sprintf (vstring, "%d.%d", info_major_version, info_minor_version); } return (vstring);}/* Error handling. */static voidremember_info_program_name (fullpath) char *fullpath;{ char *filename; filename = filename_non_directory (fullpath); program_name = xstrdup (filename);}/* Non-zero if an error has been signalled. */int info_error_was_printed = 0;/* Non-zero means ring terminal bell on errors. */int info_error_rings_bell_p = 1;/* Print FORMAT with ARG1 and ARG2. If the window system was initialized, then the message is printed in the echo area. Otherwise, a message is output to stderr. */voidinfo_error (format, arg1, arg2) char *format; void *arg1, *arg2;{ info_error_was_printed = 1; if (!info_windows_initialized_p || display_inhibited) { fprintf (stderr, "%s: ", program_name); fprintf (stderr, format, arg1, arg2); fprintf (stderr, "\n"); fflush (stderr); } else { if (!echo_area_is_active) { if (info_error_rings_bell_p) terminal_ring_bell (); window_message_in_echo_area (format, arg1, arg2); } else { NODE *temp; temp = build_message_node (format, arg1, arg2); if (info_error_rings_bell_p) terminal_ring_bell (); inform_in_echo_area (temp->contents); free (temp->contents); free (temp); } }}/* Produce a scaled down description of the available options to Info. */static voidinfo_short_help (){ printf (_("\Usage: %s [OPTION]... [INFO-FILE [MENU-ITEM...]]\n\\n\Read documentation in Info format.\n\For more complete documentation on how to use Info, run `info info options'.\n\\n\Options:\n\--directory DIR add DIR to INFOPATH.\n\--dribble FILENAME remember user keystrokes in FILENAME.\n\--file FILENAME specify Info file to visit.\n\--node NODENAME specify nodes in first visited Info file.\n\--output FILENAME output selected nodes to FILENAME.\n\--restore FILENAME read initial keystrokes from FILENAME.\n\--subnodes recursively output menu items.\n\--help display this help and exit.\n\--version display version information and exit.\n\\n\The first argument, if present, is the name of the Info file to read.\n\Any remaining arguments are treated as the names of menu\n\items in the initial node visited. For example, `info emacs buffers'\n\moves to the node `buffers' in the info file `emacs'.\n\\n\Email bug reports to bug-texinfo@gnu.org."), program_name); exit (0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -