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

Function parse_monitor_printer_state

tools/ipptool.c:2698–3122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2696 */
2697
2698static int /* O - 1 to continue, 0 to stop */
2699parse_monitor_printer_state(
2700 _ipp_file_t *f, /* I - IPP file data */
2701 ipptool_test_t *data) /* I - Test data */
2702{
2703 char token[256], /* Token string */
2704 name[1024], /* Name string */
2705 temp[1024], /* Temporary string */
2706 value[1024], /* Value string */
2707 *ptr; /* Pointer into value */
2708
2709
2710 if (!_ippFileReadToken(f, temp, sizeof(temp)))
2711 {
2712 print_fatal_error(data, "Missing printer URI on line %d of \"%s\".", f->linenum, f->filename);
2713 return (0);
2714 }
2715
2716 if (strcmp(temp, "{"))
2717 {
2718 // Got a printer URI so copy it...
2719 _ippVarsExpand(data->vars, value, temp, sizeof(value));
2720 data->monitor_uri = strdup(value);
2721
2722 // Then see if we have an opening brace...
2723 if (!_ippFileReadToken(f, temp, sizeof(temp)) || strcmp(temp, "{"))
2724 {
2725 print_fatal_error(data, "Missing opening brace on line %d of \"%s\".", f->linenum, f->filename);
2726 return (0);
2727 }
2728 }
2729 else
2730 {
2731 // Use the default printer URI...
2732 data->monitor_uri = strdup(data->vars->uri);
2733 }
2734
2735 // Loop until we get a closing brace...
2736 while (_ippFileReadToken(f, token, sizeof(token)))
2737 {
2738 if (_cups_strcasecmp(token, "COUNT") &&
2739 _cups_strcasecmp(token, "DEFINE-MATCH") &&
2740 _cups_strcasecmp(token, "DEFINE-NO-MATCH") &&
2741 _cups_strcasecmp(token, "DEFINE-VALUE") &&
2742 _cups_strcasecmp(token, "DISPLAY-MATCH") &&
2743 _cups_strcasecmp(token, "IF-DEFINED") &&
2744 _cups_strcasecmp(token, "IF-NOT-DEFINED") &&
2745 _cups_strcasecmp(token, "IN-GROUP") &&
2746 _cups_strcasecmp(token, "OF-TYPE") &&
2747 _cups_strcasecmp(token, "WITH-DISTINCT-VALUES") &&
2748 _cups_strcasecmp(token, "WITH-VALUE"))
2749 data->last_expect = NULL;
2750
2751 if (!strcmp(token, "}"))
2752 return (1);
2753 else if (!_cups_strcasecmp(token, "EXPECT"))
2754 {
2755 /*

Callers 1

token_cbFunction · 0.85

Calls 9

_ippFileReadTokenFunction · 0.85
print_fatal_errorFunction · 0.85
_ippVarsExpandFunction · 0.85
_cups_strcasecmpFunction · 0.85
_cupsStrScandFunction · 0.85
ippTagValueFunction · 0.85
cupsFileTellFunction · 0.85
cupsFileSeekFunction · 0.85
_cups_strcpyFunction · 0.85

Tested by

no test coverage detected