]>
Commit | Line | Data |
---|---|---|
bbc27441 | 1 | /* |
4ac4a490 | 2 | * Copyright (C) 1996-2017 The Squid Software Foundation and contributors |
bbc27441 AJ |
3 | * |
4 | * Squid software is distributed under GPLv2+ license and includes | |
5 | * contributions from numerous individuals and organizations. | |
6 | * Please see the COPYING and CONTRIBUTORS files for details. | |
7 | */ | |
8 | ||
f7f3304a | 9 | #include "squid.h" |
8a01b99e | 10 | #include "cache_cf.h" |
602d9612 | 11 | #include "ConfigParser.h" |
af69c635 | 12 | #include "Debug.h" |
31971e6a | 13 | #include "format/Config.h" |
31971e6a AJ |
14 | #include <list> |
15 | ||
16 | Format::FmtConfig Format::TheConfig; | |
17 | ||
18 | void | |
19 | Format::FmtConfig::parseFormats() | |
20 | { | |
21 | char *name, *def; | |
22 | ||
a25ed26c | 23 | if ((name = ConfigParser::NextToken()) == nullptr) { |
31971e6a | 24 | self_destruct(); |
a25ed26c AJ |
25 | return; |
26 | } | |
31971e6a | 27 | |
a25ed26c | 28 | if ((def = ConfigParser::NextQuotedOrToEol()) == nullptr) { |
31971e6a AJ |
29 | self_destruct(); |
30 | return; | |
31 | } | |
32 | ||
33 | debugs(3, 2, "Custom Format for '" << name << "' is '" << def << "'"); | |
34 | ||
35 | Format *nlf = new Format(name); | |
36 | ||
37 | if (!nlf->parse(def)) { | |
38 | self_destruct(); | |
39 | return; | |
40 | } | |
41 | ||
42 | // add to global config list | |
43 | nlf->next = formats; | |
44 | formats = nlf; | |
45 | } | |
46 | ||
47 | void | |
48 | Format::FmtConfig::registerTokens(const String &nsName, TokenTableEntry const *tokenArray) | |
49 | { | |
50 | debugs(46, 2, HERE << " register format tokens for '" << nsName << "'"); | |
51 | if (tokenArray != NULL) | |
52 | tokens.push_back(TokenNamespace(nsName, tokenArray)); | |
53 | else | |
fa84c01d | 54 | debugs(0, DBG_CRITICAL, "BUG: format tokens for '" << nsName << "' missing!"); |
31971e6a | 55 | } |
f53969cc | 56 |