From f2ee8aa9cdc210dc3be066eff423747f23aacb53 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sun, 25 Jan 2009 22:42:28 -0500 Subject: snapshot of project "lynx", label v2-8-7dev_12e --- WWW/Library/Implementation/HTRules.c | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'WWW') diff --git a/WWW/Library/Implementation/HTRules.c b/WWW/Library/Implementation/HTRules.c index 7fcc1e97..d4dd6eed 100644 --- a/WWW/Library/Implementation/HTRules.c +++ b/WWW/Library/Implementation/HTRules.c @@ -1,5 +1,5 @@ /* - * $LynxId: HTRules.c,v 1.35 2009/01/01 16:59:24 tom Exp $ + * $LynxId: HTRules.c,v 1.37 2009/01/25 22:42:28 tom Exp $ * * Configuration manager for Hypertext Daemon HTRules.c * ========================================== @@ -46,6 +46,7 @@ typedef struct _rule { #include /* for redirecting_url, indirectly HTPermitRedir - kw */ #include /* for LYUserSpecifiedURL - kw */ +#include /* for LYscanFloat */ #include /* for LYFixCursesOn - kw */ #include @@ -490,20 +491,33 @@ int HTSetConfiguration(char *config) if (0 == strcasecomp(word1, "suffix")) { char *encoding = HTNextField(&pointer); + status = 0; if (pointer) - status = sscanf(pointer, "%f", &quality); - else - status = 0; + status = LYscanFloat(pointer, &quality); + HTSetSuffix(word2, word3, encoding ? encoding : "binary", status >= 1 ? quality : (float) 1.0); } else if (0 == strcasecomp(word1, "presentation")) { - if (pointer) - status = sscanf(pointer, "%f%f%f%" SCN_off_t "", - &quality, &secs, &secs_per_byte, &maxbytes); - else - status = 0; + status = 0; + if (pointer) { + const char *temp = pointer; + + if (LYscanFloat2(&temp, &quality)) { + status = 1; + if (LYscanFloat2(&temp, &secs)) { + status = 2; + if (LYscanFloat2(&temp, &secs_per_byte)) { + status = 3; + if (sscanf(temp, "%" SCN_off_t, &maxbytes)) { + status = 4; + } + } + } + } + } + HTSetPresentation(word2, word3, NULL, status >= 1 ? quality : 1.0, status >= 2 ? secs : 0.0, -- cgit 1.4.1-2-gfad0