complete man page on Plan9

Printed from

COMPLETE(2)							   COMPLETE(2)

       complete - file name completion

       #include <u.h>
       #include <libc.h>
       #include <complete.h>

       typedef struct CompletionCompletion;
       struct Completion{
	   uchar advance;  /* whether forward progress has been made */
	   uchar complete; /* whether the completion now represents a file or directory */
	   char *string;   /* the string to advance, suffixed " " or "/" for file or directory */
	   int nmatch;	   /* number of files that matched */
	   int nfile;	   /* number of files returned */
	   char **filename;/* their names */

       Completion* complete(char *dir, char *s);

       void freecompletion(Completion *c);

       The  complete function implements file name completion.	Given a direc‐
       tory dir and a string s, it returns an analysis of the  file  names  in
       that  directory	that  begin  with the string s.	 The fields nmatch and
       nfile will be set to the number of files	 that  match  the  prefix  and
       filename	 will  be  filled in with their names.	If the file named is a
       directory, a slash character will be appended to it.

       If no files match the string, nmatch will be zero,  but	complete  will
       return  the full set of files in the directory, with nfile set to their

       The flag advance reports whether the string s can be  extended  without
       changing	 the  set of files that match.	If true, string will be set to
       the extension; that is, the value of string may be appended to s by the
       caller to extend the embryonic file name unambiguously.

       The flag complete reports whether the extended file name uniquely iden‐
       tifies a file.  If true, string will be suffixed with  a	 blank,	 or  a
       slash and a blank, depending on whether the resulting file name identi‐
       fies a plain file or a directory.

       The freecompletion function frees a Completion structure and  its  con‐

       In rio(1) and acme(1), file name completion is triggered by a control-F
       character or an Insert character.


       rio(1), acme(1)

       The complete function returns a null pointer and	 sets  errstr  if  the
       directory is unreadable or there is some other error.

       The  behavior  of  file	name  completion  should  be controlled by the

                             _         _         _ 
                            | |       | |       | |     
                            | |       | |       | |     
                         __ | | __ __ | | __ __ | | __  
                         \ \| |/ / \ \| |/ / \ \| |/ /  
                          \ \ / /   \ \ / /   \ \ / /   
                           \   /     \   /     \   /    
                            \_/       \_/       \_/ 
More information is available in HTML format for server Plan9

List of man pages available for Plan9

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
Vote for polarhome
Free Shell Accounts :: the biggest list on the net