1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

worked on solving some bugs

This commit is contained in:
Werner Koch 2001-03-12 20:21:50 +00:00
parent be06120679
commit 5e79cb47e0
32 changed files with 766 additions and 482 deletions

View file

@ -247,7 +247,7 @@ trim_spaces( char *str )
unsigned
unsigned int
trim_trailing_chars( byte *line, unsigned len, const char *trimchars )
{
byte *p, *mark;
@ -278,6 +278,37 @@ trim_trailing_ws( byte *line, unsigned len )
return trim_trailing_chars( line, len, " \t\r\n" );
}
unsigned int
check_trailing_chars( const byte *line, unsigned int len,
const char *trimchars )
{
const byte *p, *mark;
unsigned int n;
for(mark=NULL, p=line, n=0; n < len; n++, p++ ) {
if( strchr(trimchars, *p ) ) {
if( !mark )
mark = p;
}
else
mark = NULL;
}
if( mark ) {
return mark - line;
}
return len;
}
/****************
* remove trailing white spaces and return the length of the buffer
*/
unsigned int
check_trailing_ws( const byte *line, unsigned int len )
{
return check_trailing_chars( line, len, " \t\r\n" );
}
int