blob: 2e8c037ee97f6a501a0fc3b5fbf3034cf805047e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This tool manages privacy blacklists. Primarily for loading a text
// blacklist into the binary aggregate blacklist.
#include <iostream>
#include "base/process_util.h"
#include "base/string_util.h"
#include "chrome/browser/privacy_blacklist/blacklist.h"
#include "chrome/browser/privacy_blacklist/blacklist_io.h"
#ifdef OS_POSIX
#define ICHAR char
#define ICERR std::cerr
#define IMAIN main
#else
#define ICHAR wchar_t
#define ICERR std::wcerr
#define IMAIN wmain
#endif
namespace {
int PrintUsage(int argc, ICHAR* argv[]) {
ICERR << "Usage: " << argv[0] << " <source>... <target>\n"
" <source> are text blacklists (.pbl) to load.\n"
" <target> is the binary output blacklist repository.\n\n"
"Adds all entries from <source> to <target>.\n"
"Creates <target> if it does not exist.\n";
return 1;
}
}
int IMAIN(int argc, ICHAR* argv[]) {
base::EnableTerminationOnHeapCorruption();
if (argc < 3)
return PrintUsage(argc, argv);
BlacklistIO io;
for (int current = 1; current < argc-1; ++current) {
FilePath input(argv[current]);
if (!io.Read(input)) {
ICERR << "Error reading input file " << argv[current] << "\n";
return -1;
}
}
FilePath output(argv[argc-1]);
if (!io.Write(output))
ICERR << "Error writing output file " << argv[2] << "\n";
return 0;
}
|