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

Function html_printf

tools/ippeveprinter.c:2953–3166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2951 */
2952
2953static void
2954html_printf(ippeve_client_t *client, /* I - Client */
2955 const char *format, /* I - Printf-style format string */
2956 ...) /* I - Additional arguments as needed */
2957{
2958 va_list ap; /* Pointer to arguments */
2959 const char *start; /* Start of string */
2960 char size, /* Size character (h, l, L) */
2961 type; /* Format type character */
2962 int width, /* Width of field */
2963 prec; /* Number of characters of precision */
2964 char tformat[100], /* Temporary format string for sprintf() */
2965 *tptr, /* Pointer into temporary format */
2966 temp[1024]; /* Buffer for formatted numbers */
2967 char *s; /* Pointer to string */
2968
2969
2970 /*
2971 * Loop through the format string, formatting as needed...
2972 */
2973
2974 va_start(ap, format);
2975 start = format;
2976
2977 while (*format)
2978 {
2979 if (*format == '%')
2980 {
2981 if (format > start)
2982 httpWrite2(client->http, start, (size_t)(format - start));
2983
2984 tptr = tformat;
2985 *tptr++ = *format++;
2986
2987 if (*format == '%')
2988 {
2989 httpWrite2(client->http, "%", 1);
2990 format ++;
2991 start = format;
2992 continue;
2993 }
2994 else if (strchr(" -+#\'", *format))
2995 *tptr++ = *format++;
2996
2997 if (*format == '*')
2998 {
2999 /*
3000 * Get width from argument...
3001 */
3002
3003 format ++;
3004 width = va_arg(ap, int);
3005
3006 snprintf(tptr, sizeof(tformat) - (size_t)(tptr - tformat), "%d", width);
3007 tptr += strlen(tptr);
3008 }
3009 else
3010 {

Callers 5

html_footerFunction · 0.85
html_headerFunction · 0.85
show_mediaFunction · 0.85
show_statusFunction · 0.85
show_suppliesFunction · 0.85

Calls 2

httpWrite2Function · 0.85
html_escapeFunction · 0.85

Tested by

no test coverage detected