diff options
author | 2006-10-20 01:39:50 +1000 | |
---|---|---|
committer | 2006-10-20 01:39:50 +1000 | |
commit | 45f1263112565aaf428a154637eaf3486de58915 (patch) | |
tree | 319fd0ee54d92308aa99d98c404d6eed7f5f6475 | |
parent | 4683f4c989e90bf49fc8199d7f22c925aee836cd (diff) |
Minor code fixes
darcs-hash:20061019153950-ac50b-9a7d5939ce47cd5f8b7167a97b0e9c62315b7b6e.gz
-rw-r--r-- | builtin.c | 2 | ||||
-rw-r--r-- | common.c | 4 | ||||
-rw-r--r-- | common.h | 3 | ||||
-rw-r--r-- | env_universal_common.c | 6 | ||||
-rw-r--r-- | fallback.h | 2 |
5 files changed, 9 insertions, 8 deletions
@@ -1440,7 +1440,7 @@ static int builtin_random( wchar_t **argv ) } lrand48_r( &seed_buffer, &res ); - sb_printf( sb_out, L"%d\n", res%32767 ); + sb_printf( sb_out, L"%d\n", abs(res%32767) ); break; } @@ -408,13 +408,13 @@ wchar_t **strv2wcsv( const char **in ) } -wchar_t *wcsvarname( wchar_t *str ) +wchar_t *wcsvarname( const wchar_t *str ) { while( *str ) { if( (!iswalnum(*str)) && (*str != L'_' ) ) { - return str; + return (wchar_t *)str; } str++; } @@ -207,7 +207,8 @@ __sentinel wchar_t *wcsdupcat2( const wchar_t *a, ... ); \return null if this is a valid name, and a pointer to the first invalid character otherwise */ -wchar_t *wcsvarname( wchar_t *str ); +wchar_t *wcsvarname( const wchar_t *str ); + /** Test if the given string is valid in a variable name diff --git a/env_universal_common.c b/env_universal_common.c index 80f7119e..caa0e5ce 100644 --- a/env_universal_common.c +++ b/env_universal_common.c @@ -126,7 +126,7 @@ static int get_names_show_exported; static int get_names_show_unexported; -wchar_t *utf2wcs( char *in ) +wchar_t *utf2wcs( const char *in ) { iconv_t cd=(iconv_t) -1; int i,j; @@ -185,7 +185,7 @@ wchar_t *utf2wcs( char *in ) } - nconv = iconv( cd, &in, &in_len, &nout, &out_len ); + nconv = iconv( cd, (char **)&in, &in_len, &nout, &out_len ); if (nconv == (size_t) -1) { @@ -201,7 +201,7 @@ wchar_t *utf2wcs( char *in ) return out; } -char *wcs2utf( wchar_t *in ) +char *wcs2utf( const wchar_t *in ) { iconv_t cd=(iconv_t) -1; int i,j; @@ -50,7 +50,7 @@ typedef char tputs_arg_t; #endif #ifndef SIGWINCH -#define SIGIO SIGUSR2 +#define SIGWINCH SIGUSR2 #endif #ifndef HAVE_WINSIZE |