| 2162 | // |
| 2163 | |
| 2164 | int // O - Number bytes on success, -1 on failure |
| 2165 | ppdcSource::quotef(cups_file_t *fp, // I - File to write to |
| 2166 | const char *format, // I - Printf-style format string |
| 2167 | ...) // I - Additional args as needed |
| 2168 | { |
| 2169 | va_list ap; // Pointer to additional arguments |
| 2170 | int bytes; // Bytes written |
| 2171 | char sign, // Sign of format width |
| 2172 | size, // Size character (h, l, L) |
| 2173 | type; // Format type character |
| 2174 | const char *bufformat; // Start of format |
| 2175 | int width, // Width of field |
| 2176 | prec; // Number of characters of precision |
| 2177 | char tformat[100]; // Temporary format string for fprintf() |
| 2178 | char *s; // Pointer to string |
| 2179 | int slen; // Length of string |
| 2180 | int i; // Looping var |
| 2181 | |
| 2182 | |
| 2183 | // Range check input... |
| 2184 | if (!fp || !format) |
| 2185 | return (-1); |
| 2186 | |
| 2187 | // Loop through the format string, formatting as needed... |
| 2188 | va_start(ap, format); |
| 2189 | |
| 2190 | bytes = 0; |
| 2191 | |
| 2192 | while (*format) |
| 2193 | { |
| 2194 | if (*format == '%') |
| 2195 | { |
| 2196 | bufformat = format; |
| 2197 | format ++; |
| 2198 | |
| 2199 | if (*format == '%') |
| 2200 | { |
| 2201 | cupsFilePutChar(fp, *format++); |
| 2202 | bytes ++; |
| 2203 | continue; |
| 2204 | } |
| 2205 | else if (strchr(" -+#\'", *format)) |
| 2206 | sign = *format++; |
| 2207 | else |
| 2208 | sign = 0; |
| 2209 | |
| 2210 | width = 0; |
| 2211 | while (isdigit(*format)) |
| 2212 | width = width * 10 + *format++ - '0'; |
| 2213 | |
| 2214 | if (*format == '.') |
| 2215 | { |
| 2216 | format ++; |
| 2217 | prec = 0; |
| 2218 | |
| 2219 | while (isdigit(*format)) |
| 2220 | prec = prec * 10 + *format++ - '0'; |
| 2221 | } |
nothing calls this directly
no test coverage detected