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