mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
Improved error reporting in mimedb for failed regexps. This patch was written by Claes Nästén.
darcs-hash:20070515193751-ac50b-8221971ea524cddaba3e8e72a61b151b399ea7b6.gz
This commit is contained in:
parent
a6644631d9
commit
c1b4fa847f
1 changed files with 21 additions and 6 deletions
21
mimedb.c
21
mimedb.c
|
@ -450,6 +450,7 @@ static char *get_lang_re()
|
|||
if( close )
|
||||
*out++ = ')';
|
||||
*out++=0;
|
||||
|
||||
return buff;
|
||||
}
|
||||
|
||||
|
@ -480,12 +481,26 @@ static char *get_description( const char *mimetype )
|
|||
start_re = my_malloc( sizeof(regex_t));
|
||||
stop_re = my_malloc( sizeof(regex_t));
|
||||
|
||||
if( regcomp( start_re, buff, REG_EXTENDED ) ||
|
||||
regcomp( stop_re, STOP_TAG, REG_EXTENDED ) )
|
||||
int reg_status;
|
||||
if( ( reg_status = regcomp( start_re, buff, REG_EXTENDED ) ) )
|
||||
{
|
||||
fprintf( stderr, _( "%s: Could not compile regular expressions\n"), MIMEDB );
|
||||
char regerrbuf[BUFF_SIZE];
|
||||
regerror(reg_status, start_re, regerrbuf, BUFF_SIZE);
|
||||
fprintf( stderr, _( "%s: Could not compile regular expressions %s with error %s\n"), MIMEDB, buff, regerrbuf);
|
||||
error=1;
|
||||
|
||||
}
|
||||
else if ( ( reg_status = regcomp( stop_re, STOP_TAG, REG_EXTENDED ) ) )
|
||||
{
|
||||
char regerrbuf[BUFF_SIZE];
|
||||
regerror(reg_status, stop_re, regerrbuf, BUFF_SIZE);
|
||||
fprintf( stderr, _( "%s: Could not compile regular expressions %s with error %s\n"), MIMEDB, buff, regerrbuf);
|
||||
error=1;
|
||||
|
||||
}
|
||||
|
||||
if( error )
|
||||
{
|
||||
free( start_re );
|
||||
free( stop_re );
|
||||
start_re = stop_re = 0;
|
||||
|
|
Loading…
Reference in a new issue