| 924 | */ |
| 925 | |
| 926 | ipp_attribute_t * /* O - Next object */ |
| 927 | cgiSetIPPObjectVars( |
| 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 | */ |
no test coverage detected