(libT) #1255: fails to parse announce URLs that have leading or trailing spaces

This commit is contained in:
Charles Kerr
2008-09-05 19:11:30 +00:00
parent ad8064b4e9
commit ee10a8acab
4 changed files with 82 additions and 15 deletions

View File

@@ -669,6 +669,34 @@ tr_strerror( int i )
return ret;
}
/****
*****
****/
char*
tr_strstrip( char * str )
{
if( str != NULL )
{
size_t pos;
size_t len = strlen( str );
while( len && isspace( str[len-1] ) )
--len;
str[len] = '\0';
for( pos=0; pos<len && isspace( str[pos] ); )
++pos;
len -= pos;
memmove( str, str+pos, len );
str[len] = '\0';
}
return str;
}
/****
*****
****/