mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-29 13:23:53 +08:00
Minor comment edits, reindentation and other code formating changes
darcs-hash:20060615103706-ac50b-ad9f7060e40f5a786877e95f027688c90f43b6ec.gz
This commit is contained in:
parent
36ae253a29
commit
4e38d3bc8c
9
common.c
9
common.c
|
@ -758,12 +758,15 @@ wchar_t *escape( const wchar_t *in,
|
|||
case L'"':
|
||||
case L'%':
|
||||
case L'~':
|
||||
{
|
||||
if( escape_all )
|
||||
*pos++ = L'\\';
|
||||
*pos++ = *in;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
if( *in < 32 )
|
||||
{
|
||||
int tmp = (*in)%16;
|
||||
|
@ -773,10 +776,13 @@ wchar_t *escape( const wchar_t *in,
|
|||
*pos++ = tmp > 9? L'a'+(tmp-10):L'0'+tmp;
|
||||
}
|
||||
else
|
||||
{
|
||||
*pos++ = *in;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
in++;
|
||||
}
|
||||
|
@ -798,13 +804,12 @@ wchar_t *unescape( const wchar_t * orig, int unescape_special )
|
|||
if( !orig )
|
||||
{
|
||||
debug( 0, L"%s called with null input", __func__ );
|
||||
exit(1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
len = wcslen( orig );
|
||||
in = wcsdup( orig );
|
||||
|
||||
|
||||
if( !in )
|
||||
die_mem();
|
||||
|
||||
|
|
4
common.h
4
common.h
|
@ -95,8 +95,8 @@ 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 an array_list of wide strings according to the
|
||||
wcsfilecmp-function from the util library
|
||||
*/
|
||||
void sort_list( array_list_t *comp );
|
||||
|
||||
|
|
21
expand.h
21
expand.h
|
@ -137,8 +137,8 @@ enum
|
|||
|
||||
/**
|
||||
Perform various forms of expansion on in, such as tilde expansion
|
||||
(~USER becomes the users home directory), variable expansion
|
||||
($VAR_NAME becomes the value of the environment variable VAR_NAME),
|
||||
(\~USER becomes the users home directory), variable expansion
|
||||
(\$VAR_NAME becomes the value of the environment variable VAR_NAME),
|
||||
subshell expansion and wildcard expansion. The results are inserted
|
||||
into the list out.
|
||||
|
||||
|
@ -146,10 +146,15 @@ enum
|
|||
out. If expansion is performed, the original parameter is freed and
|
||||
newly allocated strings are inserted into the list out.
|
||||
|
||||
If \c context is non-null, all the strings contained in the
|
||||
array_list_t \c out will be registered to be free'd when context is
|
||||
free'd.
|
||||
|
||||
\param context the halloc context to use for automatic deallocation
|
||||
\param in The parameter to expand
|
||||
\param flag Specifies if any expansion pass should be skipped. Legal values are any combination of EXPAND_SKIP_SUBSHELL EXPAND_SKIP_VARIABLES and EXPAND_SKIP_WILDCARDS
|
||||
\param out The list to which the result will be appended.
|
||||
\return One of EXPAND_OK, EXPAND_ERROR, EXPAND_WILDCARD_MATCH and EXPAND_WILDCARD_NO_MATCH
|
||||
\return One of EXPAND_OK, EXPAND_ERROR, EXPAND_WILDCARD_MATCH and EXPAND_WILDCARD_NO_MATCH. EXPAND_WILDCARD_NO_MATCH and EXPAND_WILDCARD_MATCH are normal exit conditions used only on strings containing wildcards to tell if the wildcard produced any matches.
|
||||
*/
|
||||
int expand_string( void *context, wchar_t *in, array_list_t *out, int flag );
|
||||
|
||||
|
@ -158,6 +163,10 @@ int expand_string( void *context, wchar_t *in, array_list_t *out, int flag );
|
|||
expands to more than one string. This is used for expanding command
|
||||
names.
|
||||
|
||||
If \c context is non-null, the returning string ill be registered
|
||||
to be free'd when context is free'd.
|
||||
|
||||
\param context the halloc context to use for automatic deallocation
|
||||
\param in The parameter to expand
|
||||
\param flag Specifies if any expansion pass should be skipped. Legal values are any combination of EXPAND_SKIP_SUBSHELL EXPAND_SKIP_VARIABLES and EXPAND_SKIP_WILDCARDS
|
||||
\return The expanded parameter, or 0 on failiure
|
||||
|
@ -166,6 +175,8 @@ wchar_t *expand_one( void *context, wchar_t *in, int flag );
|
|||
|
||||
/**
|
||||
Convert the variable value to a human readable form, i.e. escape things, handle arrays, etc. Suitable for pretty-printing.
|
||||
|
||||
\param in the value to escape
|
||||
*/
|
||||
wchar_t *expand_escape_variable( const wchar_t *in );
|
||||
|
||||
|
@ -174,6 +185,8 @@ wchar_t *expand_escape_variable( const wchar_t *in );
|
|||
|
||||
If tilde expansion is needed, the original string is freed and a
|
||||
new string, allocated using malloc, is returned.
|
||||
|
||||
\param in the string to tilde expand
|
||||
*/
|
||||
wchar_t *expand_tilde(wchar_t *in);
|
||||
|
||||
|
@ -186,6 +199,8 @@ wchar_t *expand_tilde(wchar_t *in);
|
|||
skipping expansion on them actually does save a small amount of
|
||||
time, since it avoids multiple memory allocations during the
|
||||
expansion process.
|
||||
|
||||
\param in the string to test
|
||||
*/
|
||||
int expand_is_clean( const wchar_t *in );
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user