MCPcopy Create free account
hub / github.com/apache/nuttx / htmlize_character

Function htmlize_character

tools/kconfig2html.c:464–507  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

462 ****************************************************************************/
463
464static int htmlize_character(char *dest, char ch)
465{
466 const char *str;
467
468 /* Transfer the character from into the destination buffer, perform the
469 * conversion only if the character is one of the special characters.
470 */
471
472 str = NULL;
473
474 switch (ch)
475 {
476 case '"':
477 str = """;
478 break;
479
480 case '\'':
481 str = "'";
482 break;
483
484 case '&':
485 str = "&";
486 break;
487
488 case '<':
489 str = "&lt;";
490 break;
491
492 case '>':
493 str = "&gt;";
494 break;
495
496 default:
497 *dest++ = ch;
498 *dest = '\0';
499 return 1;
500 }
501
502 /* Transfer a string */
503
504 *dest = '\0';
505 strcat(dest, str);
506 return strlen(str);
507}
508
509/****************************************************************************
510 * Name: htmlize_text

Callers 2

htmlize_textFunction · 0.85
htmlize_expressionFunction · 0.85

Calls 2

strcatFunction · 0.50
strlenFunction · 0.50

Tested by

no test coverage detected