Changeset 4513 for pjproject/trunk/pjlib-util/src/pjlib-util/cli_console.c
- Timestamp:
- May 3, 2013 8:47:14 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib-util/src/pjlib-util/cli_console.c
r4484 r4513 182 182 struct cli_console_fe *fe = (struct cli_console_fe *)sess->fe; 183 183 184 send_data.ptr = &data_str[0];184 send_data.ptr = data_str; 185 185 send_data.slen = 0; 186 186 … … 202 202 struct cli_console_fe *fe = (struct cli_console_fe *)sess->fe; 203 203 204 send_data.ptr = &data_str[0];204 send_data.ptr = data_str; 205 205 send_data.slen = 0; 206 206 … … 273 273 static const pj_str_t sc_type = {"sc", 2}; 274 274 static const pj_str_t choice_type = {"choice", 6}; 275 send_data.ptr = &data[0];275 send_data.ptr = data; 276 276 send_data.slen = 0; 277 277 … … 288 288 for (i=0;i<info->hint_cnt;++i) { 289 289 if ((&hint[i].type) && (hint[i].type.slen > 0)) { 290 if (pj_stricmp(&hint[i].type, &sc_type) == 0) { 291 //Additional delimiter " | " 292 cmd_length += (hint[i].name.slen + 3); 290 if (pj_stricmp(&hint[i].type, &sc_type) == 0) { 291 if ((i > 0) && (!pj_stricmp(&hint[i-1].desc, &hint[i].desc))) { 292 cmd_length += (hint[i].name.slen + 3); 293 } else { 294 cmd_length = hint[i].name.slen; 295 } 293 296 } else { 294 297 cmd_length = hint[i].name.slen; … … 304 307 305 308 cmd_length = 0; 306 for (i=0;i<info->hint_cnt;++i) { 309 for (i=0;i<info->hint_cnt;++i) { 307 310 if ((&hint[i].type) && (hint[i].type.slen > 0)) { 308 311 if (pj_stricmp(&hint[i].type, &sc_type) == 0) { … … 317 320 } 318 321 319 if ((parse_state != OP_SHORTCUT)) { 320 if (cmd_desc) { 321 /* Print data if previous hint is shortcut */ 322 send_hint_arg(&send_data, cmd_desc, cmd_length, max_length); 323 cmd_desc = 0; 324 } 322 if (parse_state != OP_SHORTCUT) { 325 323 pj_strcat2(&send_data, "\r\n "); 326 324 cmd_length = hint[i].name.slen; … … 338 336 pj_strcat2(&send_data, ">"); 339 337 break; 340 case OP_SHORTCUT: 341 pj_strcat2(&send_data, " | "); 342 pj_strcat(&send_data, &hint[i].name); 343 cmd_length += (hint[i].name.slen + 3); 338 case OP_SHORTCUT: 339 /* Format : "Command | sc | description" */ 340 { 341 cmd_length += hint[i].name.slen; 342 if ((i > 0) && (!pj_stricmp(&hint[i-1].desc, &hint[i].desc))) { 343 pj_strcat2(&send_data, " | "); 344 cmd_length += 3; 345 } else { 346 pj_strcat2(&send_data, "\r\n "); 347 } 348 pj_strcat(&send_data, &hint[i].name); 349 } 344 350 break; 345 351 default: … … 350 356 351 357 if ((parse_state == OP_TYPE) || (parse_state == OP_CHOICE) || 352 ((i+1) >= info->hint_cnt)) 358 ((i+1) >= info->hint_cnt) || 359 (pj_strncmp(&hint[i].desc, &hint[i+1].desc, hint[i].desc.slen))) 353 360 { 354 361 /* Add description info */ 355 362 send_hint_arg(&send_data, &hint[i].desc, cmd_length, max_length); 363 364 cmd_length = 0; 356 365 } 357 366 }
Note: See TracChangeset
for help on using the changeset viewer.