# HG changeset patch # User bears # Date 966380893 -3600 # Node ID 7dfbb1c20a81a7631cae693b25d2baf4fb592af7 # Parent ffb8a4a91218d4d5fd7567a144ca84730b4b8cfc [svn] k and m suffices on filter numbers diff -r ffb8a4a91218 -r 7dfbb1c20a81 ChangeLog --- a/ChangeLog Mon Aug 14 20:51:51 2000 +0100 +++ b/ChangeLog Wed Aug 16 00:08:13 2000 +0100 @@ -2,6 +2,9 @@ NOFFLE ChangeLog ------------------------------------------------------------------------------- +Wed Aug 16 00:03:50 BST 2000 Jim Hague + * Permit 'k' and 'm' suffices after numbers in filter rules. + Fri Aug 11 2000 Markus Enzenberger * src/noffle.c: Minor bug fix. Noffle no longer tries to unsubscribe groups diff -r ffb8a4a91218 -r 7dfbb1c20a81 docs/noffle.conf.5 --- a/docs/noffle.conf.5 Mon Aug 14 20:51:51 2000 +0100 +++ b/docs/noffle.conf.5 Wed Aug 16 00:08:13 2000 +0100 @@ -1,5 +1,5 @@ .TH noffle.conf 5 -.\" $Id: noffle.conf.5 189 2000-08-09 21:19:17Z bears $ +.\" $Id: noffle.conf.5 199 2000-08-15 23:08:13Z bears $ .SH NAME noffle.conf \- Configuration file for NOFFLE news server @@ -344,11 +344,16 @@ than, equal to, or greater than the given number. .PP +Numbers may have a suffix of 'k' or 'm'. As you might expect, 'k' +indicates the number is to be multiplied by 1024 and 'm' indicates +it is to be multiplied by 1024*1024. Thus 10k is 10240 and 1m is 1048576. + +.PP For example, the following filters download all articles in groups in the alt.binaries tree in full if they are < 10k in size, otherwise downloads overviews. .PP -.I filter group=alt.binaries.* bytes < 10240 action=full +.I filter group=alt.binaries.* bytes < 10k action=full .br .I filter group=alt.binaries.* action=over .PP diff -r ffb8a4a91218 -r 7dfbb1c20a81 noffle.conf.example --- a/noffle.conf.example Mon Aug 14 20:51:51 2000 +0100 +++ b/noffle.conf.example Wed Aug 16 00:08:13 2000 +0100 @@ -88,4 +88,4 @@ #filter subject="\$+.*Make.*Money.*Now.*\$\$\$" action=discard #filter xposts>3 group=alt.flame action=over -#filter bytes>20480 action=over +#filter bytes>20k action=over diff -r ffb8a4a91218 -r 7dfbb1c20a81 src/configfile.c --- a/src/configfile.c Mon Aug 14 20:51:51 2000 +0100 +++ b/src/configfile.c Wed Aug 16 00:08:13 2000 +0100 @@ -6,7 +6,7 @@ SPOOLDIR VERSION - $Id: configfile.c 189 2000-08-09 21:19:17Z bears $ + $Id: configfile.c 199 2000-08-15 23:08:13Z bears $ */ #if HAVE_CONFIG_H @@ -712,8 +712,17 @@ else { char * endVal; + int suffix; rule.data.amount = strtoul( value, &endVal, 0 ); + suffix = tolower( *endVal ); + if ( suffix == 'k' || suffix == 'm' ) + { + rule.data.amount *= 1024; + if ( suffix == 'm' ) + rule.data.amount *= 1024; + endVal++; + } if ( *endVal != '\0' && ! isspace( *endVal ) ) goto synErr; }