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

Function _ippFileReadToken

cups/ipp-file.c:206–420  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204 */
205
206int /* O - 1 on success, 0 on failure */
207_ippFileReadToken(_ipp_file_t *f, /* I - File to read from */
208 char *token, /* I - Token string buffer */
209 size_t tokensize)/* I - Size of token string buffer */
210{
211 int ch, /* Character from file */
212 quote = 0; /* Quoting character */
213 char *tokptr = token, /* Pointer into token buffer */
214 *tokend = token + tokensize - 1;/* End of token buffer */
215
216
217 if (tokensize < 32)
218 return (0);
219
220 /*
221 * Skip whitespace and comments...
222 */
223
224 DEBUG_printf(("1_ippFileReadToken: linenum=%d, pos=%ld", f->linenum, (long)cupsFileTell(f->fp)));
225
226 while ((ch = cupsFileGetChar(f->fp)) != EOF)
227 {
228 if (_cups_isspace(ch))
229 {
230 /*
231 * Whitespace...
232 */
233
234 if (ch == '\n')
235 {
236 f->linenum ++;
237 DEBUG_printf(("1_ippFileReadToken: LF in leading whitespace, linenum=%d, pos=%ld", f->linenum, (long)cupsFileTell(f->fp)));
238 }
239 }
240 else if (ch == '#')
241 {
242 /*
243 * Comment...
244 */
245
246 DEBUG_puts("1_ippFileReadToken: Skipping comment in leading whitespace...");
247
248 while ((ch = cupsFileGetChar(f->fp)) != EOF)
249 {
250 if (ch == '\n')
251 break;
252 }
253
254 if (ch == '\n')
255 {
256 f->linenum ++;
257 DEBUG_printf(("1_ippFileReadToken: LF at end of comment, linenum=%d, pos=%ld", f->linenum, (long)cupsFileTell(f->fp)));
258 }
259 else
260 break;
261 }
262 else
263 break;

Callers 5

token_cbFunction · 0.85
_ippFileParseFunction · 0.85
parse_collectionFunction · 0.85
parse_valueFunction · 0.85

Calls 4

cupsFileTellFunction · 0.85
cupsFileGetCharFunction · 0.85
_cups_isspaceFunction · 0.85
cupsFileSeekFunction · 0.85

Tested by

no test coverage detected