MCPcopy Create free account
hub / github.com/OpenPrinting/cups / html_escape

Function html_escape

tools/ippeveprinter.c:2843–2875  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2841 */
2842
2843static void
2844html_escape(ippeve_client_t *client, /* I - Client */
2845 const char *s, /* I - String to write */
2846 size_t slen) /* I - Number of characters to write */
2847{
2848 const char *start, /* Start of segment */
2849 *end; /* End of string */
2850
2851
2852 start = s;
2853 end = s + (slen > 0 ? slen : strlen(s));
2854
2855 while (*s && s < end)
2856 {
2857 if (*s == '&' || *s == '<')
2858 {
2859 if (s > start)
2860 httpWrite2(client->http, start, (size_t)(s - start));
2861
2862 if (*s == '&')
2863 httpWrite2(client->http, "&amp;", 5);
2864 else
2865 httpWrite2(client->http, "&lt;", 4);
2866
2867 start = s + 1;
2868 }
2869
2870 s ++;
2871 }
2872
2873 if (s > start)
2874 httpWrite2(client->http, start, (size_t)(s - start));
2875}
2876
2877
2878/*

Callers 1

html_printfFunction · 0.85

Calls 1

httpWrite2Function · 0.85

Tested by

no test coverage detected