| 2621 | */ |
| 2622 | |
| 2623 | static void |
| 2624 | do_set_options(http_t *http, /* I - HTTP connection */ |
| 2625 | int is_class) /* I - Set options for class? */ |
| 2626 | { |
| 2627 | int i, j, k, m; /* Looping vars */ |
| 2628 | int have_options; /* Have options? */ |
| 2629 | ipp_t *request, /* IPP request */ |
| 2630 | *response; /* IPP response */ |
| 2631 | ipp_attribute_t *attr; /* IPP attribute */ |
| 2632 | char uri[HTTP_MAX_URI]; /* Job URI */ |
| 2633 | const char *var; /* Variable value */ |
| 2634 | const char *printer; /* Printer printer name */ |
| 2635 | const char *filename; /* PPD filename */ |
| 2636 | char tempfile[1024]; /* Temporary filename */ |
| 2637 | cups_file_t *in, /* Input file */ |
| 2638 | *out; /* Output file */ |
| 2639 | char line[1024], /* Line from PPD file */ |
| 2640 | value[1024], /* Option value */ |
| 2641 | keyword[1024], /* Keyword from Default line */ |
| 2642 | *keyptr; /* Pointer into keyword... */ |
| 2643 | ppd_file_t *ppd; /* PPD file */ |
| 2644 | ppd_group_t *group; /* Option group */ |
| 2645 | ppd_option_t *option; /* Option */ |
| 2646 | ppd_coption_t *coption; /* Custom option */ |
| 2647 | ppd_cparam_t *cparam; /* Custom parameter */ |
| 2648 | ppd_attr_t *ppdattr; /* PPD attribute */ |
| 2649 | const char *title; /* Page title */ |
| 2650 | |
| 2651 | |
| 2652 | title = cgiText(is_class ? _("Set Class Options") : _("Set Printer Options")); |
| 2653 | |
| 2654 | fprintf(stderr, "DEBUG: do_set_options(http=%p, is_class=%d)\n", http, |
| 2655 | is_class); |
| 2656 | |
| 2657 | /* |
| 2658 | * Get the printer name... |
| 2659 | */ |
| 2660 | |
| 2661 | if ((printer = cgiGetTextfield("PRINTER_NAME")) != NULL) |
| 2662 | httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL, |
| 2663 | "localhost", 0, is_class ? "/classes/%s" : "/printers/%s", |
| 2664 | printer); |
| 2665 | else |
| 2666 | { |
| 2667 | cgiSetVariable("ERROR", cgiText(_("Missing form variable"))); |
| 2668 | cgiStartHTML(title); |
| 2669 | cgiCopyTemplateLang("error.tmpl"); |
| 2670 | cgiEndHTML(); |
| 2671 | return; |
| 2672 | } |
| 2673 | |
| 2674 | fprintf(stderr, "DEBUG: printer=\"%s\", uri=\"%s\"...\n", printer, uri); |
| 2675 | |
| 2676 | /* |
| 2677 | * If the user clicks on the Auto-Configure button, send an AutoConfigure |
| 2678 | * command file to the printer... |
| 2679 | */ |
| 2680 |
no test coverage detected