TSG-11849 tfe增加从环境变量中读入处理机ip

TSG-11742 IP Libraries统一使用.分隔地理层级
TSG-10722 日志中开始时间从解析层获取
This commit is contained in:
fengweihao
2022-09-09 10:44:11 +08:00
parent e52bafad6b
commit b321486e3f
35 changed files with 1300 additions and 1193 deletions

View File

@@ -0,0 +1,55 @@
#include "pattern_replace.h"
#include <sys/types.h>//fstat
#include <sys/ioctl.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
void print_help(void)
{
printf("Escape $ with \\$\n");
printf("-i Input Text");
printf("-f Find What\n");
printf("-r Replace With\n");
}
int main(int argc, char ** argv)
{
const char* find=NULL, *replacement=NULL, *input=NULL;
int oc=0;
if(argc<6)
{
print_help();
return -1;
}
while((oc=getopt(argc,argv,"f:r:i:"))!=-1)
{
switch(oc)
{
case 'f':
find=strdup(optarg);
break;
case 'r':
replacement=strdup(optarg);
break;
case 'i':
input=strdup(optarg);
break;
default:
printf("Invalid parameter.\n");
print_help();
return -1;
}
}
char* output=NULL;
size_t output_sz=0;
simple_replace(find, replacement, input, strlen(input),&output, &output_sz, 1);
printf("Subject: %s\n", input);
printf("Subsitute: %s\n", output);
free(output);
return 0;
}