aboutsummaryrefslogtreecommitdiff
path: root/man/man3/complete.html
blob: 2945375250c986dae75eaecfe24298482764ffa9 (plain)
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
<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 &ndash; 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 &lt;u.h&gt;<br>
    #include &lt;libc.h&gt;<br>
    #include &lt;complete.h&gt; 
    <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>