Mercurial > noffle
changeset 134:7dfbb1c20a81 noffle
[svn] k and m suffices on filter numbers
author | bears |
---|---|
date | Wed, 16 Aug 2000 00:08:13 +0100 |
parents | ffb8a4a91218 |
children | ae1d1b93883d |
files | ChangeLog docs/noffle.conf.5 noffle.conf.example src/configfile.c |
diffstat | 4 files changed, 21 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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 <jim.hague@acm.org> + * Permit 'k' and 'm' suffices after numbers in filter rules. + Fri Aug 11 2000 Markus Enzenberger <markus.enzenberger@t-online.de> * src/noffle.c: Minor bug fix. Noffle no longer tries to unsubscribe groups
--- 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
--- 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
--- 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; }