This source file includes following definitions.
- main
#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/file_util.h"
#include "base/files/file_path.h"
#include "base/i18n/icu_util.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "base/process/memory.h"
#include "net/tools/tld_cleanup/tld_cleanup_util.h"
int main(int argc, const char* argv[]) {
base::EnableTerminationOnHeapCorruption();
if (argc != 1) {
fprintf(stderr, "Normalizes and verifies UTF-8 TLD data files\n");
fprintf(stderr, "Usage: %s\n", argv[0]);
return 1;
}
base::AtExitManager exit_manager;
#ifdef NDEBUG
logging::LoggingDestination destination = logging::LOG_TO_FILE;
#else
logging::LoggingDestination destination =
logging::LOG_TO_ALL;
#endif
CommandLine::Init(argc, argv);
base::FilePath log_filename;
PathService::Get(base::DIR_EXE, &log_filename);
log_filename = log_filename.AppendASCII("tld_cleanup.log");
logging::LoggingSettings settings;
settings.logging_dest = destination;
settings.log_file = log_filename.value().c_str();
settings.delete_old = logging::DELETE_OLD_LOG_FILE;
logging::InitLogging(settings);
base::i18n::InitializeICU();
base::FilePath input_file;
PathService::Get(base::DIR_SOURCE_ROOT, &input_file);
input_file = input_file.Append(FILE_PATH_LITERAL("net"))
.Append(FILE_PATH_LITERAL("base"))
.Append(FILE_PATH_LITERAL(
"registry_controlled_domains"))
.Append(FILE_PATH_LITERAL("effective_tld_names.dat"));
base::FilePath output_file;
PathService::Get(base::DIR_SOURCE_ROOT, &output_file);
output_file = output_file.Append(FILE_PATH_LITERAL("net"))
.Append(FILE_PATH_LITERAL("base"))
.Append(FILE_PATH_LITERAL(
"registry_controlled_domains"))
.Append(FILE_PATH_LITERAL(
"effective_tld_names.gperf"));
net::tld_cleanup::NormalizeResult result =
net::tld_cleanup::NormalizeFile(input_file, output_file);
if (result != net::tld_cleanup::kSuccess) {
fprintf(stderr,
"Errors or warnings processing file. See log in tld_cleanup.log.");
}
if (result == net::tld_cleanup::kError)
return 1;
return 0;
}