aboutsummaryrefslogtreecommitdiffhomepage
path: root/common.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'common.cpp')
-rw-r--r--common.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/common.cpp b/common.cpp
index 388f68cc..c5974d3e 100644
--- a/common.cpp
+++ b/common.cpp
@@ -83,6 +83,7 @@ parts of fish.
#include "proc.h"
#include "wildcard.h"
#include "parser.h"
+#include "complete.h"
#include "util.cpp"
#include "halloc.cpp"
@@ -155,6 +156,23 @@ wchar_t **list_to_char_arr( array_list_t *l )
return res;
}
+wchar_t **completions_to_char_arr( std::vector<completion_t> &l )
+{
+ wchar_t ** res = (wchar_t **)malloc( sizeof(wchar_t *)*( l.size() + 1) );
+ int i;
+ if( res == 0 )
+ {
+ DIE_MEM();
+ }
+ for( i=0; i< l.size(); i++ )
+ {
+ res[i] = const_cast<wchar_t*>(l.at(i).completion.c_str());
+ }
+ res[i]='\0';
+ return res;
+}
+
+
int fgetws2( wchar_t **b, int *len, FILE *f )
{
int i=0;
@@ -242,6 +260,10 @@ void sort_strings( std::vector<wcstring> &strings)
std::sort(strings.begin(), strings.end(), string_sort_predicate);
}
+void sort_completions( std::vector<completion_t> &completions)
+{
+ std::sort(completions.begin(), completions.end());
+}
wchar_t *str2wcs( const char *in )
{
wchar_t *out;