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

Function cgiSetIPPObjectVars

cgi-bin/ipp-var.c:926–1240  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

924 */
925
926ipp_attribute_t * /* O - Next object */
927cgiSetIPPObjectVars(
928 ipp_attribute_t *obj, /* I - Response data to be copied... */
929 const char *prefix, /* I - Prefix for name or NULL */
930 int element) /* I - Parent element number */
931{
932 ipp_attribute_t *attr; /* Attribute in response... */
933 int i; /* Looping var */
934 char name[1024], /* Name of attribute */
935 *nameptr, /* Pointer into name */
936 value[16384], /* Value(s) */
937 *valptr; /* Pointer into value */
938
939
940 fprintf(stderr, "DEBUG2: cgiSetIPPObjectVars(obj=%p, prefix=\"%s\", "
941 "element=%d)\n",
942 obj, prefix ? prefix : "(null)", element);
943
944 /*
945 * Set common CGI template variables...
946 */
947
948 if (!prefix)
949 cgiSetServerVersion();
950
951 /*
952 * Loop through the attributes and set them for the template...
953 */
954
955 for (attr = obj; attr && attr->group_tag != IPP_TAG_ZERO; attr = attr->next)
956 {
957 /*
958 * Copy the attribute name, substituting "_" for "-"...
959 */
960
961 if (!attr->name)
962 continue;
963
964 if (prefix)
965 {
966 snprintf(name, sizeof(name), "%s.", prefix);
967 nameptr = name + strlen(name);
968 }
969 else
970 nameptr = name;
971
972 for (i = 0; attr->name[i] && nameptr < (name + sizeof(name) - 1); i ++)
973 if (attr->name[i] == '-')
974 *nameptr++ = '_';
975 else
976 *nameptr++ = attr->name[i];
977
978 *nameptr = '\0';
979
980 /*
981 * Add "job_printer_name" variable if we have a "job_printer_uri"
982 * attribute...
983 */

Callers 4

cgiSetIPPVarsFunction · 0.85
cgiShowJobsFunction · 0.85
show_all_classesFunction · 0.85
show_all_printersFunction · 0.85

Calls 8

cgiSetServerVersionFunction · 0.85
cgiSetArrayFunction · 0.85
httpSeparateURIFunction · 0.85
httpAssembleURIFunction · 0.85
cgiRewriteURLFunction · 0.85
_cupsStrDateFunction · 0.85
ippGetIntegerFunction · 0.85
cgiSetIPPVarsFunction · 0.85

Tested by

no test coverage detected