The saw buffer is initialized and used to store ordinal values from 1 to N * for the order of the args in the array. If dup_markup == '\0', duplicates * are removed otherwise the char is prefixed to the duplicate term and, if it * is an opening paren/bracket/brace, the matching closing char is suffixed. * "none" is removed on the client side unless dup_markup != '\0'. */
| 460 | * is an opening paren/bracket/brace, the matching closing char is suffixed. |
| 461 | * "none" is removed on the client side unless dup_markup != '\0'. */ |
| 462 | int get_default_nno_list(struct name_num_obj *nno, char *to_buf, int to_buf_len, char dup_markup) |
| 463 | { |
| 464 | struct name_num_item *nni; |
| 465 | int len = 0, cnt = 0; |
| 466 | char delim = '\0', post_delim; |
| 467 | |
| 468 | switch (dup_markup) { |
| 469 | case '(': post_delim = ')'; break; |
| 470 | case '[': post_delim = ']'; break; |
| 471 | case '{': post_delim = '}'; break; |
| 472 | default: post_delim = '\0'; break; |
| 473 | } |
| 474 | |
| 475 | init_nno_saw(nno, 0); |
| 476 | |
| 477 | for (nni = nno->list, len = 0; nni->name; nni++) { |
| 478 | if (nni->num == CSUM_gone) |
| 479 | continue; |
| 480 | if (nni->main_nni) { |
| 481 | if (!dup_markup || nni->main_nni->num == CSUM_gone) |
| 482 | continue; |
| 483 | delim = dup_markup; |
| 484 | } |
| 485 | if (nni->num == 0 && !am_server && !dup_markup) |
| 486 | continue; |
| 487 | if (len) |
| 488 | to_buf[len++]= ' '; |
| 489 | if (delim) { |
| 490 | to_buf[len++]= delim; |
| 491 | delim = post_delim; |
| 492 | } |
| 493 | len += strlcpy(to_buf+len, nni->name, to_buf_len - len); |
| 494 | if (len >= to_buf_len - 3) |
| 495 | exit_cleanup(RERR_UNSUPPORTED); /* IMPOSSIBLE... */ |
| 496 | if (delim) { |
| 497 | to_buf[len++]= delim; |
| 498 | delim = '\0'; |
| 499 | } |
| 500 | nno->saw[nni->num] = ++cnt; |
| 501 | } |
| 502 | |
| 503 | return len; |
| 504 | } |
| 505 | |
| 506 | static void send_negotiate_str(int f_out, struct name_num_obj *nno, int ntype) |
| 507 | { |
no test coverage detected