mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 05:28:49 +00:00
Add autoconf checks for wide character string functions
darcs-hash:20051217213205-ac50b-df9ea4cbc1a7e4235578bd4fc542ddb7788d41cc.gz
This commit is contained in:
parent
7bdcfacee4
commit
b8ea709c1e
4 changed files with 34 additions and 8 deletions
24
common.c
24
common.c
|
@ -574,6 +574,7 @@ wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz)
|
||||||
/* count does not include NUL */
|
/* count does not include NUL */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef HAVE_WCSDUP
|
||||||
wchar_t *wcsdup( const wchar_t *in )
|
wchar_t *wcsdup( const wchar_t *in )
|
||||||
{
|
{
|
||||||
size_t len=wcslen(in);
|
size_t len=wcslen(in);
|
||||||
|
@ -587,10 +588,20 @@ wchar_t *wcsdup( const wchar_t *in )
|
||||||
return out;
|
return out;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
#ifndef HAVE_WCSLEN
|
||||||
Fallback implementation if missing from libc
|
size_t wcslen(const wchar_t *in)
|
||||||
*/
|
{
|
||||||
|
const wchar_t *end=in;
|
||||||
|
while( *end )
|
||||||
|
end++;
|
||||||
|
return end-in;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef HAVE_WCSCASECMP
|
||||||
int wcscasecmp( const wchar_t *a, const wchar_t *b )
|
int wcscasecmp( const wchar_t *a, const wchar_t *b )
|
||||||
{
|
{
|
||||||
if( *a == 0 )
|
if( *a == 0 )
|
||||||
|
@ -607,10 +618,10 @@ int wcscasecmp( const wchar_t *a, const wchar_t *b )
|
||||||
else
|
else
|
||||||
return wcscasecmp( a+1,b+1);
|
return wcscasecmp( a+1,b+1);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
Fallback implementation if missing from libc
|
#ifndef HAVE_WCSNCASECMP
|
||||||
*/
|
|
||||||
int wcsncasecmp( const wchar_t *a, const wchar_t *b, int count )
|
int wcsncasecmp( const wchar_t *a, const wchar_t *b, int count )
|
||||||
{
|
{
|
||||||
if( count == 0 )
|
if( count == 0 )
|
||||||
|
@ -630,6 +641,7 @@ int wcsncasecmp( const wchar_t *a, const wchar_t *b, int count )
|
||||||
else
|
else
|
||||||
return wcsncasecmp( a+1,b+1, count-1);
|
return wcsncasecmp( a+1,b+1, count-1);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
int wcsvarname( wchar_t *str )
|
int wcsvarname( wchar_t *str )
|
||||||
{
|
{
|
||||||
|
|
14
common.h
14
common.h
|
@ -134,6 +134,7 @@ wchar_t *wcsdupcat( const wchar_t *a, const wchar_t *b );
|
||||||
*/
|
*/
|
||||||
wchar_t *wcsdupcat2( const wchar_t *a, ... );
|
wchar_t *wcsdupcat2( const wchar_t *a, ... );
|
||||||
|
|
||||||
|
#ifndef HAVE_WCSNDUP
|
||||||
/**
|
/**
|
||||||
Returns a newly allocated wide character string wich is a copy of
|
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
|
the string in, but of length c or shorter. The returned string is
|
||||||
|
@ -141,6 +142,7 @@ wchar_t *wcsdupcat2( const wchar_t *a, ... );
|
||||||
length.
|
length.
|
||||||
*/
|
*/
|
||||||
wchar_t *wcsndup( const wchar_t *in, int c );
|
wchar_t *wcsndup( const wchar_t *in, int c );
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Converts from wide char to digit in the specified base. If d is not
|
Converts from wide char to digit in the specified base. If d is not
|
||||||
|
@ -183,12 +185,19 @@ size_t wcslcat( wchar_t *dst, const wchar_t *src, size_t siz );
|
||||||
*/
|
*/
|
||||||
size_t wcslcpy( wchar_t *dst, const wchar_t *src, size_t siz );
|
size_t wcslcpy( wchar_t *dst, const wchar_t *src, size_t siz );
|
||||||
|
|
||||||
|
#ifndef HAVE_WCSDUP
|
||||||
/**
|
/**
|
||||||
Create a dublicate string. Wide string version of strdup. Will
|
Create a duplicate string. Wide string version of strdup. Will
|
||||||
automatically exit if out of memory.
|
automatically exit if out of memory.
|
||||||
*/
|
*/
|
||||||
wchar_t *wcsdup(const wchar_t *in);
|
wchar_t *wcsdup(const wchar_t *in);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_WCSLEN
|
||||||
|
size_t wcslen(const wchar_t *in);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_WCSCASECMP
|
||||||
/**
|
/**
|
||||||
Case insensitive string compare function. Wide string version of
|
Case insensitive string compare function. Wide string version of
|
||||||
strcasecmp.
|
strcasecmp.
|
||||||
|
@ -201,7 +210,9 @@ wchar_t *wcsdup(const wchar_t *in);
|
||||||
a user-supplied string should be considered a bug.
|
a user-supplied string should be considered a bug.
|
||||||
*/
|
*/
|
||||||
int wcscasecmp( const wchar_t *a, const wchar_t *b );
|
int wcscasecmp( const wchar_t *a, const wchar_t *b );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_WCSNCASECMP
|
||||||
/**
|
/**
|
||||||
Case insensitive string compare function. Wide string version of
|
Case insensitive string compare function. Wide string version of
|
||||||
strncasecmp.
|
strncasecmp.
|
||||||
|
@ -214,6 +225,7 @@ int wcscasecmp( const wchar_t *a, const wchar_t *b );
|
||||||
a user-supplied string should be considered a bug.
|
a user-supplied string should be considered a bug.
|
||||||
*/
|
*/
|
||||||
int wcsncasecmp( const wchar_t *a, const wchar_t *b, int count );
|
int wcsncasecmp( const wchar_t *a, const wchar_t *b, int count );
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Test if the given string is a valid variable name
|
Test if the given string is a valid variable name
|
||||||
|
|
|
@ -120,6 +120,8 @@ fi
|
||||||
AC_CHECK_LIB(socket, connect)
|
AC_CHECK_LIB(socket, connect)
|
||||||
AC_CHECK_LIB(rt, nanosleep)
|
AC_CHECK_LIB(rt, nanosleep)
|
||||||
|
|
||||||
|
AC_CHECK_FUNCS(wcsdup wcsndup wcslen wcscasecmp wcsncasecmp)
|
||||||
|
|
||||||
# Check if we have ncurses, and use it rather than curses if possible.
|
# Check if we have ncurses, and use it rather than curses if possible.
|
||||||
AC_CHECK_HEADERS([ncurses.h],[AC_SUBST(CURSESLIB,[ncurses]) AC_DEFINE(HAVE_NCURSES_H)],[AC_SUBST(CURSESLIB,[curses])])
|
AC_CHECK_HEADERS([ncurses.h],[AC_SUBST(CURSESLIB,[ncurses]) AC_DEFINE(HAVE_NCURSES_H)],[AC_SUBST(CURSESLIB,[curses])])
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
\subsection block-example Example
|
\subsection block-example Example
|
||||||
|
|
||||||
<pre>block -g
|
<pre>block -g
|
||||||
#Do something that should not be interrupted
|
\#Do something that should not be interrupted
|
||||||
block -e
|
block -e
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue