1.5K Star 8.1K Fork 2K

GVP狮子的魂/ip2region

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
xdb_make_test.cc 1.14 KB
一键复制 编辑 原始数据 按行查看 历史
#include "xdb_make.h"
#include <getopt.h>
#include <stdio.h>
#include <iostream>
void print_help() {
printf("./xdb_make [command options]\n");
printf("options:\n");
printf(" --db string ip2region binary xdb file path\n");
printf(" --src string source ip text file path\n");
exit(-1);
}
int main(int argc, char* argv[]) {
struct option long_options[] = {
{"db", required_argument, 0, 'd'},
{"src", required_argument, 0, 's'},
{"help", no_argument, 0, 'h'},
{0, 0, 0, 0 }
};
std::string file_name_dst = "./ip2region.xdb";
std::string file_name_src = "../../data/ip.merge.txt";
while (1) {
int c = getopt_long(argc, argv, "", long_options, NULL);
if (c == -1)
break;
switch (c) {
case 'd':
file_name_dst = optarg;
break;
case 'h':
print_help();
break;
case 's':
file_name_src = optarg;
break;
case '?':
exit(-1);
}
}
xdb_make_t xdb(file_name_src, file_name_dst);
return 0;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/lionsoul/ip2region.git
git@gitee.com:lionsoul/ip2region.git
lionsoul
ip2region
ip2region
master

搜索帮助