137 lines
5.2 KiB
HTML
137 lines
5.2 KiB
HTML
|
|
<head>
|
||
|
|
<title>complete(3) - Plan 9 from User Space</title>
|
||
|
|
<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
|
||
|
|
</head>
|
||
|
|
<body bgcolor=#ffffff>
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0 width=100%>
|
||
|
|
<tr height=10><td>
|
||
|
|
<tr><td width=20><td>
|
||
|
|
<tr><td width=20><td><b>COMPLETE(3)</b><td align=right><b>COMPLETE(3)</b>
|
||
|
|
<tr><td width=20><td colspan=2>
|
||
|
|
<br>
|
||
|
|
<p><font size=+1><b>NAME </b></font><br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
complete, freecompletion – file name completion<br>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
<p><font size=+1><b>SYNOPSIS </b></font><br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
<tt><font size=+1>#include <u.h><br>
|
||
|
|
#include <libc.h><br>
|
||
|
|
#include <complete.h>
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
||
|
|
</font></tt>
|
||
|
|
<tt><font size=+1>typedef struct CompletionCompletion;<br>
|
||
|
|
struct Completion{<br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
uchar advance;<br>
|
||
|
|
uchar complete;<br>
|
||
|
|
char *string;<br>
|
||
|
|
int nmatch;<br>
|
||
|
|
int nfile;<br>
|
||
|
|
char **filename;<br>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
};<br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
||
|
|
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
||
|
|
|
||
|
|
Completion* complete(char *dir, char *s);
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
||
|
|
</font></tt>
|
||
|
|
<tt><font size=+1>void freecompletion(Completion *c);<br>
|
||
|
|
</font></tt>
|
||
|
|
</table>
|
||
|
|
<p><font size=+1><b>DESCRIPTION </b></font><br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
The <i>complete</i> function implements file name completion. Given a
|
||
|
|
directory <i>dir</i> and a string <i>s</i>, it returns an analysis of the file
|
||
|
|
names in that directory that begin with the string <i>s</i>. The fields
|
||
|
|
<tt><font size=+1>nmatch</font></tt> and <tt><font size=+1>nfile</font></tt> will be set to the number of files that match
|
||
|
|
the prefix and <tt><font size=+1>filename</font></tt> will be filled in with their names. If
|
||
|
|
the file named is a directory, a slash character will be appended
|
||
|
|
to it.
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
||
|
|
|
||
|
|
If no files match the string, <tt><font size=+1>nmatch</font></tt> will be zero, but <i>complete</i>
|
||
|
|
will return the full set of files in the directory, with <i>nfile</i>
|
||
|
|
set to their number.
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
||
|
|
|
||
|
|
The flag <tt><font size=+1>advance</font></tt> reports whether the string <i>s</i> can be extended
|
||
|
|
without changing the set of files that match. If true, <tt><font size=+1>string</font></tt>
|
||
|
|
will be set to the extension; that is, the value of <tt><font size=+1>string</font></tt> may
|
||
|
|
be appended to <i>s</i> by the caller to extend the embryonic file name
|
||
|
|
unambiguously.
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
||
|
|
|
||
|
|
The flag <tt><font size=+1>complete</font></tt> reports whether the extended file name uniquely
|
||
|
|
identifies a file. If true, <tt><font size=+1>string</font></tt> will be suffixed with a blank,
|
||
|
|
or a slash and a blank, depending on whether the resulting file
|
||
|
|
name identifies a plain file or a directory.
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
||
|
|
|
||
|
|
The <i>freecompletion</i> function frees a <tt><font size=+1>Completion</font></tt> structure and its
|
||
|
|
contents.
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=5><td></table>
|
||
|
|
|
||
|
|
In <a href="../man1/rio.html"><i>rio</i>(1)</a> and <a href="../man1/acme.html"><i>acme</i>(1)</a>, file name completion is triggered by a
|
||
|
|
control-F character or an Insert character.<br>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
<p><font size=+1><b>SOURCE </b></font><br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
<tt><font size=+1>/usr/local/plan9/src/libcomplete<br>
|
||
|
|
</font></tt>
|
||
|
|
</table>
|
||
|
|
<p><font size=+1><b>SEE ALSO </b></font><br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
<a href="../man1/rio.html"><i>rio</i>(1)</a>, <a href="../man1/acme.html"><i>acme</i>(1)</a><br>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
<p><font size=+1><b>DIAGNOSTICS </b></font><br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
The <i>complete</i> function returns a null pointer and sets <i>errstr</i> if
|
||
|
|
the directory is unreadable or there is some other error.<br>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
<p><font size=+1><b>BUGS </b></font><br>
|
||
|
|
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0><tr height=2><td><tr><td width=20><td>
|
||
|
|
|
||
|
|
The behavior of file name completion should be controlled by the
|
||
|
|
plumber.<br>
|
||
|
|
|
||
|
|
</table>
|
||
|
|
|
||
|
|
<td width=20>
|
||
|
|
<tr height=20><td>
|
||
|
|
</table>
|
||
|
|
<!-- TRAILER -->
|
||
|
|
<table border=0 cellpadding=0 cellspacing=0 width=100%>
|
||
|
|
<tr height=15><td width=10><td><td width=10>
|
||
|
|
<tr><td><td>
|
||
|
|
<center>
|
||
|
|
<a href="../../"><img src="../../dist/spaceglenda100.png" alt="Space Glenda" border=1></a>
|
||
|
|
</center>
|
||
|
|
</table>
|
||
|
|
<!-- TRAILER -->
|
||
|
|
</body></html>
|