| 555 | ****************************************************************************/ |
| 556 | |
| 557 | static char *htmlize_expression(const char *src) |
| 558 | { |
| 559 | char varname[VAR_SIZE + 1]; |
| 560 | char htmlvar[HTML_VAR_SIZE + 1]; |
| 561 | char *dest = g_scratch; |
| 562 | char ch = '\0'; |
| 563 | char lastc; |
| 564 | |
| 565 | /* We may get here with the source pointer equal to NULL. Return the |
| 566 | * disfavor. |
| 567 | */ |
| 568 | |
| 569 | if (!src) |
| 570 | { |
| 571 | return NULL; |
| 572 | } |
| 573 | |
| 574 | /* Transfer each character from the source string into the scratch buffer */ |
| 575 | |
| 576 | dest = g_scratch; |
| 577 | *dest = '\0'; |
| 578 | |
| 579 | while (*src) |
| 580 | { |
| 581 | /* Remember the last character and advance to the next character */ |
| 582 | |
| 583 | lastc = ch; |
| 584 | ch = *src; |
| 585 | |
| 586 | /* Skip control characters and out-of-range 7-bit ASCII characters */ |
| 587 | |
| 588 | if (*src < 0x20 || *src > 0x7e) |
| 589 | { |
| 590 | src++; |
| 591 | continue; |
| 592 | } |
| 593 | |
| 594 | /* Output no more than one consecutive space character. This depends |
| 595 | * on the fact that kconfig_line has replaces all of the forms of |
| 596 | * whitespace with a space character. |
| 597 | */ |
| 598 | |
| 599 | if (*src == ' ') |
| 600 | { |
| 601 | if (lastc != ' ') |
| 602 | { |
| 603 | *dest++ = *src; |
| 604 | *dest = '\0'; |
| 605 | } |
| 606 | |
| 607 | src++; |
| 608 | continue; |
| 609 | } |
| 610 | |
| 611 | /* Concatenate variable name strings. There strings probably begin |
| 612 | * with a uppercase letter, but here all alphanumeric values (plus '_'_ |
| 613 | * are concatenated. |
| 614 | */ |
no test coverage detected