Mercurial > noffle
comparison 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 |
comparison
equal
deleted
inserted
replaced
172:0ce333d046b9 | 173:19e3aa717196 |
---|---|
1 /* | 1 /* |
2 server.c | 2 server.c |
3 | 3 |
4 $Id: server.c 260 2001-02-25 23:29:50Z bears $ | 4 $Id: server.c 270 2001-05-01 18:07:28Z enz $ |
5 */ | 5 */ |
6 | 6 |
7 #if HAVE_CONFIG_H | 7 #if HAVE_CONFIG_H |
8 #include <config.h> | 8 #include <config.h> |
9 #endif | 9 #endif |
665 } | 665 } |
666 } | 666 } |
667 return TRUE; | 667 return TRUE; |
668 } | 668 } |
669 | 669 |
670 static Bool | |
671 containsWildcards( const char *pattern ) | |
672 { | |
673 return ( strpbrk( pattern, "?*[\\" ) == NULL ? FALSE : TRUE ); | |
674 } | |
675 | |
670 static void | 676 static void |
671 printGroups( const char *pat, void (*printProc)( Str, const char* ) ) | 677 printGroups( const char *pat, void (*printProc)( Str, const char* ) ) |
672 { | 678 { |
673 Str line; | 679 Str line; |
674 const char *g; | 680 const char *g; |
675 | 681 |
676 putStat( STAT_GRPS_FOLLOW, "Groups" ); | 682 putStat( STAT_GRPS_FOLLOW, "Groups" ); |
677 if ( Grp_exists( pat ) ) | 683 if ( containsWildcards( pat ) ) |
678 { | |
679 (*printProc)( line, pat ); | |
680 putTxtLn( line ); | |
681 } | |
682 else | |
683 { | 684 { |
684 if ( Grp_firstGrp( &g ) ) | 685 if ( Grp_firstGrp( &g ) ) |
685 do | 686 do |
686 if ( Wld_match( g, pat ) ) | 687 if ( Wld_match( g, pat ) ) |
687 { | 688 { |
688 (*printProc)( line, g ); | 689 (*printProc)( line, g ); |
689 putTxtLn( line ); | 690 putTxtLn( line ); |
690 } | 691 } |
691 while ( Grp_nextGrp( &g ) ); | 692 while ( Grp_nextGrp( &g ) ); |
693 } | |
694 else if ( Grp_exists( pat ) ) | |
695 { | |
696 (*printProc)( line, pat ); | |
697 putTxtLn( line ); | |
692 } | 698 } |
693 putEndOfTxt(); | 699 putEndOfTxt(); |
694 } | 700 } |
695 | 701 |
696 static void | 702 static void |