/** \file builtin_complete.c Functions defining the complete builtin Functions used for implementing the complete builtin. */ #include #include #include #include #include #include #include #include "config.h" #include "fallback.h" #include "util.h" #include "wutil.h" #include "builtin.h" #include "common.h" #include "complete.h" #include "wgetopt.h" #include "parser.h" #include "reader.h" /** Internal storage for the builtin_get_temporary_buffer() function. */ const static wchar_t *temporary_buffer; /* builtin_complete_* are a set of rather silly looping functions that make sure that all the proper combinations of complete_add or complete_remove get called. This is needed since complete allows you to specify multiple switches on a single commandline, like 'complete -s a -s b -s c', but the complete_add function only accepts one short switch and one long switch. */ /** Silly function */ static void builtin_complete_add2( const wchar_t *cmd, int cmd_type, const wchar_t *short_opt, array_list_t *gnu_opt, array_list_t *old_opt, int result_mode, int authorative, const wchar_t *condition, const wchar_t *comp, const wchar_t *desc ) { int i; const wchar_t *s; for( s=short_opt; *s; s++ ) { complete_add( cmd, cmd_type, *s, 0, 0, result_mode, authorative, condition, comp, desc ); } for( i=0; i