void runQueries(std::ifstream & infile) { input_text(infile); while(true) { std::cout<<"enter the word to look for ,or q to quit:"<<std::endl; std::string s; if(!(std::cin>>s)||s=="q") break; query_and_print(s,std::cout)<<std::endl; } }
int input_number(char *prompt, int i) { /* call input_text() and then convert the string to an integer */ char buf[21]; if (i>0) itoa(i, buf, 10); else buf[0]=0; if (input_text(prompt, buf, 20, is_number)==ESC) { input_cancelled = TRUE; return i; } input_cancelled = FALSE; return atoi(buf); }
int parse_args(int argc, char** argv, args_t* args) { int c; int k; const struct option long_options[] = { {"lcid", required_argument, NULL, 256}, {"rbid", required_argument, NULL, 257}, {"TBsize", required_argument, NULL, 258}, {"SDUsize", required_argument, NULL, 259}, {"eNB_RRC", no_argument, NULL, 260}, {"eNB_S1U", no_argument, NULL, 261}, {"eNB_PDCP", no_argument, NULL, 262}, {"eNB_RLC_UM", no_argument, NULL, 263}, {"eNB_RLC_AM", no_argument, NULL, 264}, {"eNB_RLC_TM", no_argument, NULL, 265}, {"eNB_MAC" , no_argument, NULL, 266}, {"UE_RRC", no_argument, NULL, 267}, {"UE_S1U", no_argument, NULL, 268}, {"UE_PDCP", no_argument, NULL, 269}, {"UE_RLC_UM", no_argument, NULL, 270}, {"UE_RLC_AM", no_argument, NULL, 271}, {"UE_RLC_TM", no_argument, NULL, 272}, {"RRCConnectionRequest", no_argument, NULL, 273}, {"RRCConnectionSetup", no_argument, NULL, 274}, {"RRCConnectionSetupComplete", no_argument, NULL, 275}, {"RRCConnectionReconfiguration", no_argument, NULL, 276}, {"RRCConnectionReconfigurationComplete", no_argument, NULL, 277}, {"RRCSIB1", no_argument, NULL, 278}, {"RRCSIB2_3", no_argument, NULL, 279}, {NULL, 0, NULL, 0} }; args->frame = 0; while((c = getopt_long(argc, argv, "ho:I:J:v", long_options, NULL)) != -1) { switch(c) { case 'h': return 1; case 'o': strcpy(args->output_file,optarg); break; case 'f': args->frame = atoi(optarg); break; case 'I': strcpy(args->input1_file,optarg); args->input1_sdu_len = input_text(args->input1_file,args->input1_sdu); printf("Got sdu1 of length %d bytes\n",args->input1_sdu_len); args->input1_sdu_flag=1; break; case 'J': strcpy(args->input2_file,optarg); args->input2_sdu_len = input_text(args->input2_file,args->input2_sdu); printf("Got sdu2 of length %d bytes\n",args->input2_sdu_len); args->input2_sdu_flag=1; break; case 'v': args->verbose++; break; case 256: // lchan args->lcid = atoi(optarg); break; case 257: // args->rbid = atoi(optarg); break; case 258: args->TBsize = atoi(optarg); break; case 259: args->SDUsize = atoi(optarg); break; case 260: //eNB_RRC case 261: //eNB_S1U case 262: //eNB_PDCP case 263: //eNB_RLC_UM case 264: //eNB_RLC_AM case 265: //eNB_RLC_TM case 266: //eNB_MAC case 267: //UE_RRC case 268: //UE_S1U case 269: //UE_PDCP case 270: //UE_RLC_UM case 271: //UE_RLC_AM case 272: //UE_RLC_TM args->SDUsource = c-260; break; case 273: //RRCConnectionRequest case 274: //RRCConnectionSetup case 275: //RRCConnectionSetupComplete case 276: //RRCConnectionReconfiguration case 277: //RRCConnectionReconfigurationComplete case 278: //RRCSIB1 case 279: //RRCSIB2_3 args->RRCmessage = c-273; break; default: return 1; } } return 0; }
int main(int argc, char ** argv) { text txt = input_text(); process_text(txt); output_text(txt); return 0; }