| 602 | */ |
| 603 | |
| 604 | static void |
| 605 | do_am_printer(http_t *http, /* I - HTTP connection */ |
| 606 | int modify) /* I - Modify the printer? */ |
| 607 | { |
| 608 | int i; /* Looping var */ |
| 609 | ipp_attribute_t *attr; /* Current attribute */ |
| 610 | ipp_t *request, /* IPP request */ |
| 611 | *response, /* IPP response */ |
| 612 | *oldinfo; /* Old printer information */ |
| 613 | const cgi_file_t *file; /* Uploaded file, if any */ |
| 614 | const char *var; /* CGI variable */ |
| 615 | char *ppd_name = NULL; /* Pointer to PPD name */ |
| 616 | char uri[HTTP_MAX_URI], /* Device or printer URI */ |
| 617 | *uriptr, /* Pointer into URI */ |
| 618 | evefile[1024] = ""; /* IPP Everywhere PPD file */ |
| 619 | int maxrate; /* Maximum baud rate */ |
| 620 | char baudrate[255]; /* Baud rate string */ |
| 621 | const char *name, /* Pointer to class name */ |
| 622 | *ptr; /* Pointer to CGI variable */ |
| 623 | const char *title; /* Title of page */ |
| 624 | static int baudrates[] = /* Baud rates */ |
| 625 | { |
| 626 | 1200, |
| 627 | 2400, |
| 628 | 4800, |
| 629 | 9600, |
| 630 | 19200, |
| 631 | 38400, |
| 632 | 57600, |
| 633 | 115200, |
| 634 | 230400, |
| 635 | 460800 |
| 636 | }; |
| 637 | |
| 638 | |
| 639 | ptr = cgiGetVariable("DEVICE_URI"); |
| 640 | fprintf(stderr, "DEBUG: do_am_printer: DEVICE_URI=\"%s\"\n", |
| 641 | ptr ? ptr : "(null)"); |
| 642 | |
| 643 | title = cgiText(modify ? _("Modify Printer") : _("Add Printer")); |
| 644 | |
| 645 | if (modify) |
| 646 | { |
| 647 | /* |
| 648 | * Build an IPP_GET_PRINTER_ATTRIBUTES request, which requires the |
| 649 | * following attributes: |
| 650 | * |
| 651 | * attributes-charset |
| 652 | * attributes-natural-language |
| 653 | * printer-uri |
| 654 | */ |
| 655 | |
| 656 | request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES); |
| 657 | |
| 658 | httpAssembleURIf(HTTP_URI_CODING_ALL, uri, sizeof(uri), "ipp", NULL, |
| 659 | "localhost", 0, "/printers/%s", |
| 660 | cgiGetTextfield("PRINTER_NAME")); |
| 661 | ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", |
no test coverage detected