comparison src/server.c @ 264:94b7962a0fbe noffle

[svn] * src/group.c: Explicitly disallow zero-length group names. Yes, I found one. * src/server.c: Correctly implement LISTGROUP when the optional group name parameter is omitted.
author bears
date Mon, 05 Aug 2002 23:05:02 +0100
parents b660fadc1814
children b3a2f710fe2c
comparison
equal deleted inserted replaced
263:0e56fd09921e 264:94b7962a0fbe
1 /* 1 /*
2 server.c 2 server.c
3 3
4 $Id: server.c 391 2002-06-26 13:30:26Z bears $ 4 $Id: server.c 396 2002-08-05 22:05:02Z bears $
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
841 } 841 }
842 842
843 static Bool 843 static Bool
844 doListgrp( char *arg, const Cmd *cmd ) 844 doListgrp( char *arg, const Cmd *cmd )
845 { 845 {
846 const Over *ov;
847 int first, last, i; 846 int first, last, i;
848 847
849 UNUSED( cmd ); 848 UNUSED( cmd );
850 849
851 if ( ! Grp_exists( arg ) ) 850 if ( *arg != '\0' )
852 putStat( STAT_NO_SUCH_GRP, "No such group" ); 851 {
852 if ( ! Grp_exists( arg ) )
853 {
854 putStat( STAT_NO_SUCH_GRP, "No such group" );
855 return TRUE;
856 }
857 changeToGrp( arg );
858 }
853 else 859 else
854 { 860 {
855 changeToGrp( arg ); 861 if ( ! loadGrpIfSelected() )
856 first = Cont_first(); 862 return TRUE;
857 last = Cont_last(); 863
858 putStat( STAT_GRP_SELECTED, "Article list" ); 864 }
859 for ( i = first; i <= last; ++i ) 865
860 if ( ( ov = Cont_get( i ) ) ) 866 first = Cont_first();
861 putTxtLn( "%lu", i ); 867 last = Cont_last();
862 putEndOfTxt(); 868 putStat( STAT_GRP_SELECTED, "Article list" );
863 } 869 for ( i = first; i <= last; ++i )
870 if ( Cont_get( i ) != NULL )
871 putTxtLn( "%d", i );
872 putEndOfTxt();
864 return TRUE; 873 return TRUE;
865 } 874 }
866 875
867 static Bool 876 static Bool
868 doMode( char *arg, const Cmd *cmd ) 877 doMode( char *arg, const Cmd *cmd )