Mercurial > noffle
diff src/server.c @ 173:19e3aa717196 noffle
[svn] do not search all groups if group does not
exist and contains no wildcards
author | enz |
---|---|
date | Tue, 01 May 2001 19:07:28 +0100 |
parents | 7ba337dafb2c |
children | e196de757ecd |
line wrap: on
line diff
--- a/src/server.c Tue Mar 13 11:46:03 2001 +0000 +++ b/src/server.c Tue May 01 19:07:28 2001 +0100 @@ -1,7 +1,7 @@ /* server.c - $Id: server.c 260 2001-02-25 23:29:50Z bears $ + $Id: server.c 270 2001-05-01 18:07:28Z enz $ */ #if HAVE_CONFIG_H @@ -667,6 +667,12 @@ return TRUE; } +static Bool +containsWildcards( const char *pattern ) +{ + return ( strpbrk( pattern, "?*[\\" ) == NULL ? FALSE : TRUE ); +} + static void printGroups( const char *pat, void (*printProc)( Str, const char* ) ) { @@ -674,12 +680,7 @@ const char *g; putStat( STAT_GRPS_FOLLOW, "Groups" ); - if ( Grp_exists( pat ) ) - { - (*printProc)( line, pat ); - putTxtLn( line ); - } - else + if ( containsWildcards( pat ) ) { if ( Grp_firstGrp( &g ) ) do @@ -690,6 +691,11 @@ } while ( Grp_nextGrp( &g ) ); } + else if ( Grp_exists( pat ) ) + { + (*printProc)( line, pat ); + putTxtLn( line ); + } putEndOfTxt(); }