/*
- * "$Id: classes.c,v 1.8 1999/06/25 12:35:32 mike Exp $"
+ * "$Id: classes.c,v 1.9 1999/06/25 12:53:00 mike Exp $"
*
* Printer class routines for the Common UNIX Printing System (CUPS).
*
*/
if ((c = AddPrinter(name)) != NULL)
+ {
c->type = CUPS_PRINTER_CLASS;
+ sprintf(c->uri, "ipp://%s:%d/classes/%s", ServerName,
+ ntohs(Listeners[0].address.sin_port), name);
+ SetPrinterAttrs(c);
+ }
return (c);
}
/*
- * End of "$Id: classes.c,v 1.8 1999/06/25 12:35:32 mike Exp $".
+ * End of "$Id: classes.c,v 1.9 1999/06/25 12:53:00 mike Exp $".
*/
/*
- * "$Id: client.c,v 1.25 1999/06/21 19:43:48 mike Exp $"
+ * "$Id: client.c,v 1.26 1999/06/25 12:53:00 mike Exp $"
*
* Client routines for the Common UNIX Printing System (CUPS) scheduler.
*
static char lang[1024]; /* LANG env variable */
static char content_length[1024]; /* CONTENT_LENGTH env variable */
static char content_type[1024]; /* CONTENT_TYPE env variable */
+ static char ipp_port[1024]; /* Default listen port */
static char server_port[1024]; /* Default listen port */
static char server_name[1024]; /* Default listen hostname */
static char remote_host[1024]; /* REMOTE_HOST env variable */
gethostname(hostname, sizeof(hostname) - 1);
sprintf(lang, "LANG=%s", con->language ? con->language->language : "C");
+ sprintf(ipp_port, "IPP_PORT=%d", ntohs(con->http.hostaddr.sin_port));
sprintf(server_port, "SERVER_PORT=%d", ntohs(con->http.hostaddr.sin_port));
sprintf(server_name, "SERVER_NAME=%s", hostname);
sprintf(remote_host, "REMOTE_HOST=%s", con->http.hostname);
envp[1] = "SERVER_SOFTWARE=CUPS/1.0";
envp[2] = "GATEWAY_INTERFACE=CGI/1.1";
envp[3] = "SERVER_PROTOCOL=HTTP/1.1";
- envp[4] = server_name;
- envp[5] = server_port;
- envp[6] = remote_host;
- envp[7] = remote_user;
- envp[8] = lang;
- envp[9] = "TZ=GMT";
- envp[10] = tmpdir;
+ envp[4] = ipp_port;
+ envp[5] = server_name;
+ envp[6] = server_port;
+ envp[7] = remote_host;
+ envp[8] = remote_user;
+ envp[9] = lang;
+ envp[10] = "TZ=GMT";
+ envp[11] = tmpdir;
if (con->operation == HTTP_GET)
{
- envp[11] = "REQUEST_METHOD=GET";
- envp[12] = NULL;
+ envp[12] = "REQUEST_METHOD=GET";
+ envp[13] = NULL;
}
else
{
sprintf(content_type, "CONTENT_TYPE=%s",
con->http.fields[HTTP_FIELD_CONTENT_TYPE]);
- envp[11] = "REQUEST_METHOD=POST";
- envp[12] = content_length;
- envp[13] = content_type;
- envp[14] = NULL;
+ envp[12] = "REQUEST_METHOD=POST";
+ envp[13] = content_length;
+ envp[14] = content_type;
+ envp[15] = NULL;
}
/*
/*
- * End of "$Id: client.c,v 1.25 1999/06/21 19:43:48 mike Exp $".
+ * End of "$Id: client.c,v 1.26 1999/06/25 12:53:00 mike Exp $".
*/
/*
- * "$Id: printers.c,v 1.29 1999/06/25 12:30:47 mike Exp $"
+ * "$Id: printers.c,v 1.30 1999/06/25 12:53:01 mike Exp $"
*
* Printer routines for the Common UNIX Printing System (CUPS).
*
strcpy(p->name, name);
strcpy(p->hostname, ServerName);
+ sprintf(p->uri, "ipp://%s:%d/printers/%s", ServerName,
+ ntohs(Listeners[0].address.sin_port), name);
+
p->state = IPP_PRINTER_STOPPED;
p->accepting = 0;
p->filetype = mimeAddType(MimeDatabase, "printer", name);
if ((super[0] == '*' || strcmp((*temptype)->super, super) == 0) &&
(type[0] == '*' || strcmp((*temptype)->type, type) == 0))
{
- DEBUG_printf(("Adding filter %s/%s %s/%s %d %s\n", (*temptype)->super,
- (*temptype)->type, p->filetype->super, p->filetype->type,
- cost, program));
+ LogMessage(LOG_DEBUG, "Adding filter %s/%s %s/%s %d %s",
+ (*temptype)->super, (*temptype)->type,
+ p->filetype->super, p->filetype->type,
+ cost, program);
mimeAddFilter(MimeDatabase, *temptype, p->filetype, cost, program);
}
}
p->attrs = ippNew();
- if (p->type & CUPS_PRINTER_CLASS)
- sprintf(p->uri, "ipp://%s:%d/classes/%s", ServerName,
- ntohs(Listeners[0].address.sin_port), p->name);
- else
- sprintf(p->uri, "ipp://%s:%d/printers/%s", ServerName,
- ntohs(Listeners[0].address.sin_port), p->name);
ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_URI, "printer-uri-supported",
NULL, p->uri);
ippAddString(p->attrs, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
/*
- * End of "$Id: printers.c,v 1.29 1999/06/25 12:30:47 mike Exp $".
+ * End of "$Id: printers.c,v 1.30 1999/06/25 12:53:01 mike Exp $".
*/