]>
Commit | Line | Data |
---|---|---|
f7f3304a | 1 | #include "squid.h" |
31971e6a AJ |
2 | #include "format/Config.h" |
3 | #include "protos.h" | |
4 | #include <list> | |
5 | ||
6 | Format::FmtConfig Format::TheConfig; | |
7 | ||
8 | void | |
9 | Format::FmtConfig::parseFormats() | |
10 | { | |
11 | char *name, *def; | |
12 | ||
13 | if ((name = strtok(NULL, w_space)) == NULL) | |
14 | self_destruct(); | |
15 | ||
16 | if ((def = strtok(NULL, "\r\n")) == NULL) { | |
17 | self_destruct(); | |
18 | return; | |
19 | } | |
20 | ||
21 | debugs(3, 2, "Custom Format for '" << name << "' is '" << def << "'"); | |
22 | ||
23 | Format *nlf = new Format(name); | |
24 | ||
25 | if (!nlf->parse(def)) { | |
26 | self_destruct(); | |
27 | return; | |
28 | } | |
29 | ||
30 | // add to global config list | |
31 | nlf->next = formats; | |
32 | formats = nlf; | |
33 | } | |
34 | ||
35 | void | |
36 | Format::FmtConfig::registerTokens(const String &nsName, TokenTableEntry const *tokenArray) | |
37 | { | |
38 | debugs(46, 2, HERE << " register format tokens for '" << nsName << "'"); | |
39 | if (tokenArray != NULL) | |
40 | tokens.push_back(TokenNamespace(nsName, tokenArray)); | |
41 | else | |
42 | debugs(0,0, "BUG: format tokens for '" << nsName << "' missing!"); | |
43 | } |