1
0

ncurses.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  3. "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  4. <!ENTITY % general-entities SYSTEM "../general.ent">
  5. %general-entities;
  6. ]>
  7. <sect1 id="ch-system-ncurses" role="wrap">
  8. <?dbhtml filename="ncurses.html"?>
  9. <sect1info condition="script">
  10. <productname>ncurses</productname>
  11. <productnumber>&ncurses-version;</productnumber>
  12. <address>&ncurses-url;</address>
  13. </sect1info>
  14. <title>Ncurses-&ncurses-version;</title>
  15. <indexterm zone="ch-system-ncurses">
  16. <primary sortas="a-Ncurses">Ncurses</primary>
  17. </indexterm>
  18. <sect2 role="package">
  19. <title/>
  20. <para>Ncurses 软件包包含终端无关的字符屏幕处理库。</para>
  21. <segmentedlist>
  22. <segtitle>&buildtime;</segtitle>
  23. <segtitle>&diskspace;</segtitle>
  24. <seglistitem>
  25. <seg>&ncurses-ch6-sbu;</seg>
  26. <seg>&ncurses-ch6-du;</seg>
  27. </seglistitem>
  28. </segmentedlist>
  29. </sect2>
  30. <sect2 role="installation">
  31. <title>安装 Ncurses</title>
  32. <para>输入以下命令,使构建系统不安装一个 configure 脚本未处理的静态库:
  33. </para>
  34. <screen><userinput remap="pre">sed -i '/LIBTOOL_INSTALL/d' c++/Makefile.in</userinput></screen>
  35. <para>准备安装 Ncurses:</para>
  36. <screen><userinput remap="configure">./configure --prefix=/usr \
  37. --mandir=/usr/share/man \
  38. --with-shared \
  39. --without-debug \
  40. --without-normal \
  41. --enable-pc-files \
  42. --enable-widec</userinput></screen>
  43. <variablelist>
  44. <title>新的配置选项的含义:</title>
  45. <varlistentry>
  46. <term><parameter>--enable-widec</parameter></term>
  47. <listitem>
  48. <!--para>This switch causes wide-character libraries (e.g., <filename
  49. class="libraryfile">libncursesw.so.&ncurses-version;</filename>)
  50. to be built instead of normal ones (e.g., <filename
  51. class="libraryfile">libncurses.so.&ncurses-version;</filename>).
  52. These wide-character libraries are usable in both multibyte and
  53. traditional 8-bit locales, while normal libraries work properly
  54. only in 8-bit locales. Wide-character and normal libraries are
  55. source-compatible, but not binary-compatible.</para-->
  56. <para os="widec">该选项使得宽字符库(例如
  57. <filename class="libraryfile">libncursesw.so.&ncurses-version;</filename> )
  58. 被构建,而不构建常规字符库(例如
  59. <filename class="libraryfile">libncurses.so.&ncurses-version;</filename>)。
  60. 宽字符库在多字节和传统 8 位 locale 中都能工作,
  61. 而常规字符库只能在 8 位 locale 中工作。
  62. 宽字符库和普通字符库在源码层面是兼容的,但二进制不兼容。</para>
  63. </listitem>
  64. </varlistentry>
  65. <varlistentry>
  66. <term><parameter>--enable-pc-files</parameter></term>
  67. <listitem>
  68. <para>该参数使得构建系统生成并安装 pkg-config 使用的 .pc 文件。
  69. </para>
  70. </listitem>
  71. </varlistentry>
  72. <varlistentry>
  73. <term><parameter>--without-normal</parameter></term>
  74. <listitem>
  75. <para>该选项禁止构建系统编译并安装多数静态库。
  76. </para>
  77. </listitem>
  78. </varlistentry>
  79. </variablelist>
  80. <para>编译该软件包:</para>
  81. <screen><userinput remap="make">make</userinput></screen>
  82. <!--para>This package has a test suite, but it can only be run after the
  83. package has been installed. The tests reside in the
  84. <filename class="directory">test/</filename> directory. See the
  85. <filename>README</filename> file in that directory for further details.
  86. </para-->
  87. <para>该软件包有测试套件,但只能在安装该软件包后才能运行。
  88. 测试用例位于 <filename class="directory">test/</filename> 中,
  89. 阅读其中的 <filename>README</filename> 文件了解更多细节。</para>
  90. <para>安装该软件包:</para>
  91. <screen><userinput remap="install">make install</userinput></screen>
  92. <para>将共享库移动到期望的
  93. <filename class="directory">/lib</filename> 目录:</para>
  94. <screen><userinput remap="install">mv -v /usr/lib/libncursesw.so.6* /lib</userinput></screen>
  95. <para>由于共享库被移走了,一个符号链接指向了不存在的文件。
  96. 重新创建它:</para>
  97. <screen><userinput remap="install">ln -sfv ../../lib/$(readlink /usr/lib/libncursesw.so) /usr/lib/libncursesw.so</userinput></screen>
  98. <!--para>Many applications still expect the linker to be able to find
  99. non-wide-character Ncurses libraries. Trick such applications into linking with
  100. wide-character libraries by means of symlinks and linker scripts:</para-->
  101. <para>许多程序仍然希望链接器能够找到非宽字符版本的 Ncurses 库。
  102. 通过使用符号链接和链接脚本,诱导它们链接到宽字符库:</para>
  103. <screen><userinput remap="install">for lib in ncurses form panel menu ; do
  104. rm -vf /usr/lib/lib${lib}.so
  105. echo "INPUT(-l${lib}w)" &gt; /usr/lib/lib${lib}.so
  106. ln -sfv ${lib}w.pc /usr/lib/pkgconfig/${lib}.pc
  107. done</userinput></screen>
  108. <para>最后,确保那些在构建时寻找
  109. <filename class="libraryfile">-lcurses</filename>
  110. 的老式程序仍然能够构建:</para>
  111. <screen><userinput remap="install">rm -vf /usr/lib/libcursesw.so
  112. echo "INPUT(-lncursesw)" &gt; /usr/lib/libcursesw.so
  113. ln -sfv libncurses.so /usr/lib/libcurses.so</userinput></screen>
  114. <para>如果需要的话,安装 Ncurses 文档:</para>
  115. <screen><userinput remap="install">mkdir -v /usr/share/doc/ncurses-&ncurses-version;
  116. cp -v -R doc/* /usr/share/doc/ncurses-&ncurses-version;</userinput></screen>
  117. <note>
  118. <!--para>The instructions above don't create non-wide-character Ncurses
  119. libraries since no package installed by compiling from sources would link
  120. against them at runtime. However, the only known binary-only
  121. applications that link against non-wide-character Ncurses libraries
  122. require version 5. If you must have such libraries because of some binary-only
  123. application or to be compliant with LSB, build the package again with the
  124. following commands:</para-->
  125. <para>上述指令没有创建非宽字符的 Ncurses 库,
  126. 因为从源码编译的软件包不会在运行时链接到它。
  127. 然而,已知的需要链接到非宽字符 Ncurses 库的二进制程序都需要版本
  128. 5,如果您为了满足一些仅有二进制版本的程序,或者满足 LSB 兼容性,
  129. 必须安装这样的库,执行以下命令再次构建该软件包:</para>
  130. <screen role="nodump"><userinput>make distclean
  131. ./configure --prefix=/usr \
  132. --with-shared \
  133. --without-normal \
  134. --without-debug \
  135. --without-cxx-binding \
  136. --with-abi-version=5
  137. make sources libs
  138. cp -av lib/lib*.so.5* /usr/lib</userinput></screen>
  139. </note>
  140. </sect2>
  141. <sect2 id="contents-ncurses" role="content">
  142. <title>Ncurses 的内容</title>
  143. <segmentedlist>
  144. <segtitle>安装的程序</segtitle>
  145. <segtitle>安装的库</segtitle>
  146. <segtitle>安装的目录</segtitle>
  147. <seglistitem>
  148. <seg>
  149. captoinfo (链接到 tic),
  150. clear,
  151. infocmp,
  152. infotocap (链接到 tic),
  153. ncursesw6-config,
  154. reset (链接到 tset),
  155. tabs,
  156. tic,
  157. toe,
  158. tput, 以及
  159. tset
  160. </seg>
  161. <seg>
  162. libcursesw.so (指向 libncursesw.so 的符号链接和链接脚本),
  163. libformw.so,
  164. libmenuw.so,
  165. libncursesw.so,
  166. libncurses++w.a,
  167. libpanelw.so, 以及它们的库名称没有 <quote>w</quote>
  168. 的非宽字符替代品</seg>
  169. <seg>
  170. /usr/share/tabset,
  171. /usr/share/terminfo, 以及
  172. /usr/share/doc/ncurses-&ncurses-version;
  173. </seg>
  174. </seglistitem>
  175. </segmentedlist>
  176. <variablelist>
  177. <bridgehead renderas="sect3">简要描述</bridgehead>
  178. <?dbfo list-presentation="list"?>
  179. <?dbhtml list-presentation="table"?>
  180. <varlistentry id="captoinfo">
  181. <term><command>captoinfo</command></term>
  182. <listitem>
  183. <para>将 termcap 描述转换成 terminfo 描述</para>
  184. <indexterm zone="ch-system-ncurses captoinfo">
  185. <primary sortas="b-captoinfo">captoinfo</primary>
  186. </indexterm>
  187. </listitem>
  188. </varlistentry>
  189. <varlistentry id="clear">
  190. <term><command>clear</command></term>
  191. <listitem>
  192. <para>如果可能的话,清空屏幕</para>
  193. <indexterm zone="ch-system-ncurses clear">
  194. <primary sortas="b-clear">clear</primary>
  195. </indexterm>
  196. </listitem>
  197. </varlistentry>
  198. <varlistentry id="infocmp">
  199. <term><command>infocmp</command></term>
  200. <listitem>
  201. <para>比较或输出 terminfo 描述</para>
  202. <indexterm zone="ch-system-ncurses infocmp">
  203. <primary sortas="b-infocmp">infocmp</primary>
  204. </indexterm>
  205. </listitem>
  206. </varlistentry>
  207. <varlistentry id="infotocap">
  208. <term><command>infotocap</command></term>
  209. <listitem>
  210. <para>将 terminfo 描述转化为 termcap 描述</para>
  211. <indexterm zone="ch-system-ncurses infotocap">
  212. <primary sortas="b-infotocap">infotocap</primary>
  213. </indexterm>
  214. </listitem>
  215. </varlistentry>
  216. <varlistentry id="ncursesw6-config">
  217. <term><command>ncursesw6-config</command></term>
  218. <listitem>
  219. <para>提供 ncurses 的配置信息</para>
  220. <indexterm zone="ch-system-ncurses ncursesw6-config">
  221. <primary sortas="b-ncursesw6-config">ncursesw6-config</primary>
  222. </indexterm>
  223. </listitem>
  224. </varlistentry>
  225. <varlistentry id="reset">
  226. <term><command>reset</command></term>
  227. <listitem>
  228. <para>以终端默认值重新初始化终端</para>
  229. <indexterm zone="ch-system-ncurses reset">
  230. <primary sortas="b-reset">reset</primary>
  231. </indexterm>
  232. </listitem>
  233. </varlistentry>
  234. <varlistentry id="tabs">
  235. <term><command>tabs</command></term>
  236. <listitem>
  237. <para>清除并设置终端的 tab 宽度</para>
  238. <indexterm zone="ch-system-ncurses tabs">
  239. <primary sortas="b-tabs">tabs</primary>
  240. </indexterm>
  241. </listitem>
  242. </varlistentry>
  243. <varlistentry id="tic">
  244. <term><command>tic</command></term>
  245. <listitem>
  246. <!--para>The terminfo entry-description compiler that translates a
  247. terminfo file from source format into the binary format needed for the
  248. ncurses library routines [A terminfo file contains information on the
  249. capabilities of a certain terminal.]</para-->
  250. <para>Terminfo 条目描述编译器,将 terminfo
  251. 文件从源代码格式翻译为 ncurses 库子程序需要的二进制格式
  252. [terminfo 文件包含特定终端的功能信息。]</para>
  253. <indexterm zone="ch-system-ncurses tic">
  254. <primary sortas="b-tic">tic</primary>
  255. </indexterm>
  256. </listitem>
  257. </varlistentry>
  258. <varlistentry id="toe">
  259. <term><command>toe</command></term>
  260. <listitem>
  261. <para>列出所有可用的终端类型,并给出每种类型的主要名称和描述
  262. </para>
  263. <indexterm zone="ch-system-ncurses toe">
  264. <primary sortas="b-toe">toe</primary>
  265. </indexterm>
  266. </listitem>
  267. </varlistentry>
  268. <varlistentry id="tput">
  269. <term><command>tput</command></term>
  270. <listitem>
  271. <para>使 shell 可以使用终端相关的功能;也可以重置或初始化终端,
  272. 或者报告它的长名称</para>
  273. <indexterm zone="ch-system-ncurses tput">
  274. <primary sortas="b-tput">tput</primary>
  275. </indexterm>
  276. </listitem>
  277. </varlistentry>
  278. <varlistentry id="tset">
  279. <term><command>tset</command></term>
  280. <listitem>
  281. <para>可以被用于初始化终端</para>
  282. <indexterm zone="ch-system-ncurses tset">
  283. <primary sortas="b-tset">tset</primary>
  284. </indexterm>
  285. </listitem>
  286. </varlistentry>
  287. <varlistentry id="libcursesw">
  288. <term><filename class="libraryfile">libcursesw</filename></term>
  289. <listitem>
  290. <para>指向 <filename>libncursesw</filename> 的链接</para>
  291. <indexterm zone="ch-system-ncurses libcursesw">
  292. <primary sortas="c-libcursesw">libcursesw</primary>
  293. </indexterm>
  294. </listitem>
  295. </varlistentry>
  296. <varlistentry id="libncursesw">
  297. <term><filename class="libraryfile">libncursesw</filename></term>
  298. <listitem>
  299. <!--para>Contains functions to display text in many complex ways on a
  300. terminal screen; a good example of the use of these functions is the
  301. menu displayed during the kernel's <command>make
  302. menuconfig</command></para-->
  303. <para>包含在终端屏幕上以多种复杂方式显示文本的函数;
  304. 使用这些函数的典型例子是运行内核的
  305. <command>make menuconfig</command> 时显示的目录。</para>
  306. <indexterm zone="ch-system-ncurses libncursesw">
  307. <primary sortas="c-libncursesw">libncursesw</primary>
  308. </indexterm>
  309. </listitem>
  310. </varlistentry>
  311. <varlistentry id="libformw">
  312. <term><filename class="libraryfile">libformw</filename></term>
  313. <listitem>
  314. <para>包含实现表单的函数</para>
  315. <indexterm zone="ch-system-ncurses libformw">
  316. <primary sortas="c-libformw">libformw</primary>
  317. </indexterm>
  318. </listitem>
  319. </varlistentry>
  320. <varlistentry id="libmenuw">
  321. <term><filename class="libraryfile">libmenuw</filename></term>
  322. <listitem>
  323. <para>包含实现目录的函数</para>
  324. <indexterm zone="ch-system-ncurses libmenuw">
  325. <primary sortas="c-libmenuw">libmenuw</primary>
  326. </indexterm>
  327. </listitem>
  328. </varlistentry>
  329. <varlistentry id="libpanelw">
  330. <term><filename class="libraryfile">libpanelw</filename></term>
  331. <listitem>
  332. <para>包含实现面板的函数</para>
  333. <indexterm zone="ch-system-ncurses libpanelw">
  334. <primary sortas="c-libpanelw">libpanelw</primary>
  335. </indexterm>
  336. </listitem>
  337. </varlistentry>
  338. </variablelist>
  339. </sect2>
  340. </sect1>