【发布时间】:2014-09-29 16:10:15
【问题描述】:
Fedora 19 {虽然我怀疑这是否相关]
如果我为实际上没有 info 节点但确实有手册页的主题调用 info 命令,info 显然会创建一个名为 @ 的节点来自手册页的 987654324@ -- 即时。
我在任何地方都找不到此功能的文档,也找不到(显然)它是如何完成的描述。
谁能给我一些关于这方面的文档?
【问题讨论】:
Fedora 19 {虽然我怀疑这是否相关]
如果我为实际上没有 info 节点但确实有手册页的主题调用 info 命令,info 显然会创建一个名为 @ 的节点来自手册页的 987654324@ -- 即时。
我在任何地方都找不到此功能的文档,也找不到(显然)它是如何完成的描述。
谁能给我一些关于这方面的文档?
【问题讨论】:
我检查了GNU standalone info manual 和GNU Info manual,只发现一个小迹象表明此功能存在。在description of option --all 我们可以读到:
--全部 -a
Find all files matching the given menu-item (a file or node name). Three usage patterns are supported, as follows. First, if --all is used together with --where, info prints the names of all matching files found on standard output (including *manpages* if relevant) and exits.
所以恐怕唯一的文档就是源代码。在info.c 中,您可以找到以下功能。查找“回退到加载手册页”。评论。
/* Get the initial Info file, either by following menus from "(dir)Top",
or what the user specifed with values in filename. */
static char *
get_initial_file (char *filename, int *argc, char ***argv, char **error)
{
char *initial_file = 0; /* First file loaded by Info. */
REFERENCE *entry;
/* If there are any more arguments, the initial file is the
dir entry given by the first one. */
if (!filename && (*argv)[0])
{
/* If they say info -O info, we want to show them the invocation node
for standalone info; there's nothing useful in info.texi. */
if (goto_invocation_p && (*argv)[0]
&& mbscasecmp ((*argv)[0], "info") == 0)
(*argv)[0] = "info-stnd";
entry = lookup_dir_entry ((*argv)[0], 0);
if (entry)
{
initial_file = info_find_fullpath (entry->filename, 0);
if (initial_file)
{
(*argv)++; /* Advance past first remaining argument. */
(*argc)--;
/* Store full path, so that we find the already loaded file in
info_find_file, and show the full path if --where is used. */
entry->filename = initial_file;
add_pointer_to_array (info_copy_reference (entry),
ref_index, ref_list, ref_slots, 2);
return initial_file;
}
}
}
/* User used "--file". */
if (filename)
{
initial_file = info_find_fullpath (filename, 0);
if (!initial_file)
{
if (filesys_error_number)
*error = filesys_error_string (filename, filesys_error_number);
}
else
return initial_file;
}
/* File name lookup. */
if (!filename && (*argv)[0])
{
/* Try finding a file with this name, in case
it exists, but wasn't listed in dir. */
initial_file = info_find_fullpath ((*argv)[0], 0);
if (initial_file)
{
(*argv)++; /* Advance past first remaining argument. */
(*argc)--;
return initial_file;
}
else
asprintf (error, _("No menu item `%s' in node `%s'."),
(*argv)[0], "(dir)Top");
}
/* Fall back to loading man page. */
if (filename || (*argv)[0])
{
NODE *man_node;
debug (3, ("falling back to manpage node"));
man_node = get_manpage_node (filename ? filename : (*argv)[0]);
if (man_node)
{
add_pointer_to_array
(info_new_reference (MANPAGE_FILE_BUFFER_NAME,
filename ? filename : (*argv)[0]),
ref_index, ref_list, ref_slots, 2);
initial_file = MANPAGE_FILE_BUFFER_NAME;
return initial_file;
}
}
/* Inexact dir lookup. */
if (!filename && (*argv)[0])
{
entry = lookup_dir_entry ((*argv)[0], 1);
if (entry)
{
(*argv)++; /* Advance past first remaining argument. */
(*argc)--;
/* Clear error message. */
free (*error);
*error = 0;
initial_file = info_find_fullpath (entry->filename, 0);
/* Store full path, so that we find the already loaded file in
info_find_file, and show the full path if --where is used. */
entry->filename = initial_file;
add_pointer_to_array (info_copy_reference (entry),
ref_index, ref_list, ref_slots, 2);
return initial_file;
}
}
/* Otherwise, we want the dir node. The only node to be displayed
or output will be "Top". */
return 0;
}
man.h 包含 MANPAGE_FILE_BUFFER_NAME 的定义:
#define MANPAGE_FILE_BUFFER_NAME "*manpages*"
【讨论】:
info 是一个类似 man 的命令,你可以测试命令:info make 但是 info 阅读 Info 格式的文档。
【讨论】:
info 如何按需将手册页变成 info 节点。