Mercurial > noffle
diff src/content.c @ 49:5ecb646acf97 noffle
[svn] Article numbering bug fixes
author | bears |
---|---|
date | Sat, 06 May 2000 17:56:50 +0100 |
parents | 32ba1198c6fa |
children | 125d79c9e586 |
line wrap: on
line diff
--- a/src/content.c Sat May 06 17:55:22 2000 +0100 +++ b/src/content.c Sat May 06 17:56:50 2000 +0100 @@ -1,7 +1,7 @@ /* content.c - $Id: content.c 51 2000-05-05 23:49:38Z uh1763 $ + $Id: content.c 55 2000-05-06 16:56:50Z bears $ */ #if HAVE_CONFIG_H @@ -173,11 +173,6 @@ FILE *f; const Over *ov; - - /* Move the first article no. to the first active article */ - while ( ! Cont_validNumb( cont.first ) && cont.first <= cont.last ) - ++cont.first; - /* Save the overview */ if ( ! ( f = fopen( cont.file, "w" ) ) ) { @@ -186,6 +181,7 @@ } Log_dbg( "Writing %s (%lu)", cont.file, cont.size ); anythingWritten = FALSE; + cont.first = -1; for ( i = 0; i < cont.size; ++i ) { if ( ( ov = cont.elem[ i ] ) ) @@ -198,7 +194,11 @@ break; } else + { anythingWritten = TRUE; + if ( cont.first < 0 ) + cont.first = cont.vecFirst + i; + } } } } @@ -229,6 +229,22 @@ int Cont_last( void ) { return cont.last; } +int +Cont_find( const char *msgId ) +{ + int i; + const Over *ov; + + for ( i = 0; i < cont.size; i++ ) + { + if ( ( ov = cont.elem[ i ] ) + && strcmp( Ov_msgId( ov ), msgId ) == 0 ) + return i + cont.vecFirst; + } + + return -1; +} + const char * Cont_grp( void ) { return cont.name; }