aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2005-11-03 02:49:13 +1000
committerGravatar axel <axel@liljencrantz.se>2005-11-03 02:49:13 +1000
commitd50c051eec9bc212bcf5e1bbc1e16d60ecf6f662 (patch)
tree10eda939a8d6f82b5b41ee15017f9716e2ad5394
parent8d58e58d7bb53e77752ea2897d100398ac62ace7 (diff)
Change quoting rules to POSIX style
darcs-hash:20051102164913-ac50b-d4b696394e13a2d4c787f8ee1a2b209317dddb51.gz
-rw-r--r--common.c564
-rw-r--r--common.h91
-rw-r--r--expand.c245
-rw-r--r--expand.h3
-rw-r--r--init/completions/apropos.fish7
-rw-r--r--init/completions/apt-get.fish88
-rw-r--r--init/completions/apt-proxy-import.fish16
-rw-r--r--init/completions/apt-show-source.fish18
-rw-r--r--init/completions/apt-show-versions.fish24
-rw-r--r--init/completions/cat.fish22
-rw-r--r--init/completions/cvs.fish94
-rw-r--r--init/completions/gcc.fish110
-rw-r--r--init/completions/kill.fish4
-rw-r--r--init/completions/less.fish2
-rw-r--r--init/completions/mount.fish42
-rw-r--r--init/completions/perl.fish38
-rw-r--r--init/completions/rpm.fish2
-rw-r--r--init/completions/ruby.fish46
-rw-r--r--init/completions/screen.fish62
-rw-r--r--init/fish.in19
-rw-r--r--init/fish_complete.fish6
-rw-r--r--init/fish_function.fish2
22 files changed, 861 insertions, 644 deletions
diff --git a/common.c b/common.c
index 6feedec0..436de6a4 100644
--- a/common.c
+++ b/common.c
@@ -314,8 +314,7 @@ char **wcsv2strv( const wchar_t **in )
char **res = malloc( sizeof( char *)*(count+1));
if( res == 0 )
{
- die_mem();
-
+ die_mem();
}
for( i=0; i<count; i++ )
@@ -353,8 +352,10 @@ wchar_t *wcsdupcat2( const wchar_t *a, ... )
wchar_t *res = malloc( sizeof(wchar_t)*(len +1 ));
if( res == 0 )
- return 0;
-
+ {
+ die_mem();
+ }
+
wcscpy( res, a );
pos = wcslen(a);
while( (arg=va_arg(va2, wchar_t *) )!= 0 )
@@ -489,17 +490,6 @@ long wcstol(const wchar_t *nptr,
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/**
- Appends src to string dst of size siz (unlike wcsncat, siz is the
- full size of dst, not space left). At most siz-1 characters will be
- copied. Always NUL terminates (unless siz <= wcslen(dst)). Returns
- wcslen(src) + MIN(siz, wcslen(initial dst)). If retval >= siz,
- truncation occurred.
-
- This is the OpenBSD strlcat function, modified for wide characters,
- and renamed to reflect this change.
-
-*/
size_t
wcslcat(wchar_t *dst, const wchar_t *src, size_t siz)
{
@@ -552,14 +542,6 @@ wcslcat(wchar_t *dst, const wchar_t *src, size_t siz)
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/**
- Copy src to string dst of size siz. At most siz-1 characters will
- be copied. Always NUL terminates (unless siz == 0). Returns
- wcslen(src); if retval >= siz, truncation occurred.
-
- This is the OpenBSD strlcpy function, modified for wide characters,
- and renamed to reflect this change.
-*/
size_t
wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz)
{
@@ -591,9 +573,6 @@ wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz)
/* count does not include NUL */
}
-/**
- Fallback implementation if missing from libc
-*/
wchar_t *wcsdup( const wchar_t *in )
{
size_t len=wcslen(in);
@@ -601,7 +580,6 @@ wchar_t *wcsdup( const wchar_t *in )
if( out == 0 )
{
die_mem();
-
}
memcpy( out, in, sizeof( wchar_t)*(len+1));
@@ -706,43 +684,25 @@ int my_wcswidth( const wchar_t *c )
wchar_t *quote_end( const wchar_t *in )
{
- int level=1;
- int offset = (*in != L'\"');
-
- in++;
-
- while(1)
+ switch( *in )
{
-/* fwprintf( stderr, L"Check %c\n", *tok->buff );*/
- switch( *in )
+ case '"':
{
- case L'\\':
- in++;
- if( *in == L'\0' )
- {
+ while(1)
+ {
+ in = wcschr( in+1, L'"' );
+ if( !in )
return 0;
- }
- break;
- case L'\"':
- case L'\'':
- if( (((level+offset) % 2)?L'\"':L'\'') == *in )
- {
- level--;
- }
- else
- {
- level++;
- }
-
- break;
+ if( *(in-1) != L'\\' )
+ return (wchar_t *)in;
+ }
+ }
+ case '\'':
+ {
+ return wcschr( in+1, L'\'' );
}
- if( (*in == L'\0') ||(level==0))
- break;
-
- in++;
}
- return level?0:(wchar_t *)in;
-
+ return 0;
}
@@ -997,8 +957,10 @@ wchar_t *escape( const wchar_t *in,
}
-wchar_t *unescape( const wchar_t * orig, int escape_special )
+wchar_t *unescape( const wchar_t * orig, int unescape_special )
{
+
+ int mode = 0;
int in_pos, out_pos, len = wcslen( orig );
int c;
int bracket_count=0;
@@ -1007,194 +969,346 @@ wchar_t *unescape( const wchar_t * orig, int escape_special )
if( !in )
die_mem();
- for( in_pos=0, out_pos=0; in_pos<len; prev=in[out_pos], out_pos++, in_pos++ )
+ for( in_pos=0, out_pos=0;
+ in_pos<len;
+ (prev=(out_pos>=0)?in[out_pos]:0), out_pos++, in_pos++ )
{
c = in[in_pos];
- if( c == L'\\' )
+ switch( mode )
{
- switch( in[++in_pos] )
- {
- case L'\0':
- free(in);
- return 0;
- case L'n':
- in[out_pos]=L'\n';
- break;
-
- case L'r':
- in[out_pos]=L'\r';
- break;
-
- case L't':
- in[out_pos]=L'\t';
- break;
-
- case L'b':
- in[out_pos]=L'\b';
- break;
-
- case L'e':
- in[out_pos]=L'\e';
- break;
-
- case L'u':
- case L'U':
- case L'x':
- case L'o':
+ /*
+ Mode 0 means unquoted string
+ */
+ case 0:
+ {
+ if( c == L'\\' )
{
- int i;
- wchar_t res=0;
- int chars=2;
- int base=16;
-
- switch( in[in_pos] )
+ switch( in[++in_pos] )
{
- case L'u':
- base=16;
- chars=4;
+ case L'\0':
+ {
+ free(in);
+ return 0;
+ }
+
+ case L'n':
+ {
+ in[out_pos]=L'\n';
break;
-
- case L'U':
- base=16;
- chars=8;
+ }
+
+ case L'r':
+ {
+ in[out_pos]=L'\r';
break;
-
- case L'x':
- base=16;
- chars=2;
+ }
+
+ case L't':
+ {
+ in[out_pos]=L'\t';
break;
-
- case L'o':
- base=8;
- chars=3;
+ }
+
+ case L'b':
+ {
+ in[out_pos]=L'\b';
break;
-
- }
-
- for( i=0; i<chars; i++ )
- {
- int d = convert_digit( in[++in_pos],base);
- if( d < 0 )
+ }
+
+ case L'e':
{
- in_pos--;
+ in[out_pos]=L'\e';
break;
}
- res=(res*base)|d;
+ case L'u':
+ case L'U':
+ case L'x':
+ case L'o':
+ {
+ int i;
+ wchar_t res=0;
+ int chars=2;
+ int base=16;
+
+ switch( in[in_pos] )
+ {
+ case L'u':
+ {
+ base=16;
+ chars=4;
+ break;
+ }
+
+ case L'U':
+ {
+ base=16;
+ chars=8;
+ break;
+ }
+
+ case L'x':
+ {
+ base=16;
+ chars=2;
+ break;
+ }
+
+ case L'o':
+ {
+ base=8;
+ chars=3;
+ break;
+ }
+
+ }
+
+ for( i=0; i<chars; i++ )
+ {
+ int d = convert_digit( in[++in_pos],base);
+ if( d < 0 )
+ {
+ in_pos--;
+ break;
+ }
- }
+ res=(res*base)|d;
+
+ }
- in[out_pos] = res;
+ in[out_pos] = res;
- break;
- }
+ break;
+ }
- default:
- in[out_pos]=in[in_pos];
- break;
- }
- }
- else
- {
- switch( in[in_pos]){
- case L'~':
- if( escape_special && (in_pos == 0) )
- in[out_pos]=HOME_DIRECTORY;
- else
- in[out_pos] = L'~';
- break;
- case L'%':
- if( escape_special && (in_pos == 0) )
- in[out_pos]=PROCESS_EXPAND;
- else
- in[out_pos]=in[in_pos];
- break;
- case L'*':
- if( escape_special )
- {
- if( out_pos > 0 && in[out_pos-1]==ANY_STRING )
+ default:
{
- out_pos--;
- in[out_pos] = ANY_STRING_RECURSIVE;
+ in[out_pos]=in[in_pos];
+ break;
}
- else
- in[out_pos]=ANY_STRING;
- }
- else
- in[out_pos]=in[in_pos];
- break;
- case L'?':
- if( escape_special )
- in[out_pos]=ANY_CHAR;
- else
- in[out_pos]=in[in_pos];
- break;
- case L'$':
- if( escape_special )
- in[out_pos]=VARIABLE_EXPAND;
- else
- in[out_pos]=in[in_pos];
- break;
- case L'{':
- if( escape_special )
- {
- bracket_count++;
- in[out_pos]=BRACKET_BEGIN;
}
- else
- in[out_pos]=in[in_pos];
- break;
- case L'}':
- if( escape_special )
- {
- bracket_count--;
- in[out_pos]=BRACKET_END;
- }
- else
- in[out_pos]=in[in_pos];
- break;
+ }
+ else
+ {
+ switch( in[in_pos]){
+ case L'~':
+ {
+ if( unescape_special && (in_pos == 0) )
+ {
+ in[out_pos]=HOME_DIRECTORY;
+ }
+ else
+ {
+ in[out_pos] = L'~';
+ }
+ break;
+ }
- case L',':
- if( escape_special && bracket_count && prev!=BRACKET_SEP)
- {
- in[out_pos]=BRACKET_SEP;
- }
- else
- in[out_pos]=in[in_pos];
- break;
+ case L'%':
+ {
+ if( unescape_special && (in_pos == 0) )
+ {
+ in[out_pos]=PROCESS_EXPAND;
+ }
+ else
+ {
+ in[out_pos]=in[in_pos];
+ }
+ break;
+ }
- case L'\'':
- case L'\"':
- {
- wchar_t *end = quote_end( &in[in_pos] );
- int len;
-
- if( end == 0 )
- {
- free(in);
- return 0;
- }
-
- len = end- &in[in_pos]-1;
+ case L'*':
+ {
+ if( unescape_special )
+ {
+ if( out_pos > 0 && in[out_pos-1]==ANY_STRING )
+ {
+ out_pos--;
+ in[out_pos] = ANY_STRING_RECURSIVE;
+ }
+ else
+ in[out_pos]=ANY_STRING;
+ }
+ else
+ {
+ in[out_pos]=in[in_pos];
+ }
+ break;
+ }
- if( escape_special)
- in[out_pos++]=INTERNAL_SEPARATOR;
+ case L'?':
+ {
+ if( unescape_special )
+ {
+ in[out_pos]=ANY_CHAR;
+ }
+ else
+ {
+ in[out_pos]=in[in_pos];
+ }
+ break;
+ }
- memmove( &in[out_pos], &in[in_pos+1], sizeof(wchar_t)*(len) );
- in_pos += len+1;
- out_pos += len-1;
+ case L'$':
+ {
+ if( unescape_special )
+ {
+ in[out_pos]=VARIABLE_EXPAND;
+ }
+ else
+ {
+ in[out_pos]=in[in_pos];
+ }
+ break;
+ }
- if( escape_special)
- in[++out_pos]=INTERNAL_SEPARATOR;
+ case L'{':
+ {
+ if( unescape_special )
+ {
+ bracket_count++;
+ in[out_pos]=BRACKET_BEGIN;
+ }
+ else
+ {
+ in[out_pos]=in[in_pos];
+ }
+ break;
+ }
+
+ case L'}':
+ {
+ if( unescape_special )
+ {
+ bracket_count--;
+ in[out_pos]=BRACKET_END;
+ }
+ else
+ {
+ in[out_pos]=in[in_pos];
+ }
+ break;
+ }
+
+ case L',':
+ {
+ if( unescape_special && bracket_count && prev!=BRACKET_SEP)
+ {
+ in[out_pos]=BRACKET_SEP;
+ }
+ else
+ {
+ in[out_pos]=in[in_pos];
+ }
+ break;
+ }
+
+ case L'\'':
+ {
+ mode = 1;
+ out_pos--;
+ break;
+ }
+
+ case L'\"':
+ {
+ mode = 2;
+ out_pos--;
+ break;
+ }
- break;
+ default:
+ {
+ in[out_pos] = in[in_pos];
+ break;
+ }
+ }
+ }
+ break;
+ }
+
+ /*
+ Mode 1 means single quoted string, i.e 'foo'
+ */
+ case 1:
+ {
+ if( c == L'\'' )
+ {
+ out_pos--;
+ mode = 0;
}
- default:
+ else
+ {
in[out_pos] = in[in_pos];
- break;
+ }
+
+ break;
}
- }
+
+ /*
+ Mode 2 means double quoted string, i.e. "foo"
+ */
+ case 2:
+ {
+ switch( c )
+ {
+ case '"':
+ {
+ mode = 0;
+ out_pos--;
+ break;
+ }
+
+ case '\\':
+ {
+ switch( in[++in_pos] )
+ {
+ case L'\0':
+ {
+ free(in);
+ return 0;
+ }
+
+ case L'$':
+ {
+ in[out_pos]=in[in_pos];
+ break;
+ }
+
+ default:
+ {
+ in[out_pos++] = L'\\';
+ in[out_pos] = in[in_pos];
+ break;
+ }
+ }
+ break;
+ }
+
+ case '$':
+ {
+ if( unescape_special )
+ {
+ in[out_pos]=VARIABLE_EXPAND_SINGLE;
+ }
+ else
+ {
+ in[out_pos]=in[in_pos];
+ }
+ break;
+ }
+
+ default:
+ {
+ in[out_pos] = in[in_pos];
+ break;
+ }
+
+ }
+ break;
+ }
+ }
}
in[out_pos]=L'\0';
return in;
@@ -1310,13 +1424,13 @@ static char *gen_unique_nfs_filename( const char *filename )
pidlen = sprint_pid_t( getpid(), newname + orglen + 1 + hnlen + 1 );
newname[orglen + 1 + hnlen + 1 + pidlen] = '\0';
/* debug( 1, L"gen_unique_nfs_filename returning with: newname = \"%s\"; "
- L"HOST_NAME_MAX = %d; hnlen = %d; orglen = %d; "
- L"sizeof(pid_t) = %d; maxpiddigits = %d; malloc'd size: %d",
- newname, (int)HOST_NAME_MAX, hnlen, orglen,
- (int)sizeof(pid_t),
- (int)(0.31 * sizeof(pid_t) * CHAR_BIT + 1),
- (int)(orglen + 1 + hnlen + 1 +
- (int)(0.31 * sizeof(pid_t) * CHAR_BIT + 1) + 1) ); */
+ L"HOST_NAME_MAX = %d; hnlen = %d; orglen = %d; "
+ L"sizeof(pid_t) = %d; maxpiddigits = %d; malloc'd size: %d",
+ newname, (int)HOST_NAME_MAX, hnlen, orglen,
+ (int)sizeof(pid_t),
+ (int)(0.31 * sizeof(pid_t) * CHAR_BIT + 1),
+ (int)(orglen + 1 + hnlen + 1 +
+ (int)(0.31 * sizeof(pid_t) * CHAR_BIT + 1) + 1) ); */
return newname;
}
diff --git a/common.h b/common.h
index 3954f505..60b74c53 100644
--- a/common.h
+++ b/common.h
@@ -14,7 +14,10 @@
#include "util.h"
/**
- Under curses, tputs expects an int (*func)(char) as its last parameter, but in ncurses, tputs expects a int (*func)(int) as its last parameter. tputs_arg_t is defined to always be what tputs expects. Hopefully.
+ Under curses, tputs expects an int (*func)(char) as its last
+ parameter, but in ncurses, tputs expects a int (*func)(int) as its
+ last parameter. tputs_arg_t is defined to always be what tputs
+ expects. Hopefully.
*/
#ifdef NCURSES_VERSION
@@ -24,7 +27,7 @@ typedef char tputs_arg_t;
#endif
/**
- Maximum number of bytes in a utf-8 character
+ Maximum number of bytes used by a single utf-8 character
*/
#define MAX_UTF8_BYTES 6
@@ -39,11 +42,14 @@ typedef char tputs_arg_t;
*/
#define FISH_COLOR_RESET -2
-/** Save the shell mode on startup so we can restore them on exit */
+/**
+ Save the shell mode on startup so we can restore them on exit
+*/
extern struct termios shell_modes;
/**
- The character to use where the text has been truncated. Is an ellipsis on unicode system and a $ on other systems.
+ The character to use where the text has been truncated. Is an
+ ellipsis on unicode system and a $ on other systems.
*/
extern wchar_t ellipsis_char;
@@ -69,7 +75,8 @@ extern char *profile;
extern wchar_t *program_name;
/**
- Take an array_list_t containing wide strings and converts them to a wchar_t **.
+ Take an array_list_t containing wide strings and converts them to a
+ single null-terminated wchar_t **.
*/
wchar_t **list_to_char_arr( array_list_t *l );
@@ -87,22 +94,26 @@ wchar_t **list_to_char_arr( array_list_t *l );
int fgetws2( wchar_t **buff, int *len, FILE *f );
/**
- Sorts a list of wide strings according to the wcsfilecmp-function from the util library
+ Sorts a list of wide strings according to the wcsfilecmp-function
+ from the util library
*/
void sort_list( array_list_t *comp );
/**
- Returns a newly allocated wide character string equivalent of the specified multibyte character string
+ Returns a newly allocated wide character string equivalent of the
+ specified multibyte character string
*/
wchar_t *str2wcs( const char *in );
/**
- Returns a newly allocated multibyte character string equivalent of the specified wide character string
+ Returns a newly allocated multibyte character string equivalent of
+ the specified wide character string
*/
char *wcs2str( const wchar_t *in );
/**
- Returns a newly allocated wide character string array equivalent of the specified multibyte character string array
+ Returns a newly allocated wide character string array equivalent of
+ the specified multibyte character string array
*/
char **wcsv2strv( const wchar_t **in );
@@ -112,17 +123,22 @@ char **wcsv2strv( const wchar_t **in );
wchar_t **strv2wcsv( const char **in );
/**
- Returns a newly allocated concatenation of the specified wide character strings
+ Returns a newly allocated concatenation of the specified wide
+ character strings
*/
wchar_t *wcsdupcat( const wchar_t *a, const wchar_t *b );
/**
- Returns a newly allocated concatenation of the specified wide character strings. The last argument must be a null pointer.
+ Returns a newly allocated concatenation of the specified wide
+ character strings. The last argument must be a null pointer.
*/
wchar_t *wcsdupcat2( const wchar_t *a, ... );
/**
- Returns a newly allocated wide character string wich is a copy of the string in, but of length c or shorter. The returned string is always null terminated, and the null is not included in the string length.
+ Returns a newly allocated wide character string wich is a copy of
+ the string in, but of length c or shorter. The returned string is
+ always null terminated, and the null is not included in the string
+ length.
*/
wchar_t *wcsndup( const wchar_t *in, int c );
@@ -144,14 +160,32 @@ long wcstol(const wchar_t *nptr,
wchar_t **endptr,
int base);
-size_t
-wcslcat(wchar_t *dst, const wchar_t *src, size_t siz);
+/**
+ Appends src to string dst of size siz (unlike wcsncat, siz is the
+ full size of dst, not space left). At most siz-1 characters will be
+ copied. Always NUL terminates (unless siz <= wcslen(dst)). Returns
+ wcslen(src) + MIN(siz, wcslen(initial dst)). If retval >= siz,
+ truncation occurred.
-size_t
-wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz);
+ This is the OpenBSD strlcat function, modified for wide characters,
+ and renamed to reflect this change.
+
+*/
+size_t wcslcat( wchar_t *dst, const wchar_t *src, size_t siz );
+
+/**
+ Copy src to string dst of size siz. At most siz-1 characters will
+ be copied. Always NUL terminates (unless siz == 0). Returns
+ wcslen(src); if retval >= siz, truncation occurred.
+
+ This is the OpenBSD strlcpy function, modified for wide characters,
+ and renamed to reflect this change.
+*/
+size_t wcslcpy( wchar_t *dst, const wchar_t *src, size_t siz );
/**
- Create a dublicate string. Wide string version of strdup.
+ Create a dublicate string. Wide string version of strdup. Will
+ automatically exit if out of memory.
*/
wchar_t *wcsdup(const wchar_t *in);
@@ -163,9 +197,22 @@ wchar_t *wcsdup(const wchar_t *in);
esoteric locales where uppercase and lowercase do not cleanly
transform between each other. Hopefully this should be fine since
fish only uses this function with one of the strings supplied by
- fish and guaranteed to be a sane, english word.
+ fish and guaranteed to be a sane, english word. Using wcscasecmp on
+ a user-supplied string should be considered a bug.
*/
int wcscasecmp( const wchar_t *a, const wchar_t *b );
+
+/**
+ Case insensitive string compare function. Wide string version of
+ strncasecmp.
+
+ This implementation of wcsncasecmp does not take into account
+ esoteric locales where uppercase and lowercase do not cleanly
+ transform between each other. Hopefully this should be fine since
+ fish only uses this function with one of the strings supplied by
+ fish and guaranteed to be a sane, english word. Using wcsncasecmp on
+ a user-supplied string should be considered a bug.
+*/
int wcsncasecmp( const wchar_t *a, const wchar_t *b, int count );
/**
@@ -188,7 +235,11 @@ int wcwidth( wchar_t c );
int my_wcswidth( const wchar_t *c );
/**
- This functions returns the end of a quoted substring. It can handle nested single and double quotes.
+ This functions returns the end of the quoted substring beginning at
+ \c in. It can handle both single and double quotes. Returns 0 on
+ error.
+
+ \param in the position of the opening quote
*/
wchar_t *quote_end( const wchar_t *in );
@@ -205,7 +256,7 @@ void error_reset();
/**
Set the locale, also change the ellipsis character
*/
-void fish_setlocale(int category, const wchar_t *locale);
+void fish_setlocale( int category, const wchar_t *locale );
/**
Checks if \c needle is included in the list of strings specified
diff --git a/expand.c b/expand.c
index 3a56e050..75f1f808 100644
--- a/expand.c
+++ b/expand.c
@@ -120,7 +120,7 @@ static wchar_t *expand_var( wchar_t *in )
{
if( !in )
return 0;
- return (in[0] == VARIABLE_EXPAND )? env_get( expand_var(in+1) ) : env_get( in );
+ return env_get( in );
}
void expand_variable_array( const wchar_t *val, array_list_t *out )
@@ -133,7 +133,6 @@ void expand_variable_array( const wchar_t *val, array_list_t *out )
if( !cpy )
{
die_mem();
-
}
for( start=pos=cpy; *pos; pos++ )
@@ -146,7 +145,7 @@ void expand_variable_array( const wchar_t *val, array_list_t *out )
}
}
al_push( out, wcsdup(start) );
-
+
free(cpy);
}
}
@@ -196,7 +195,7 @@ wchar_t *expand_escape_variable( const wchar_t *in )
switch( al_get_count( &l) )
{
case 0:
- sb_append( &buff, L"\'\'");
+ sb_append( &buff, L"''");
break;
case 1:
@@ -206,9 +205,9 @@ wchar_t *expand_escape_variable( const wchar_t *in )
if( wcschr( el, L' ' ) && is_quotable( el ) )
{
sb_append2( &buff,
- L"\'",
+ L"'",
el,
- L"\'",
+ L"'",
(void *)0 );
}
else
@@ -232,9 +231,9 @@ wchar_t *expand_escape_variable( const wchar_t *in )
if( is_quotable( el ) )
{
sb_append2( &buff,
- L"\'",
+ L"'",
el,
- L"\'",
+ L"'",
(void *)0 );
}
else
@@ -693,11 +692,10 @@ static int expand_variables( wchar_t *in, array_list_t *out )
int is_ok= 1;
int empty=0;
-
for( i=wcslen(in)-1; (i>=0) && is_ok && !empty; i-- )
{
c = in[i];
- if( c == VARIABLE_EXPAND )
+ if( ( c == VARIABLE_EXPAND ) || (c == VARIABLE_EXPAND_SINGLE ) )
{
int start_pos = i+1;
int stop_pos;
@@ -706,15 +704,8 @@ static int expand_variables( wchar_t *in, array_list_t *out )
wchar_t * var_val;
wchar_t * new_in;
array_list_t l;
-
-
-
-// fwprintf( stderr, L"Expand %ls\n", in );
-
-
-// while (in[stop_pos]==VARIABLE_EXPAND)
-// stop_pos++;
-
+ int is_single = (c==VARIABLE_EXPAND_SINGLE);
+
stop_pos = start_pos;
while( 1 )
@@ -736,95 +727,122 @@ static int expand_variables( wchar_t *in, array_list_t *out )
{
die_mem();
}
- else
- {
- wcsncpy( var_name, &in[start_pos], var_len );
- var_name[var_len]='\0';
+ wcsncpy( var_name, &in[start_pos], var_len );
+ var_name[var_len]='\0';
/* printf( "Variable name is %s, len is %d\n", var_name, var_len );*/
- wchar_t *var_val_orig = expand_var( var_name );
+ wchar_t *var_val_orig = expand_var( var_name );
- if( var_val_orig && (var_val = wcsdup( var_val_orig) ) )
- {
- int all_vars=1;
- array_list_t idx;
- al_init( &idx );
- al_init( &l );
+ if( var_val_orig && (var_val = wcsdup( var_val_orig) ) )
+ {
+ int all_vars=1;
+ array_list_t idx;
+ al_init( &idx );
+ al_init( &l );
- if( in[stop_pos] == L'[' )
- {
- wchar_t *end;
+ if( in[stop_pos] == L'[' )
+ {
+ wchar_t *end;
- all_vars = 0;
+ all_vars = 0;
- stop_pos++;
- while( 1 )
- {
- int tmp;
+ stop_pos++;
+ while( 1 )
+ {
+ int tmp;
- while( iswspace(in[stop_pos]) || (in[stop_pos]==INTERNAL_SEPARATOR))
- stop_pos++;
+ while( iswspace(in[stop_pos]) || (in[stop_pos]==INTERNAL_SEPARATOR))
+ stop_pos++;
- if( in[stop_pos] == L']' )
- {
- stop_pos++;
- break;
- }
+ if( in[stop_pos] == L']' )
+ {
+ stop_pos++;
+ break;
+ }
- errno=0;
- tmp = wcstol( &in[stop_pos], &end, 10 );
- if( ( errno ) || ( end == &in[stop_pos] ) )
- {
- error( SYNTAX_ERROR,
- L"Expected integer or \']\'",
- -1 );
- is_ok = 0;
- break;
- }
- al_push( &idx, (void *)tmp );
- stop_pos = end-in;
+ errno=0;
+ tmp = wcstol( &in[stop_pos], &end, 10 );
+ if( ( errno ) || ( end == &in[stop_pos] ) )
+ {
+ error( SYNTAX_ERROR,
+ L"Expected integer or \']\'",
+ -1 );
+ is_ok = 0;
+ break;
}
+ al_push( &idx, (void *)tmp );
+ stop_pos = end-in;
}
+ }
- if( is_ok )
- {
- expand_variable_array( var_val, &l );
- if( !all_vars )
- {
- int j;
- for( j=0; j<al_get_count( &idx ); j++)
+ if( is_ok )
+ {
+ expand_variable_array( var_val, &l );
+ if( !all_vars )
+ {
+ int j;
+ for( j=0; j<al_get_count( &idx ); j++)
+ {
+ int tmp = (int)al_get( &idx, j );
+ if( tmp < 1 || tmp > al_get_count( &l ) )
{
- int tmp = (int)al_get( &idx, j );
- if( tmp < 1 || tmp > al_get_count( &l ) )
- {
- error( SYNTAX_ERROR, L"Array index out of bounds", -1 );
- is_ok=0;
- al_truncate( &idx, j );
- break;
- }
- else
- {
- /* Move string from list l to list idx */
- al_set( &idx, j, al_get( &l, tmp-1 ) );
- al_set( &l, tmp-1, 0 );
- }
+ error( SYNTAX_ERROR, L"Array index out of bounds", -1 );
+ is_ok=0;
+ al_truncate( &idx, j );
+ break;
+ }
+ else
+ {
+ /* Move string from list l to list idx */
+ al_set( &idx, j, al_get( &l, tmp-1 ) );
+ al_set( &l, tmp-1, 0 );
}
- /* Free remaining strings in list l and truncate it */
- al_foreach( &l, (void (*)(const void *))&free );
- al_truncate( &l, 0 );
- /* Add items from list idx back to list l */
- al_push_all( &l, &idx );
}
- free( var_val );
- }
+ /* Free remaining strings in list l and truncate it */
+ al_foreach( &l, (void (*)(const void *))&free );
+ al_truncate( &l, 0 );
+ /* Add items from list idx back to list l */
+ al_push_all( &l, &idx );
+ }
+ free( var_val );
+ }
+
+ if( is_single )
+ {
+ string_buffer_t res;
+ sb_init( &res );
+
+ in[i]=0;
+
+ sb_append( &res, in );
for( j=0; j<al_get_count( &l); j++ )
{
wchar_t *next = (wchar_t *)al_get( &l, j );
if( is_ok )
+ {
+ if( j != 0 )
+ sb_append( &res, L" " );
+ sb_append( &res, next );
+ }
+ free( next );
+ }
+ sb_append( &res, &in[stop_pos] );
+ is_ok &= expand_variables( wcsdup((wchar_t *)res.buff), out );
+
+ sb_destroy( &res );
+
+ }
+ else
+ {
+ for( j=0; j<al_get_count( &l); j++ )
+ {
+ wchar_t *next = (wchar_t *)al_get( &l, j );
+
+ if( is_ok )
{
-
+
new_len = wcslen(in) - (stop_pos-start_pos+1) + wcslen( next) +2;
if( !(new_in = malloc( sizeof(wchar_t)*new_len )))
@@ -853,21 +871,54 @@ static int expand_variables( wchar_t *in, array_list_t *out )
}
}
free( next );
- }
- al_destroy( &l );
- al_destroy( &idx );
- free(in);
- free(var_name );
- return is_ok;
+ }
}
- else
+
+ al_destroy( &l );
+ al_destroy( &idx );
+ free(in);
+ free(var_name );
+ return is_ok;
+ }
+ else
+ {
+ /*
+ Expand a non-existing variable
+ */
+ if( c == VARIABLE_EXPAND )
{
+ /*
+ Regular expantion, i.e. expand this argument to nothing
+ */
empty = 1;
}
+ else
+ {
+ /*
+ Expantion to single argument.
+ */
+ string_buffer_t res;
+ sb_init( &res );
+
+ in[i]=0;
+
+ sb_append( &res, in );
+
+ sb_append( &res, &in[stop_pos] );
+ is_ok &= expand_variables( wcsdup((wchar_t *)res.buff), out );
+
+ sb_destroy( &res );
+ free(in);
+ free(var_name );
+ return is_ok;
+ }
- free(var_name );
}
+
+ free(var_name );
+
}
+
prev_char = c;
}
@@ -1326,9 +1377,9 @@ static void remove_internal_separator( const void *s, int conv )
}
*out=0;
/* if( changed )
- {
- fwprintf( stderr, L" -> %ls\n", s );
- }
+ {
+ fwprintf( stderr, L" -> %ls\n", s );
+ }
*/
}
diff --git a/expand.h b/expand.h
index 038519c9..e0bc6e5a 100644
--- a/expand.h
+++ b/expand.h
@@ -70,6 +70,9 @@ enum
/** Character representing variable expantion */
VARIABLE_EXPAND,
+ /** Character rpresenting variable expantion into a single element*/
+ VARIABLE_EXPAND_SINGLE,
+
/** Character representing the start of a bracket expantion */
BRACKET_BEGIN,
diff --git a/init/completions/apropos.fish b/init/completions/apropos.fish
index fed1336e..8caf49bf 100644
--- a/init/completions/apropos.fish
+++ b/init/completions/apropos.fish
@@ -1,11 +1,12 @@
+
function __fish_complete_apropos
if test (commandline -ct)
set str (commandline -ct)
- apropos $str|sed -e 's/^\(.*'$str'\([^ ]*\).*\)$/'$str'\2\t\1/'
+ apropos $str|sed -e "s/^\(.*$str\([^ ]*\).*\)$/$str\2\t\1/"
end
end
-complete -xc apropos -a "(__fish_complete_apropos)" -d "Whatis entry"
+complete -xc apropos -a '(__fish_complete_apropos)' -d "Whatis entry"
complete -c apropos -s h -l help -d "apropos command help"
complete -f -c apropos -s d -l debug -d "print debugging info"
@@ -14,7 +15,7 @@ complete -f -c apropos -s r -l regex -d "keyword as regex"
complete -f -c apropos -s w -l wildcard -d "keyword as wildwards"
complete -f -c apropos -s e -l exact -d "keyword as exactly match"
complete -x -c apropos -s m -l system -d "search for other system"
-complete -x -c apropos -s M -l manpath -a "(echo $MANPATH)" -d "specify man path"
+complete -x -c apropos -s M -l manpath -a '(echo $MANPATH)' -d "specify man path"
complete -x -c apropos -s C -l config-file -d "specify a conf file"
complete -f -c apropos -s V -l version -d "Display version"
diff --git a/init/completions/apt-get.fish b/init/completions/apt-get.fish
index ee253a7a..ec328b8f 100644
--- a/init/completions/apt-get.fish
+++ b/init/completions/apt-get.fish
@@ -1,6 +1,6 @@
#completion for apt-get
-function __fish_apt_no_subcommand -d "test if apt has yet to be given the subcommand"
+function __fish_apt_no_subcommand -d 'test if apt has yet to be given the subcommand'
for i in (commandline -opc)
if contains -- $i update upgrade dselect-upgrade dist-upgrade install remove source build-dep check clean autoclean
return 1
@@ -9,7 +9,7 @@ function __fish_apt_no_subcommand -d "test if apt has yet to be given the subcom
return 0
end
-function __fish_apt_use_package -d "Test if apt command should have packages as potential completion"
+function __fish_apt_use_package -d 'Test if apt command should have packages as potential completion'
for i in (commandline -opc)
if contains -- $i contains install remove build-dep
return 0
@@ -18,47 +18,47 @@ function __fish_apt_use_package -d "Test if apt command should have packages as
return 1
end
-complete -c apt-get -n "__fish_apt_use_package" -a "(__fish_print_packages)" -d "Package"
+complete -c apt-get -n '__fish_apt_use_package' -a '(__fish_print_packages)' -d 'Package'
-complete -c apt-get -s h -l help -d "apt-get command help"
-complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "update" -d "update sources"
-complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "upgrade" -d "upgrade or install newest packages"
-complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "dselect-upgrade" -d "use with dselect front-end"
-complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "dist-upgrade" -d "distro upgrade"
-complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "install" -d "install one or more packages"
-complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "remove" -d "remove one or more packages"
-complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "source" -d "fetch source packages"
-complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "build-dep" -d "install/remove packages for dependencies"
-complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "check" -d "update cache and check dep"
-complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "clean" -d "clean local caches and packages"
-complete -f -n "__fish_apt_no_subcommand" -c apt-get -a "autoclean" -d "clean packages no longer be downloaded"
-complete -c apt-get -s d -l download-only -d "Download Only"
-complete -c apt-get -s f -l fix-broken -d "correct broken deps"
-complete -c apt-get -s m -l fix-missing -d "ignore missing packages"
-complete -c apt-get -l no-download -d "Disable downloading packages"
-complete -c apt-get -s q -l quiet -d "quiet output"
-complete -c apt-get -s s -l simulate -d "perform a siulation"
-complete -c apt-get -s y -l assume-yes -d "automatic yes to prompts"
-complete -c apt-get -s u -l show-upgraded -d "show upgraded packages"
-complete -c apt-get -s V -l verbose-versions -d "show full versions for packages"
-complete -c apt-get -s b -l compile -d "compile source packages"
-complete -c apt-get -s b -l build -d "compile source packages"
-complete -c apt-get -l ignore-hold -d "ignore package Holds"
-complete -c apt-get -l no-upgrade -d "Do not upgrade packages"
-complete -c apt-get -l force-yes -d "Force yes"
-complete -c apt-get -l print-uris -d "print the URIs"
-complete -c apt-get -l purge -d "use purge instead of remove"
-complete -c apt-get -l reinstall -d "reinstall packages"
-complete -c apt-get -l list-cleanup -d "erase obsolete files"
-complete -c apt-get -s t -l target-release -d "control default input to the policy engine"
-complete -c apt-get -l trivial-only -d "only perform operations that are trivial"
-complete -c apt-get -l no-remove -d "abort if any packages are to be removed"
-complete -c apt-get -l only-source -d "only accept source packages"
-complete -c apt-get -l diff-only -d "download only diff file"
-complete -c apt-get -l tar-only -d "download only tar file"
-complete -c apt-get -l arch-only -d "only process arch-dep build-deps"
-complete -c apt-get -l allow-unauthenticated -d "ignore non-authenticated packages"
-complete -c apt-get -s v -l version -d "show program version"
-complete -r -c apt-get -s c -l config-file -d "specify a config file"
-complete -r -c apt-get -s o -l option -d "set a config option"
+complete -c apt-get -s h -l help -d 'apt-get command help'
+complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'update' -d 'update sources'
+complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'upgrade' -d 'upgrade or install newest packages'
+complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'dselect-upgrade' -d 'use with dselect front-end'
+complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'dist-upgrade' -d 'distro upgrade'
+complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'install' -d 'install one or more packages'
+complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'remove' -d 'remove one or more packages'
+complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'source' -d 'fetch source packages'
+complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'build-dep' -d 'install/remove packages for dependencies'
+complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'check' -d 'update cache and check dep'
+complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'clean' -d 'clean local caches and packages'
+complete -f -n '__fish_apt_no_subcommand' -c apt-get -a 'autoclean' -d 'clean packages no longer be downloaded'
+complete -c apt-get -s d -l download-only -d 'Download Only'
+complete -c apt-get -s f -l fix-broken -d 'correct broken deps'
+complete -c apt-get -s m -l fix-missing -d 'ignore missing packages'
+complete -c apt-get -l no-download -d 'Disable downloading packages'
+complete -c apt-get -s q -l quiet -d 'quiet output'
+complete -c apt-get -s s -l simulate -d 'perform a siulation'
+complete -c apt-get -s y -l assume-yes -d 'automatic yes to prompts'
+complete -c apt-get -s u -l show-upgraded -d 'show upgraded packages'
+complete -c apt-get -s V -l verbose-versions -d 'show full versions for packages'
+complete -c apt-get -s b -l compile -d 'compile source packages'
+complete -c apt-get -s b -l build -d 'compile source packages'
+complete -c apt-get -l ignore-hold -d 'ignore package Holds'
+complete -c apt-get -l no-upgrade -d 'Do not upgrade packages'
+complete -c apt-get -l force-yes -d 'Force yes'
+complete -c apt-get -l print-uris -d 'print the URIs'
+complete -c apt-get -l purge -d 'use purge instead of remove'
+complete -c apt-get -l reinstall -d 'reinstall packages'
+complete -c apt-get -l list-cleanup -d 'erase obsolete files'
+complete -c apt-get -s t -l target-release -d 'control default input to the policy engine'
+complete -c apt-get -l trivial-only -d 'only perform operations that are trivial'
+complete -c apt-get -l no-remove -d 'abort if any packages are to be removed'
+complete -c apt-get -l only-source -d 'only accept source packages'
+complete -c apt-get -l diff-only -d 'download only diff file'
+complete -c apt-get -l tar-only -d 'download only tar file'
+complete -c apt-get -l arch-only -d 'only process arch-dep build-deps'
+complete -c apt-get -l allow-unauthenticated -d 'ignore non-authenticated packages'
+complete -c apt-get -s v -l version -d 'show program version'
+complete -r -c apt-get -s c -l config-file -d 'specify a config file'
+complete -r -c apt-get -s o -l option -d 'set a config option'
diff --git a/init/completions/apt-proxy-import.fish b/init/completions/apt-proxy-import.fish
index 0c2965e3..97d880ac 100644
--- a/init/completions/apt-proxy-import.fish
+++ b/init/completions/apt-proxy-import.fish
@@ -1,10 +1,10 @@
#apt-proxy-import
-complete -c apt-proxy-import -s h -l help -d "apt-proxy-import command help"
-complete -f -c apt-proxy-import -s V -l version -d "print version"
-complete -f -c apt-proxy-import -s v -l verbose -d "verbose info"
-complete -f -c apt-proxy-import -s q -l quiet -d "no message to STDOUT"
-complete -f -c apt-proxy-import -s r -l recursive -d "recurse into subdir"
-complete -r -c apt-proxy-import -s i -l import-dir -a "(ls -Fp|grep /$)" -d "dir to import"
-complete -r -c apt-proxy-import -s u -l user -a "(__fish_complete_users)" -d "change to user"
-complete -r -c apt-proxy-import -s d -l debug -d "debug level[default 0]"
+complete -c apt-proxy-import -s h -l help -d 'apt-proxy-import command help'
+complete -f -c apt-proxy-import -s V -l version -d 'print version'
+complete -f -c apt-proxy-import -s v -l verbose -d 'verbose info'
+complete -f -c apt-proxy-import -s q -l quiet -d 'no message to STDOUT'
+complete -f -c apt-proxy-import -s r -l recursive -d 'recurse into subdir'
+complete -r -c apt-proxy-import -s i -l import-dir -a '(ls -Fp|grep /$)' -d 'dir to import'
+complete -r -c apt-proxy-import -s u -l user -a '(__fish_complete_users)' -d 'change to user'
+complete -r -c apt-proxy-import -s d -l debug -d 'debug level[default 0]'
diff --git a/init/completions/apt-show-source.fish b/init/completions/apt-show-source.fish
index 08016185..fc1b459f 100644
--- a/init/completions/apt-show-source.fish
+++ b/init/completions/apt-show-source.fish
@@ -1,10 +1,10 @@
#apt-show-source
-complete -c apt-show-source -s h -l help -d "apt-show-source command help"
-complete -r -c apt-show-source -l status-file -d "read pkg from FILE" -f
-complete -r -c apt-show-source -o stf -d "read pkg from FILE" -f
-complete -r -c apt-show-source -l list-dir -a "(ls -Fp .|grep /$) /var/lib/apt/lists" -d "specify APT list dir"
-complete -r -c apt-show-source -o ld -a "(ls -Fp .|grep /$) /var/lib/apt/lists" -d "specify APT list dir"
-complete -r -c apt-show-source -s p -l package -a "(apt-cache pkgnames)" -d "list PKG info"
-complete -f -c apt-show-source -l version-only -d "print version only"
-complete -f -c apt-show-source -s a -l all -d "print all src pkgs with version"
-complete -f -c apt-show-source -s v -l verbose -d "verbose message"
+complete -c apt-show-source -s h -l help -d 'apt-show-source command help'
+complete -r -c apt-show-source -l status-file -d 'read pkg from FILE' -f
+complete -r -c apt-show-source -o stf -d 'read pkg from FILE' -f
+complete -r -c apt-show-source -l list-dir -a '(ls -Fp .|grep /$) /var/lib/apt/lists' -d 'specify APT list dir'
+complete -r -c apt-show-source -o ld -a '(ls -Fp .|grep /$) /var/lib/apt/lists' -d 'specify APT list dir'
+complete -r -c apt-show-source -s p -l package -a '(apt-cache pkgnames)' -d 'list PKG info'
+complete -f -c apt-show-source -l version-only -d 'print version only'
+complete -f -c apt-show-source -s a -l all -d 'print all src pkgs with version'
+complete -f -c apt-show-source -s v -l verbose -d 'verbose message'
diff --git a/init/completions/apt-show-versions.fish b/init/completions/apt-show-versions.fish
index 47abe1ba..733327f4 100644
--- a/init/completions/apt-show-versions.fish
+++ b/init/completions/apt-show-versions.fish
@@ -1,14 +1,14 @@
#apt-show-versions
-complete -c apt-show-source -s h -l help -d "apt-show-versions command help"
-complete -r -c apt-show-versions -s p -l packages -a "(apt-cache pkgnames)" -d "print PKG versions"
-complete -f -c apt-show-versions -s r -l regex -d "using regex"
-complete -f -c apt-show-versions -s u -l upgradeable -d "print only upgradeable pkgs"
-complete -f -c apt-show-versions -s a -l allversions -d "print all versions"
-complete -f -c apt-show-versions -s b -l brief -d "print pkg name/distro"
-complete -f -c apt-show-versions -s v -l verbose -d "print verbose info"
-complete -f -c apt-show-versions -s i -l initialize -d "init or update cache only"
-complete -r -c apt-show-versions -l status-file -d "read pkg from FILE"
-complete -r -c apt-show-versions -o stf -d "read pkg from FILE"
-complete -r -c apt-show-versions -l list-dir -a "(ls -Fp .|grep /$) /var/lib/apt/lists /var/state/apt/lists" -d "specify APT list dir"
-complete -r -c apt-show-versions -o ld -a "(ls -Fp .|grep /$) /var/lib/apt/lists /var/state/apt/lists" -d "specify APT list dir"
+complete -c apt-show-source -s h -l help -d 'apt-show-versions command help'
+complete -r -c apt-show-versions -s p -l packages -a '(apt-cache pkgnames)' -d 'print PKG versions'
+complete -f -c apt-show-versions -s r -l regex -d 'using regex'
+complete -f -c apt-show-versions -s u -l upgradeable -d 'print only upgradeable pkgs'
+complete -f -c apt-show-versions -s a -l allversions -d 'print all versions'
+complete -f -c apt-show-versions -s b -l brief -d 'print pkg name/distro'
+complete -f -c apt-show-versions -s v -l verbose -d 'print verbose info'
+complete -f -c apt-show-versions -s i -l initialize -d 'init or update cache only'
+complete -r -c apt-show-versions -l status-file -d 'read pkg from FILE'
+complete -r -c apt-show-versions -o stf -d 'read pkg from FILE'
+complete -r -c apt-show-versions -l list-dir -a '(ls -Fp .|grep /$) /var/lib/apt/lists /var/state/apt/lists' -d 'specify APT list dir'
+complete -r -c apt-show-versions -o ld -a '(ls -Fp .|grep /$) /var/lib/apt/lists /var/state/apt/lists' -d 'specify APT list dir'
diff --git a/init/completions/cat.fish b/init/completions/cat.fish
index 67066177..1919d216 100644
--- a/init/completions/cat.fish
+++ b/init/completions/cat.fish
@@ -1,12 +1,12 @@
-complete -c cat -s A -l show-all -d "Escape all non-printing characters"
-complete -c cat -s b -l number-nonblank -d "Number nonblank lines"
-complete -c cat -s e -d "Escape non-printing characters except tab"
-complete -c cat -s E -l show-ends -d "Display $ at end of line"
-complete -c cat -s n -l number -d "Number all lines"
-complete -c cat -s s -l squeeze-blank -d "Never more than single blank line"
-complete -c cat -s t -d "Escape non-printing characters except newline"
-complete -c cat -s T -l show-tabs -d "Escape tab"
-complete -c cat -s v -d "Escape non-printing except newline and tab"
-complete -c cat -l help -d "Display help and exit"
-complete -c cat -l version -d "Display version and exit"
+complete -c cat -s A -l show-all -d 'Escape all non-printing characters'
+complete -c cat -s b -l number-nonblank -d 'Number nonblank lines'
+complete -c cat -s e -d 'Escape non-printing characters except tab'
+complete -c cat -s E -l show-ends -d 'Display $ at end of line'
+complete -c cat -s n -l number -d 'Number all lines'
+complete -c cat -s s -l squeeze-blank -d 'Never more than single blank line'
+complete -c cat -s t -d 'Escape non-printing characters except newline'
+complete -c cat -s T -l show-tabs -d 'Escape tab'
+complete -c cat -s v -d 'Escape non-printing except newline and tab'
+complete -c cat -l help -d 'Display help and exit'
+complete -c cat -l version -d 'Display version and exit'
diff --git a/init/completions/cvs.fish b/init/completions/cvs.fish
index d0834f9c..9bc531b1 100644
--- a/init/completions/cvs.fish
+++ b/init/completions/cvs.fish
@@ -2,52 +2,52 @@
# I don't use CVS, so these completions are probably not all that good.
#
-complete -c cvs -x -a "add" -d "Add a new file/directory to the repository"
-complete -c cvs -x -a "admin" -d "Administration front end for rcs"
-complete -c cvs -x -a "annotate" -d "Show last revision where each line was modified"
-complete -c cvs -x -a "checkout" -d "Checkout sources for editing"
-complete -c cvs -x -a "commit" -d "Check files into the repository"
-complete -c cvs -x -a "diff" -d "Show differences between revisions"
-complete -c cvs -x -a "edit" -d "Get ready to edit a watched file"
-complete -c cvs -x -a "editors" -d "See who is editing a watched file"
-complete -c cvs -x -a "export" -d "Export sources from CVS, similar to checkout"
-complete -c cvs -x -a "history" -d "Show repository access history"
-complete -c cvs -x -a "import" -d "Import sources into CVS, using vendor branches"
-complete -c cvs -x -a "init" -d "Create a CVS repository if it doesnt exist"
-complete -c cvs -x -a "kserver" -d "Kerberos server mode"
-complete -c cvs -x -a "log" -d "Print out history information for files"
-complete -c cvs -x -a "login" -d "Prompt for password for authenticating server"
-complete -c cvs -x -a "logout" -d "Removes entry in .cvspass for remote repository"
-complete -c cvs -x -a "pserver" -d "Password server mode"
-complete -c cvs -x -a "rannotate" -d "Show last revision where each line of module was modified"
-complete -c cvs -x -a "rdiff" -d "Create 'patch' format diffs between releases"
-complete -c cvs -x -a "release" -d "Indicate that a Module is no longer in use"
-complete -c cvs -x -a "remove" -d "Remove an entry from the repository"
-complete -c cvs -x -a "rlog" -d "Print out history information for a module"
-complete -c cvs -x -a "rtag" -d "Add a symbolic tag to a module"
-complete -c cvs -x -a "server" -d "Server mode"
-complete -c cvs -x -a "status" -d "Display status information on checked out files"
-complete -c cvs -x -a "tag" -d "Add a symbolic tag to checked out version of files"
-complete -c cvs -x -a "unedit" -d "Undo an edit command"
-complete -c cvs -x -a "update" -d "Bring work tree in sync with repository"
-complete -c cvs -x -a "version" -d "Show current CVS version(s)"
-complete -c cvs -x -a "watch" -d "Set watches"
-complete -c cvs -x -a "watchers" -d "See who is watching a file"
+complete -c cvs -x -a 'add' -d 'Add a new file/directory to the repository'
+complete -c cvs -x -a 'admin' -d 'Administration front end for rcs'
+complete -c cvs -x -a 'annotate' -d 'Show last revision where each line was modified'
+complete -c cvs -x -a 'checkout' -d 'Checkout sources for editing'
+complete -c cvs -x -a 'commit' -d 'Check files into the repository'
+complete -c cvs -x -a 'diff' -d 'Show differences between revisions'
+complete -c cvs -x -a 'edit' -d 'Get ready to edit a watched file'
+complete -c cvs -x -a 'editors' -d 'See who is editing a watched file'
+complete -c cvs -x -a 'export' -d 'Export sources from CVS, similar to checkout'
+complete -c cvs -x -a 'history' -d 'Show repository access history'
+complete -c cvs -x -a 'import' -d 'Import sources into CVS, using vendor branches'
+complete -c cvs -x -a 'init' -d 'Create a CVS repository if it doesnt exist'
+complete -c cvs -x -a 'kserver' -d 'Kerberos server mode'
+complete -c cvs -x -a 'log' -d 'Print out history information for files'
+complete -c cvs -x -a 'login' -d 'Prompt for password for authenticating server'
+complete -c cvs -x -a 'logout' -d 'Removes entry in .cvspass for remote repository'
+complete -c cvs -x -a 'pserver' -d 'Password server mode'
+complete -c cvs -x -a 'rannotate' -d 'Show last revision where each line of module was modified'
+complete -c cvs -x -a 'rdiff' -d 'Create "patch" format diffs between releases'
+complete -c cvs -x -a 'release' -d 'Indicate that a Module is no longer in use'
+complete -c cvs -x -a 'remove' -d 'Remove an entry from the repository'
+complete -c cvs -x -a 'rlog' -d 'Print out history information for a module'
+complete -c cvs -x -a 'rtag' -d 'Add a symbolic tag to a module'
+complete -c cvs -x -a 'server' -d 'Server mode'
+complete -c cvs -x -a 'status' -d 'Display status information on checked out files'
+complete -c cvs -x -a 'tag' -d 'Add a symbolic tag to checked out version of files'
+complete -c cvs -x -a 'unedit' -d 'Undo an edit command'
+complete -c cvs -x -a 'update' -d 'Bring work tree in sync with repository'
+complete -c cvs -x -a 'version' -d 'Show current CVS version(s)'
+complete -c cvs -x -a 'watch' -d 'Set watches'
+complete -c cvs -x -a 'watchers' -d 'See who is watching a file'
-complete -c cvs -x -s H -d "Displays usage information for command"
-complete -c cvs -x -s Q -d "Cause CVS to be really quiet"
-complete -c cvs -x -s q -d "Cause CVS to be somewhat quiet"
-complete -c cvs -x -s r -d "Make checked-out files read-only"
-complete -c cvs -x -s w -d "Make checked-out files read-write (default)"
-complete -c cvs -x -s n -d "Do not execute anything that will change the disk"
-complete -c cvs -x -s t -d "Show trace of program execution -- try with -n"
-complete -c cvs -x -s v -d "CVS version and copyright"
-complete -c cvs -x -s T -r -d "Use 'tmpdir' for temporary files"
-complete -c cvs -x -s e -r -d "Use 'editor' for editing log information"
-complete -c cvs -x -s d -r -d "Overrides $CVSROOT as the root of the CVS tree"
-complete -c cvs -x -s f -d "Do not use the ~/.cvsrc file"
-complete -c cvs -x -s z -d "Compression level for net traffic" -x -a "1 2 3 4 5 6 7 8 9"
-complete -c cvs -x -s x -d "Encrypt all net traffic"
-complete -c cvs -x -s a -d "Authenticate all net traffic"
-complete -c cvs -x -s s -d "Set CVS user variable" -x
+complete -c cvs -x -s H -d 'Displays usage information for command'
+complete -c cvs -x -s Q -d 'Cause CVS to be really quiet'
+complete -c cvs -x -s q -d 'Cause CVS to be somewhat quiet'
+complete -c cvs -x -s r -d 'Make checked-out files read-only'
+complete -c cvs -x -s w -d 'Make checked-out files read-write (default)'
+complete -c cvs -x -s n -d 'Do not execute anything that will change the disk'
+complete -c cvs -x -s t -d 'Show trace of program execution -- try with -n'
+complete -c cvs -x -s v -d 'CVS version and copyright'
+complete -c cvs -x -s T -r -d 'Use "tmpdir" for temporary files'
+complete -c cvs -x -s e -r -d 'Use "editor" for editing log information'
+complete -c cvs -x -s d -r -d 'Overrides $CVSROOT as the root of the CVS tree'
+complete -c cvs -x -s f -d 'Do not use the ~/.cvsrc file'
+complete -c cvs -x -s z -d 'Compression level for net traffic' -x -a '1 2 3 4 5 6 7 8 9'
+complete -c cvs -x -s x -d 'Encrypt all net traffic'
+complete -c cvs -x -s a -d 'Authenticate all net traffic'
+complete -c cvs -x -s s -d 'Set CVS user variable' -x
diff --git a/init/completions/gcc.fish b/init/completions/gcc.fish
index f02c525d..d752a2c2 100644
--- a/init/completions/gcc.fish
+++ b/init/completions/gcc.fish
@@ -2,7 +2,7 @@
# The gcc completion list is incomplete. There are just so many of them...
#
-complete -c gcc -s x -d "Language" -x -a "
+complete -c gcc -s x -d 'Language' -x -a '
c
c-header
cpp-output
@@ -19,17 +19,17 @@ complete -c gcc -s x -d "Language" -x -a "
java
treelang
none
-"
-complete -c gcc -o pass-exit-codes -d "Pass program exit codes"
-complete -c gcc -s c -d "Stop after assembler"
-complete -c gcc -s S -d "Stop after compile"
-complete -c gcc -s E -d "Stop after preprocesswor"
-complete -c gcc -s o -r -d "Output file"
-complete -c gcc -s v -d "Print commands to stderr"
-complete -c gcc -o \#\#\# -d "Print quoted commands to stderr, do not run"
-complete -c gcc -o pipe -d "Use pipes"
-complete -c gcc -o ansi -d "Use ansi mode"
-complete -c gcc -o std -d "Standard mode" -x -a '
+'
+complete -c gcc -o pass-exit-codes -d 'Pass program exit codes'
+complete -c gcc -s c -d 'Stop after assembler'
+complete -c gcc -s S -d 'Stop after compile'
+complete -c gcc -s E -d 'Stop after preprocesswor'
+complete -c gcc -s o -r -d 'Output file'
+complete -c gcc -s v -d 'Print commands to stderr'
+complete -c gcc -o \#\#\# -d 'Print quoted commands to stderr, do not run'
+complete -c gcc -o pipe -d 'Use pipes'
+complete -c gcc -o ansi -d 'Use ansi mode'
+complete -c gcc -o std -d 'Standard mode' -x -a '
c89\t"ISO C90"
iso9899:1990\t"ISO C90"
iso9899:199409\t"ISO C90 as modified in amendment 1"
@@ -43,54 +43,54 @@ complete -c gcc -o std -d "Standard mode" -x -a '
c++98\t"ISO C++98"
gnu++98\t"ISO C++98 plus GNU extentions"
'
-complete -c gcc -o aux-info -r -d "Write prototypes to file"
-complete -c gcc -o fno-asm -d "Do not recognize asm, inline or typeof keywords"
-complete -c gcc -o fno-builtin -d "Do not use builtin functions"
-complete -c gcc -o fhosted -d "Assert hosted environment"
-complete -c gcc -o ffreestanding -d "Assert freestanding environment"
-complete -c gcc -o fms-extensions -d "Use Microsoft extensions"
-complete -c gcc -o trigraphs -d "Use ANSI trigraphs"
-complete -c gcc -o no-integrated-cpp -d "Do not use integrated preprocessor"
-complete -c gcc -o funsigned-char -d "char is unsigned"
-complete -c gcc -o fsigned-char -d "char is signed"
-complete -c gcc -o funsigned-bitfields -d "bifield is unsigned"
-complete -c gcc -o fsigned-bitfields -d "bifield is signed"
-complete -c gcc -o fno-unsigned-bitfields -d "All bifields are signed"
-complete -c gcc -o fno-signed-bitfields -d "All bifield are signed"
-complete -c gcc -o fwritable-strings -d "String constants are not const"
-complete -c gcc -o fabi-version -d "C++ ABI version" -r -x -a "1 0"
-complete -c gcc -o fno-access-control -d "Turn off access checking"
-complete -c gcc -o fcheck-new -d "Check pointer returned by new"
-complete -c gcc -o fconserve-space -d "Put globals in the common segment"
-complete -c gcc -o fno-const-strings -d "String constants are not const"
-complete -c gcc -o fdollars-in-identifiers -d "Accept $ in identifiers"
-complete -c gcc -o fno-dollars-in-identifiers -d "Reject $ in identifiers"
-complete -c gcc -o fno-elide-constructors -d "Do not omit unneeded temporarys"
-complete -c gcc -o fno-enforce-eh-specs -d "Allow exception violations"
-complete -c gcc -o ffor-scope -d "Do not extend for-loop scope"
-complete -c gcc -o fno-for-scope -d "Extend for-loop scope"
-complete -c gcc -o fno-gnu-keywords -d "Do not recognize typeof as keyword"
-complete -c gcc -o fno-implicit-templates -d "Do not emit code for implicit templates"
-complete -c gcc -o fno-implicit-inline-templates -d "Do not emit code for implicit inline templates"
-complete -c gcc -o fno-implement-inlines -d "Do not emit out-of-line code for inline functions"
-complete -c gcc -o fms-extensions -d "Disable warnings about MFC"
-complete -c gcc -o fno-nonansi-builtins -d "Disable some built-in functions"
-complete -c gcc -o fno-operator-names -d "Disable operator keywords"
-complete -c gcc -o fno-optional-diags -d "Disable optional diagnostics"
-complete -c gcc -o fpermissive -d "Downgrade some errors to warnings"
-complete -c gcc -o frepo -d "Enable automatic template instantiation at link time"
-complete -c gcc -o fno-rtti -d "Disable generation of C++ runtime type information"
-#complete -c gcc -o fstats -d "Emit front-end usage statistics"
+complete -c gcc -o aux-info -r -d 'Write prototypes to file'
+complete -c gcc -o fno-asm -d 'Do not recognize asm, inline or typeof keywords'
+complete -c gcc -o fno-builtin -d 'Do not use builtin functions'
+complete -c gcc -o fhosted -d 'Assert hosted environment'
+complete -c gcc -o ffreestanding -d 'Assert freestanding environment'
+complete -c gcc -o fms-extensions -d 'Use Microsoft extensions'
+complete -c gcc -o trigraphs -d 'Use ANSI trigraphs'
+complete -c gcc -o no-integrated-cpp -d 'Do not use integrated preprocessor'
+complete -c gcc -o funsigned-char -d 'char is unsigned'
+complete -c gcc -o fsigned-char -d 'char is signed'
+complete -c gcc -o funsigned-bitfields -d 'bifield is unsigned'
+complete -c gcc -o fsigned-bitfields -d 'bifield is signed'
+complete -c gcc -o fno-unsigned-bitfields -d 'All bifields are signed'
+complete -c gcc -o fno-signed-bitfields -d 'All bifield are signed'
+complete -c gcc -o fwritable-strings -d 'String constants are not const'
+complete -c gcc -o fabi-version -d 'C++ ABI version' -r -x -a '1 0'
+complete -c gcc -o fno-access-control -d 'Turn off access checking'
+complete -c gcc -o fcheck-new -d 'Check pointer returned by new'
+complete -c gcc -o fconserve-space -d 'Put globals in the common segment'
+complete -c gcc -o fno-const-strings -d 'String constants are not const'
+complete -c gcc -o fdollars-in-identifiers -d 'Accept $ in identifiers'
+complete -c gcc -o fno-dollars-in-identifiers -d 'Reject $ in identifiers'
+complete -c gcc -o fno-elide-constructors -d 'Do not omit unneeded temporarys'
+complete -c gcc -o fno-enforce-eh-specs -d 'Allow exception violations'
+complete -c gcc -o ffor-scope -d 'Do not extend for-loop scope'
+complete -c gcc -o fno-for-scope -d 'Extend for-loop scope'
+complete -c gcc -o fno-gnu-keywords -d 'Do not recognize typeof as keyword'
+complete -c gcc -o fno-implicit-templates -d 'Do not emit code for implicit templates'
+complete -c gcc -o fno-implicit-inline-templates -d 'Do not emit code for implicit inline templates'
+complete -c gcc -o fno-implement-inlines -d 'Do not emit out-of-line code for inline functions'
+complete -c gcc -o fms-extensions -d 'Disable warnings about MFC'
+complete -c gcc -o fno-nonansi-builtins -d 'Disable some built-in functions'
+complete -c gcc -o fno-operator-names -d 'Disable operator keywords'
+complete -c gcc -o fno-optional-diags -d 'Disable optional diagnostics'
+complete -c gcc -o fpermissive -d 'Downgrade some errors to warnings'
+complete -c gcc -o frepo -d 'Enable automatic template instantiation at link time'
+complete -c gcc -o fno-rtti -d 'Disable generation of C++ runtime type information'
+#complete -c gcc -o fstats -d 'Emit front-end usage statistics'
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17;
complete -c gcc -o ftemplate-depth-1 -d Set\ maximum\ template\ depth\ to\ $i;
end;
-complete -c gcc -o fno-threadsafe-statistics -d "Do not emit code for thread-safe initialization of local statics"
-complete -c gcc -o fuse-cxa-atexit -d "Use __cxa_atexit for destructors"
-complete -c gcc -o fvisibility-inlines-hidden -d "Hides inline methods from export table"
-complete -c gcc -o fno-weak -d "Do not use weak symbol support"
+complete -c gcc -o fno-threadsafe-statistics -d 'Do not emit code for thread-safe initialization of local statics'
+complete -c gcc -o fuse-cxa-atexit -d 'Use __cxa_atexit for destructors'
+complete -c gcc -o fvisibility-inlines-hidden -d 'Hides inline methods from export table'
+complete -c gcc -o fno-weak -d 'Do not use weak symbol support'
# gcc completion listing is incomplete.
-#complete -c gcc -o -d ""
+#complete -c gcc -o -d ''
diff --git a/init/completions/kill.fish b/init/completions/kill.fish
index 7cd108d6..46627457 100644
--- a/init/completions/kill.fish
+++ b/init/completions/kill.fish
@@ -24,12 +24,12 @@ else
complete -c kill -s l -d "List codes and names of available signals"
- for i in (kill -l|tr \ \t \n|grep "^[A-Z][A-Z0-9]*$")
+ for i in (kill -l|tr \ \t \n|grep '^[A-Z][A-Z0-9]*$')
complete -c kill -o $i -d Send\ $i\ signal
complete -c kill -o s -x -a $i\tSend\ $i\ signal -d "Send specified signal"
end
end
-complete -c kill -xa "(__fish_complete_pids)"
+complete -c kill -xa '(__fish_complete_pids)'
complete -c kill -s l -d "List names of available signals"
diff --git a/init/completions/less.fish b/init/completions/less.fish
index f5413ec9..0b55e4e5 100644
--- a/init/completions/less.fish
+++ b/init/completions/less.fish
@@ -17,7 +17,7 @@ complete -c less -s I -l IGNORE-CASE -d "Search ignores all case"
complete -c less -s j -l jump-target -d "Target line" -r -a "0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19"
complete -c less -s J -l status-column -d "Display status column"
complete -c less -s k -l lesskey-file -d "Specify key bindings file" -r
-complete -c less -s L -l no-lessopen -d "Ignore $LESSOPEN"
+complete -c less -s L -l no-lessopen -d 'Ignore $LESSOPEN'
complete -c less -s m -l long-prompt -d "Prompt with percentage"
complete -c less -s M -l LONG-PROMPT -d "Verbose prompt"
complete -c less -s n -l line-numbers -d "Display line number"
diff --git a/init/completions/mount.fish b/init/completions/mount.fish
index 26adc8ba..0cd73c38 100644
--- a/init/completions/mount.fish
+++ b/init/completions/mount.fish
@@ -3,7 +3,7 @@
# A list of all known filesystem types, used by various completions,
# including mount and df
-set -g __fish_filesystems "
+set -g __fish_filesystems '
adfs
affs
autofs
@@ -39,29 +39,29 @@ set -g __fish_filesystems "
xenix
xfs
xiafs
-"
+'
# Completions for mount
-complete -x -c mount -a "(cat /etc/fstab|sed -e 's/^\([^ \t]*\)[ \t]*\([^ \t]*\).*/\1\n\2/'|grep '^/')" -d "Mount point"
-complete -c mount -s V -d "Display version and exit"
-complete -c mount -s h -d "Display help and exit"
-complete -c mount -s v -d "Verbose mode"
-complete -c mount -s a -d "Mount filesystems in fstab"
-complete -c mount -s F -d "Fork process for each mount"
-complete -c mount -s f -d "Fake mounting"
-complete -c mount -s l -d "Add label to output"
-complete -c mount -s n -d "Do not write mtab"
-complete -c mount -s s -d "Tolerate sloppy mount options"
-complete -c mount -s r -d "Read only"
-complete -c mount -s w -d "Read/Write mode"
-complete -x -c mount -s L -d "Mount partition with specified label"
-complete -x -c mount -s U -d "Mount partition with specified UID"
-complete -c mount -s O -x -d "Exclude filesystems"
-complete -c mount -l bind -f -d "Remount a subtree to a second position"
-complete -c mount -l move -f -d "Move a subtree to a new position"
-complete -c mount -x -s t -d "Filesystem" -a $__fish_filesystems
+complete -x -c mount -a '(cat /etc/fstab|sed -e "s/^\([^ \t]*\)[ \t]*\([^ \t]*\).*/\1\n\2/"|grep "^/")' -d 'Mount point'
+complete -c mount -s V -d 'Display version and exit'
+complete -c mount -s h -d 'Display help and exit'
+complete -c mount -s v -d 'Verbose mode'
+complete -c mount -s a -d 'Mount filesystems in fstab'
+complete -c mount -s F -d 'Fork process for each mount'
+complete -c mount -s f -d 'Fake mounting'
+complete -c mount -s l -d 'Add label to output'
+complete -c mount -s n -d 'Do not write mtab'
+complete -c mount -s s -d 'Tolerate sloppy mount options'
+complete -c mount -s r -d 'Read only'
+complete -c mount -s w -d 'Read/Write mode'
+complete -x -c mount -s L -d 'Mount partition with specified label'
+complete -x -c mount -s U -d 'Mount partition with specified UID'
+complete -c mount -s O -x -d 'Exclude filesystems'
+complete -c mount -l bind -f -d 'Remount a subtree to a second position'
+complete -c mount -l move -f -d 'Move a subtree to a new position'
+complete -c mount -x -s t -d 'Filesystem' -a $__fish_filesystems
-complete -c mount -x -s o -d "Mount option" -a "(__fish_append ',' $__fish_mount_opts)"
+complete -c mount -x -s o -d 'Mount option' -a '(__fish_append , $__fish_mount_opts)'
set -g __fish_mount_opts async\tUse\ asynchronous\ I/O atime\tUpdate\ time\ on\ each\ access auto\tMounted\ with\ -a defaults\tUse\ default\ options dev\tInterpret\ character/block\ special\ devices exec\tPermit\ executables _netdev\tFilesystem\ uses\network noatime\tDo\ not\ update\ time\ on\ each\ access noauto\tNot\ mounted\ by\ -a nodev\tDo\ not\ interpret\ character/block\ special\ devices noexec\tDo\ not\ permit\ executables nosuid\tIgnore\ suid\ bits nouser\tOnly\ root\ may\ mount remount\tRemount\ read-only\ filesystem ro\tMount\ read-only rw\tMount\ read-write suid\tAllow\ suid\ bits sync\tUse\ synchronous\ I/O dirsync\tUse\ synchronous\ directory\ operations user\tAny\ user\ may\ mount users\tAny\ user\ may\ mount\ and\ unmount
diff --git a/init/completions/perl.fish b/init/completions/perl.fish
index d17e82c1..caa5a44e 100644
--- a/init/completions/perl.fish
+++ b/init/completions/perl.fish
@@ -1,20 +1,20 @@
-complete -c perl -s 0 -d "Specify record separator"
-complete -c perl -s a -d "Feed input to split"
-complete -c perl -s c -d "Check syntax"
-complete -c perl -s d -d "Debugger"
-complete -c perl -s D -x -d "Debug option"
-complete -c perl -s e -x -d "Execute command"
-complete -c perl -s F -d "Set regexp used to split input"
-complete -c perl -s i -d "Edit files in-place"
-complete -c perl -s I -d "Include path"
-complete -c perl -s l -d "Line ending processing"
-complete -c perl -s n -d "Loop script"
-complete -c perl -s p -d "Loop script, print $_"
-complete -c perl -s P -d "Invoke CPP"
-complete -c perl -s s -d "Define custom switches"
-complete -c perl -s S -d "Search $PATH for script"
-complete -c perl -s T -d "Taint checking"
-complete -c perl -s U -d "Unsafe mode"
-complete -c perl -s v -d "Display version"
-complete -c perl -s x -d "Extract script"
+complete -c perl -s 0 -d 'Specify record separator'
+complete -c perl -s a -d 'Feed input to split'
+complete -c perl -s c -d 'Check syntax'
+complete -c perl -s d -d 'Debugger'
+complete -c perl -s D -x -d 'Debug option'
+complete -c perl -s e -x -d 'Execute command'
+complete -c perl -s F -d 'Set regexp used to split input'
+complete -c perl -s i -d 'Edit files in-place'
+complete -c perl -s I -d 'Include path'
+complete -c perl -s l -d 'Line ending processing'
+complete -c perl -s n -d 'Loop script'
+complete -c perl -s p -d 'Loop script, print $_'
+complete -c perl -s P -d 'Invoke CPP'
+complete -c perl -s s -d 'Define custom switches'
+complete -c perl -s S -d 'Search $PATH for script'
+complete -c perl -s T -d 'Taint checking'
+complete -c perl -s U -d 'Unsafe mode'
+complete -c perl -s v -d 'Display version'
+complete -c perl -s x -d 'Extract script'
diff --git a/init/completions/rpm.fish b/init/completions/rpm.fish
index fb5ada28..01e73411 100644
--- a/init/completions/rpm.fish
+++ b/init/completions/rpm.fish
@@ -122,7 +122,7 @@ complete $rpm_erase -l repackage -d 'Re-package the files before erasing'
complete $rpm_erase -l test -d 'Dont really uninstall anything, just go through the motions'
set -e rpm_erase
-set -- rpm_mode -c rpm -n "__fish_contains_opt -s e -s i -s F -s V -s U -s q erase install freshen verify upgrade query; if test $status = 0; false; else; true; end"
+set -- rpm_mode -c rpm -n '__fish_contains_opt -s e -s i -s F -s V -s U -s q erase install freshen verify upgrade query; if test $status = 0; false; else; true; end'
complete $rpm_mode -s i -l install -d 'Install new package'
complete $rpm_mode -s U -l upgrade -d 'Upgrade existing package'
complete $rpm_mode -s F -l freshen -d 'Upgrade package if already installed'
diff --git a/init/completions/ruby.fish b/init/completions/ruby.fish
index 1fc43a01..6dc81b96 100644
--- a/init/completions/ruby.fish
+++ b/init/completions/ruby.fish
@@ -1,25 +1,25 @@
#Completions for ruby
-complete -c ruby -s 0 -d "Specify record separator"
-complete -c ruby -s a -d "Feed input to split"
-complete -c ruby -s c -d "Check syntax"
-complete -c ruby -s K -d "Kanji code-set"
-complete -c ruby -s d -l debug -d "Debugger"
-complete -c ruby -s e -x -d "Execute command"
-complete -c ruby -s h -l help -d "Display help"
-complete -c ruby -s F -d "Set regexp used to split input"
-complete -c ruby -s i -d "Edit files in-place"
-complete -c ruby -s I -d "Include path"
-complete -c ruby -s l -d "Line ending processing"
-complete -c ruby -s n -d "Loop script"
-complete -c ruby -s p -d "Loop script, print $_"
-complete -c ruby -s r -r -d "Require file"
-complete -c ruby -s s -d "Define custom switches"
-complete -c ruby -s S -d "Search $PATH for script"
-complete -c ruby -s T -d "Taint checking"
-complete -c ruby -s v -l verbose -d "Verbose mode"
-complete -c ruby -s w -d "Verbose mode without message"
-complete -c ruby -l version -d "Display version"
-complete -c ruby -s x -d "Extract script"
-complete -c ruby -s X -x -a "(__fish_complete_directory (commandline -ct))" -d "Directory"
-complete -c ruby -s y -l yydebug -d "Compiler debug mode"
+complete -c ruby -s 0 -d 'Specify record separator'
+complete -c ruby -s a -d 'Feed input to split'
+complete -c ruby -s c -d 'Check syntax'
+complete -c ruby -s K -d 'Kanji code-set'
+complete -c ruby -s d -l debug -d 'Debugger'
+complete -c ruby -s e -x -d 'Execute command'
+complete -c ruby -s h -l help -d 'Display help'
+complete -c ruby -s F -d 'Set regexp used to split input'
+complete -c ruby -s i -d 'Edit files in-place'
+complete -c ruby -s I -d 'Include path'
+complete -c ruby -s l -d 'Line ending processing'
+complete -c ruby -s n -d 'Loop script'
+complete -c ruby -s p -d 'Loop script, print $_'
+complete -c ruby -s r -r -d 'Require file'
+complete -c ruby -s s -d 'Define custom switches'
+complete -c ruby -s S -d 'Search $PATH for script'
+complete -c ruby -s T -d 'Taint checking'
+complete -c ruby -s v -l verbose -d 'Verbose mode'
+complete -c ruby -s w -d 'Verbose mode without message'
+complete -c ruby -l version -d 'Display version'
+complete -c ruby -s x -d 'Extract script'
+complete -c ruby -s X -x -a '(__fish_complete_directory (commandline -ct))' -d 'Directory'
+complete -c ruby -s y -l yydebug -d 'Compiler debug mode'
diff --git a/init/completions/screen.fish b/init/completions/screen.fish
index 416121b3..16620857 100644
--- a/init/completions/screen.fish
+++ b/init/completions/screen.fish
@@ -3,35 +3,35 @@ function __fish_complete_screen -d "Print a list of running screen sessions"
end
complete -c screen -x
-complete -c screen -s a -d "Include all capabilitys"
-complete -c screen -s A -d "Adapt window size"
-complete -c screen -s c -r -d "Specify init file"
-complete -c screen -s d -d "Detach screen" -a "(__fish_complete_screen)"
-complete -c screen -s D -d "Detach screen" -a "(__fish_complete_screen)"
-complete -c screen -s r -d "Reattach session" -a "(__fish_complete_screen)"
-complete -c screen -s R -d "Reattach/create session"
-complete -c screen -o RR -d "Reattach/create any session"
-complete -c screen -s e -x -d "Escape character"
-complete -c screen -s f -d "Flow control on"
-complete -c screen -o fn -d "Flow control off"
-complete -c screen -o fa -d "Flow control automatic"
-complete -c screen -s h -x -d "History length"
-complete -c screen -s i -d "Interrupt display on C-c"
-complete -c screen -s l -d "Login on"
-complete -c screen -o ln -d "Login off"
-complete -c screen -o ls -d "List sessions"
-complete -c screen -o list -d "List sessions"
-complete -c screen -s L -d "Log on"
-complete -c screen -s m -d "Ignore $STY"
-complete -c screen -s O -d "Optimal output"
-complete -c screen -s p -d "Preselect window"
-complete -c screen -s q -d "Quiet mode"
-complete -c screen -s s -r -d "Set shell"
-complete -c screen -s S -x -d "Session name"
-complete -c screen -s t -x -d "Session title"
-complete -c screen -s U -d "UTF-8 mode"
-complete -c screen -s v -d "Display version"
-complete -c screen -o wipe -d "Wipe dead sessions"
-complete -c screen -s x -d "Multi attach"
-complete -c screen -s X -r -d "Send command"
+complete -c screen -s a -d 'Include all capabilitys'
+complete -c screen -s A -d 'Adapt window size'
+complete -c screen -s c -r -d 'Specify init file'
+complete -c screen -s d -d 'Detach screen' -a '(__fish_complete_screen)'
+complete -c screen -s D -d 'Detach screen' -a '(__fish_complete_screen)'
+complete -c screen -s r -d 'Reattach session' -a '(__fish_complete_screen)'
+complete -c screen -s R -d 'Reattach/create session'
+complete -c screen -o RR -d 'Reattach/create any session'
+complete -c screen -s e -x -d 'Escape character'
+complete -c screen -s f -d 'Flow control on'
+complete -c screen -o fn -d 'Flow control off'
+complete -c screen -o fa -d 'Flow control automatic'
+complete -c screen -s h -x -d 'History length'
+complete -c screen -s i -d 'Interrupt display on C-c'
+complete -c screen -s l -d 'Login on'
+complete -c screen -o ln -d 'Login off'
+complete -c screen -o ls -d 'List sessions'
+complete -c screen -o list -d 'List sessions'
+complete -c screen -s L -d 'Log on'
+complete -c screen -s m -d 'Ignore $STY'
+complete -c screen -s O -d 'Optimal output'
+complete -c screen -s p -d 'Preselect window'
+complete -c screen -s q -d 'Quiet mode'
+complete -c screen -s s -r -d 'Set shell'
+complete -c screen -s S -x -d 'Session name'
+complete -c screen -s t -x -d 'Session title'
+complete -c screen -s U -d 'UTF-8 mode'
+complete -c screen -s v -d 'Display version'
+complete -c screen -o wipe -d 'Wipe dead sessions'
+complete -c screen -s x -d 'Multi attach'
+complete -c screen -s X -r -d 'Send command'
diff --git a/init/fish.in b/init/fish.in
index c4014d5c..c202caf3 100644
--- a/init/fish.in
+++ b/init/fish.in
@@ -16,19 +16,20 @@ set -g IFS \ \t\n
#
for i in /bin /usr/bin /usr/X11R6/bin @PREFIX@/bin
- if test -d $i
- if not echo $PATH|grep $i >/dev/null
+ if not expr "$PATH" : .\*$i.\* >/dev/null
+ if test -d $i
set PATH $PATH $i
end
end
end
+
#
# Set some value for LANG if nothing was set before
#
if status --is-login
- if not count $LANG >/dev/null
+ if not set -q LANG >/dev/null
set -gx LANG en_US.UTF-8
end
end
@@ -39,13 +40,9 @@ end
# situation as well?
#
-if count $LANG >/dev/null
- if test (expr match $LANG ".*UTF") -gt 0
- if count $TERM >/dev/null
- if test linux = $TERM
- unicode_start ^/dev/null
- end
- end
+if expr match "$LANG" ".*UTF" >/dev/null
+ if test linux = "$TERM"
+ unicode_start ^/dev/null
end
end
@@ -56,7 +53,7 @@ end
#
for i in DISPLAY
- if test (count $$i) -gt 1
+ if set -q $i
set -- $i (printf ":%s" $$i|cut -c 2-)
end
end
diff --git a/init/fish_complete.fish b/init/fish_complete.fish
index 283001fd..7dd6bb4d 100644
--- a/init/fish_complete.fish
+++ b/init/fish_complete.fish
@@ -42,10 +42,10 @@ function __fish_complete_suffix -d "Complete using files"
set -- desc $argv[3]
set -- base (echo $comp |sed -e 's/\.[a-zA-Z0-9]*$//')
- eval "set -- files "$base"*"$suff
+ eval "set -- files $base*$suff"
if test $files[1]
- printf "%s\t"$desc"\n" $files
+ printf "%s\t$desc\n" $files
end
#
@@ -74,7 +74,7 @@ function __fish_complete_directory -d "Complete using directories"
eval "set -- dirs "$comp"*/"
if test $dirs[1]
- printf "%s\t"$desc"\n" $dirs
+ printf "%s\t$desc\n" $dirs
end
end
diff --git a/init/fish_function.fish b/init/fish_function.fish
index 4ae80d10..2083757a 100644
--- a/init/fish_function.fish
+++ b/init/fish_function.fish
@@ -222,7 +222,7 @@ function prompt_pwd -d "Print the current working directory, ellipsise it if it
if test $len -gt $max_width
#Write ellipsis character if known to be using UTF
#else use $
- set -l ellipsis "$" #default
+ set -l ellipsis '$' #default
if count $LANG >/dev/null
if test (expr match $LANG ".*UTF") -gt 0
set ellipsis \u2026