Implemented process expansion on OS X

Also fixed issue where process expansion would always fail for processes with spaces
Fixes https://github.com/fish-shell/fish-shell/issues/56
This commit is contained in:
ridiculousfish
2012-07-16 12:05:36 -07:00
parent 548ea1e54a
commit 33c6410809
5 changed files with 367 additions and 209 deletions

View File

@@ -136,6 +136,40 @@ wcstring_list_t completions_to_wcstring_list( const std::vector<completion_t> &l
return strings;
}
int fgetws2(wcstring *s, FILE *f)
{
int i=0;
wint_t c;
while( 1 )
{
errno=0;
c = getwc( f );
if( errno == EILSEQ )
{
continue;
}
switch( c )
{
/* End of line */
case WEOF:
case L'\n':
case L'\0':
return i;
/* Ignore carriage returns */
case L'\r':
break;
default:
i++;
s->push_back((wchar_t)c);
break;
}
}
}
int fgetws2( wchar_t **b, int *len, FILE *f )
{