Comparar commits
1 Commits
| Autor | SHA1 | Data | |
|---|---|---|---|
| 45b1118fc2 |
@@ -61,6 +61,7 @@ install:
|
||||
(cd data; make install)
|
||||
(cd doc; make install)
|
||||
(cd fonts; make install)
|
||||
(cd ppd; make install)
|
||||
|
||||
#
|
||||
# End of "$Id$".
|
||||
|
||||
@@ -46,6 +46,8 @@ clean:
|
||||
#
|
||||
|
||||
install:
|
||||
-$(MKDIR) $(SERVERROOT)/cgi-bin
|
||||
$(CP) $(TARGETS) $(SERVERROOT)/cgi-bin
|
||||
|
||||
#
|
||||
# printers.cgi
|
||||
|
||||
+1
-1
@@ -54,7 +54,7 @@ install:
|
||||
else \
|
||||
$(CP) $$file $(SERVERROOT)/conf ; \
|
||||
fi ; \
|
||||
end
|
||||
done
|
||||
|
||||
#
|
||||
# End of "$Id$".
|
||||
|
||||
+9
-9
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# "$Id: classes.conf 320 1999-05-13 20:40:14Z mike $"
|
||||
# "$Id: classes.conf 333 1999-05-17 18:03:40Z mike $"
|
||||
#
|
||||
# Sample class configuration file for the Common UNIX Printing System
|
||||
# (CUPS) scheduler.
|
||||
@@ -40,33 +40,33 @@
|
||||
# the default.
|
||||
#
|
||||
|
||||
<Class sample>
|
||||
#<Class sample>
|
||||
#
|
||||
# Info: the description for the class.
|
||||
#
|
||||
|
||||
Info Acme LaserPrint 1000 Printers
|
||||
#Info Acme LaserPrint 1000 Printers
|
||||
|
||||
#
|
||||
# MoreInfo: a URL for more information on the printer.
|
||||
#
|
||||
|
||||
MoreInfo http://www.acme.com/lp1000.html
|
||||
#MoreInfo http://www.acme.com/lp1000.html
|
||||
|
||||
#
|
||||
# Location: the location of the printer.
|
||||
#
|
||||
|
||||
Location Room 101 in the activities building
|
||||
#Location Room 101 in the activities building
|
||||
|
||||
#
|
||||
# Printer: adds a printer to the class.
|
||||
#
|
||||
|
||||
Printer sample@host1
|
||||
Printer sample@host2
|
||||
</Class>
|
||||
#Printer sample
|
||||
#Printer sample@host2
|
||||
#</Class>
|
||||
|
||||
#
|
||||
# End of "$Id: classes.conf 320 1999-05-13 20:40:14Z mike $".
|
||||
# End of "$Id: classes.conf 333 1999-05-17 18:03:40Z mike $".
|
||||
#
|
||||
|
||||
+15
-7
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# "$Id: cupsd.conf 327 1999-05-14 17:03:06Z mike $"
|
||||
# "$Id: cupsd.conf 349 1999-05-21 20:53:02Z mike $"
|
||||
#
|
||||
# Sample configuration file for the Common UNIX Printing System (CUPS)
|
||||
# scheduler.
|
||||
@@ -92,7 +92,7 @@ SystemGroup sys
|
||||
# By default the compiled-in value.
|
||||
#
|
||||
|
||||
#ServerRoot /var/spool/cups
|
||||
#ServerRoot /var/cups
|
||||
|
||||
#
|
||||
# AccessLog: the access log file; if this does not start with a leading /
|
||||
@@ -110,6 +110,14 @@ SystemGroup sys
|
||||
|
||||
#ErrorLog logs/error_log
|
||||
|
||||
#
|
||||
# PageLog: the page log file; if this does not start with a leading /
|
||||
# then it is assumed to be relative to ServerRoot. By default set to
|
||||
# "logs/page_log"
|
||||
#
|
||||
|
||||
#PageLog logs/page_log
|
||||
|
||||
#
|
||||
# LogLevel: controls the number of messages logged to the ErrorLog
|
||||
# file and can be one of the following:
|
||||
@@ -121,21 +129,21 @@ SystemGroup sys
|
||||
# none Log nothing.
|
||||
#
|
||||
|
||||
LogLevel warn
|
||||
LogLevel info
|
||||
|
||||
#
|
||||
# MaxLogSize: controls the maximum size of each log file before they are
|
||||
# rotated. Defaults to 1048576 (1MB). Set to 0 to disable log rotating.
|
||||
#
|
||||
|
||||
#MaxLogSize: 0
|
||||
#MaxLogSize 0
|
||||
|
||||
#
|
||||
# MaxRequestSize: controls the maximum size of print files. Set to 0 to
|
||||
# disable this feature (defaults to 0.)
|
||||
#
|
||||
|
||||
#MaxRequestSize: 0
|
||||
#MaxRequestSize 0
|
||||
|
||||
#
|
||||
# HostNameLookups: whether or not to do lookups on IP addresses to get a
|
||||
@@ -269,7 +277,7 @@ LogLevel warn
|
||||
# supported.
|
||||
#
|
||||
# AuthClass: the authorization class; currently only "Anonymous", "User",
|
||||
# "System" (valid user belonging to group SystemGroupName), and "Group"
|
||||
# "System" (valid user belonging to group SystemGroup), and "Group"
|
||||
# (valid user belonging to the specified group) are supported.
|
||||
#
|
||||
# AuthGroupName: the group name for "Group" authorization.
|
||||
@@ -320,5 +328,5 @@ Allow From 127.0.0.1
|
||||
</Location>
|
||||
|
||||
#
|
||||
# End of "$Id: cupsd.conf 327 1999-05-14 17:03:06Z mike $".
|
||||
# End of "$Id: cupsd.conf 349 1999-05-21 20:53:02Z mike $".
|
||||
#
|
||||
|
||||
+8
-20
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# "$Id: printers.conf 320 1999-05-13 20:40:14Z mike $"
|
||||
# "$Id: printers.conf 334 1999-05-17 18:11:26Z mike $"
|
||||
#
|
||||
# Sample printer configuration file for the Common UNIX Printing System
|
||||
# (CUPS) scheduler.
|
||||
@@ -40,24 +40,24 @@
|
||||
# default.
|
||||
#
|
||||
|
||||
<Printer sample>
|
||||
#<Printer sample>
|
||||
#
|
||||
# Info: the description for the printer.
|
||||
#
|
||||
|
||||
Info Acme LaserPrint 1000
|
||||
#Info Acme LaserPrint 1000
|
||||
|
||||
#
|
||||
# MoreInfo: a URL for more information on the printer.
|
||||
#
|
||||
|
||||
MoreInfo http://www.acme.com/lp1000.html
|
||||
#MoreInfo http://www.acme.com/lp1000.html
|
||||
|
||||
#
|
||||
# Location: the location of the printer.
|
||||
#
|
||||
|
||||
Location Room 101 in the activities building
|
||||
#Location Room 101 in the activities building
|
||||
|
||||
#
|
||||
# DeviceURI: the device URI for this printer.
|
||||
@@ -73,18 +73,6 @@ Location Room 101 in the activities building
|
||||
#DeviceURI ipp://hostname/path
|
||||
#DeviceURI smb://hostname/printer
|
||||
|
||||
#
|
||||
# AddFilter: adds a filter for this printer. Format is:
|
||||
#
|
||||
# AddFilter from-type cost program
|
||||
#
|
||||
# Filter programs must accept the standard filter options outlined in
|
||||
# the CUPS documentation. A filter program of "-" means that the
|
||||
# two types are equivalent.
|
||||
#
|
||||
|
||||
AddFilter application/cups-postscript 0 -
|
||||
|
||||
#
|
||||
# State: sets the initial state of the printer. Can be one of the
|
||||
# following:
|
||||
@@ -93,9 +81,9 @@ AddFilter application/cups-postscript 0 -
|
||||
# Stopped - Printer is disabled but accepting new jobs.
|
||||
#
|
||||
|
||||
State Idle
|
||||
</Printer>
|
||||
#State Idle
|
||||
#</Printer>
|
||||
|
||||
#
|
||||
# End of "$Id: printers.conf 320 1999-05-13 20:40:14Z mike $".
|
||||
# End of "$Id: printers.conf 334 1999-05-17 18:11:26Z mike $".
|
||||
#
|
||||
|
||||
@@ -68,6 +68,12 @@
|
||||
|
||||
#undef HAVE_SHADOW_H
|
||||
|
||||
/*
|
||||
* Do we have <crypt.h>?
|
||||
*/
|
||||
|
||||
#undef HAVE_CRYPT_H
|
||||
|
||||
/*
|
||||
* Do we have the strXXX() functions?
|
||||
*/
|
||||
|
||||
+13
-16
@@ -60,6 +60,7 @@ fi
|
||||
|
||||
dnl Check for libraries...
|
||||
AC_CHECK_LIB(c,crypt,LIBS="$LIBS",AC_CHECK_LIB(crypt,crypt))
|
||||
AC_CHECK_HEADER(crypt.h, AC_DEFINE(HAVE_CRYPT_H))
|
||||
AC_CHECK_LIB(sec,getspent)
|
||||
AC_CHECK_LIB(socket,socket,
|
||||
if test "$uname" != "IRIX"; then
|
||||
@@ -76,22 +77,18 @@ fi)
|
||||
|
||||
IMGLIBS=""
|
||||
AC_SUBST(IMGLIBS)
|
||||
AC_CHECK_LIB(jpeg,jpeg_destroy_decompress,
|
||||
AC_CHECK_HEADER(jpeglib.h,
|
||||
AC_DEFINE(HAVE_LIBJPEG)
|
||||
IMGLIBS="$IMGLIBS -ljpeg"))
|
||||
AC_CHECK_LIB(png,png_read_info,
|
||||
AC_CHECK_HEADER(png.h,
|
||||
AC_DEFINE(HAVE_LIBPNG)
|
||||
IMGLIBS="$IMGLIBS -lpng"))
|
||||
AC_CHECK_LIB(tiff,TIFFGetField,
|
||||
AC_CHECK_HEADER(tiff.h,
|
||||
AC_DEFINE(HAVE_LIBTIFF)
|
||||
IMGLIBS="$IMGLIBS -ltiff"))
|
||||
AC_CHECK_LIB(z,deflate,
|
||||
AC_CHECK_HEADER(zlib.h,
|
||||
AC_DEFINE(HAVE_LIBZ)
|
||||
IMGLIBS="$IMGLIBS -lz"))
|
||||
AC_CHECK_HEADER(jpeglib.h,
|
||||
AC_DEFINE(HAVE_LIBJPEG)
|
||||
IMGLIBS="$IMGLIBS -ljpeg")
|
||||
AC_CHECK_HEADER(zlib.h,
|
||||
AC_DEFINE(HAVE_LIBZ)
|
||||
IMGLIBS="$IMGLIBS -lz")
|
||||
AC_CHECK_HEADER(png.h,
|
||||
AC_DEFINE(HAVE_LIBPNG)
|
||||
IMGLIBS="$IMGLIBS -lpng")
|
||||
AC_CHECK_HEADER(tiff.h,
|
||||
AC_DEFINE(HAVE_LIBTIFF)
|
||||
IMGLIBS="$IMGLIBS -ltiff")
|
||||
|
||||
dnl Checks for header files.
|
||||
AC_HEADER_STDC
|
||||
|
||||
+3
-2
@@ -105,8 +105,9 @@ typedef struct /**** Printer Options ****/
|
||||
*/
|
||||
|
||||
extern int cupsCancelJob(char *printer, int job);
|
||||
extern ipp_t *cupsDoRequest(http_t *http, ipp_t *request,
|
||||
char *resource);
|
||||
#define cupsDoRequest(http,request,resource) cupsDoFileRequest((http),(request),(resource),NULL)
|
||||
extern ipp_t *cupsDoFileRequest(http_t *http, ipp_t *request,
|
||||
char *resource, char *filename);
|
||||
extern int cupsGetClasses(char ***classes);
|
||||
extern char *cupsGetPPD(char *printer);
|
||||
extern char *cupsGetDefault(void);
|
||||
|
||||
+13
-45
@@ -27,38 +27,6 @@
|
||||
* mimeFilter() - Find the fastest way to convert from one type to another.
|
||||
* compare() - Compare two filter types...
|
||||
* lookup() - Lookup a filter...
|
||||
*
|
||||
* Revision History:
|
||||
*
|
||||
* $Log: filter.c,v $
|
||||
* Revision 1.6 1999/04/21 14:49:49 mike
|
||||
* cupsDoRequest() needed to retry requests when doing authorization.
|
||||
*
|
||||
* mimeFilter() didn't always return the least-cost filter.
|
||||
*
|
||||
* Revision 1.5 1999/03/01 20:51:51 mike
|
||||
* Code cleanup - removed extraneous semi-colons...
|
||||
*
|
||||
* Revision 1.4 1999/02/05 17:40:51 mike
|
||||
* Added IPP client read/write code.
|
||||
*
|
||||
* Added string functions missing from some UNIXs.
|
||||
*
|
||||
* Added option parsing functions.
|
||||
*
|
||||
* Added IPP convenience functions (not implemented yet).
|
||||
*
|
||||
* Updated source files to use local string.h as needed (for
|
||||
* missing string functions)
|
||||
*
|
||||
* Revision 1.3 1999/01/24 14:18:43 mike
|
||||
* Check-in prior to CVS use.
|
||||
*
|
||||
* Revision 1.2 1998/08/06 14:38:38 mike
|
||||
* Finished coding and testing for CUPS 1.0.
|
||||
*
|
||||
* Revision 1.1 1998/06/11 20:50:53 mike
|
||||
* Initial revision
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -165,12 +133,6 @@ mimeAddFilter(mime_t *mime, /* I - MIME database */
|
||||
|
||||
/*
|
||||
* 'mimeFilter()' - Find the fastest way to convert from one type to another.
|
||||
*
|
||||
* NOTE: Currently we do not use the "cost" field provided with each filter.
|
||||
* This will be addressed in a future version of this function. For
|
||||
* now all filters are assumed to be equally costly and we find the
|
||||
* smallest number of filters to run that satisfies the filter
|
||||
* requirements.
|
||||
*/
|
||||
|
||||
mime_filter_t * /* O - Array of filters to run */
|
||||
@@ -179,9 +141,11 @@ mimeFilter(mime_t *mime, /* I - MIME database */
|
||||
mime_type_t *dst, /* I - Destination file type */
|
||||
int *num_filters) /* O - Number of filters to run */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
int num_temp, /* Number of temporary filters */
|
||||
num_mintemp; /* Current minimum */
|
||||
int i, j, /* Looping vars */
|
||||
num_temp, /* Number of temporary filters */
|
||||
num_mintemp, /* Number of filters in the minimum */
|
||||
cost, /* Current cost */
|
||||
mincost; /* Current minimum */
|
||||
mime_filter_t *temp, /* Temporary filter */
|
||||
*mintemp, /* Current minimum */
|
||||
*mincurrent, /* Current filter for minimum */
|
||||
@@ -220,8 +184,8 @@ mimeFilter(mime_t *mime, /* I - MIME database */
|
||||
* OK, now look for filters from the source type to any other type...
|
||||
*/
|
||||
|
||||
num_mintemp = 100000;
|
||||
mintemp = NULL;
|
||||
mincost = 9999999;
|
||||
mintemp = NULL;
|
||||
|
||||
for (i = mime->num_filters, current = mime->filters; i > 0; i --, current ++)
|
||||
if (current->src == src)
|
||||
@@ -239,13 +203,17 @@ mimeFilter(mime_t *mime, /* I - MIME database */
|
||||
* any...)
|
||||
*/
|
||||
|
||||
if (num_temp < num_mintemp)
|
||||
for (j = 0, cost = 0; j < num_temp; j ++)
|
||||
cost += temp->cost;
|
||||
|
||||
if (cost < mincost)
|
||||
{
|
||||
if (mintemp != NULL)
|
||||
free(mintemp);
|
||||
|
||||
num_mintemp = num_temp;
|
||||
mincost = cost;
|
||||
mintemp = temp;
|
||||
num_mintemp = num_temp;
|
||||
mincurrent = current;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -768,7 +768,6 @@ httpWrite(http_t *http, /* I - HTTP data */
|
||||
bytes = send(http->fd, buffer, length, 0);
|
||||
if (bytes < 0)
|
||||
{
|
||||
perror("httpWrite");
|
||||
DEBUG_puts("httpWrite: error writing data...\n");
|
||||
return (-1);
|
||||
}
|
||||
|
||||
+2
-1
@@ -191,7 +191,8 @@ typedef enum /**** IPP operations... ****/
|
||||
CUPS_ADD_CLASS,
|
||||
CUPS_DELETE_CLASS,
|
||||
CUPS_ACCEPT_JOBS,
|
||||
CUPS_REJECT_JOBS
|
||||
CUPS_REJECT_JOBS,
|
||||
CUPS_SET_DEFAULT
|
||||
} ipp_op_t;
|
||||
|
||||
typedef enum /**** IPP status codes... ****/
|
||||
|
||||
+6
-16
@@ -279,28 +279,18 @@ cupsMarkOptions(ppd_file_t *ppd, /* I - PPD file */
|
||||
{
|
||||
int i; /* Looping var */
|
||||
int conflict; /* Option conflicts */
|
||||
char media_size[64]; /* Updated media size */
|
||||
|
||||
|
||||
conflict = 0;
|
||||
|
||||
for (i = num_options; i > 0; i --, options ++)
|
||||
if (strcmp(options->name, "media-size") == 0)
|
||||
if (strcmp(options->name, "media") == 0)
|
||||
{
|
||||
strcpy(media_size, options->value);
|
||||
|
||||
if (strncmp(options->value, "us-", 3) == 0)
|
||||
{
|
||||
strcpy(media_size, media_size + 3);
|
||||
media_size[0] = toupper(media_size[0]);
|
||||
}
|
||||
else if (strncmp(options->value, "iso-", 4) == 0)
|
||||
{
|
||||
strcpy(media_size, media_size + 4);
|
||||
media_size[0] = toupper(media_size[0]);
|
||||
}
|
||||
|
||||
if (ppdMarkOption(ppd, "PageSize", media_size))
|
||||
if (ppdMarkOption(ppd, "PageSize", options->value))
|
||||
conflict = 1;
|
||||
if (ppdMarkOption(ppd, "InputSlot", options->value))
|
||||
conflict = 1;
|
||||
if (ppdMarkOption(ppd, "MediaType", options->value))
|
||||
conflict = 1;
|
||||
}
|
||||
else if (strcmp(options->name, "sides") == 0)
|
||||
|
||||
@@ -408,6 +408,7 @@ ppdOpen(FILE *fp) /* I - File to read from */
|
||||
float order; /* Order dependency number */
|
||||
ppd_section_t section; /* Order dependency section */
|
||||
ppd_profile_t *profile; /* Pointer to color profile */
|
||||
char **filter; /* Pointer to filter */
|
||||
|
||||
|
||||
/*
|
||||
@@ -590,6 +591,24 @@ ppdOpen(FILE *fp) /* I - File to read from */
|
||||
profile->matrix[2] + 0, profile->matrix[2] + 1,
|
||||
profile->matrix[2] + 2);
|
||||
}
|
||||
else if (strcmp(keyword, "cupsFilter") == 0)
|
||||
{
|
||||
if (ppd->num_filters == 0)
|
||||
filter = malloc(sizeof(char *));
|
||||
else
|
||||
filter = realloc(ppd->filters, sizeof(char *) * (ppd->num_filters + 1));
|
||||
|
||||
ppd->filters = filter;
|
||||
filter += ppd->num_filters;
|
||||
ppd->num_filters ++;
|
||||
|
||||
/*
|
||||
* Copy filter string and prevent it from being freed below...
|
||||
*/
|
||||
|
||||
*filter = string;
|
||||
string = NULL;
|
||||
}
|
||||
else if (strcmp(keyword, "VariablePaperSize") == 0 &&
|
||||
strcmp(string, "True") == 0)
|
||||
{
|
||||
|
||||
@@ -194,6 +194,8 @@ typedef struct /**** Files ****/
|
||||
char **fonts; /* Pre-loaded fonts */
|
||||
int num_profiles; /* Number of sRGB color profiles */
|
||||
ppd_profile_t *profiles; /* sRGB color profiles */
|
||||
int num_filters; /* Number of filters */
|
||||
char **filters; /* Filter strings... */
|
||||
} ppd_file_t;
|
||||
|
||||
|
||||
|
||||
+167
-150
@@ -23,14 +23,14 @@
|
||||
*
|
||||
* Contents:
|
||||
*
|
||||
* cupsCancelJob() - Cancel a print job.
|
||||
* cupsDoRequest() - Do an IPP request...
|
||||
* cupsGetClasses() - Get a list of printer classes.
|
||||
* cupsGetDefault() - Get the default printer or class.
|
||||
* cupsGetPPD() - Get the PPD file for a printer.
|
||||
* cupsGetPrinters() - Get a list of printers.
|
||||
* cupsPrintFile() - Print a file to a printer or class.
|
||||
* cups_connect() - Connect to the specified host...
|
||||
* cupsCancelJob() - Cancel a print job.
|
||||
* cupsDoFileRequest() - Do an IPP request...
|
||||
* cupsGetClasses() - Get a list of printer classes.
|
||||
* cupsGetDefault() - Get the default printer or class.
|
||||
* cupsGetPPD() - Get the PPD file for a printer.
|
||||
* cupsGetPrinters() - Get a list of printers.
|
||||
* cupsPrintFile() - Print a file to a printer or class.
|
||||
* cups_connect() - Connect to the specified host...
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -133,17 +133,22 @@ cupsCancelJob(char *name, /* I - Name of printer or class */
|
||||
|
||||
|
||||
/*
|
||||
* 'cupsDoRequest()' - Do an IPP request...
|
||||
* 'cupsDoFileRequest()' - Do an IPP request...
|
||||
*/
|
||||
|
||||
ipp_t * /* O - Response data */
|
||||
cupsDoRequest(http_t *http, /* I - HTTP connection to server */
|
||||
ipp_t *request, /* I - IPP request */
|
||||
char *resource) /* I - HTTP resource for POST */
|
||||
ipp_t * /* O - Response data */
|
||||
cupsDoFileRequest(http_t *http, /* I - HTTP connection to server */
|
||||
ipp_t *request, /* I - IPP request */
|
||||
char *resource, /* I - HTTP resource for POST */
|
||||
char *filename) /* I - File to send or NULL */
|
||||
{
|
||||
ipp_t *response; /* IPP response data */
|
||||
char length[255]; /* Content-Length field */
|
||||
http_status_t status; /* Status of HTTP request */
|
||||
FILE *file; /* File to send */
|
||||
struct stat fileinfo; /* File information */
|
||||
int bytes; /* Number of bytes read/written */
|
||||
char buffer[8192]; /* Output buffer */
|
||||
#if !defined(WIN32) && !defined(__EMX__)
|
||||
char *password, /* Password string */
|
||||
plain[255], /* Plaintext username:password */
|
||||
@@ -154,99 +159,178 @@ cupsDoRequest(http_t *http, /* I - HTTP connection to server */
|
||||
/* Authorization string */
|
||||
|
||||
|
||||
DEBUG_printf(("cupsDoRequest(%08x, %08s, \'%s\')\n", http, request, resource));
|
||||
DEBUG_printf(("cupsDoFileRequest(%08x, %08s, \'%s\', \'%s\')\n",
|
||||
http, request, resource, filename ? filename : "(null)"));
|
||||
|
||||
/*
|
||||
* Setup the HTTP variables needed...
|
||||
* See if we have a file to send...
|
||||
*/
|
||||
|
||||
sprintf(length, "%d", ippLength(request));
|
||||
httpClearFields(http);
|
||||
httpSetField(http, HTTP_FIELD_CONTENT_LENGTH, length);
|
||||
httpSetField(http, HTTP_FIELD_CONTENT_TYPE, "application/ipp");
|
||||
httpSetField(http, HTTP_FIELD_AUTHORIZATION, authstring);
|
||||
|
||||
/*
|
||||
* Try the request...
|
||||
*/
|
||||
|
||||
if (httpPost(http, resource))
|
||||
if (httpPost(http, resource))
|
||||
if (filename != NULL)
|
||||
{
|
||||
if (stat(filename, &fileinfo))
|
||||
{
|
||||
/*
|
||||
* Can't get file information!
|
||||
*/
|
||||
|
||||
ippDelete(request);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* Send the IPP data and wait for the response...
|
||||
*/
|
||||
|
||||
ippWrite(http, request);
|
||||
|
||||
if ((status = httpUpdate(http)) == HTTP_UNAUTHORIZED)
|
||||
{
|
||||
/*
|
||||
* Flush any error message...
|
||||
*/
|
||||
|
||||
httpFlush(http);
|
||||
|
||||
#if !defined(WIN32) && !defined(__EMX__)
|
||||
if ((password = getpass("Password:")) != NULL)
|
||||
if ((file = fopen(filename, "rb")) == NULL)
|
||||
{
|
||||
/*
|
||||
* Got a password; now send it to the server...
|
||||
* Can't open file!
|
||||
*/
|
||||
|
||||
sprintf(plain, "%s:%s", cuserid(NULL), password);
|
||||
httpEncode64(encode, plain);
|
||||
sprintf(authstring, "Basic %s", encode);
|
||||
|
||||
httpClearFields(http);
|
||||
httpSetField(http, HTTP_FIELD_CONTENT_LENGTH, length);
|
||||
httpSetField(http, HTTP_FIELD_CONTENT_TYPE, "application/ipp");
|
||||
httpSetField(http, HTTP_FIELD_AUTHORIZATION, authstring);
|
||||
|
||||
if (httpPost(http, resource))
|
||||
httpPost(http, resource);
|
||||
request->state = IPP_IDLE;
|
||||
ippWrite(http, request);
|
||||
status = httpUpdate(http);
|
||||
ippDelete(request);
|
||||
return (NULL);
|
||||
}
|
||||
#endif /* !WIN32 && !__EMX__ */
|
||||
}
|
||||
|
||||
if (status != HTTP_OK)
|
||||
/*
|
||||
* Loop until we can send the request without authorization problems.
|
||||
*/
|
||||
|
||||
response = NULL;
|
||||
|
||||
while (response == NULL)
|
||||
{
|
||||
DEBUG_puts("cupsDoFileRequest: setup...");
|
||||
|
||||
/*
|
||||
* Flush any error message...
|
||||
* Setup the HTTP variables needed...
|
||||
*/
|
||||
|
||||
httpFlush(http);
|
||||
if (filename != NULL)
|
||||
sprintf(length, "%u", ippLength(request) + fileinfo.st_size);
|
||||
else
|
||||
sprintf(length, "%u", ippLength(request));
|
||||
|
||||
httpClearFields(http);
|
||||
httpSetField(http, HTTP_FIELD_CONTENT_LENGTH, length);
|
||||
httpSetField(http, HTTP_FIELD_CONTENT_TYPE, "application/ipp");
|
||||
httpSetField(http, HTTP_FIELD_AUTHORIZATION, authstring);
|
||||
|
||||
response = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Read the response...
|
||||
* Try the request...
|
||||
*/
|
||||
|
||||
response = ippNew();
|
||||
DEBUG_puts("cupsDoFileRequest: post...");
|
||||
|
||||
if (ippRead(http, response) == IPP_ERROR)
|
||||
if (httpPost(http, resource))
|
||||
if (httpPost(http, resource))
|
||||
break;
|
||||
|
||||
/*
|
||||
* Send the IPP data and wait for the response...
|
||||
*/
|
||||
|
||||
DEBUG_puts("cupsDoFileRequest: ipp write...");
|
||||
|
||||
request->state = IPP_IDLE;
|
||||
if (ippWrite(http, request) != IPP_ERROR)
|
||||
if (filename != NULL)
|
||||
{
|
||||
DEBUG_puts("cupsDoFileRequest: file write...");
|
||||
|
||||
/*
|
||||
* Send the file...
|
||||
*/
|
||||
|
||||
rewind(file);
|
||||
|
||||
while ((bytes = fread(buffer, 1, sizeof(buffer), file)) > 0)
|
||||
if (httpWrite(http, buffer, bytes) < bytes)
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the server's return status...
|
||||
*/
|
||||
|
||||
DEBUG_puts("cupsDoFileRequest: update...");
|
||||
|
||||
while ((status = httpUpdate(http)) == HTTP_CONTINUE);
|
||||
|
||||
#if !defined(WIN32) && !defined(__EMX__)
|
||||
if (status == HTTP_UNAUTHORIZED)
|
||||
{
|
||||
ippDelete(response);
|
||||
response = NULL;
|
||||
DEBUG_puts("cupsDoFileRequest: unauthorized...");
|
||||
|
||||
/*
|
||||
* Flush any remaining data...
|
||||
* Flush any error message...
|
||||
*/
|
||||
|
||||
httpFlush(http);
|
||||
|
||||
if ((password = getpass("Password:")) != NULL)
|
||||
{
|
||||
/*
|
||||
* Got a password; send it to the server...
|
||||
*/
|
||||
|
||||
if (!password[0])
|
||||
break;
|
||||
sprintf(plain, "%s:%s", cuserid(NULL), password);
|
||||
httpEncode64(encode, plain);
|
||||
sprintf(authstring, "Basic %s", encode);
|
||||
|
||||
continue;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
#endif /* !WIN32 && !__EMX__ */
|
||||
|
||||
if (status != HTTP_OK)
|
||||
{
|
||||
DEBUG_printf(("cupsDoFileRequest: error %d...\n", status));
|
||||
|
||||
/*
|
||||
* Flush any error message...
|
||||
*/
|
||||
|
||||
httpFlush(http);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* Read the response...
|
||||
*/
|
||||
|
||||
DEBUG_puts("cupsDoFileRequest: response...");
|
||||
|
||||
response = ippNew();
|
||||
|
||||
if (ippRead(http, response) == IPP_ERROR)
|
||||
{
|
||||
/*
|
||||
* Delete the response...
|
||||
*/
|
||||
|
||||
ippDelete(response);
|
||||
response = NULL;
|
||||
|
||||
/*
|
||||
* Flush any remaining data...
|
||||
*/
|
||||
|
||||
httpFlush(http);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Close the file if needed...
|
||||
*/
|
||||
|
||||
if (filename != NULL)
|
||||
fclose(file);
|
||||
|
||||
/*
|
||||
* Delete the original request and return the response...
|
||||
*/
|
||||
@@ -593,9 +677,6 @@ cupsPrintFile(char *name, /* I - Printer or class name */
|
||||
printer[HTTP_MAX_URI], /* Printer or class name */
|
||||
uri[HTTP_MAX_URI]; /* Printer URI */
|
||||
cups_lang_t *language; /* Language to use */
|
||||
struct stat filestats; /* File information */
|
||||
FILE *fp; /* File pointer */
|
||||
char buffer[8192]; /* Copy buffer */
|
||||
int jobid; /* New job ID */
|
||||
|
||||
|
||||
@@ -605,34 +686,17 @@ cupsPrintFile(char *name, /* I - Printer or class name */
|
||||
if (name == NULL || filename == NULL)
|
||||
return (0);
|
||||
|
||||
/*
|
||||
* See if the file exists and is readable...
|
||||
*/
|
||||
|
||||
if (stat(filename, &filestats))
|
||||
return (0);
|
||||
|
||||
if ((fp = fopen(filename, "rb")) == NULL)
|
||||
{
|
||||
DEBUG_puts("cupsPrintFile: Unable to open file!");
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup a connection and request data...
|
||||
*/
|
||||
|
||||
if ((request = ippNew()) == NULL)
|
||||
{
|
||||
fclose(fp);
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (!cups_connect(name, printer, hostname))
|
||||
{
|
||||
DEBUG_printf(("cupsPrintFile: Unable to open connection - %s.\n",
|
||||
strerror(errno)));
|
||||
fclose(fp);
|
||||
ippDelete(request);
|
||||
return (0);
|
||||
}
|
||||
@@ -806,76 +870,29 @@ cupsPrintFile(char *name, /* I - Printer or class name */
|
||||
}
|
||||
|
||||
/*
|
||||
* Setup the necessary HTTP fields...
|
||||
*/
|
||||
|
||||
httpClearFields(cups_server);
|
||||
httpSetField(cups_server, HTTP_FIELD_CONTENT_TYPE, "application/ipp");
|
||||
|
||||
sprintf(buffer, "%u", (unsigned)(ippLength(request) + filestats.st_size));
|
||||
httpSetField(cups_server, HTTP_FIELD_CONTENT_LENGTH, buffer);
|
||||
|
||||
/*
|
||||
* Finally, issue a POST request for the printer and send the IPP data and
|
||||
* file.
|
||||
* Try printing the file...
|
||||
*/
|
||||
|
||||
sprintf(uri, "/printers/%s", printer);
|
||||
|
||||
response = ippNew();
|
||||
|
||||
if (httpPost(cups_server, uri))
|
||||
if ((response = cupsDoFileRequest(cups_server, request, uri, filename)) == NULL)
|
||||
jobid = 0;
|
||||
else if (response->request.status.status_code > IPP_OK_CONFLICT)
|
||||
{
|
||||
DEBUG_puts("httpPost() failed.");
|
||||
DEBUG_printf(("IPP response code was 0x%x!\n",
|
||||
response->request.status.status_code));
|
||||
jobid = 0;
|
||||
}
|
||||
else if (ippWrite(cups_server, request) == IPP_ERROR)
|
||||
else if ((attr = ippFindAttribute(response, "job-id", IPP_TAG_INTEGER)) == NULL)
|
||||
{
|
||||
DEBUG_puts("ippWrite() failed.");
|
||||
DEBUG_puts("No job ID!");
|
||||
jobid = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
while ((i = fread(buffer, 1, sizeof(buffer), fp)) > 0)
|
||||
if (httpWrite(cups_server, buffer, i) < i)
|
||||
{
|
||||
DEBUG_puts("httpWrite() failed.");
|
||||
jobid = attr->values[0].integer;
|
||||
|
||||
fclose(fp);
|
||||
ippDelete(request);
|
||||
ippDelete(response);
|
||||
httpClose(cups_server);
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (httpUpdate(cups_server) == HTTP_ERROR)
|
||||
{
|
||||
DEBUG_puts("httpUpdate() failed.");
|
||||
jobid = 0;
|
||||
}
|
||||
else if ((ippRead(cups_server, response)) == IPP_ERROR)
|
||||
{
|
||||
DEBUG_puts("ippRead() failed.");
|
||||
jobid = 0;
|
||||
}
|
||||
else if (response->request.status.status_code > IPP_OK_CONFLICT)
|
||||
{
|
||||
DEBUG_printf(("IPP response code was 0x%x!\n",
|
||||
response->request.status.status_code));
|
||||
jobid = 0;
|
||||
}
|
||||
else if ((attr = ippFindAttribute(response, "job-id", IPP_TAG_INTEGER)) == NULL)
|
||||
{
|
||||
DEBUG_puts("No job ID!");
|
||||
jobid = 0;
|
||||
}
|
||||
else
|
||||
jobid = attr->values[0].integer;
|
||||
}
|
||||
|
||||
fclose(fp);
|
||||
ippDelete(request);
|
||||
ippDelete(response);
|
||||
if (response != NULL)
|
||||
ippDelete(response);
|
||||
|
||||
return (jobid);
|
||||
}
|
||||
|
||||
+25
-12
@@ -41,10 +41,11 @@ include ../Makedefs
|
||||
|
||||
DOCUMENTS = cmp.shtml idd.shtml sam.shtml sdd.shtml ssr.shtml \
|
||||
stp.shtml sum.shtml svd.shtml
|
||||
DOCIMAGES = images/navbar.gif
|
||||
DOCIMAGES = images/cups-block-diagram.gif images/cups-large.gif \
|
||||
images/cups-medium.gif images/cups-small.gif
|
||||
WEBPAGES = cups.css cupsdoc.css index.html documentation.html
|
||||
WEBIMAGES = images/navbar.gif images/printer-idle.gif \
|
||||
images/printer-processing.gif \
|
||||
WEBIMAGES = images/logo.gif images/navbar.gif \
|
||||
images/printer-idle.gif images/printer-processing.gif \
|
||||
images/printer-stopped.gif
|
||||
|
||||
#
|
||||
@@ -68,22 +69,34 @@ clean:
|
||||
#
|
||||
|
||||
install:
|
||||
-$(MKDIR) $(SERVERROOT)/doc
|
||||
$(CP) $(WEBPAGES) $(SERVERROOT)/doc
|
||||
$(CP) overview.html overview.pdf $(SERVERROOT)/doc
|
||||
$(CP) $(DOCUMENTS:.shtml=.html) $(SERVERROOT)/doc
|
||||
$(CP) $(DOCUMENTS:.shtml=.pdf) $(SERVERROOT)/doc
|
||||
-$(MKDIR) $(SERVERROOT)/doc/images
|
||||
$(CP) $(WEBIMAGES) $(SERVERROOT)/doc/images
|
||||
$(CP) $(DOCIMAGES) $(SERVERROOT)/doc/images
|
||||
-$(MKDIR) $(DATADIR)/doc
|
||||
$(CP) $(WEBPAGES) $(DATADIR)/doc
|
||||
$(CP) overview.html overview.pdf $(DATADIR)/doc
|
||||
$(CP) $(DOCUMENTS:.shtml=.html) $(DATADIR)/doc
|
||||
$(CP) $(DOCUMENTS:.shtml=.pdf) $(DATADIR)/doc
|
||||
-$(MKDIR) $(DATADIR)/doc/images
|
||||
$(CP) $(WEBIMAGES) $(DATADIR)/doc/images
|
||||
$(CP) $(DOCIMAGES) $(DATADIR)/doc/images
|
||||
|
||||
#
|
||||
# The overview PDF file gets special attention...
|
||||
# The overview, admin guide, and user's guide get special attention...
|
||||
#
|
||||
|
||||
overview.pdf: overview.html
|
||||
htmldoc --duplex --compression=9 --jpeg --webpage -f $@ $<
|
||||
|
||||
sam.html: sam.shtml
|
||||
htmldoc --title images/cups-large.gif -f $@ $<
|
||||
sam.pdf: sam.shtml
|
||||
htmldoc --title images/cups-large.gif --duplex --compression=9 \
|
||||
--jpeg -f $@ $<
|
||||
|
||||
sum.html: sum.shtml
|
||||
htmldoc --title images/cups-large.gif -f $@ $<
|
||||
sum.pdf: sum.shtml
|
||||
htmldoc --title images/cups-large.gif --duplex --compression=9 \
|
||||
--jpeg -f $@ $<
|
||||
|
||||
#
|
||||
# End of Makefile.
|
||||
#
|
||||
|
||||
+5
-2
@@ -118,6 +118,9 @@ with reduced functionality. </P>
|
||||
<P>CUPS adds network printer browsing and PostScript Printer
|
||||
Description ("PPD")-based printing options to support real world
|
||||
applications under UNIX. </P>
|
||||
<P>CUPS also includes a customized version of GNU GhostScript
|
||||
(currently based off GNU GhostScript 4.03) and an image file RIP that
|
||||
can be used to support non-PostScript printers. </P>
|
||||
<H2><A NAME=1_3>1.3 Document Overview</A></H2>
|
||||
This configuration management document is organized into the following
|
||||
sections:
|
||||
@@ -337,7 +340,7 @@ extension of ".h".
|
||||
the file, the purpose or nature of the source file, the copyright and
|
||||
licensing notice, and the functions contained in the file. The file
|
||||
name and revision information is provided by the CVS "$Id: cmp.shtml,v
|
||||
1.2 1999/05/13 20:40:40 mike Exp $" tag:
|
||||
1.3 1999/05/21 20:54:04 mike Exp $" tag:
|
||||
<UL>
|
||||
<PRE>
|
||||
/*
|
||||
@@ -373,7 +376,7 @@ name and revision information is provided by the CVS "$Id: cmp.shtml,v
|
||||
</PRE>
|
||||
</UL>
|
||||
The bottom of each source file shall contain a trailer giving the name
|
||||
of the file using the CVS "$Id: cmp.shtml,v 1.2 1999/05/13 20:40:40
|
||||
of the file using the CVS "$Id: cmp.shtml,v 1.3 1999/05/21 20:54:04
|
||||
mike Exp $" tag. The primary purpose of this is to mark the end of a
|
||||
source file; if the trailer is missing it is possible that code has
|
||||
been lost near the end of the file:
|
||||
|
||||
+139
-142
@@ -1,6 +1,6 @@
|
||||
%PDF-1.2
|
||||
%âãÏÓ
|
||||
1 0 obj<</Producer(htmldoc 2.0b1 Copyright 1997-1999 Michael Sweet, All Rights Reserved.)/CreationDate(D:19990514170117Z)/Title(CUPS Configuration Management Plan)/Author(Easy Software Products)>>endobj
|
||||
1 0 obj<</Producer(htmldoc 2.0b1 Copyright 1997-1999 Michael Sweet, All Rights Reserved.)/CreationDate(D:19990521210307Z)/Title(CUPS Configuration Management Plan)/Author(Easy Software Products)>>endobj
|
||||
2 0 obj<</Type/Encoding/BaseEncoding/WinAnsiEncoding>>endobj
|
||||
3 0 obj<</Type/Font/Subtype/Type1/BaseFont/Courier/Encoding 2 0 R>>endobj
|
||||
4 0 obj<</Type/Font/Subtype/Type1/BaseFont/Times-Roman/Encoding 2 0 R>>endobj
|
||||
@@ -16,9 +16,9 @@
|
||||
14 0 obj<</Subtype/Link/Rect[108.0 646.8 124.5 659.8]/Border[0 0 0]/Dest[198 0 R/XYZ null 658 0]>>endobj
|
||||
15 0 obj<</Subtype/Link/Rect[124.5 646.8 159.6 659.8]/Border[0 0 0]/Dest[198 0 R/XYZ null 658 0]>>endobj
|
||||
16 0 obj<</Subtype/Link/Rect[159.6 646.8 203.0 659.8]/Border[0 0 0]/Dest[198 0 R/XYZ null 658 0]>>endobj
|
||||
17 0 obj<</Subtype/Link/Rect[108.0 633.6 124.5 646.6]/Border[0 0 0]/Dest[198 0 R/XYZ null 474 0]>>endobj
|
||||
18 0 obj<</Subtype/Link/Rect[124.5 633.6 173.1 646.6]/Border[0 0 0]/Dest[198 0 R/XYZ null 474 0]>>endobj
|
||||
19 0 obj<</Subtype/Link/Rect[173.1 633.6 216.4 646.6]/Border[0 0 0]/Dest[198 0 R/XYZ null 474 0]>>endobj
|
||||
17 0 obj<</Subtype/Link/Rect[108.0 633.6 124.5 646.6]/Border[0 0 0]/Dest[198 0 R/XYZ null 434 0]>>endobj
|
||||
18 0 obj<</Subtype/Link/Rect[124.5 633.6 173.1 646.6]/Border[0 0 0]/Dest[198 0 R/XYZ null 434 0]>>endobj
|
||||
19 0 obj<</Subtype/Link/Rect[173.1 633.6 216.4 646.6]/Border[0 0 0]/Dest[198 0 R/XYZ null 434 0]>>endobj
|
||||
20 0 obj<</Subtype/Link/Rect[72.0 607.2 80.2 620.2]/Border[0 0 0]/Dest[204 0 R/XYZ null 818 0]>>endobj
|
||||
21 0 obj<</Subtype/Link/Rect[80.2 607.2 131.6 620.2]/Border[0 0 0]/Dest[204 0 R/XYZ null 818 0]>>endobj
|
||||
22 0 obj<</Subtype/Link/Rect[108.0 594.0 124.5 607.0]/Border[0 0 0]/Dest[204 0 R/XYZ null 737 0]>>endobj
|
||||
@@ -263,7 +263,7 @@
|
||||
138 0 obj<</D[198 0 R/XYZ null 818 null]>>endobj
|
||||
139 0 obj<</D[198 0 R/XYZ null 737 null]>>endobj
|
||||
140 0 obj<</D[198 0 R/XYZ null 658 null]>>endobj
|
||||
141 0 obj<</D[198 0 R/XYZ null 474 null]>>endobj
|
||||
141 0 obj<</D[198 0 R/XYZ null 434 null]>>endobj
|
||||
142 0 obj<</D[204 0 R/XYZ null 818 null]>>endobj
|
||||
143 0 obj<</D[204 0 R/XYZ null 737 null]>>endobj
|
||||
144 0 obj<</D[204 0 R/XYZ null 540 null]>>endobj
|
||||
@@ -380,12 +380,14 @@ endobj
|
||||
Õ;c`<k»ñΙ¡µ€±¯ïdŠÉÐP¶ÀƳ¿bY™>R°0qí{±;ÂçT®„4`6µƒ¢Y™Kz�ÉÐ|€#· &……Kæ`1 "Íë9ƒ‹ö ›òMÏRØê€…Ý…‚U˜«âµëU‹`4,}< | ||||