File: readline.xml

package info (click to toggle)
phpdoc 20020310-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 35,272 kB
  • ctags: 354
  • sloc: xml: 799,767; php: 1,395; cpp: 500; makefile: 200; sh: 140; awk: 51
file content (215 lines) | stat: -rw-r--r-- 6,940 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<?xml version="1.0" encoding="utf-8"?>
 <reference id="ref.readline">
  <title>GNU Readline</title>
  <titleabbrev>Readline</titleabbrev>

  <partintro>
   <simpara>
    The <function>readline</function> functions implement an interface
    to the GNU Readline library.  These are functions that provide
    editable command lines.  An example being the way Bash allows you
    to use the arrow keys to insert characters or scroll through
    command history.  Because of the interactive nature of this
    library, it will be of little use for writing Web applications,
    but may be useful when writing scripts meant to be run from a
    shell.
   </simpara>
   <simpara>
    The home page of the GNU Readline project is
    <ulink url="&url.readline;">&url.readline;</ulink>.  It's maintained
    by Chet Ramey, who's also the author of Bash.
   </simpara>
  </partintro>

  <refentry id="function.readline">
   <refnamediv>
    <refname>readline</refname>
    <refpurpose>Reads a line</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>string</type><methodname>readline</methodname>
      <methodparam choice="opt"><type>string</type><parameter>prompt</parameter></methodparam>
     </methodsynopsis>
    <para>
     This function returns a single string from the user.  You may
     specify a string with which to prompt the user.  The line
     returned has the ending newline removed.  You must add this line
     to the history yourself using
     <function>readline_add_history</function>.
    </para>
    <example>
     <title><function>readline</function></title>
     <programlisting role="php">
//get 3 commands from user
for ($i=0; $i &amp; 3; $i++) {
        $line = readline ("Command: ");
        readline_add_history ($line);
}

//dump history
print_r (readline_list_history());

//dump variables
print_r (readline_info());
     </programlisting>
    </example>
   </refsect1>
  </refentry>

  <refentry id="function.readline-add-history">
   <refnamediv>
    <refname>readline_add_history</refname>
    <refpurpose>Adds a line to the history</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>void</type><methodname>readline_add_history</methodname>
      <methodparam><type>string</type><parameter>line</parameter></methodparam>
     </methodsynopsis>
    <para>
     This function adds a line to the command line history.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.readline-clear-history">
   <refnamediv>
    <refname>readline_clear_history</refname>
    <refpurpose>Clears the history</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>boolean</type><methodname>readline_clear_history</methodname>
      <methodparam><type>void</type><parameter/></methodparam>
     </methodsynopsis>
    <para>
     This function clears the entire command line history.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.readline-completion-function">
   <refnamediv>
    <refname>readline_completion_function</refname>
    <refpurpose>Registers a completion function</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>boolean</type><methodname>readline_completion_function</methodname>
      <methodparam><type>string</type><parameter>line</parameter></methodparam>
     </methodsynopsis>
    <para>
     This function registers a completion function.  You must supply
     the name of an existing function which accepts a partial command
     line and returns an array of possible matches.  This is the same
     kind of functionality you'd get if you hit your tab key while
     using Bash.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.readline-info">
   <refnamediv>
    <refname>readline_info</refname>
    <refpurpose>Gets/sets various internal readline variables</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>mixed</type><methodname>readline_info</methodname>
      <methodparam choice="opt"><type>string</type><parameter>varname</parameter></methodparam>
      <methodparam choice="opt"><type>string</type><parameter>newvalue</parameter></methodparam>
     </methodsynopsis>
    <para>
     If called with no parameters, this function returns an array of
     values for all the setting readline uses.  The elements will
     be indexed by the following values: done, end, erase_empty_line,
     library_version, line_buffer, mark, pending_input, point, prompt,
     readline_name, and terminal_name.
    </para>
    <para>
     If called with one parameter, the value of that setting is
     returned.  If called with two parameters, the setting will be
     changed to the given value.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.readline-list-history">
   <refnamediv>
    <refname>readline_list_history</refname>
    <refpurpose>Lists the history</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>array</type><methodname>readline_list_history</methodname>
      <methodparam><type>void</type><parameter/></methodparam>
     </methodsynopsis>
    <para>
     This function returns an array of the entire command line
     history.  The elements are indexed by integers starting at zero.
    </para>
   </refsect1>
  </refentry>

  <refentry id="function.readline-read-history">
   <refnamediv>
    <refname>readline_read_history</refname>
    <refpurpose>Reads the history</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>boolean</type><methodname>readline_read_history</methodname>
      <methodparam><type>string</type><parameter>filename</parameter></methodparam>
     </methodsynopsis>
    <para>
     This function reads a command history from a file.
    </para>
   </refsect1>
  </refentry>


  <refentry id="function.readline-write-history">
   <refnamediv>
    <refname>readline_write_history</refname>
    <refpurpose>Writes the history</refpurpose>
   </refnamediv>
   <refsect1>
    <title>Description</title>
     <methodsynopsis>
      <type>boolean</type><methodname>readline_write_history</methodname>
      <methodparam><type>string</type><parameter>filename</parameter></methodparam>
     </methodsynopsis>
    <para>
     This function writes the command history to a file.
    </para>
   </refsect1>
  </refentry>

 </reference>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->