diff 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
line wrap: on
line diff
--- a/src/server.c	Thu Jul 04 21:51:03 2002 +0100
+++ b/src/server.c	Mon Aug 05 23:05:02 2002 +0100
@@ -1,7 +1,7 @@
 /*
   server.c
 
-  $Id: server.c 391 2002-06-26 13:30:26Z bears $
+  $Id: server.c 396 2002-08-05 22:05:02Z bears $
 */
 
 #if HAVE_CONFIG_H
@@ -843,24 +843,33 @@
 static Bool
 doListgrp( char *arg, const Cmd *cmd )
 {
-    const Over *ov;
     int first, last, i;
 
     UNUSED( cmd );
 
-    if ( ! Grp_exists( arg ) )
-        putStat( STAT_NO_SUCH_GRP, "No such group" );
+    if ( *arg != '\0' )
+    {
+	if ( ! Grp_exists( arg ) )
+	{
+	    putStat( STAT_NO_SUCH_GRP, "No such group" );
+	    return TRUE;
+	}
+	changeToGrp( arg );
+    }
     else
     {
-        changeToGrp( arg );
-        first = Cont_first();
-        last = Cont_last();
-        putStat( STAT_GRP_SELECTED, "Article list" );
-        for ( i = first; i <= last; ++i )
-            if ( ( ov = Cont_get( i ) ) )
-                putTxtLn( "%lu", i );
-        putEndOfTxt();
+	if ( ! loadGrpIfSelected() )
+	    return TRUE;
+	
     }
+    
+    first = Cont_first();
+    last = Cont_last();
+    putStat( STAT_GRP_SELECTED, "Article list" );
+    for ( i = first; i <= last; ++i )
+	if ( Cont_get( i ) != NULL )
+	    putTxtLn( "%d", i );
+    putEndOfTxt();
     return TRUE;
 }