-CHANGES.txt - 2008-12-08
+CHANGES.txt - 2008-12-10
------------------------
CHANGES IN CUPS V1.4b2
- Documentation updates (STR #2983, STR #2998, STR #3021)
+ - The cupsGetPPD* APIs now create symlinks to local PPD files
+ rather than copying them whenever possible.
+ - Various performance optimizations in the string pool, dests, and
+ options implementations.
+ - The cupsGetDests* APIs now return the marker and printer-commands
+ attributes.
+ - Side-channel SNMP lookups would not work when cupsSNMPSupplies
+ was set to False in the PPD file.
- Localized the device descriptions for the SCSI, serial,
and network backends (STR #3014)
- Added a Spanish localization (STR #3015)
sep; /* Separator character */
int snmp_fd, /* SNMP socket */
start_count, /* Page count via SNMP at start */
- page_count; /* Page count via SNMP */
+ page_count, /* Page count via SNMP */
+ have_supplies; /* Printer supports supply levels? */
int num_files; /* Number of files to print */
char **files, /* Files to print */
*filename; /* Pointer to single filename */
*/
if ((snmp_fd = _cupsSNMPOpen(http->hostaddr->addr.sa_family)) >= 0)
- {
- if (backendSNMPSupplies(snmp_fd, http->hostaddr, &start_count, NULL))
- {
- /*
- * No, close it...
- */
-
- _cupsSNMPClose(snmp_fd);
- snmp_fd = -1;
- }
- }
+ have_supplies = !backendSNMPSupplies(snmp_fd, http->hostaddr, &start_count,
+ NULL);
else
- start_count = 0;
+ have_supplies = start_count = 0;
/*
* Build a URI for the printer and fill the standard IPP attributes for
* Collect the final page count as needed...
*/
- if (snmp_fd >= 0 &&
+ if (have_supplies &&
!backendSNMPSupplies(snmp_fd, http->hostaddr, &page_count, NULL) &&
page_count > start_count)
fprintf(stderr, "PAGE: total %d\n", page_count - start_count);
char addrname[256]; /* Address name */
http_addrlist_t *addrlist, /* Address list */
*addr; /* Socket address */
- int snmp_fd; /* SNMP socket */
+ int snmp_fd, /* SNMP socket */
+ have_supplies; /* Printer supports supply levels? */
int copy; /* Copies written */
time_t start_time; /* Time of first connect */
int recoverable; /* Recoverable error shown? */
*/
if ((snmp_fd = _cupsSNMPOpen(addr->addr.addr.sa_family)) >= 0)
- {
- if (backendSNMPSupplies(snmp_fd, &(addr->addr), NULL, NULL))
- {
- /*
- * No, close it...
- */
-
- _cupsSNMPClose(snmp_fd);
- snmp_fd = -1;
- }
- }
+ have_supplies = !backendSNMPSupplies(snmp_fd, &(addr->addr), NULL, NULL);
+ else
+ have_supplies = 0;
/*
* Check for side-channel requests...
* Collect the final supply levels as needed...
*/
- if (snmp_fd >= 0)
+ if (have_supplies)
backendSNMPSupplies(snmp_fd, &(addr->addr), NULL, NULL);
/*
char addrname[256]; /* Address name */
int snmp_fd, /* SNMP socket */
start_count, /* Page count via SNMP at start */
- page_count; /* Page count via SNMP */
+ page_count, /* Page count via SNMP */
+ have_supplies; /* Printer supports supply levels? */
ssize_t tbytes; /* Total number of bytes written */
#if defined(HAVE_SIGACTION) && !defined(HAVE_SIGSET)
struct sigaction action; /* Actions for POSIX signals */
if ((snmp_fd = _cupsSNMPOpen(addr->addr.addr.sa_family)) >= 0)
{
- if (backendSNMPSupplies(snmp_fd, &(addr->addr), &start_count, NULL))
- {
- /*
- * No, close it...
- */
-
- _cupsSNMPClose(snmp_fd);
- snmp_fd = -1;
- }
+ have_supplies = !backendSNMPSupplies(snmp_fd, &(addr->addr), &start_count,
+ NULL);
}
else
- start_count = 0;
+ have_supplies = start_count = 0;
/*
* Print everything...
* Collect the final page count as needed...
*/
- if (snmp_fd >= 0 &&
+ if (have_supplies &&
!backendSNMPSupplies(snmp_fd, &(addr->addr), &page_count, NULL) &&
page_count > start_count)
fprintf(stderr, "PAGE: total %d\n", page_count - start_count);
mxmldoc --section "Programming" --title "CUPS API" \
--css ../doc/cups-printable.css \
--header api-cups.header --intro api-cups.shtml \
- cups.h dest.c language.c notify.c \
+ cups.h adminutil.c dest.c language.c notify.c \
options.c tempfile.c usersys.c \
util.c >../doc/help/api-cups.html
mxmldoc --section "Programming" --title "File and Directory APIs" \
--section "Programming" --title "CUPS API" \
--css ../doc/cups-printable.css \
--header api-cups.header --intro api-cups.shtml \
- cups.h dest.c language.c notify.c \
+ cups.h adminutil.c dest.c language.c notify.c \
options.c tempfile.c usersys.c \
util.c
mxmldoc --framed api-filedir \
../tools/makedocset --docset org.cups.cups.docset \
--title "CUPS API" \
--header api-cups.header --intro api-cups.shtml \
- cups.h dest.c language.c notify.c \
+ cups.h adminutil.c dest.c language.c notify.c \
options.c tempfile.c usersys.c \
util.c
../tools/makedocset --docset org.cups.filedir.docset \
/*
* 'cupsAdminCreateWindowsPPD()' - Create the Windows PPD file for a printer.
+ *
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
char * /* O - PPD file or NULL */
/*
* 'cupsAdminExportSamba()' - Export a printer to Samba.
+ *
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 1 on success, 0 on failure */
* The returned settings should be freed with cupsFreeOptions() when
* you are done with them.
*
- * @since CUPS 1.3@
+ * @since CUPS 1.3/Mac OS X 10.5@
*/
int /* O - 1 on success, 0 on failure */
/*
* 'cupsAdminSetServerSettings()' - Set settings on the server.
*
- * @since CUPS 1.3@
+ * @since CUPS 1.3/Mac OS X 10.5@
*/
int /* O - 1 on success, 0 on failure */
* appended at the end of the run of identical elements. For unsorted arrays,
* the element is appended to the end of the array.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 1 on success, 0 on failure */
* The caller is responsible for freeing the memory used by the
* elements themselves.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
void
/*
* 'cupsArrayCount()' - Get the number of elements in the array.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - Number of elements */
* The current element is undefined until you call @link cupsArrayFind@,
* @link cupsArrayFirst@, or @link cupsArrayIndex@, or @link cupsArrayLast@.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
void * /* O - Element */
* The caller is responsible for freeing the memory used by the
* elements themselves.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
void
/*
* 'cupsArrayDup()' - Duplicate the array.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
cups_array_t * /* O - Duplicate array */
/*
* 'cupsArrayFind()' - Find an element in the array.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
void * /* O - Element found or @code NULL@ */
/*
* 'cupsArrayFirst()' - Get the first element in the array.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
void * /* O - First element or @code NULL@ if the array is empty */
* The current element is undefined until you call @link cupsArrayFind@,
* @link cupsArrayFirst@, or @link cupsArrayIndex@, or @link cupsArrayLast@.
*
- * @since CUPS 1.3@
+ * @since CUPS 1.3/Mac OS X 10.5@
*/
int /* O - Index of the current element, starting at 0 */
/*
* 'cupsArrayGetInsert()' - Get the index of the last inserted element.
*
- * @since CUPS 1.3@
+ * @since CUPS 1.3/Mac OS X 10.5@
*/
int /* O - Index of the last inserted element, starting at 0 */
/*
* 'cupsArrayIndex()' - Get the N-th element in the array.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
void * /* O - N-th element or @code NULL@ */
* inserted at the beginning of the run of identical elements. For unsorted
* arrays, the element is inserted at the beginning of the array.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 0 on failure, 1 on success */
/*
* 'cupsArrayLast()' - Get the last element in the array.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
void * /* O - Last element or @code NULL@ if the array is empty */
* data pointer argument can safely be omitted when not required so functions
* like @code strcmp@ can be used for sorted string arrays.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
cups_array_t * /* O - Array */
* The hash function ("h") is used to implement cached lookups with the
* specified hash size ("hsize").
*
- * @since CUPS 1.3@
+ * @since CUPS 1.3/Mac OS X 10.5@
*/
cups_array_t * /* O - Array */
* @link cupsArrayFirst@, or @link cupsArrayIndex@, or @link cupsArrayLast@
* to set the current element.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
void * /* O - Next element or @code NULL@ */
* @link cupsArrayFirst@, or @link cupsArrayIndex@, or @link cupsArrayLast@
* to set the current element.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
void * /* O - Previous element or @code NULL@ */
* The caller is responsible for freeing the memory used by the
* removed element.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 1 on success, 0 on failure */
/*
* 'cupsArrayRestore()' - Reset the current element to the last @link cupsArraySave@.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
void * /* O - New current element */
*
* The save/restore stack is guaranteed to be at least 32 elements deep.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 1 on success, 0 on failure */
/*
* 'cupsArrayUserData()' - Return the user data for an array.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
void * /* O - User data */
/*
* 'cups_array_add()' - Insert or append an element to the array...
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
static int /* O - 1 on success, 0 on failure */
/*
* 'cups_array_find()' - Find an element in the array...
- *
- * @since CUPS 1.2@
*/
static int /* O - Index of match */
/*
* 'ppdFindAttr()' - Find the first matching attribute.
*
- * @since CUPS 1.1.19@
+ * @since CUPS 1.1.19/Mac OS X 10.3@
*/
ppd_attr_t * /* O - Attribute or @code NULL@ if not found */
/*
* 'ppdFindNextAttr()' - Find the next matching attribute.
*
- * @since CUPS 1.1.19@
+ * @since CUPS 1.1.19/Mac OS X 10.3@
*/
ppd_attr_t * /* O - Attribute or @code NULL@ if not found */
* This function should be called in response to a @code HTTP_UNAUTHORIZED@
* status, prior to resubmitting your request.
*
- * @since CUPS 1.1.20@
+ * @since CUPS 1.1.20/Mac OS X 10.4@
*/
int /* O - 0 on success, -1 on error */
* parameter controls how many seconds to wait for the data - use 0.0 to
* return immediately if there is no data, -1.0 to wait for data indefinitely.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
ssize_t /* O - Bytes read or -1 on error */
* 0.0 to return immediately if the data cannot be written, -1.0 to wait
* indefinitely.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
ssize_t /* O - Bytes written or -1 on error */
* function returns the device URI passed in the DEVICE_URI environment
* variable or the device URI passed in argv[0], whichever is found
* first.
+ *
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
const char * /* O - Device URI or @code NULL@ */
* This function writes a single device line to stdout for a backend.
* It handles quoting of special characters in the device-make-and-model,
* device-info, device-id, and device-location strings.
+ *
+ * @since CUPS 1.4@
*/
void
* Constants...
*/
-# define CUPS_VERSION 1.0399
+# define CUPS_VERSION 1.0400
# define CUPS_VERSION_MAJOR 1
# define CUPS_VERSION_MINOR 4
# define CUPS_VERSION_PATCH -1
CUPS_PRINTER_DEFAULT = 0x20000, /* Default printer on network */
CUPS_PRINTER_FAX = 0x40000, /* Fax queue */
CUPS_PRINTER_REJECTING = 0x80000, /* Printer is rejecting jobs */
- CUPS_PRINTER_DELETE = 0x100000, /* Delete printer @since CUPS 1.2@ */
- CUPS_PRINTER_NOT_SHARED = 0x200000, /* Printer is not shared @since CUPS 1.2@ */
- CUPS_PRINTER_AUTHENTICATED = 0x400000,/* Printer requires authentication @since CUPS 1.2@ */
- CUPS_PRINTER_COMMANDS = 0x800000, /* Printer supports maintenance commands @since CUPS 1.2@ */
- CUPS_PRINTER_DISCOVERED = 0x1000000, /* Printer was automatically discovered and added @since CUPS 1.3@ */
+ CUPS_PRINTER_DELETE = 0x100000, /* Delete printer @since CUPS 1.2/Mac OS X 10.5@ */
+ CUPS_PRINTER_NOT_SHARED = 0x200000, /* Printer is not shared @since CUPS 1.2/Mac OS X 10.5@ */
+ CUPS_PRINTER_AUTHENTICATED = 0x400000,/* Printer requires authentication @since CUPS 1.2/Mac OS X 10.5@ */
+ CUPS_PRINTER_COMMANDS = 0x800000, /* Printer supports maintenance commands @since CUPS 1.2/Mac OS X 10.5@ */
+ CUPS_PRINTER_DISCOVERED = 0x1000000, /* Printer was automatically discovered and added @since CUPS 1.3/Mac OS X 10.5@ */
CUPS_PRINTER_OPTIONS = 0x6fffc /* ~(CLASS | REMOTE | IMPLICIT | DEFAULT | FAX | REJECTING | DELETE | NOT_SHARED | AUTHENTICATED | COMMANDS | DISCOVERED) @private@ */
};
/*
* 'ppdFindCustomOption()' - Find a custom option.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
ppd_coption_t * /* O - Custom option or NULL */
/*
* 'ppdFindCustomParam()' - Find a parameter for a custom option.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
ppd_cparam_t * /* O - Custom parameter or NULL */
/*
* 'ppdFirstCustomParam()' - Return the first parameter for a custom option.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
ppd_cparam_t * /* O - Custom parameter or NULL */
/*
* 'ppdNextCustomParam()' - Return the next parameter for a custom option.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
ppd_cparam_t * /* O - Custom parameter or NULL */
* server.
* cupsSetDests2() - Save the list of destinations for the specified
* server.
- * appleCopyLocations() - Get the location history array.
+ * appleCopyLocations() - Copy the location history array.
* appleCopyNetwork() - Get the network ID for the current location.
* appleGetDefault() - Get the default printer for this location.
+ * appleGetPaperSize() - Get the default paper size.
* appleGetPrinter() - Get a printer from the history array.
* appleSetDefault() - Set the default printer for this location.
* appleUseLastPrinter() - Get the default printer preference value.
+ * cups_add_dest() - Add a destination to the array.
+ * cups_compare_dests() - Compare two destinations.
+ * cups_find_dest() - Find a destination using a binary search.
* cups_get_default() - Get the default destination from an lpoptions file.
* cups_get_dests() - Get destinations from a file.
* cups_get_sdests() - Get destinations from a server.
+ * cups_make_string() - Make a comma-separated string of values from an IPP
+ * attribute.
*/
/*
# include <sys/cdefs.h>
# include <CoreFoundation/CoreFoundation.h>
# include <SystemConfiguration/SystemConfiguration.h>
+# define kDefaultPaperIDKey CFSTR("DefaultPaperID")
# define kLocationHistoryArrayKey CFSTR("kLocationHistoryArrayKeyTMP")
# define kLocationNetworkKey CFSTR("kLocationNetworkKey")
# define kLocationPrinterIDKey CFSTR("kLocationPrinterIDKey")
static CFArrayRef appleCopyLocations(void);
static CFStringRef appleCopyNetwork(void);
static char *appleGetDefault(char *name, int namesize);
+static char *appleGetPaperSize(char *name, int namesize);
static CFStringRef appleGetPrinter(CFArrayRef locations, CFStringRef network,
CFIndex *locindex);
static void appleSetDefault(const char *name);
static int appleUseLastPrinter(void);
#endif /* __APPLE__ */
+static cups_dest_t *cups_add_dest(const char *name, const char *instance,
+ int *num_dests, cups_dest_t **dests);
+static int cups_compare_dests(cups_dest_t *a, cups_dest_t *b);
+static int cups_find_dest(const char *name, const char *instance,
+ int num_dests, cups_dest_t *dests, int prev,
+ int *rdiff);
static char *cups_get_default(const char *filename, char *namebuf,
- size_t namesize, const char **instance);
+ size_t namesize, const char **instance);
static int cups_get_dests(const char *filename, const char *match_name,
const char *match_inst, int num_dests,
cups_dest_t **dests);
static int cups_get_sdests(http_t *http, ipp_op_t op, const char *name,
int num_dests, cups_dest_t **dests);
+static char *cups_make_string(ipp_attribute_t *attr, char *buffer,
+ size_t bufsize);
/*
int i; /* Looping var */
cups_dest_t *dest; /* Destination pointer */
cups_dest_t *parent; /* Parent destination */
- cups_option_t *option; /* Current option */
+ cups_option_t *doption, /* Current destination option */
+ *poption; /* Current parent option */
if (!name || !dests)
return (0);
- if (cupsGetDest(name, instance, num_dests, *dests))
- return (num_dests);
-
- /*
- * Add new destination...
- */
-
- if (num_dests == 0)
- dest = malloc(sizeof(cups_dest_t));
- else
- dest = realloc(*dests, sizeof(cups_dest_t) * (num_dests + 1));
-
- if (dest == NULL)
- return (num_dests);
-
- *dests = dest;
-
- /*
- * Find where to insert the destination...
- */
-
- for (i = num_dests; i > 0; i --, dest ++)
- if (strcasecmp(name, dest->name) < 0)
- break;
- else if (!instance && dest->instance)
- break;
- else if (!strcasecmp(name, dest->name) &&
- instance && dest->instance &&
- strcasecmp(instance, dest->instance) < 0)
- break;
-
- if (i > 0)
- memmove(dest + 1, dest, i * sizeof(cups_dest_t));
+ if (!cupsGetDest(name, instance, num_dests, *dests))
+ {
+ if (instance &&
+ (parent = cupsGetDest(name, NULL, num_dests, *dests)) == NULL)
+ return (num_dests);
- /*
- * Initialize the destination...
- */
+ dest = cups_add_dest(name, instance, &num_dests, dests);
- dest->name = _cupsStrAlloc(name);
- dest->is_default = 0;
- dest->num_options = 0;
- dest->options = (cups_option_t *)0;
+ if (instance && parent && parent->num_options > 0)
+ {
+ /*
+ * Copy options from parent...
+ */
- if (!instance)
- dest->instance = NULL;
- else
- {
- /*
- * Copy options from the primary instance...
- */
+ dest->options = calloc(sizeof(cups_option_t), parent->num_options);
- dest->instance = _cupsStrAlloc(instance);
+ if (dest->options)
+ {
+ dest->num_options = parent->num_options;
- if ((parent = cupsGetDest(name, NULL, num_dests + 1, *dests)) != NULL)
- {
- for (i = parent->num_options, option = parent->options;
- i > 0;
- i --, option ++)
- dest->num_options = cupsAddOption(option->name, option->value,
- dest->num_options,
- &(dest->options));
+ for (i = dest->num_options, doption = dest->options,
+ poption = parent->options;
+ i > 0;
+ i --, doption ++, poption ++)
+ {
+ doption->name = _cupsStrRetain(poption->name);
+ doption->value = _cupsStrRetain(poption->value);
+ }
+ }
}
}
- return (num_dests + 1);
+ return (num_dests);
}
int num_dests, /* I - Number of destinations */
cups_dest_t *dests) /* I - Destinations */
{
- int comp; /* Result of comparison */
+ int diff, /* Result of comparison */
+ match; /* Matching index */
if (num_dests <= 0 || !dests)
* Lookup name and optionally the instance...
*/
- while (num_dests > 0)
- {
- if ((comp = strcasecmp(name, dests->name)) < 0)
- return (NULL);
- else if (comp == 0)
- {
- if ((!instance && !dests->instance) ||
- (instance != NULL && dests->instance != NULL &&
- !strcasecmp(instance, dests->instance)))
- return (dests);
- }
+ match = cups_find_dest(name, instance, num_dests, dests, -1, &diff);
- num_dests --;
- dests ++;
- }
+ if (!diff)
+ return (dests + match);
}
return (NULL);
* Starting with CUPS 1.2, the returned list of destinations include the
* printer-info, printer-is-accepting-jobs, printer-is-shared,
* printer-make-and-model, printer-state, printer-state-change-time,
- * printer-state-reasons, and printer-type attributes as options.
+ * printer-state-reasons, and printer-type attributes as options. CUPS 1.4
+ * adds the marker-change-time, marker-colors, marker-high-levels,
+ * marker-levels, marker-low-levels, marker-message, marker-names,
+ * marker-types, and printer-commands attributes as well.
*
* Use the @link cupsFreeDests@ function to free the destination list and
* the @link cupsGetDest@ function to find a particular destination.
* Starting with CUPS 1.2, the returned list of destinations include the
* printer-info, printer-is-accepting-jobs, printer-is-shared,
* printer-make-and-model, printer-state, printer-state-change-time,
- * printer-state-reasons, and printer-type attributes as options.
+ * printer-state-reasons, and printer-type attributes as options. CUPS 1.4
+ * adds the marker-change-time, marker-colors, marker-high-levels,
+ * marker-levels, marker-low-levels, marker-message, marker-names,
+ * marker-types, and printer-commands attributes as well.
*
* Use the @link cupsFreeDests@ function to free the destination list and
* the @link cupsGetDest@ function to find a particular destination.
*
- * @since CUPS 1.1.21@
+ * @since CUPS 1.1.21/Mac OS X 10.4@
*/
int /* O - Number of destinations */
*/
num_dests = cups_get_sdests(http, CUPS_GET_PRINTERS, NULL, num_dests, dests);
- if (cupsLastError() < IPP_REDIRECTION_OTHER_SITE)
- num_dests = cups_get_sdests(http, CUPS_GET_CLASSES, NULL, num_dests, dests);
if (cupsLastError() >= IPP_REDIRECTION_OTHER_SITE)
{
* @link cupsSetDests@ or @link cupsSetDests2@ functions to save the new
* options for the user.
*
- * @since CUPS 1.3@
+ * @since CUPS 1.3/Mac OS X 10.5@
*/
int /* O - New number of destinations */
/*
* 'cupsSetDefaultDest()' - Set the default destination.
*
- * @since CUPS 1.3@
+ * @since CUPS 1.3/Mac OS X 10.5@
*/
void
* This function saves the destinations to /etc/cups/lpoptions when run
* as root and ~/.cups/lpoptions when run as a normal user.
*
- * @since CUPS 1.1.21@
+ * @since CUPS 1.1.21/Mac OS X 10.4@
*/
int /* O - 0 on success, -1 on error */
*/
num_temps = cups_get_sdests(http, CUPS_GET_PRINTERS, NULL, 0, &temps);
- num_temps = cups_get_sdests(http, CUPS_GET_CLASSES, NULL, num_temps, &temps);
+
+ if (cupsLastError() >= IPP_REDIRECTION_OTHER_SITE)
+ {
+ cupsFreeDests(num_temps, temps);
+ return (-1);
+ }
/*
* Figure out which file to write to...
}
+/*
+ * 'appleGetPaperSize()' - Get the default paper size.
+ */
+
+static char * /* O - Default paper size */
+appleGetPaperSize(char *name, /* I - Paper size name buffer */
+ int namesize) /* I - Size of buffer */
+{
+ CFStringRef defaultPaperID; /* Default paper ID */
+
+
+ defaultPaperID = CFPreferencesCopyAppValue(kDefaultPaperIDKey,
+ kPMPrintingPreferences);
+ if (!defaultPaperID ||
+ !CFStringGetCString(defaultPaperID, name, namesize,
+ kCFStringEncodingUTF8))
+ name[0] = '\0';
+ else if (!strncmp(name, "na-", 3))
+ _cups_strcpy(name, name + 3);
+ else if (!strncmp(name, "iso-", 4))
+ _cups_strcpy(name, name + 4);
+
+ if (defaultPaperID)
+ CFRelease(defaultPaperID);
+
+ return (name);
+}
+
+
/*
* 'appleGetPrinter()' - Get a printer from the history array.
*/
#endif /* __APPLE__ */
+/*
+ * 'cups_add_dest()' - Add a destination to the array.
+ *
+ * Unlike cupsAddDest(), this function does not check for duplicates.
+ */
+
+static cups_dest_t * /* O - New destination */
+cups_add_dest(const char *name, /* I - Name of destination */
+ const char *instance, /* I - Instance or NULL */
+ int *num_dests, /* IO - Number of destinations */
+ cups_dest_t **dests) /* IO - Destinations */
+{
+ int insert, /* Insertion point */
+ diff; /* Result of comparison */
+ cups_dest_t *dest; /* Destination pointer */
+
+
+ /*
+ * Add new destination...
+ */
+
+ if (*num_dests == 0)
+ dest = malloc(sizeof(cups_dest_t));
+ else
+ dest = realloc(*dests, sizeof(cups_dest_t) * (*num_dests + 1));
+
+ if (!dest)
+ return (NULL);
+
+ *dests = dest;
+
+ /*
+ * Find where to insert the destination...
+ */
+
+ if (*num_dests == 0)
+ insert = 0;
+ else
+ {
+ insert = cups_find_dest(name, instance, *num_dests, *dests, *num_dests - 1,
+ &diff);
+
+ if (diff > 0)
+ insert ++;
+ }
+
+ /*
+ * Move the array elements as needed...
+ */
+
+ if (insert < *num_dests)
+ memmove(*dests + insert + 1, *dests + insert,
+ (*num_dests - insert) * sizeof(cups_dest_t));
+
+ (*num_dests) ++;
+
+ /*
+ * Initialize the destination...
+ */
+
+ dest = *dests + insert;
+ dest->name = _cupsStrAlloc(name);
+ dest->instance = _cupsStrAlloc(instance);
+ dest->is_default = 0;
+ dest->num_options = 0;
+ dest->options = (cups_option_t *)0;
+
+ return (dest);
+}
+
+
+/*
+ * 'cups_compare_dests()' - Compare two destinations.
+ */
+
+static int /* O - Result of comparison */
+cups_compare_dests(cups_dest_t *a, /* I - First destination */
+ cups_dest_t *b) /* I - Second destination */
+{
+ int diff; /* Difference */
+
+
+ if ((diff = strcasecmp(a->name, b->name)) != 0)
+ return (diff);
+ else if (a->instance && b->instance)
+ return (strcasecmp(a->instance, b->instance));
+ else
+ return ((a->instance && !b->instance) - (!a->instance && b->instance));
+}
+
+
+/*
+ * 'cups_find_dest()' - Find a destination using a binary search.
+ */
+
+static int /* O - Index of match */
+cups_find_dest(const char *name, /* I - Destination name */
+ const char *instance, /* I - Instance or NULL */
+ int num_dests, /* I - Number of destinations */
+ cups_dest_t *dests, /* I - Destinations */
+ int prev, /* I - Previous index */
+ int *rdiff) /* O - Difference of match */
+{
+ int left, /* Low mark for binary search */
+ right, /* High mark for binary search */
+ current, /* Current index */
+ diff; /* Result of comparison */
+ cups_dest_t key; /* Search key */
+
+
+ key.name = (char *)name;
+ key.instance = (char *)instance;
+
+ if (prev >= 0)
+ {
+ /*
+ * Start search on either side of previous...
+ */
+
+ if ((diff = cups_compare_dests(&key, dests + prev)) == 0 ||
+ (diff < 0 && prev == 0) ||
+ (diff > 0 && prev == (num_dests - 1)))
+ {
+ *rdiff = diff;
+ return (prev);
+ }
+ else if (diff < 0)
+ {
+ /*
+ * Start with previous on right side...
+ */
+
+ left = 0;
+ right = prev;
+ }
+ else
+ {
+ /*
+ * Start wih previous on left side...
+ */
+
+ left = prev;
+ right = num_dests - 1;
+ }
+ }
+ else
+ {
+ /*
+ * Start search in the middle...
+ */
+
+ left = 0;
+ right = num_dests - 1;
+ }
+
+ do
+ {
+ current = (left + right) / 2;
+ diff = cups_compare_dests(&key, dests + current);
+
+ if (diff == 0)
+ break;
+ else if (diff < 0)
+ right = current;
+ else
+ left = current;
+ }
+ while ((right - left) > 1);
+
+ if (diff != 0)
+ {
+ /*
+ * Check the last 1 or 2 elements...
+ */
+
+ if ((diff = cups_compare_dests(&key, dests + left)) <= 0)
+ current = left;
+ else
+ {
+ diff = cups_compare_dests(&key, dests + right);
+ current = right;
+ }
+ }
+
+ /*
+ * Return the closest destination and the difference...
+ */
+
+ *rdiff = diff;
+
+ return (current);
+}
+
+
/*
* 'cups_get_default()' - Get the default destination from an lpoptions file.
*/
ipp_t *request, /* IPP Request */
*response; /* IPP Response */
ipp_attribute_t *attr; /* Current attribute */
- int accepting, /* printer-is-accepting-jobs attribute */
- shared, /* printer-is-shared attribute */
- state, /* printer-state attribute */
- change_time, /* printer-state-change-time attribute */
- type; /* printer-type attribute */
- const char *info, /* printer-info attribute */
- *location, /* printer-location attribute */
- *make_model, /* printer-make-and-model attribute */
- *printer_name; /* printer-name attribute */
- char uri[1024], /* printer-uri value */
- job_sheets[1024], /* job-sheets-default attribute */
- auth_info_req[1024], /* auth-info-required attribute */
- reasons[1024]; /* printer-state-reasons attribute */
+ const char *printer_name; /* printer-name attribute */
+ char uri[1024]; /* printer-uri value */
int num_options; /* Number of options */
cups_option_t *options; /* Options */
+#ifdef __APPLE__
+ char media_default[41]; /* Default paper size */
+#endif /* __APPLE__ */
char optname[1024], /* Option name */
value[2048], /* Option value */
*ptr; /* Pointer into name/value */
{
"auth-info-required",
"job-sheets-default",
+ "marker-change-time",
+ "marker-colors",
+ "marker-high-levels",
+ "marker-levels",
+ "marker-low-levels",
+ "marker-message",
+ "marker-names",
+ "marker-types",
+#ifdef __APPLE__
+ "media-supported",
+#endif /* __APPLE__ */
+ "printer-commands",
"printer-info",
"printer-is-accepting-jobs",
"printer-is-shared",
};
+#ifdef __APPLE__
+ /*
+ * Get the default paper size...
+ */
+
+ appleGetPaperSize(media_default, sizeof(media_default));
+#endif /* __APPLE__ */
+
/*
- * Build a CUPS_GET_PRINTERS or CUPS_GET_CLASSES request, which require
- * the following attributes:
+ * Build a CUPS_GET_PRINTERS or IPP_GET_PRINTER_ATTRIBUTES request, which
+ * require the following attributes:
*
* attributes-charset
* attributes-natural-language
* requesting-user-name
+ * printer-uri [for IPP_GET_PRINTER_ATTRIBUTES]
*/
request = ippNewRequest(op);
* Pull the needed attributes from this printer...
*/
- accepting = 0;
- change_time = 0;
- info = NULL;
- location = NULL;
- make_model = NULL;
printer_name = NULL;
num_options = 0;
options = NULL;
- shared = 1;
- state = IPP_PRINTER_IDLE;
- type = CUPS_PRINTER_LOCAL;
- auth_info_req[0] = '\0';
- job_sheets[0] = '\0';
- reasons[0] = '\0';
-
- while (attr != NULL && attr->group_tag == IPP_TAG_PRINTER)
+ for (; attr && attr->group_tag == IPP_TAG_PRINTER; attr = attr->next)
{
- if (!strcmp(attr->name, "auth-info-required") &&
- attr->value_tag == IPP_TAG_KEYWORD)
- {
- strlcpy(auth_info_req, attr->values[0].string.text,
- sizeof(auth_info_req));
+ if (attr->value_tag != IPP_TAG_INTEGER &&
+ attr->value_tag != IPP_TAG_ENUM &&
+ attr->value_tag != IPP_TAG_BOOLEAN &&
+ attr->value_tag != IPP_TAG_TEXT &&
+ attr->value_tag != IPP_TAG_TEXTLANG &&
+ attr->value_tag != IPP_TAG_NAME &&
+ attr->value_tag != IPP_TAG_NAMELANG &&
+ attr->value_tag != IPP_TAG_KEYWORD &&
+ attr->value_tag != IPP_TAG_RANGE)
+ continue;
- for (i = 1, ptr = auth_info_req + strlen(auth_info_req);
- i < attr->num_values;
- i ++)
- {
- snprintf(ptr, sizeof(auth_info_req) - (ptr - auth_info_req), ",%s",
- attr->values[i].string.text);
- ptr += strlen(ptr);
- }
- }
- else if (!strcmp(attr->name, "job-sheets-default") &&
- (attr->value_tag == IPP_TAG_KEYWORD ||
- attr->value_tag == IPP_TAG_NAME))
+ if (!strcmp(attr->name, "auth-info-required") ||
+ !strcmp(attr->name, "marker-change-time") ||
+ !strcmp(attr->name, "marker-colors") ||
+ !strcmp(attr->name, "marker-high-levels") ||
+ !strcmp(attr->name, "marker-levels") ||
+ !strcmp(attr->name, "marker-low-levels") ||
+ !strcmp(attr->name, "marker-message") ||
+ !strcmp(attr->name, "marker-names") ||
+ !strcmp(attr->name, "marker-types") ||
+ !strcmp(attr->name, "printer-commands") ||
+ !strcmp(attr->name, "printer-info") ||
+ !strcmp(attr->name, "printer-is-shared") ||
+ !strcmp(attr->name, "printer-make-and-model") ||
+ !strcmp(attr->name, "printer-state") ||
+ !strcmp(attr->name, "printer-state-change-time") ||
+ !strcmp(attr->name, "printer-type") ||
+ !strcmp(attr->name, "printer-is-accepting-jobs") ||
+ !strcmp(attr->name, "printer-location") ||
+ !strcmp(attr->name, "printer-state-reasons"))
{
- if (attr->num_values == 2)
- snprintf(job_sheets, sizeof(job_sheets), "%s,%s",
- attr->values[0].string.text, attr->values[1].string.text);
- else
- strlcpy(job_sheets, attr->values[0].string.text,
- sizeof(job_sheets));
- }
- else if (!strcmp(attr->name, "printer-info") &&
- attr->value_tag == IPP_TAG_TEXT)
- info = attr->values[0].string.text;
- else if (!strcmp(attr->name, "printer-is-accepting-jobs") &&
- attr->value_tag == IPP_TAG_BOOLEAN)
- accepting = attr->values[0].boolean;
- else if (!strcmp(attr->name, "printer-is-shared") &&
- attr->value_tag == IPP_TAG_BOOLEAN)
- shared = attr->values[0].boolean;
- else if (!strcmp(attr->name, "printer-location") &&
- attr->value_tag == IPP_TAG_TEXT)
- location = attr->values[0].string.text;
- else if (!strcmp(attr->name, "printer-make-and-model") &&
- attr->value_tag == IPP_TAG_TEXT)
- make_model = attr->values[0].string.text;
+ /*
+ * Add a printer description attribute...
+ */
+
+ num_options = cupsAddOption(attr->name,
+ cups_make_string(attr, value,
+ sizeof(value)),
+ num_options, &options);
+ }
+ else if (!strcmp(attr->name, "media-supported"))
+ {
+ /*
+ * See if we can set a default media size...
+ */
+
+ for (i = 0; i < attr->num_values; i ++)
+ if (!strcasecmp(media_default, attr->values[i].string.text))
+ {
+ num_options = cupsAddOption("media", media_default, num_options,
+ &options);
+ break;
+ }
+ }
else if (!strcmp(attr->name, "printer-name") &&
attr->value_tag == IPP_TAG_NAME)
printer_name = attr->values[0].string.text;
- else if (!strcmp(attr->name, "printer-state") &&
- attr->value_tag == IPP_TAG_ENUM)
- state = attr->values[0].integer;
- else if (!strcmp(attr->name, "printer-state-change-time") &&
- attr->value_tag == IPP_TAG_INTEGER)
- change_time = attr->values[0].integer;
- else if (!strcmp(attr->name, "printer-state-reasons") &&
- attr->value_tag == IPP_TAG_KEYWORD)
- {
- strlcpy(reasons, attr->values[0].string.text, sizeof(reasons));
- for (i = 1, ptr = reasons + strlen(reasons);
- i < attr->num_values;
- i ++)
- {
- snprintf(ptr, sizeof(reasons) - (ptr - reasons), ",%s",
- attr->values[i].string.text);
- ptr += strlen(ptr);
- }
- }
- else if (!strcmp(attr->name, "printer-type") &&
- attr->value_tag == IPP_TAG_ENUM)
- type = attr->values[0].integer;
else if (strncmp(attr->name, "notify-", 7) &&
(attr->value_tag == IPP_TAG_BOOLEAN ||
attr->value_tag == IPP_TAG_ENUM ||
attr->value_tag == IPP_TAG_KEYWORD ||
attr->value_tag == IPP_TAG_NAME ||
attr->value_tag == IPP_TAG_RANGE) &&
- strstr(attr->name, "-default"))
+ (ptr = strstr(attr->name, "-default")) != NULL)
{
- char *valptr; /* Pointer into attribute value */
-
-
/*
* Add a default option...
*/
strlcpy(optname, attr->name, sizeof(optname));
- if ((ptr = strstr(optname, "-default")) != NULL)
- *ptr = '\0';
-
- value[0] = '\0';
- for (i = 0, ptr = value; i < attr->num_values; i ++)
- {
- if (ptr >= (value + sizeof(value) - 1))
- break;
-
- if (i)
- *ptr++ = ',';
-
- switch (attr->value_tag)
- {
- case IPP_TAG_INTEGER :
- case IPP_TAG_ENUM :
- snprintf(ptr, sizeof(value) - (ptr - value), "%d",
- attr->values[i].integer);
- break;
-
- case IPP_TAG_BOOLEAN :
- if (attr->values[i].boolean)
- strlcpy(ptr, "true", sizeof(value) - (ptr - value));
- else
- strlcpy(ptr, "false", sizeof(value) - (ptr - value));
- break;
-
- case IPP_TAG_RANGE :
- if (attr->values[i].range.lower ==
- attr->values[i].range.upper)
- snprintf(ptr, sizeof(value) - (ptr - value), "%d",
- attr->values[i].range.lower);
- else
- snprintf(ptr, sizeof(value) - (ptr - value), "%d-%d",
- attr->values[i].range.lower,
- attr->values[i].range.upper);
- break;
-
- default :
- for (valptr = attr->values[i].string.text;
- *valptr && ptr < (value + sizeof(value) - 2);)
- {
- if (strchr(" \t\n\\\'\"", *valptr))
- *ptr++ = '\\';
-
- *ptr++ = *valptr++;
- }
-
- *ptr = '\0';
- break;
- }
-
- ptr += strlen(ptr);
- }
-
- num_options = cupsAddOption(optname, value, num_options, &options);
+ optname[ptr - attr->name] = '\0';
+
+ if (strcasecmp(optname, "media") ||
+ !cupsGetOption("media", num_options, options))
+ num_options = cupsAddOption(optname,
+ cups_make_string(attr, value,
+ sizeof(value)),
+ num_options, &options);
}
-
- attr = attr->next;
}
/*
continue;
}
- num_dests = cupsAddDest(printer_name, NULL, num_dests, dests);
-
- if ((dest = cupsGetDest(printer_name, NULL, num_dests, *dests)) != NULL)
+ if ((dest = cups_add_dest(printer_name, NULL, &num_dests, dests)) != NULL)
{
dest->num_options = num_options;
dest->options = options;
-
- num_options = 0;
- options = NULL;
-
- if (auth_info_req[0])
- dest->num_options = cupsAddOption("auth-info-required", auth_info_req,
- dest->num_options,
- &(dest->options));
-
- if (job_sheets[0])
- dest->num_options = cupsAddOption("job-sheets", job_sheets,
- dest->num_options,
- &(dest->options));
-
- if (info)
- dest->num_options = cupsAddOption("printer-info", info,
- dest->num_options,
- &(dest->options));
-
- sprintf(value, "%d", accepting);
- dest->num_options = cupsAddOption("printer-is-accepting-jobs", value,
- dest->num_options,
- &(dest->options));
-
- sprintf(value, "%d", shared);
- dest->num_options = cupsAddOption("printer-is-shared", value,
- dest->num_options,
- &(dest->options));
-
- if (location)
- dest->num_options = cupsAddOption("printer-location",
- location, dest->num_options,
- &(dest->options));
-
- if (make_model)
- dest->num_options = cupsAddOption("printer-make-and-model",
- make_model, dest->num_options,
- &(dest->options));
-
- sprintf(value, "%d", state);
- dest->num_options = cupsAddOption("printer-state", value,
- dest->num_options,
- &(dest->options));
-
- if (change_time)
- {
- sprintf(value, "%d", change_time);
- dest->num_options = cupsAddOption("printer-state-change-time", value,
- dest->num_options,
- &(dest->options));
- }
-
- if (reasons[0])
- dest->num_options = cupsAddOption("printer-state-reasons", reasons,
- dest->num_options,
- &(dest->options));
-
- sprintf(value, "%d", type);
- dest->num_options = cupsAddOption("printer-type", value,
- dest->num_options,
- &(dest->options));
}
-
- cupsFreeOptions(num_options, options);
+ else
+ cupsFreeOptions(num_options, options);
if (attr == NULL)
break;
}
+/*
+ * 'cups_make_string()' - Make a comma-separated string of values from an IPP
+ * attribute.
+ */
+
+static char * /* O - New string */
+cups_make_string(
+ ipp_attribute_t *attr, /* I - Attribute to convert */
+ char *buffer, /* I - Buffer */
+ size_t bufsize) /* I - Size of buffer */
+{
+ int i; /* Looping var */
+ char *ptr, /* Pointer into buffer */
+ *end, /* Pointer to end of buffer */
+ *valptr; /* Pointer into string attribute */
+
+
+ /*
+ * Return quickly if we have a single string value...
+ */
+
+ if (attr->num_values == 1 &&
+ attr->value_tag != IPP_TAG_INTEGER &&
+ attr->value_tag != IPP_TAG_ENUM &&
+ attr->value_tag != IPP_TAG_BOOLEAN &&
+ attr->value_tag != IPP_TAG_RANGE)
+ return (attr->values[0].string.text);
+
+ /*
+ * Copy the values to the string, separating with commas and escaping strings
+ * as needed...
+ */
+
+ end = buffer + bufsize - 1;
+
+ for (i = 0, ptr = buffer; i < attr->num_values && ptr < end; i ++)
+ {
+ if (i)
+ *ptr++ = ',';
+
+ switch (attr->value_tag)
+ {
+ case IPP_TAG_INTEGER :
+ case IPP_TAG_ENUM :
+ snprintf(ptr, end - ptr + 1, "%d", attr->values[i].integer);
+ break;
+
+ case IPP_TAG_BOOLEAN :
+ if (attr->values[i].boolean)
+ strlcpy(ptr, "true", end - ptr + 1);
+ else
+ strlcpy(ptr, "false", end - ptr + 1);
+ break;
+
+ case IPP_TAG_RANGE :
+ if (attr->values[i].range.lower == attr->values[i].range.upper)
+ snprintf(ptr, end - ptr + 1, "%d", attr->values[i].range.lower);
+ else
+ snprintf(ptr, end - ptr + 1, "%d-%d", attr->values[i].range.lower,
+ attr->values[i].range.upper);
+ break;
+
+ default :
+ for (valptr = attr->values[i].string.text;
+ *valptr && ptr < end;)
+ {
+ if (strchr(" \t\n\\\'\"", *valptr))
+ {
+ if (ptr >= (end - 1))
+ break;
+
+ *ptr++ = '\\';
+ }
+
+ *ptr++ = *valptr++;
+ }
+
+ *ptr = '\0';
+ break;
+ }
+
+ ptr += strlen(ptr);
+ }
+
+ *ptr = '\0';
+
+ return (buffer);
+}
+
+
/*
* End of "$Id: dest.c 7946 2008-09-16 23:27:54Z mike $".
*/
/*
* 'cupsDirClose()' - Close a directory.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
void
/*
* 'cupsDirOpen()' - Open a directory.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
cups_dir_t * /* O - Directory pointer or @code NULL@ if the directory could not be opened. */
/*
* 'cupsDirRead()' - Read the next directory entry.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
cups_dentry_t * /* O - Directory entry or @code NULL@ if there are no more */
/*
* 'cupsDirRewind()' - Rewind to the start of the directory.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
void
/*
* 'cupsDirClose()' - Close a directory.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
void
/*
* 'cupsDirOpen()' - Open a directory.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
cups_dir_t * /* O - Directory pointer or @code NULL@ if the directory could not be opened. */
/*
* 'cupsDirRead()' - Read the next directory entry.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
cups_dentry_t * /* O - Directory entry or @code NULL@ when there are no more */
/*
* 'cupsDirRewind()' - Rewind to the start of the directory.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
void
* The choices array should be freed using @code free@ when you are
* finished with it.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - Number of options marked */
*
* When "limit" is zero, this function is identical to ppdEmit().
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 0 on success, -1 on failure */
/*
* 'ppdEmitJCLEnd()' - Emit JCLEnd code to a file.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 0 on success, -1 on failure */
* The return string is allocated on the heap and should be freed using
* @code free@ when you are done with it.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
char * /* O - String containing option code or @code NULL@ if there is no option code */
{ 1, "job-sheets-default", IPP_TAG_NAME, IPP_TAG_PRINTER },
{ 0, "job-uuid", IPP_TAG_URI, IPP_TAG_JOB },
{ 0, "landscape", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
+ { 1, "marker-change-time", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
+ { 1, "marker-colors", IPP_TAG_NAME, IPP_TAG_PRINTER },
+ { 1, "marker-high-levels", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
+ { 1, "marker-levels", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
+ { 1, "marker-low-levels", IPP_TAG_INTEGER, IPP_TAG_PRINTER },
+ { 0, "marker-message", IPP_TAG_TEXT, IPP_TAG_PRINTER },
+ { 1, "marker-names", IPP_TAG_NAME, IPP_TAG_PRINTER },
+ { 1, "marker-types", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
{ 1, "media", IPP_TAG_KEYWORD, IPP_TAG_JOB },
{ 0, "mirror", IPP_TAG_BOOLEAN, IPP_TAG_JOB },
{ 0, "mirror-default", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
{ 0, "prettyprint-default", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
{ 0, "print-quality", IPP_TAG_ENUM, IPP_TAG_JOB },
{ 0, "print-quality-default", IPP_TAG_ENUM, IPP_TAG_PRINTER },
+ { 1, "printer-commands", IPP_TAG_KEYWORD, IPP_TAG_PRINTER },
{ 0, "printer-error-policy", IPP_TAG_NAME, IPP_TAG_PRINTER },
{ 0, "printer-info", IPP_TAG_TEXT, IPP_TAG_PRINTER },
{ 0, "printer-is-accepting-jobs", IPP_TAG_BOOLEAN, IPP_TAG_PRINTER },
* function multiple times for each group, or use cupsEncodeOptions()
* to add the standard groups.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
void
* Copy the name over...
*/
- if ((attr->name = _cupsStrAlloc(option->name)) == NULL)
- {
- /*
- * Ran out of memory!
- */
-
- DEBUG_puts("cupsEncodeOptions2: Ran out of memory for name!");
- return;
- }
+ attr->name = _cupsStrRetain(option->name);
if (count > 1)
{
break;
default :
- if ((attr->values[j].string.text = _cupsStrAlloc(val)) == NULL)
+ if (count == 1)
+ attr->values[0].string.text = _cupsStrRetain(val);
+ else if ((attr->values[j].string.text = _cupsStrAlloc(val)) == NULL)
{
/*
* Ran out of memory!
/*
* 'cupsFileClose()' - Close a CUPS file.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 0 on success, -1 on error */
/*
* 'cupsFileCompression()' - Return whether a file is compressed.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - @code CUPS_FILE_NONE@ or @code CUPS_FILE_GZIP@ */
/*
* 'cupsFileEOF()' - Return the end-of-file status.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 1 on end of file, 0 otherwise */
* the supplied paths, @code NULL@ is returned. A @code NULL@ path only
* matches the current directory.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
const char * /* O - Full path to file or @code NULL@ if not found */
/*
* 'cupsFileFlush()' - Flush pending output.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 0 on success, -1 on error */
/*
* 'cupsFileGetChar()' - Get a single character from a file.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - Character or -1 on end of file */
/*
* 'cupsFileGetConf()' - Get a line from a configuration file...
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
char * /* O - Line read or @code NULL@ on end of file or error */
* nul-terminated, however you should use the returned length to determine
* the number of bytes on the line.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
size_t /* O - Number of bytes on line or 0 on end of file */
/*
* 'cupsFileGets()' - Get a CR and/or LF-terminated line.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
char * /* O - Line read or @code NULL@ on end of file or error */
/*
* 'cupsFileLock()' - Temporarily lock access to a file.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 0 on success, -1 on error */
/*
* 'cupsFileNumber()' - Return the file descriptor associated with a CUPS file.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - File descriptor */
* connection as needed, generally preferring IPv6 connections when there is
* a choice.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
cups_file_t * /* O - CUPS file or @code NULL@ if the file or socket cannot be opened */
* supplied which enables Flate compression of the file. Compression is
* not supported for the "a" (append) mode.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
cups_file_t * /* O - CUPS file or @code NULL@ if the file could not be opened */
/*
* 'cupsFilePeekChar()' - Peek at the next character from a file.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - Character or -1 on end of file */
/*
* 'cupsFilePrintf()' - Write a formatted string.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - Number of bytes written or -1 on error */
/*
* 'cupsFilePutChar()' - Write a character.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 0 on success, -1 on error */
*
* Like the @code fputs@ function, no newline is appended to the string.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - Number of bytes written or -1 on error */
/*
* 'cupsFileRead()' - Read from a file.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
ssize_t /* O - Number of bytes read or -1 on error */
* 'cupsFileRewind()' - Set the current file position to the beginning of the
* file.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
off_t /* O - New file position or -1 on error */
/*
* 'cupsFileSeek()' - Seek in a file.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
off_t /* O - New file position or -1 on error */
/*
* 'cupsFileStderr()' - Return a CUPS file associated with stderr.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
cups_file_t * /* O - CUPS file */
/*
* 'cupsFileStdin()' - Return a CUPS file associated with stdin.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
cups_file_t * /* O - CUPS file */
/*
* 'cupsFileStdout()' - Return a CUPS file associated with stdout.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
cups_file_t * /* O - CUPS file */
/*
* 'cupsFileTell()' - Return the current file position.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
off_t /* O - File position */
/*
* 'cupsFileUnlock()' - Unlock access to a file.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 0 on success, -1 on error */
/*
* 'cupsFileWrite()' - Write to a file.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
ssize_t /* O - Number of bytes written or -1 on error */
*
* This function returns @code HTTP_OK@ when the file is successfully retrieved.
*
- * @since CUPS 1.1.20@
+ * @since CUPS 1.1.20/Mac OS X 10.4@
*/
http_status_t /* O - HTTP status */
*
* This function returns @code HTTP_OK@ when the file is successfully retrieved.
*
- * @since CUPS 1.1.20@
+ * @since CUPS 1.1.20/Mac OS X 10.4@
*/
http_status_t /* O - HTTP status */
* This function returns @code HTTP_CREATED@ when the file is stored
* successfully.
*
- * @since CUPS 1.1.20@
+ * @since CUPS 1.1.20/Mac OS X 10.4@
*/
http_status_t /* O - HTTP status */
* This function returns @code HTTP_CREATED@ when the file is stored
* successfully.
*
- * @since CUPS 1.1.20@
+ * @since CUPS 1.1.20/Mac OS X 10.4@
*/
http_status_t /* O - HTTP status */
/*
* 'httpAddrAny()' - Check for the "any" address.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 1 if "any", 0 otherwise */
/*
* 'httpAddrEqual()' - Compare two addresses.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 1 if equal, 0 if not */
/*
* 'httpAddrLength()' - Return the length of the address in bytes.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - Length in bytes */
/*
* 'httpAddrLocalhost()' - Check for the local loopback address.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 1 if local host, 0 otherwise */
/*
* 'httpAddrLookup()' - Lookup the hostname associated with the address.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
char * /* O - Host name */
/*
* 'httpAddrString()' - Convert an address to a numeric string.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
char * /* O - Numeric address string */
* Otherwise, return the FQDN for the local system using both gethostname()
* and gethostbyname() to get the local hostname with domain.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
const char * /* O - FQDN for connection or system */
/*
* 'httpAddrConnect()' - Connect to any of the addresses in the list.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
http_addrlist_t * /* O - Connected address or NULL on failure */
/*
* 'httpAddrFreeList()' - Free an address list.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
void
/*
* 'httpAddrGetList()' - Get a list of addresses for a hostname.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
http_addrlist_t * /* O - List of addresses or NULL */
*
* Private HTTP definitions for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007 by Apple Inc.
+ * Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
* place of traditional string functions whenever you need to create a
* URI string.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
http_uri_status_t /* O - URI status */
* this function in place of traditional string functions whenever
* you need to create a URI string.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
http_uri_status_t /* O - URI status */
/*
* 'httpDecode64_2()' - Base64-decode a string.
*
- * @since CUPS 1.1.21@
+ * @since CUPS 1.1.21/Mac OS X 10.4@
*/
char * /* O - Decoded string */
/*
* 'httpEncode64_2()' - Base64-encode a string.
*
- * @since CUPS 1.1.21@
+ * @since CUPS 1.1.21/Mac OS X 10.4@
*/
char * /* O - Encoded string */
/*
* 'httpGetDateString2()' - Get a formatted date/time string from a time value.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
const char * /* O - Date/time string */
*
* This function is deprecated; use the httpSeparateURI() function instead.
*
- * @since CUPS 1.1.21@
+ * @since CUPS 1.1.21/Mac OS X 10.4@
* @deprecated@
*/
* 'httpSeparateURI()' - Separate a Universal Resource Identifier into its
* components.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
http_uri_status_t /* O - Result of separation */
/*
* 'httpClearCookie()' - Clear the cookie value(s).
*
- * @since CUPS 1.1.19@
+ * @since CUPS 1.1.19/Mac OS X 10.3@
*/
void
/*
* 'httpFlushWrite()' - Flush data in write buffer.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - Bytes written or -1 on error */
* string to use with httpSetField() for the HTTP_FIELD_AUTHORIZATION
* value.
*
- * @since CUPS 1.3@
+ * @since CUPS 1.3/Mac OS X 10.5@
*/
char * /* O - Authorization string */
/*
* 'httpGetBlocking()' - Get the blocking/non-block state of a connection.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 1 if blocking, 0 if non-blocking */
/*
* 'httpGetCookie()' - Get any cookie data from the response.
*
- * @since CUPS 1.1.19@
+ * @since CUPS 1.1.19/Mac OS X 10.3@
*/
const char * /* O - Cookie data or NULL */
/*
* 'httpGetFd()' - Get the file descriptor associated with a connection.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - File descriptor or -1 if none */
* This function returns the complete content length, even for
* content larger than 2^31 - 1.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
off_t /* O - Content length */
/*
* 'httpGetStatus()' - Get the status of the last HTTP request.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
http_status_t /* O - HTTP status */
/*
* 'httpGetSubField2()' - Get a sub-field value.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
char * /* O - Value or NULL */
/*
* 'httpRead2()' - Read data from a HTTP connection.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
ssize_t /* O - Number of bytes read */
* HTTP_FIELD_AUTHORIZATION prior to issuing a HTTP request using httpGet(),
* httpHead(), httpOptions(), httpPost, or httpPut().
*
- * @since CUPS 1.3@
+ * @since CUPS 1.3/Mac OS X 10.5@
*/
void
/*
* 'httpSetCookie()' - Set the cookie value(s)...
*
- * @since CUPS 1.1.19@
+ * @since CUPS 1.1.19/Mac OS X 10.3@
*/
void
*
* Currently only HTTP_CONTINUE is supported for the "expect" argument.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
void
/*
* 'httpSetLength()' - Set the content-length and content-encoding.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
void
/*
* 'httpWait()' - Wait for data available on a connection.
*
- * @since CUPS 1.1.19@
+ * @since CUPS 1.1.19/Mac OS X 10.3@
*/
int /* O - 1 if data is available, 0 otherwise */
/*
* 'httpWrite2()' - Write data to a HTTP connection.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
ssize_t /* O - Number of bytes written */
HTTP_AUTH_MD5_SESS, /* MD5-session authentication in use */
HTTP_AUTH_MD5_INT, /* Digest authentication in use for body */
HTTP_AUTH_MD5_SESS_INT, /* MD5-session authentication in use for body */
- HTTP_AUTH_NEGOTIATE /* GSSAPI authentication in use @since CUPS 1.3@ */
+ HTTP_AUTH_NEGOTIATE /* GSSAPI authentication in use @since CUPS 1.3/Mac OS X 10.5@ */
} http_auth_t;
typedef enum http_encoding_e /**** HTTP transfer encoding values ****/
typedef union _http_addr_u /**** Socket address union, which
**** makes using IPv6 and other
**** address types easier and
- **** more portable. @since CUPS 1.2@
+ **** more portable. @since CUPS 1.2/Mac OS X 10.5@
****/
{
struct sockaddr addr; /* Base structure for family value */
typedef struct http_addrlist_s /**** Socket address list, which is
**** used to enumerate all of the
**** addresses that are associated
- **** with a hostname. @since CUPS 1.2@
+ **** with a hostname. @since CUPS 1.2/Mac OS X 10.5@
****/
{
struct http_addrlist_s *next; /* Pointer to next address in list */
/*
* 'ippErrorValue()' - Return a status code for the given name.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
ipp_status_t /* O - IPP status code */
/*
* 'ippOpString()' - Return a name for the given operation id.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
const char * /* O - Name */
/*
* 'ippOpValue()' - Return an operation id for the given name.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
ipp_op_t /* O - Operation ID */
/*
* 'ippAddCollection()' - Add a collection value.
*
- * @since CUPS 1.1.19@
+ * @since CUPS 1.1.19/Mac OS X 10.3@
*/
ipp_attribute_t * /* O - New attribute */
/*
* 'ippAddCollections()' - Add an array of collection values.
*
- * @since CUPS 1.1.19@
+ * @since CUPS 1.1.19/Mac OS X 10.3@
*/
ipp_attribute_t * /* O - New attribute */
/*
* 'ippAddOctetString()' - Add an octetString value to an IPP message.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
ipp_attribute_t * /* O - New attribute */
/*
* 'ippDeleteAttribute()' - Delete a single attribute in an IPP message.
*
- * @since CUPS 1.1.19@
+ * @since CUPS 1.1.19/Mac OS X 10.3@
*/
void
* attributes-natural-language attributes added. The
* attributes-natural-language value is derived from the current locale.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
ipp_t * /* O - IPP request message */
/*
* 'ippReadFile()' - Read data for an IPP message from a file.
*
- * @since CUPS 1.1.19@
+ * @since CUPS 1.1.19/Mac OS X 10.3@
*/
ipp_state_t /* O - Current state */
/*
* 'ippReadIO()' - Read data for an IPP message.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
ipp_state_t /* O - Current state */
/*
* 'ippWriteFile()' - Write data for an IPP message to a file.
*
- * @since CUPS 1.1.19@
+ * @since CUPS 1.1.19/Mac OS X 10.3@
*/
ipp_state_t /* O - Current state */
/*
* 'ippWriteIO()' - Write data for an IPP message.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
ipp_state_t /* O - Current state */
* Internet Printing Protocol definitions for the Common UNIX Printing
* System (CUPS).
*
- * Copyright 2007 by Apple Inc.
+ * Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
IPP_SET_PRINTER_ATTRIBUTES, /* Set printer attributes @private@ */
IPP_SET_JOB_ATTRIBUTES, /* Set job attributes */
IPP_GET_PRINTER_SUPPORTED_VALUES, /* Get supported attribute values */
- IPP_CREATE_PRINTER_SUBSCRIPTION, /* Create a printer subscription @since CUPS 1.2@ */
- IPP_CREATE_JOB_SUBSCRIPTION, /* Create a job subscription @since CUPS 1.2@ */
- IPP_GET_SUBSCRIPTION_ATTRIBUTES, /* Get subscription attributes @since CUPS 1.2@ */
- IPP_GET_SUBSCRIPTIONS, /* Get list of subscriptions @since CUPS 1.2@ */
- IPP_RENEW_SUBSCRIPTION, /* Renew a printer subscription @since CUPS 1.2@ */
- IPP_CANCEL_SUBSCRIPTION, /* Cancel a subscription @since CUPS 1.2@ */
- IPP_GET_NOTIFICATIONS, /* Get notification events @since CUPS 1.2@ */
+ IPP_CREATE_PRINTER_SUBSCRIPTION, /* Create a printer subscription @since CUPS 1.2/Mac OS X 10.5@ */
+ IPP_CREATE_JOB_SUBSCRIPTION, /* Create a job subscription @since CUPS 1.2/Mac OS X 10.5@ */
+ IPP_GET_SUBSCRIPTION_ATTRIBUTES, /* Get subscription attributes @since CUPS 1.2/Mac OS X 10.5@ */
+ IPP_GET_SUBSCRIPTIONS, /* Get list of subscriptions @since CUPS 1.2/Mac OS X 10.5@ */
+ IPP_RENEW_SUBSCRIPTION, /* Renew a printer subscription @since CUPS 1.2/Mac OS X 10.5@ */
+ IPP_CANCEL_SUBSCRIPTION, /* Cancel a subscription @since CUPS 1.2/Mac OS X 10.5@ */
+ IPP_GET_NOTIFICATIONS, /* Get notification events @since CUPS 1.2/Mac OS X 10.5@ */
IPP_SEND_NOTIFICATIONS, /* Send notification events @private@ */
IPP_GET_PRINT_SUPPORT_FILES = 0x0021, /* Get printer support files @private@ */
IPP_ENABLE_PRINTER, /* Start a printer */
CUPS_GET_DEVICES, /* Get a list of supported devices */
CUPS_GET_PPDS, /* Get a list of supported drivers */
CUPS_MOVE_JOB, /* Move a job to a different printer */
- CUPS_AUTHENTICATE_JOB, /* Authenticate a job @since CUPS 1.2@ */
- CUPS_GET_PPD, /* Get a PPD file @since CUPS 1.3@ */
+ CUPS_AUTHENTICATE_JOB, /* Authenticate a job @since CUPS 1.2/Mac OS X 10.5@ */
+ CUPS_GET_PPD, /* Get a PPD file @since CUPS 1.3/Mac OS X 10.5@ */
CUPS_GET_DOCUMENT = 0x4027 /* Get a document file @since CUPS 1.4@ */
} ipp_op_t;
/**** New in CUPS 1.2 ****/
typedef ssize_t (*ipp_iocb_t)(void *, ipp_uchar_t *, size_t);
- /**** IPP IO Callback Function @since CUPS 1.2@ ****/
+ /**** IPP IO Callback Function @since CUPS 1.2/Mac OS X 10.5@ ****/
typedef union ipp_request_u /**** Request Header ****/
{
} status;
/**** New in CUPS 1.1.19 ****/
- struct /* Event Header */
+ struct /* Event Header @since CUPS 1.1.19/Mac OS X 10.3@ */
{
ipp_uchar_t version[2]; /* Protocol version number */
ipp_status_t status_code; /* Status code */
} unknown; /* Unknown attribute type */
/**** New in CUPS 1.1.19 ****/
- ipp_t *collection; /* Collection value */
+ ipp_t *collection; /* Collection value @since CUPS 1.1.19/Mac OS X 10.3@ */
} ipp_value_t;
typedef struct ipp_attribute_s /**** Attribute ****/
ipp_tag_t curtag; /* Current attribute group tag */
/**** New in CUPS 1.2 ****/
- ipp_attribute_t *prev; /* Previous attribute (for read) */
+ ipp_attribute_t *prev; /* Previous attribute (for read) @since CUPS 1.2/Mac OS X 10.5@ */
};
*
* Multi-language support for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007 by Apple Inc.
+ * Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
__cupsStrFlush
__cupsStrFormatd
__cupsStrFree
+__cupsStrRetain
__cupsStrScand
__cupsStrStatistics
__httpAddrPort
_cupsStrFlush
_cupsStrFormatd
_cupsStrFree
+_cupsStrRetain
_cupsStrScand
_cupsStrStatistics
_cups_getifaddrs
* descriptions, printer presets, and custom option parameters. Each
* localized string uses the UTF-8 character encoding.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - 0 on success, -1 on error */
*
* If no value of the requested scheme can be found, NULL is returned.
*
- * @since CUPS 1.3@
+ * @since CUPS 1.3/Mac OS X 10.5@
*/
const char * /* O - Value or NULL if not found */
*
* Options are returned from all groups in ascending alphanumeric order.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
ppd_option_t * /* O - First option or @code NULL@ */
*
* Options are returned from all groups in ascending alphanumeric order.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
ppd_option_t * /* O - Next option or @code NULL@ */
if (cparam->current.custom_string)
_cupsStrFree(cparam->current.custom_string);
- cparam->current.custom_string = _cupsStrAlloc(val->value);
+ cparam->current.custom_string = _cupsStrRetain(val->value);
break;
}
}
*
* The returned string must be freed by the caller using @code free@.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
char * /* O - Subject string or @code NULL@ */
*
* The returned string must be freed by the caller using @code free@.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
char * /* O - Message text or @code NULL@ */
/*
- * "$Id: options.c 7819 2008-08-01 00:27:24Z mike $"
+ * "$Id: options.c 8181 2008-12-10 17:29:57Z mike $"
*
* Option routines for the Common UNIX Printing System (CUPS).
*
#include "debug.h"
+/*
+ * Local functions...
+ */
+
+static int cups_compare_options(cups_option_t *a, cups_option_t *b);
+static int cups_find_option(const char *name, int num_options,
+ cups_option_t *option, int prev, int *rdiff);
+
+
/*
* 'cupsAddOption()' - Add an option to an option array.
*
int num_options,/* I - Number of options */
cups_option_t **options) /* IO - Pointer to options */
{
- int i; /* Looping var */
cups_option_t *temp; /* Pointer to new option */
+ int insert, /* Insertion point */
+ diff; /* Result of search */
DEBUG_printf(("cupsAddOption(name=\"%s\", value=\"%s\", num_options=%d, "
* Look for an existing option with the same name...
*/
- for (i = 0, temp = *options; i < num_options; i ++, temp ++)
- if (!strcasecmp(temp->name, name))
- break;
+ if (num_options == 0)
+ {
+ insert = 0;
+ diff = 1;
+ }
+ else
+ {
+ insert = cups_find_option(name, num_options, *options, num_options - 1,
+ &diff);
- if (i >= num_options)
+ if (diff > 0)
+ insert ++;
+ }
+
+ if (diff)
{
/*
* No matching option name...
*/
- DEBUG_puts("cupsAddOption: New option...");
+ DEBUG_printf(("cupsAddOption: New option inserted at index %d...\n",
+ insert));
if (num_options == 0)
temp = (cups_option_t *)malloc(sizeof(cups_option_t));
return (0);
}
- *options = temp;
- temp += num_options;
+ *options = temp;
+
+ if (insert < num_options)
+ {
+ DEBUG_printf(("cupsAddOption: Shifting %d options...\n",
+ (int)(num_options - insert)));
+ memmove(temp + insert + 1, temp + insert,
+ (num_options - insert) * sizeof(cups_option_t));
+ }
+
+ temp += insert;
temp->name = _cupsStrAlloc(name);
num_options ++;
}
* Match found; free the old value...
*/
- DEBUG_puts("cupsAddOption: Option already exists...");
+ DEBUG_printf(("cupsAddOption: Option already exists at index %d...\n",
+ insert));
+
+ temp = *options + insert;
_cupsStrFree(temp->value);
}
int num_options,/* I - Number of options */
cups_option_t *options) /* I - Options */
{
- int i; /* Looping var */
+ int diff, /* Result of comparison */
+ match; /* Matching index */
DEBUG_printf(("cupsGetOption(name=\"%s\", num_options=%d, options=%p)\n",
return (NULL);
}
- for (i = 0; i < num_options; i ++)
- if (!strcasecmp(options[i].name, name))
- {
- DEBUG_printf(("cupsGetOption: Returning \"%s\"\n", options[i].value));
- return (options[i].value);
- }
+ match = cups_find_option(name, num_options, options, -1, &diff);
+
+ if (!diff)
+ {
+ DEBUG_printf(("cupsGetOption: Returning \"%s\"\n", options[match].value));
+ return (options[match].value);
+ }
DEBUG_puts("cupsGetOption: Returning NULL");
return (NULL);
*ptr, /* Pointer into string */
*name, /* Pointer to name */
*value, /* Pointer to value */
+ sep, /* Separator character */
quote; /* Quote character */
while (isspace(*ptr & 255))
*ptr++ = '\0';
+ if ((sep = *ptr) == '=')
+ *ptr++ = '\0';
+
DEBUG_printf(("cupsParseOptions: name=\"%s\"\n", name));
- if (*ptr != '=')
+ if (sep != '=')
{
/*
* Boolean option...
* Remove = and parse the value...
*/
- *ptr++ = '\0';
- value = ptr;
+ value = ptr;
while (*ptr && !isspace(*ptr & 255))
{
/*
* 'cupsRemoveOption()' - Remove an option from an option array.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
int /* O - New number of options */
/*
- * End of "$Id: options.c 7819 2008-08-01 00:27:24Z mike $".
+ * 'cups_compare_options()' - Compare two options.
+ */
+
+static int /* O - Result of comparison */
+cups_compare_options(cups_option_t *a, /* I - First option */
+ cups_option_t *b) /* I - Second option */
+{
+ return (strcasecmp(a->name, b->name));
+}
+
+
+/*
+ * 'cups_find_option()' - Find an option using a binary search.
+ */
+
+static int /* O - Index of match */
+cups_find_option(
+ const char *name, /* I - Option name */
+ int num_options, /* I - Number of options */
+ cups_option_t *options, /* I - Options */
+ int prev, /* I - Previous index */
+ int *rdiff) /* O - Difference of match */
+{
+ int left, /* Low mark for binary search */
+ right, /* High mark for binary search */
+ current, /* Current index */
+ diff; /* Result of comparison */
+ cups_option_t key; /* Search key */
+
+
+ DEBUG_printf(("cups_find_option(name=\"%s\", num_options=%d, options=%p, "
+ "prev=%d, rdiff=%p)\n", name, num_options, options, prev,
+ rdiff));
+
+#ifdef DEBUG
+ for (left = 0; left < num_options; left ++)
+ DEBUG_printf(("cups_find_option: options[%d].name=\"%s\", .value=\"%s\"\n",
+ left, options[left].name, options[left].value));
+#endif /* DEBUG */
+
+ key.name = (char *)name;
+
+ if (prev >= 0)
+ {
+ /*
+ * Start search on either side of previous...
+ */
+
+ if ((diff = cups_compare_options(&key, options + prev)) == 0 ||
+ (diff < 0 && prev == 0) ||
+ (diff > 0 && prev == (num_options - 1)))
+ {
+ *rdiff = diff;
+ return (prev);
+ }
+ else if (diff < 0)
+ {
+ /*
+ * Start with previous on right side...
+ */
+
+ left = 0;
+ right = prev;
+ }
+ else
+ {
+ /*
+ * Start wih previous on left side...
+ */
+
+ left = prev;
+ right = num_options - 1;
+ }
+ }
+ else
+ {
+ /*
+ * Start search in the middle...
+ */
+
+ left = 0;
+ right = num_options - 1;
+ }
+
+ do
+ {
+ current = (left + right) / 2;
+ diff = cups_compare_options(&key, options + current);
+
+ if (diff == 0)
+ break;
+ else if (diff < 0)
+ right = current;
+ else
+ left = current;
+ }
+ while ((right - left) > 1);
+
+ if (diff != 0)
+ {
+ /*
+ * Check the last 1 or 2 elements...
+ */
+
+ if ((diff = cups_compare_options(&key, options + left)) <= 0)
+ current = left;
+ else
+ {
+ diff = cups_compare_options(&key, options + right);
+ current = right;
+ }
+ }
+
+ /*
+ * Return the closest destination and the difference...
+ */
+
+ *rdiff = diff;
+
+ return (current);
+}
+
+
+/*
+ * End of "$Id: options.c 8181 2008-12-10 17:29:57Z mike $".
*/
*
* Page size functions for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007 by Apple Inc.
+ * Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products, all rights reserved.
*
* These coded instructions, statements, and computer programs are the
/*
* 'ppdErrorString()' - Returns the text assocated with a status.
*
- * @since CUPS 1.1.19@
+ * @since CUPS 1.1.19/Mac OS X 10.3@
*/
const char * /* O - Status string */
/*
* 'ppdLastError()' - Return the status from the last ppdOpen*().
*
- * @since CUPS 1.1.19@
+ * @since CUPS 1.1.19/Mac OS X 10.3@
*/
ppd_status_t /* O - Status code */
/*
* 'ppdOpen2()' - Read a PPD file into memory.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
ppd_file_t * /* O - PPD file record or @code NULL@ if the PPD file could not be opened. */
strlcpy(choice->text,
custom_attr->text[0] ? custom_attr->text : _("Custom"),
sizeof(choice->text));
- choice->code = _cupsStrAlloc(custom_attr->value);
+ choice->code = _cupsStrRetain(custom_attr->value);
}
}
else if (!strcmp(keyword, "JCLOpenUI"))
strlcpy(choice->text,
custom_attr->text[0] ? custom_attr->text : _("Custom"),
sizeof(choice->text));
- choice->code = _cupsStrAlloc(custom_attr->value);
+ choice->code = _cupsStrRetain(custom_attr->value);
}
}
else if (!strcmp(keyword, "CloseUI") || !strcmp(keyword, "JCLCloseUI"))
/*
* 'ppdSetConformance()' - Set the conformance level for PPD files.
*
- * @since CUPS 1.1.20@
+ * @since CUPS 1.1.20/Mac OS X 10.4@
*/
void
PPD_CS_N /* DeviceN colorspace */
} ppd_cs_t;
-typedef enum ppd_status_e /**** Status Codes @since CUPS 1.1.19@ ****/
+typedef enum ppd_status_e /**** Status Codes @since CUPS 1.1.19/Mac OS X 10.3@ ****/
{
PPD_OK = 0, /* OK */
PPD_FILE_OPEN_ERROR, /* Unable to open PPD file */
PPD_BAD_CUSTOM_PARAM /* Bad custom parameter */
} ppd_status_t;
-enum ppd_conform_e /**** Conformance Levels @since CUPS 1.1.19@ ****/
+enum ppd_conform_e /**** Conformance Levels @since CUPS 1.1.19/Mac OS X 10.3@ ****/
{
PPD_CONFORM_RELAXED, /* Relax whitespace and control char */
PPD_CONFORM_STRICT /* Require strict conformance */
};
typedef enum ppd_conform_e ppd_conform_t;
- /**** Conformance Levels @since CUPS 1.1.19@ ****/
+ /**** Conformance Levels @since CUPS 1.1.19/Mac OS X 10.3@ ****/
-typedef struct ppd_attr_s /**** PPD Attribute Structure @since CUPS 1.1.19@ ****/
+typedef struct ppd_attr_s /**** PPD Attribute Structure @since CUPS 1.1.19/Mac OS X 10.3@ ****/
{
char name[PPD_MAX_NAME]; /* Name of attribute (cupsXYZ) */
char spec[PPD_MAX_NAME]; /* Specifier string, if any */
****/
char text[PPD_MAX_TEXT - PPD_MAX_NAME];
/* Human-readable group name */
- char name[PPD_MAX_NAME]; /* Group name @since CUPS 1.1.18@ */
+ char name[PPD_MAX_NAME]; /* Group name @since CUPS 1.1.18/Mac OS X 10.3@ */
int num_options; /* Number of options */
ppd_option_t *options; /* Options */
int num_subgroups; /* Number of sub-groups */
} ppd_profile_t;
/**** New in CUPS 1.2 ****/
-typedef enum ppd_cptype_e /**** Custom Parameter Type @since CUPS 1.2@ ****/
+typedef enum ppd_cptype_e /**** Custom Parameter Type @since CUPS 1.2/Mac OS X 10.5@ ****/
{
PPD_CUSTOM_CURVE, /* Curve value for f(x) = x^value */
PPD_CUSTOM_INT, /* Integer number value */
PPD_CUSTOM_STRING /* String of characters */
} ppd_cptype_t;
-typedef union ppd_cplimit_u /**** Custom Parameter Limit @since CUPS 1.2@ ****/
+typedef union ppd_cplimit_u /**** Custom Parameter Limit @since CUPS 1.2/Mac OS X 10.5@ ****/
{
float custom_curve; /* Gamma value */
int custom_int; /* Integer value */
int custom_string; /* String length */
} ppd_cplimit_t;
-typedef union ppd_cpvalue_u /**** Custom Parameter Value @since CUPS 1.2@ ****/
+typedef union ppd_cpvalue_u /**** Custom Parameter Value @since CUPS 1.2/Mac OS X 10.5@ ****/
{
float custom_curve; /* Gamma value */
int custom_int; /* Integer value */
char *custom_string; /* String value */
} ppd_cpvalue_t;
-typedef struct ppd_cparam_s /**** Custom Parameter @since CUPS 1.2@ ****/
+typedef struct ppd_cparam_s /**** Custom Parameter @since CUPS 1.2/Mac OS X 10.5@ ****/
{
char name[PPD_MAX_NAME]; /* Parameter name */
char text[PPD_MAX_TEXT]; /* Human-readable text */
ppd_cpvalue_t current; /* Current value */
} ppd_cparam_t;
-typedef struct ppd_coption_s /**** Custom Option @since CUPS 1.2@ ****/
+typedef struct ppd_coption_s /**** Custom Option @since CUPS 1.2/Mac OS X 10.5@ ****/
{
char keyword[PPD_MAX_NAME]; /* Name of option that is being extended... */
ppd_option_t *option; /* Option that is being extended... */
int flip_duplex; /* 1 = Flip page for back sides @deprecated@ */
/**** New in CUPS 1.1.19 ****/
- char *protocols; /* Protocols (BCP, TBCP) string @since CUPS 1.1.19@ */
- char *pcfilename; /* PCFileName string @since CUPS 1.1.19@ */
- int num_attrs; /* Number of attributes @since CUPS 1.1.19@ @private@ */
- int cur_attr; /* Current attribute @since CUPS 1.1.19@ @private@ */
- ppd_attr_t **attrs; /* Attributes @since CUPS 1.1.19@ @private@ */
+ char *protocols; /* Protocols (BCP, TBCP) string @since CUPS 1.1.19/Mac OS X 10.3@ */
+ char *pcfilename; /* PCFileName string @since CUPS 1.1.19/Mac OS X 10.3@ */
+ int num_attrs; /* Number of attributes @since CUPS 1.1.19/Mac OS X 10.3@ @private@ */
+ int cur_attr; /* Current attribute @since CUPS 1.1.19/Mac OS X 10.3@ @private@ */
+ ppd_attr_t **attrs; /* Attributes @since CUPS 1.1.19/Mac OS X 10.3@ @private@ */
/**** New in CUPS 1.2 ****/
- cups_array_t *sorted_attrs; /* Attribute lookup array @since CUPS 1.2@ @private@ */
- cups_array_t *options; /* Option lookup array @since CUPS 1.2@ @private@ */
- cups_array_t *coptions; /* Custom options array @since CUPS 1.2@ @private@ */
+ cups_array_t *sorted_attrs; /* Attribute lookup array @since CUPS 1.2/Mac OS X 10.5@ @private@ */
+ cups_array_t *options; /* Option lookup array @since CUPS 1.2/Mac OS X 10.5@ @private@ */
+ cups_array_t *coptions; /* Custom options array @since CUPS 1.2/Mac OS X 10.5@ @private@ */
/**** New in CUPS 1.3 ****/
- cups_array_t *marked; /* Marked choices @since CUPS 1.3@ @private@ */
+ cups_array_t *marked; /* Marked choices @since CUPS 1.3/Mac OS X 10.5@ @private@ */
/**** New in CUPS 1.4 ****/
cups_array_t *cups_uiconstraints; /* cupsUIConstraints @since CUPS 1.4@ @private@ */
CUPS_CSPACE_GOLD = 13, /* Gold foil */
CUPS_CSPACE_SILVER = 14, /* Silver foil */
- CUPS_CSPACE_CIEXYZ = 15, /* CIE XYZ @since CUPS 1.1.19@ */
- CUPS_CSPACE_CIELab = 16, /* CIE Lab @since CUPS 1.1.19@ */
+ CUPS_CSPACE_CIEXYZ = 15, /* CIE XYZ @since CUPS 1.1.19/Mac OS X 10.3@ */
+ CUPS_CSPACE_CIELab = 16, /* CIE Lab @since CUPS 1.1.19/Mac OS X 10.3@ */
CUPS_CSPACE_RGBW = 17, /* Red, green, blue, white @since CUPS 1.2/Mac OS X 10.5@ */
- CUPS_CSPACE_ICC1 = 32, /* ICC-based, 1 color @since CUPS 1.1.19@ */
- CUPS_CSPACE_ICC2 = 33, /* ICC-based, 2 colors @since CUPS 1.1.19@ */
- CUPS_CSPACE_ICC3 = 34, /* ICC-based, 3 colors @since CUPS 1.1.19@ */
- CUPS_CSPACE_ICC4 = 35, /* ICC-based, 4 colors @since CUPS 1.1.19@ */
- CUPS_CSPACE_ICC5 = 36, /* ICC-based, 5 colors @since CUPS 1.1.19@ */
- CUPS_CSPACE_ICC6 = 37, /* ICC-based, 6 colors @since CUPS 1.1.19@ */
- CUPS_CSPACE_ICC7 = 38, /* ICC-based, 7 colors @since CUPS 1.1.19@ */
- CUPS_CSPACE_ICC8 = 39, /* ICC-based, 8 colors @since CUPS 1.1.19@ */
- CUPS_CSPACE_ICC9 = 40, /* ICC-based, 9 colors @since CUPS 1.1.19@ */
- CUPS_CSPACE_ICCA = 41, /* ICC-based, 10 colors @since CUPS 1.1.19@ */
- CUPS_CSPACE_ICCB = 42, /* ICC-based, 11 colors @since CUPS 1.1.19@ */
- CUPS_CSPACE_ICCC = 43, /* ICC-based, 12 colors @since CUPS 1.1.19@ */
- CUPS_CSPACE_ICCD = 44, /* ICC-based, 13 colors @since CUPS 1.1.19@ */
- CUPS_CSPACE_ICCE = 45, /* ICC-based, 14 colors @since CUPS 1.1.19@ */
- CUPS_CSPACE_ICCF = 46 /* ICC-based, 15 colors @since CUPS 1.1.19@ */
+ CUPS_CSPACE_ICC1 = 32, /* ICC-based, 1 color @since CUPS 1.1.19/Mac OS X 10.3@ */
+ CUPS_CSPACE_ICC2 = 33, /* ICC-based, 2 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
+ CUPS_CSPACE_ICC3 = 34, /* ICC-based, 3 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
+ CUPS_CSPACE_ICC4 = 35, /* ICC-based, 4 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
+ CUPS_CSPACE_ICC5 = 36, /* ICC-based, 5 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
+ CUPS_CSPACE_ICC6 = 37, /* ICC-based, 6 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
+ CUPS_CSPACE_ICC7 = 38, /* ICC-based, 7 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
+ CUPS_CSPACE_ICC8 = 39, /* ICC-based, 8 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
+ CUPS_CSPACE_ICC9 = 40, /* ICC-based, 9 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
+ CUPS_CSPACE_ICCA = 41, /* ICC-based, 10 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
+ CUPS_CSPACE_ICCB = 42, /* ICC-based, 11 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
+ CUPS_CSPACE_ICCC = 43, /* ICC-based, 12 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
+ CUPS_CSPACE_ICCD = 44, /* ICC-based, 13 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
+ CUPS_CSPACE_ICCE = 45, /* ICC-based, 14 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
+ CUPS_CSPACE_ICCF = 46 /* ICC-based, 15 colors @since CUPS 1.1.19/Mac OS X 10.3@ */
} cups_cspace_t;
typedef enum cups_cut_e /**** CutMedia attribute values ****/
{
CUPS_RASTER_READ = 0, /* Open stream for reading */
CUPS_RASTER_WRITE = 1, /* Open stream for writing */
- CUPS_RASTER_WRITE_COMPRESSED = 2 /* Open stream for compressed writing @since CUPS 1.3@ */
+ CUPS_RASTER_WRITE_COMPRESSED = 2 /* Open stream for compressed writing @since CUPS 1.3/Mac OS X 10.5@ */
};
typedef enum cups_mode_e cups_mode_t; /**** cupsRasterOpen modes ****/
* If "outfile" is a valid file descriptor, cupsDoIORequest() copies
* all of the data after the IPP response message to the file.
*
- * @since CUPS 1.3@
+ * @since CUPS 1.3/Mac OS X 10.5@
*/
ipp_t * /* O - Response data */
* pointed to by the "data" parameter. cupsSideChannelDoRequest() will
* update the value to contain the number of data bytes in the buffer.
*
- * @since CUPS 1.3@
+ * @since CUPS 1.3/Mac OS X 10.5@
*/
cups_sc_status_t /* O - Status of command */
* pointed to by the "data" parameter. cupsSideChannelDoRequest() will
* update the value to contain the number of data bytes in the buffer.
*
- * @since CUPS 1.3@
+ * @since CUPS 1.3/Mac OS X 10.5@
*/
int /* O - 0 on success, -1 on error */
* This function is normally only called by backend programs to send
* responses to a filter, driver, or port monitor program.
*
- * @since CUPS 1.3@
+ * @since CUPS 1.3/Mac OS X 10.5@
*/
int /* O - 0 on success, -1 on error */
/*
* '_cupsSNMPClose()' - Close a SNMP socket.
- *
- * @since CUPS 1.4@
*/
void
* '_cupsSNMPCopyOID()' - Copy an OID.
*
* The array pointed to by "src" is terminated by the value -1.
- *
- * @since CUPS 1.4@
*/
int * /* O - New OID */
*
* The default community name is the first community name found in the
* snmp.conf file. If no community name is defined there, "public" is used.
- *
- * @since CUPS 1.4@
*/
const char * /* O - Default community name */
* '_cupsSNMPIsOID()' - Test whether a SNMP response contains the specified OID.
*
* The array pointed to by "oid" is terminated by the value -1.
- *
- * @since CUPS 1.4@
*/
int /* O - 1 if equal, 0 if not equal */
* OID prefix.
*
* The array pointed to by "prefix" is terminated by the value -1.
- *
- * @since CUPS 1.4@
*/
int /* O - 1 if prefixed, 0 if not prefixed */
/*
* '_cupsSNMPOIDToString()' - Convert an OID to a string.
- *
- * @since CUPS 1.4@
*/
/*
* '_cupsSNMPOpen()' - Open a SNMP socket.
- *
- * @since CUPS 1.4@
*/
int /* O - SNMP socket file descriptor */
*
* If "timeout" is negative, @code _cupsSNMPRead@ will wait for a response
* indefinitely.
- *
- * @since CUPS 1.4@
*/
cups_snmp_t * /* O - SNMP packet or @code NULL@ if none */
/*
* '_cupsSNMPSetDebug()' - Enable/disable debug logging to stderr.
- *
- * @since CUPS 1.4@
*/
void
*
* @code NULL@ is returned if the array is not large enough or the string is
* not a valid OID number.
- *
- * @since CUPS 1.4@
*/
int * /* O - Pointer to OID array or @code NULL@ on error */
*
* If "timeout" is negative, @code _cupsSNMPWalk@ will wait for a response
* indefinitely.
- *
- * @since CUPS 1.4@
*/
int /* O - Number of OIDs found or -1 on error */
* '_cupsSNMPWrite()' - Send an SNMP query packet.
*
* The array pointed to by "oid" is terminated by the value -1.
- *
- * @since CUPS 1.4@
*/
int /* O - 1 on success, 0 on error */
*
* String functions for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007 by Apple Inc.
+ * Copyright 2007-2008 by Apple Inc.
* Copyright 1997-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
*
* Contents:
*
- * _cupsStrAlloc() - Allocate/reference a string.
- * _cupsStrFlush() - Flush the string pool...
- * _cupsStrFormatd() - Format a floating-point number.
- * _cupsStrFree() - Free/dereference a string.
- * _cupsStrScand() - Scan a string for a floating-point number.
- * _cupsStrStatistics() - Return allocation statistics for string pool.
- * _cups_strcpy() - Copy a string allowing for overlapping strings.
- * _cups_strdup() - Duplicate a string.
- * _cups_strcasecmp() - Do a case-insensitive comparison.
- * _cups_strncasecmp() - Do a case-insensitive comparison on up to N chars.
- * _cups_strlcat() - Safely concatenate two strings.
- * _cups_strlcpy() - Safely copy two strings.
- * compare_sp_items() - Compare two string pool items...
+ * _cupsStrAlloc() - Allocate/reference a string.
+ * _cupsStrFlush() - Flush the string pool.
+ * _cupsStrFormatd() - Format a floating-point number.
+ * _cupsStrFree() - Free/dereference a string.
+ * _cupsStrRetain() - Increment the reference count of a string.
+ * _cupsStrScand() - Scan a string for a floating-point number.
+ * _cupsStrStatistics() - Return allocation statistics for string pool.
+ * _cups_strcpy() - Copy a string allowing for overlapping strings.
+ * _cups_strdup() - Duplicate a string.
+ * _cups_strcasecmp() - Do a case-insensitive comparison.
+ * _cups_strncasecmp() - Do a case-insensitive comparison on up to N chars.
+ * _cups_strlcat() - Safely concatenate two strings.
+ * _cups_strlcpy() - Safely copy two strings.
+ * compare_sp_items() - Compare two string pool items...
*/
/*
_cupsStrAlloc(const char *s) /* I - String */
{
_cups_sp_item_t *item, /* String pool item */
- key; /* Search key */
+ *key; /* Search key */
/*
* See if the string is already in the pool...
*/
- key.str = (char *)s;
+ key = (_cups_sp_item_t *)(s - sizeof(unsigned int));
- if ((item = (_cups_sp_item_t *)cupsArrayFind(stringpool, &key)) != NULL)
+ if ((item = (_cups_sp_item_t *)cupsArrayFind(stringpool, key)) != NULL)
{
/*
* Found it, return the cached string...
* Not found, so allocate a new one...
*/
- item = (_cups_sp_item_t *)calloc(1, sizeof(_cups_sp_item_t));
+ item = (_cups_sp_item_t *)calloc(1, sizeof(_cups_sp_item_t) + strlen(s));
if (!item)
{
#ifdef HAVE_PTHREAD_H
}
item->ref_count = 1;
- item->str = strdup(s);
-
- if (!item->str)
- {
- free(item);
-
-#ifdef HAVE_PTHREAD_H
- pthread_mutex_unlock(&sp_mutex);
-#endif /* HAVE_PTHREAD_H */
-
- return (NULL);
- }
+ strcpy(item->str, s);
/*
* Add the string to the pool and return it...
/*
- * '_cupsStrFlush()' - Flush the string pool...
+ * '_cupsStrFlush()' - Flush the string pool.
*/
void
for (item = (_cups_sp_item_t *)cupsArrayFirst(stringpool);
item;
item = (_cups_sp_item_t *)cupsArrayNext(stringpool))
- {
- free(item->str);
free(item);
- }
cupsArrayDelete(stringpool);
stringpool = NULL;
_cupsStrFree(const char *s) /* I - String to free */
{
_cups_sp_item_t *item, /* String pool item */
- key; /* Search key */
+ *key; /* Search key */
/*
pthread_mutex_lock(&sp_mutex);
#endif /* HAVE_PTHREAD_H */
- key.str = (char *)s;
+ key = (_cups_sp_item_t *)(s - sizeof(unsigned int));
- if ((item = (_cups_sp_item_t *)cupsArrayFind(stringpool, &key)) != NULL &&
- item->str == s)
+ if ((item = (_cups_sp_item_t *)cupsArrayFind(stringpool, key)) != NULL &&
+ item == key)
{
/*
* Found it, dereference...
cupsArrayRemove(stringpool, item);
- free(item->str);
free(item);
}
}
}
+/*
+ * '_cupsStrRetain()' - Increment the reference count of a string.
+ *
+ * Note: This function does not verify that the passed pointer is in the
+ * string pool, so any calls to it MUST know they are passing in a
+ * good pointer.
+ */
+
+char * /* O - Pointer to string */
+_cupsStrRetain(char *s) /* I - String to retain */
+{
+ _cups_sp_item_t *item; /* Pointer to string pool item */
+
+
+ if (s)
+ {
+ item = (_cups_sp_item_t *)(s - sizeof(unsigned int));
+
+#ifdef HAVE_PTHREAD_H
+ pthread_mutex_lock(&sp_mutex);
+#endif /* HAVE_PTHREAD_H */
+
+ item->ref_count ++;
+
+#ifdef HAVE_PTHREAD_H
+ pthread_mutex_unlock(&sp_mutex);
+#endif /* HAVE_PTHREAD_H */
+ }
+
+ return (s);
+}
+
+
/*
* '_cupsStrScand()' - Scan a string for a floating-point number.
*
typedef struct _cups_sp_item_s /**** String Pool Item ****/
{
- char *str; /* String */
unsigned int ref_count; /* Reference count */
+ char str[1]; /* String */
} _cups_sp_item_t;
extern char *_cupsStrAlloc(const char *s);
extern void _cupsStrFlush(void);
extern void _cupsStrFree(const char *s);
+extern char *_cupsStrRetain(char *s);
extern size_t _cupsStrStatistics(size_t *alloc_bytes, size_t *total_bytes);
* The temporary filename is returned in the filename buffer.
* The temporary file is opened for writing.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
cups_file_t * /* O - CUPS file or @code NULL@ on error */
*
* Admin function test program for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007 by Apple Inc.
+ * Copyright 2007-2008 by Apple Inc.
* Copyright 2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
fputs("cupsPrintFile: ", stdout);
fflush(stdout);
- if (cupsPrintFile(dest->name, "../data/testprint.ps", "Test Page",
+ if (cupsPrintFile(dest->name, "../data/testprint", "Test Page",
dest->num_options, dest->options) <= 0)
{
- puts("FAIL");
+ printf("FAIL (%s)\n", cupsLastErrorString());
return (1);
}
else
* functions to get the user-defined default printer, as this function does
* not support the lpoptions-defined default printer.
*
- * @since CUPS 1.1.21@
+ * @since CUPS 1.1.21/Mac OS X 10.4@
*/
const char * /* O - Default printer or @code NULL@ */
* pending, processing, or held and @code CUPS_WHICHJOBS_COMPLETED@ returns
* jobs that are stopped, canceled, aborted, or completed.
*
- * @since CUPS 1.1.21@
+ * @since CUPS 1.1.21/Mac OS X 10.4@
*/
int /* O - Number of jobs */
* The returned filename is stored in a static buffer and is overwritten with
* each call to @link cupsGetPPD@ or @code cupsGetPPD2@.
*
- * @since CUPS 1.1.21@
+ * @since CUPS 1.1.21/Mac OS X 10.4@
*/
const char * /* O - Filename for PPD file */
return (HTTP_NOT_ACCEPTABLE);
}
+#ifndef WIN32
+ /*
+ * See if the PPD file is available locally...
+ */
+
+ if (!cg->servername[0])
+ cupsServer();
+
+ if (!strcasecmp(cg->servername, "localhost"))
+ {
+ char ppdname[1024]; /* PPD filename */
+ struct stat ppdinfo; /* PPD file information */
+
+
+ snprintf(ppdname, sizeof(ppdname), "%s/%s.ppd", cg->cups_serverroot, name);
+ if (!stat(ppdname, &ppdinfo))
+ {
+ /*
+ * OK, the file exists, use it!
+ */
+
+ if (buffer[0])
+ {
+ unlink(buffer);
+
+ if (symlink(ppdname, buffer) && errno != EEXIST)
+ {
+ _cupsSetError(IPP_INTERNAL_ERROR, NULL, 0);
+
+ return (HTTP_SERVER_ERROR);
+ }
+ }
+ else
+ {
+ int tries; /* Number of tries */
+ const char *tmpdir; /* TMPDIR environment variable */
+ struct timeval curtime; /* Current time */
+
+ /*
+ * Previously we put root temporary files in the default CUPS temporary
+ * directory under /var/spool/cups. However, since the scheduler cleans
+ * out temporary files there and runs independently of the user apps, we
+ * don't want to use it unless specifically told to by cupsd.
+ */
+
+ if ((tmpdir = getenv("TMPDIR")) == NULL)
+# ifdef __APPLE__
+ tmpdir = "/private/tmp"; /* /tmp is a symlink to /private/tmp */
+# else
+ tmpdir = "/tmp";
+# endif /* __APPLE__ */
+
+ /*
+ * Make the temporary name using the specified directory...
+ */
+
+ tries = 0;
+
+ do
+ {
+ /*
+ * Get the current time of day...
+ */
+
+ gettimeofday(&curtime, NULL);
+
+ /*
+ * Format a string using the hex time values...
+ */
+
+ snprintf(buffer, bufsize, "%s/%08lx%05lx", tmpdir,
+ (unsigned long)curtime.tv_sec,
+ (unsigned long)curtime.tv_usec);
+
+ /*
+ * Try to make a symlink...
+ */
+
+ if (!symlink(ppdname, buffer))
+ break;
+
+ tries ++;
+ }
+ while (tries < 1000);
+
+ if (tries >= 1000)
+ {
+ _cupsSetError(IPP_INTERNAL_ERROR, NULL, 0);
+
+ return (HTTP_SERVER_ERROR);
+ }
+ }
+
+ if (*modtime <= ppdinfo.st_mtime)
+ return (HTTP_NOT_MODIFIED);
+ else
+ {
+ *modtime = ppdinfo.st_mtime;
+ return (HTTP_OK);
+ }
+ }
+ }
+#endif /* !WIN32 */
+
/*
* Try finding a printer URI for this printer...
*/
* overwritten on the next call to @link cupsGetPPD@, @link cupsGetPPD2@,
* or @link cupsGetServerPPD@.
*
- * @since CUPS 1.3@
+ * @since CUPS 1.3/Mac OS X 10.5@
*/
char * /* O - Name of PPD file or @code NULL@ on error */
/*
* 'cupsLastErrorString()' - Return the last IPP status-message.
*
- * @since CUPS 1.2@
+ * @since CUPS 1.2/Mac OS X 10.5@
*/
const char * /* O - status-message text from last request */
* 'cupsPrintFile2()' - Print a file to a printer or class on the specified
* server.
*
- * @since CUPS 1.1.21@
+ * @since CUPS 1.1.21/Mac OS X 10.4@
*/
int /* O - Job ID or 0 on error */
* 'cupsPrintFiles2()' - Print one or more files to a printer or class on the
* specified server.
*
- * @since CUPS 1.1.21@
+ * @since CUPS 1.1.21/Mac OS X 10.4@
*/
int /* O - Job ID or 0 on error */
</table></div>
<h2 class="title">Contents</h2>
<ul class="contents">
+<ul class="subcontents">
<li><a href="#OVERVIEW">Overview</a><ul class="subcontents">
<li><a href="#MANAGING_ARRAYS">Managing Arrays</a></li>
<li><a href="#FINDING_AND_ENUMERATING">Finding and Enumerating Elements</a></li>
<li><a href="#cups_array_func_t" title="Array comparison function">cups_array_func_t</a></li>
<li><a href="#cups_array_t" title="CUPS array type">cups_array_t</a></li>
</ul></li>
-</ul>
<!--
"$Id: api-array.shtml 7616 2008-05-28 00:34:13Z mike $"
puts(s);
</pre>
<h2 class="title"><a name="FUNCTIONS">Functions</a></h2>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsArrayAdd">cupsArrayAdd</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsArrayAdd">cupsArrayAdd</a></h3>
<p class="description">Add an element to the array.</p>
<p class="code">
int cupsArrayAdd (<br>
the element is appended to the end of the array.
</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsArrayClear">cupsArrayClear</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsArrayClear">cupsArrayClear</a></h3>
<p class="description">Clear the array.</p>
<p class="code">
void cupsArrayClear (<br>
elements themselves.
</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsArrayCount">cupsArrayCount</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsArrayCount">cupsArrayCount</a></h3>
<p class="description">Get the number of elements in the array.</p>
<p class="code">
int cupsArrayCount (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Number of elements</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsArrayCurrent">cupsArrayCurrent</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsArrayCurrent">cupsArrayCurrent</a></h3>
<p class="description">Return the current element in the array.</p>
<p class="code">
void *cupsArrayCurrent (<br>
<a href="#cupsArrayFirst"><code>cupsArrayFirst</code></a>, or <a href="#cupsArrayIndex"><code>cupsArrayIndex</code></a>, or <a href="#cupsArrayLast"><code>cupsArrayLast</code></a>.
</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsArrayDelete">cupsArrayDelete</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsArrayDelete">cupsArrayDelete</a></h3>
<p class="description">Free all memory used by the array.</p>
<p class="code">
void cupsArrayDelete (<br>
elements themselves.
</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsArrayDup">cupsArrayDup</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsArrayDup">cupsArrayDup</a></h3>
<p class="description">Duplicate the array.</p>
<p class="code">
<a href="#cups_array_t">cups_array_t</a> *cupsArrayDup (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Duplicate array</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsArrayFind">cupsArrayFind</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsArrayFind">cupsArrayFind</a></h3>
<p class="description">Find an element in the array.</p>
<p class="code">
void *cupsArrayFind (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Element found or <code>NULL</code></p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsArrayFirst">cupsArrayFirst</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsArrayFirst">cupsArrayFirst</a></h3>
<p class="description">Get the first element in the array.</p>
<p class="code">
void *cupsArrayFirst (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">First element or <code>NULL</code> if the array is empty</p>
-<h3 class="function"><span class="info"> CUPS 1.3 </span><a name="cupsArrayGetIndex">cupsArrayGetIndex</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.3/Mac OS X 10.5 </span><a name="cupsArrayGetIndex">cupsArrayGetIndex</a></h3>
<p class="description">Get the index of the current element.</p>
<p class="code">
int cupsArrayGetIndex (<br>
<a href="#cupsArrayFirst"><code>cupsArrayFirst</code></a>, or <a href="#cupsArrayIndex"><code>cupsArrayIndex</code></a>, or <a href="#cupsArrayLast"><code>cupsArrayLast</code></a>.
</p>
-<h3 class="function"><span class="info"> CUPS 1.3 </span><a name="cupsArrayGetInsert">cupsArrayGetInsert</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.3/Mac OS X 10.5 </span><a name="cupsArrayGetInsert">cupsArrayGetInsert</a></h3>
<p class="description">Get the index of the last inserted element.</p>
<p class="code">
int cupsArrayGetInsert (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Index of the last inserted element, starting at 0</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsArrayIndex">cupsArrayIndex</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsArrayIndex">cupsArrayIndex</a></h3>
<p class="description">Get the N-th element in the array.</p>
<p class="code">
void *cupsArrayIndex (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">N-th element or <code>NULL</code></p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsArrayInsert">cupsArrayInsert</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsArrayInsert">cupsArrayInsert</a></h3>
<p class="description">Insert an element in the array.</p>
<p class="code">
int cupsArrayInsert (<br>
arrays, the element is inserted at the beginning of the array.
</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsArrayLast">cupsArrayLast</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsArrayLast">cupsArrayLast</a></h3>
<p class="description">Get the last element in the array.</p>
<p class="code">
void *cupsArrayLast (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Last element or <code>NULL</code> if the array is empty</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsArrayNew">cupsArrayNew</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsArrayNew">cupsArrayNew</a></h3>
<p class="description">Create a new array.</p>
<p class="code">
<a href="#cups_array_t">cups_array_t</a> *cupsArrayNew (<br>
like <code>strcmp</code> can be used for sorted string arrays.
</p>
-<h3 class="function"><span class="info"> CUPS 1.3 </span><a name="cupsArrayNew2">cupsArrayNew2</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.3/Mac OS X 10.5 </span><a name="cupsArrayNew2">cupsArrayNew2</a></h3>
<p class="description">Create a new array with hash.</p>
<p class="code">
<a href="#cups_array_t">cups_array_t</a> *cupsArrayNew2 (<br>
specified hash size ("hsize").
</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsArrayNext">cupsArrayNext</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsArrayNext">cupsArrayNext</a></h3>
<p class="description">Get the next element in the array.</p>
<p class="code">
void *cupsArrayNext (<br>
to set the current element.
</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsArrayPrev">cupsArrayPrev</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsArrayPrev">cupsArrayPrev</a></h3>
<p class="description">Get the previous element in the array.</p>
<p class="code">
void *cupsArrayPrev (<br>
to set the current element.
</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsArrayRemove">cupsArrayRemove</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsArrayRemove">cupsArrayRemove</a></h3>
<p class="description">Remove an element from the array.</p>
<p class="code">
int cupsArrayRemove (<br>
removed element.
</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsArrayRestore">cupsArrayRestore</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsArrayRestore">cupsArrayRestore</a></h3>
<p class="description">Reset the current element to the last <a href="#cupsArraySave"><code>cupsArraySave</code></a>.</p>
<p class="code">
void *cupsArrayRestore (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">New current element</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsArraySave">cupsArraySave</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsArraySave">cupsArraySave</a></h3>
<p class="description">Mark the current element for a later <a href="#cupsArrayRestore"><code>cupsArrayRestore</code></a>.</p>
<p class="code">
int cupsArraySave (<br>
The save/restore stack is guaranteed to be at least 32 elements deep.
</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsArrayUserData">cupsArrayUserData</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsArrayUserData">cupsArrayUserData</a></h3>
<p class="description">Return the user data for an array.</p>
<p class="code">
void *cupsArrayUserData (<br>
</table></div>
<h2 class="title">Contents</h2>
<ul class="contents">
+<ul class="subcontents">
<li><a href="#OVERVIEW">Overview</a><ul class="subcontents">
<li><a href="#CLIENTS_AND_SERVERS">Clients and Servers</a></li>
<li><a href="#PRINTERS_AND_CLASSES">Printers and Classes</a></li>
<li><a href="#FUNCTIONS">Functions</a><ul class="code">
<li><a href="#cupsAddDest" title="Add a destination to the list of destinations.">cupsAddDest</a></li>
<li><a href="#cupsAddOption" title="Add an option to an option array.">cupsAddOption</a></li>
+<li><a href="#cupsAdminCreateWindowsPPD" title="Create the Windows PPD file for a printer.">cupsAdminCreateWindowsPPD</a></li>
+<li><a href="#cupsAdminExportSamba" title="Export a printer to Samba.">cupsAdminExportSamba</a></li>
+<li><a href="#cupsAdminGetServerSettings" title="Get settings from the server.">cupsAdminGetServerSettings</a></li>
+<li><a href="#cupsAdminSetServerSettings" title="Set settings on the server.">cupsAdminSetServerSettings</a></li>
<li><a href="#cupsCancelJob" title="Cancel a print job on the default server.">cupsCancelJob</a></li>
<li><a href="#cupsCancelJob2" title="Cancel or purge a print job.">cupsCancelJob2</a></li>
<li><a href="#cupsCreateJob" title="Create an empty job for streaming.">cupsCreateJob</a></li>
<li><a href="#ENUMERATIONS">Constants</a><ul class="code">
<li><a href="#cups_ptype_e" title="Printer type/capability bit constants">cups_ptype_e</a></li>
</ul></li>
-</ul>
<!--
"$Id: api-cups.shtml 7337 2008-02-22 04:44:04Z mike $"
<h4 class="discussion">Discussion</h4>
<p class="discussion">New option arrays can be initialized simply by passing 0 for the
"num_options" parameter.</p>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsAdminCreateWindowsPPD">cupsAdminCreateWindowsPPD</a></h3>
+<p class="description">Create the Windows PPD file for a printer.</p>
+<p class="code">
+char *cupsAdminCreateWindowsPPD (<br>
+ http_t *http,<br>
+ const char *dest,<br>
+ char *buffer,<br>
+ int bufsize<br>
+);</p>
+<h4 class="parameters">Parameters</h4>
+<dl>
+<dt>http</dt>
+<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
+<dt>dest</dt>
+<dd class="description">Printer or class</dd>
+<dt>buffer</dt>
+<dd class="description">Filename buffer</dd>
+<dt>bufsize</dt>
+<dd class="description">Size of filename buffer</dd>
+</dl>
+<h4 class="returnvalue">Return Value</h4>
+<p class="description">PPD file or NULL</p>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsAdminExportSamba">cupsAdminExportSamba</a></h3>
+<p class="description">Export a printer to Samba.</p>
+<p class="code">
+int cupsAdminExportSamba (<br>
+ const char *dest,<br>
+ const char *ppd,<br>
+ const char *samba_server,<br>
+ const char *samba_user,<br>
+ const char *samba_password,<br>
+ FILE *logfile<br>
+);</p>
+<h4 class="parameters">Parameters</h4>
+<dl>
+<dt>dest</dt>
+<dd class="description">Destination to export</dd>
+<dt>ppd</dt>
+<dd class="description">PPD file</dd>
+<dt>samba_server</dt>
+<dd class="description">Samba server</dd>
+<dt>samba_user</dt>
+<dd class="description">Samba username</dd>
+<dt>samba_password</dt>
+<dd class="description">Samba password</dd>
+<dt>logfile</dt>
+<dd class="description">Log file, if any</dd>
+</dl>
+<h4 class="returnvalue">Return Value</h4>
+<p class="description">1 on success, 0 on failure</p>
+<h3 class="function"><span class="info"> CUPS 1.3/Mac OS X 10.5 </span><a name="cupsAdminGetServerSettings">cupsAdminGetServerSettings</a></h3>
+<p class="description">Get settings from the server.</p>
+<p class="code">
+int cupsAdminGetServerSettings (<br>
+ http_t *http,<br>
+ int *num_settings,<br>
+ <a href="#cups_option_t">cups_option_t</a> **settings<br>
+);</p>
+<h4 class="parameters">Parameters</h4>
+<dl>
+<dt>http</dt>
+<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
+<dt>num_settings</dt>
+<dd class="description">Number of settings</dd>
+<dt>settings</dt>
+<dd class="description">Settings</dd>
+</dl>
+<h4 class="returnvalue">Return Value</h4>
+<p class="description">1 on success, 0 on failure</p>
+<h4 class="discussion">Discussion</h4>
+<p class="discussion">The returned settings should be freed with cupsFreeOptions() when
+you are done with them.
+
+</p>
+<h3 class="function"><span class="info"> CUPS 1.3/Mac OS X 10.5 </span><a name="cupsAdminSetServerSettings">cupsAdminSetServerSettings</a></h3>
+<p class="description">Set settings on the server.</p>
+<p class="code">
+int cupsAdminSetServerSettings (<br>
+ http_t *http,<br>
+ int num_settings,<br>
+ <a href="#cups_option_t">cups_option_t</a> *settings<br>
+);</p>
+<h4 class="parameters">Parameters</h4>
+<dl>
+<dt>http</dt>
+<dd class="description">Connection to server or <code>CUPS_HTTP_DEFAULT</code></dd>
+<dt>num_settings</dt>
+<dd class="description">Number of settings</dd>
+<dt>settings</dt>
+<dd class="description">Settings</dd>
+</dl>
+<h4 class="returnvalue">Return Value</h4>
+<p class="description">1 on success, 0 on failure</p>
<h3 class="function"><a name="cupsCancelJob">cupsCancelJob</a></h3>
<p class="description">Cancel a print job on the default server.</p>
<p class="code">
Applications should use the <a href="#cupsGetDests"><code>cupsGetDests</code></a> and <a href="#cupsGetDest"><code>cupsGetDest</code></a>
functions to get the user-defined default printer, as this function does
not support the lpoptions-defined default printer.</p>
-<h3 class="function"><span class="info"> CUPS 1.1.21 </span><a name="cupsGetDefault2">cupsGetDefault2</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.1.21/Mac OS X 10.4 </span><a name="cupsGetDefault2">cupsGetDefault2</a></h3>
<p class="description">Get the default printer or class for the specified server.</p>
<p class="code">
const char *cupsGetDefault2 (<br>
<p class="discussion">Starting with CUPS 1.2, the returned list of destinations include the
printer-info, printer-is-accepting-jobs, printer-is-shared,
printer-make-and-model, printer-state, printer-state-change-time,
-printer-state-reasons, and printer-type attributes as options.<br>
+printer-state-reasons, and printer-type attributes as options. CUPS 1.4
+adds the marker-change-time, marker-colors, marker-high-levels,
+marker-levels, marker-low-levels, marker-message, marker-names,
+marker-types, and printer-commands attributes as well.<br>
<br>
Use the <a href="#cupsFreeDests"><code>cupsFreeDests</code></a> function to free the destination list and
the <a href="#cupsGetDest"><code>cupsGetDest</code></a> function to find a particular destination.</p>
-<h3 class="function"><span class="info"> CUPS 1.1.21 </span><a name="cupsGetDests2">cupsGetDests2</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.1.21/Mac OS X 10.4 </span><a name="cupsGetDests2">cupsGetDests2</a></h3>
<p class="description">Get the list of destinations from the specified server.</p>
<p class="code">
int cupsGetDests2 (<br>
<p class="discussion">Starting with CUPS 1.2, the returned list of destinations include the
printer-info, printer-is-accepting-jobs, printer-is-shared,
printer-make-and-model, printer-state, printer-state-change-time,
-printer-state-reasons, and printer-type attributes as options.<br>
+printer-state-reasons, and printer-type attributes as options. CUPS 1.4
+adds the marker-change-time, marker-colors, marker-high-levels,
+marker-levels, marker-low-levels, marker-message, marker-names,
+marker-types, and printer-commands attributes as well.<br>
<br>
Use the <a href="#cupsFreeDests"><code>cupsFreeDests</code></a> function to free the destination list and
the <a href="#cupsGetDest"><code>cupsGetDest</code></a> function to find a particular destination.
of state, while <code>CUPS_WHICHJOBS_ACTIVE</code> returns jobs that are
pending, processing, or held and <code>CUPS_WHICHJOBS_COMPLETED</code> returns
jobs that are stopped, canceled, aborted, or completed.</p>
-<h3 class="function"><span class="info"> CUPS 1.1.21 </span><a name="cupsGetJobs2">cupsGetJobs2</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.1.21/Mac OS X 10.4 </span><a name="cupsGetJobs2">cupsGetJobs2</a></h3>
<p class="description">Get the jobs from the specified server.</p>
<p class="code">
int cupsGetJobs2 (<br>
<br>
The returned filename is stored in a static buffer and is overwritten with
each call to <code>cupsGetPPD</code> or <a href="#cupsGetPPD2"><code>cupsGetPPD2</code></a>.</p>
-<h3 class="function"><span class="info"> CUPS 1.1.21 </span><a name="cupsGetPPD2">cupsGetPPD2</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.1.21/Mac OS X 10.4 </span><a name="cupsGetPPD2">cupsGetPPD2</a></h3>
<p class="description">Get the PPD file for a printer from the specified server.</p>
<p class="code">
const char *cupsGetPPD2 (<br>
<p class="discussion">This function is deprecated - use <a href="#cupsGetDests"><code>cupsGetDests</code></a> instead.
</p>
-<h3 class="function"><span class="info"> CUPS 1.3 </span><a name="cupsGetServerPPD">cupsGetServerPPD</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.3/Mac OS X 10.5 </span><a name="cupsGetServerPPD">cupsGetServerPPD</a></h3>
<p class="description">Get an available PPD file from the server.</p>
<p class="code">
char *cupsGetServerPPD (<br>
ipp_status_t cupsLastError (void);</p>
<h4 class="returnvalue">Return Value</h4>
<p class="description">IPP status code from last request</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsLastErrorString">cupsLastErrorString</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsLastErrorString">cupsLastErrorString</a></h3>
<p class="description">Return the last IPP status-message.</p>
<p class="code">
const char *cupsLastErrorString (void);</p>
<h4 class="returnvalue">Return Value</h4>
<p class="description">status-message text from last request</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsNotifySubject">cupsNotifySubject</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsNotifySubject">cupsNotifySubject</a></h3>
<p class="description">Return the subject for the given notification message.</p>
<p class="code">
char *cupsNotifySubject (<br>
<p class="discussion">The returned string must be freed by the caller using <code>free</code>.
</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsNotifyText">cupsNotifyText</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsNotifyText">cupsNotifyText</a></h3>
<p class="description">Return the text for the given notification message.</p>
<p class="code">
char *cupsNotifyText (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Job ID or 0 on error</p>
-<h3 class="function"><span class="info"> CUPS 1.1.21 </span><a name="cupsPrintFile2">cupsPrintFile2</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.1.21/Mac OS X 10.4 </span><a name="cupsPrintFile2">cupsPrintFile2</a></h3>
<p class="description">Print a file to a printer or class on the specified
server.</p>
<p class="code">
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Job ID or 0 on error</p>
-<h3 class="function"><span class="info"> CUPS 1.1.21 </span><a name="cupsPrintFiles2">cupsPrintFiles2</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.1.21/Mac OS X 10.4 </span><a name="cupsPrintFiles2">cupsPrintFiles2</a></h3>
<p class="description">Print one or more files to a printer or class on the
specified server.</p>
<p class="code">
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Job ID or 0 on error</p>
-<h3 class="function"><span class="info"> CUPS 1.3 </span><a name="cupsRemoveDest">cupsRemoveDest</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.3/Mac OS X 10.5 </span><a name="cupsRemoveDest">cupsRemoveDest</a></h3>
<p class="description">Remove a destination from the destination list.</p>
<p class="code">
int cupsRemoveDest (<br>
options for the user.
</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsRemoveOption">cupsRemoveOption</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsRemoveOption">cupsRemoveOption</a></h3>
<p class="description">Remove an option from an option array.</p>
<p class="code">
int cupsRemoveOption (<br>
<h4 class="discussion">Discussion</h4>
<p class="discussion">The returned value can be a fully-qualified hostname, a numeric
IPv4 or IPv6 address, or a domain socket pathname.</p>
-<h3 class="function"><span class="info"> CUPS 1.3 </span><a name="cupsSetDefaultDest">cupsSetDefaultDest</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.3/Mac OS X 10.5 </span><a name="cupsSetDefaultDest">cupsSetDefaultDest</a></h3>
<p class="description">Set the default destination.</p>
<p class="code">
void cupsSetDefaultDest (<br>
<h4 class="discussion">Discussion</h4>
<p class="discussion">This function saves the destinations to /etc/cups/lpoptions when run
as root and ~/.cups/lpoptions when run as a normal user.</p>
-<h3 class="function"><span class="info"> CUPS 1.1.21 </span><a name="cupsSetDests2">cupsSetDests2</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.1.21/Mac OS X 10.4 </span><a name="cupsSetDests2">cupsSetDests2</a></h3>
<p class="description">Save the list of destinations for the specified server.</p>
<p class="code">
int cupsSetDests2 (<br>
<a href="#cupsTempFile2"><code>cupsTempFile2</code></a> instead.
</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsTempFile2">cupsTempFile2</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsTempFile2">cupsTempFile2</a></h3>
<p class="description">Creates a temporary CUPS file.</p>
<p class="code">
cups_file_t *cupsTempFile2 (<br>
<p class="description">Printer type/capability bit constants</p>
<h4 class="constants">Constants</h4>
<dl>
-<dt>CUPS_PRINTER_AUTHENTICATED <span class="info"> CUPS 1.2 </span></dt>
+<dt>CUPS_PRINTER_AUTHENTICATED <span class="info"> CUPS 1.2/Mac OS X 10.5 </span></dt>
<dd class="description">Printer requires authentication </dd>
<dt>CUPS_PRINTER_BIND </dt>
<dd class="description">Can bind output</dd>
<dd class="description">Can collage copies</dd>
<dt>CUPS_PRINTER_COLOR </dt>
<dd class="description">Can do color printing</dd>
-<dt>CUPS_PRINTER_COMMANDS <span class="info"> CUPS 1.2 </span></dt>
+<dt>CUPS_PRINTER_COMMANDS <span class="info"> CUPS 1.2/Mac OS X 10.5 </span></dt>
<dd class="description">Printer supports maintenance commands </dd>
<dt>CUPS_PRINTER_COPIES </dt>
<dd class="description">Can do copies</dd>
<dd class="description">Can cover output</dd>
<dt>CUPS_PRINTER_DEFAULT </dt>
<dd class="description">Default printer on network</dd>
-<dt>CUPS_PRINTER_DELETE <span class="info"> CUPS 1.2 </span></dt>
+<dt>CUPS_PRINTER_DELETE <span class="info"> CUPS 1.2/Mac OS X 10.5 </span></dt>
<dd class="description">Delete printer </dd>
-<dt>CUPS_PRINTER_DISCOVERED <span class="info"> CUPS 1.3 </span></dt>
+<dt>CUPS_PRINTER_DISCOVERED <span class="info"> CUPS 1.3/Mac OS X 10.5 </span></dt>
<dd class="description">Printer was automatically discovered and added </dd>
<dt>CUPS_PRINTER_DUPLEX </dt>
<dd class="description">Can do duplexing</dd>
<dd class="description">Local printer or class</dd>
<dt>CUPS_PRINTER_MEDIUM </dt>
<dd class="description">Can do Tabloid/B/C/A3/A2</dd>
-<dt>CUPS_PRINTER_NOT_SHARED <span class="info"> CUPS 1.2 </span></dt>
+<dt>CUPS_PRINTER_NOT_SHARED <span class="info"> CUPS 1.2/Mac OS X 10.5 </span></dt>
<dd class="description">Printer is not shared </dd>
<dt>CUPS_PRINTER_PUNCH </dt>
<dd class="description">Can punch output</dd>
</table></div>
<h2 class="title">Contents</h2>
<ul class="contents">
+<ul class="subcontents">
<li><a href="#OVERVIEW">Overview</a></li>
<li><a href="#FUNCTIONS">Functions</a><ul class="code">
<li><a href="#cupsDirClose" title="Close a directory.">cupsDirClose</a></li>
<li><a href="#STRUCTURES">Structures</a><ul class="code">
<li><a href="#cups_dentry_s" title="Directory entry type">cups_dentry_s</a></li>
</ul></li>
-</ul>
<!--
"$Id: api-filedir.shtml 7279 2008-01-31 01:50:44Z mike $"
to get both a list of files and the information (permissions,
size, timestamp, etc.) for each of those files.</p>
<h2 class="title"><a name="FUNCTIONS">Functions</a></h2>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsDirClose">cupsDirClose</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsDirClose">cupsDirClose</a></h3>
<p class="description">Close a directory.</p>
<p class="code">
void cupsDirClose (<br>
<dt>dp</dt>
<dd class="description">Directory pointer</dd>
</dl>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsDirOpen">cupsDirOpen</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsDirOpen">cupsDirOpen</a></h3>
<p class="description">Open a directory.</p>
<p class="code">
<a href="#cups_dir_t">cups_dir_t</a> *cupsDirOpen (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Directory pointer or <code>NULL</code> if the directory could not be opened.</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsDirRead">cupsDirRead</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsDirRead">cupsDirRead</a></h3>
<p class="description">Read the next directory entry.</p>
<p class="code">
<a href="#cups_dentry_t">cups_dentry_t</a> *cupsDirRead (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Directory entry or <code>NULL</code> when there are no more</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsDirRewind">cupsDirRewind</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsDirRewind">cupsDirRewind</a></h3>
<p class="description">Rewind to the start of the directory.</p>
<p class="code">
void cupsDirRewind (<br>
<dt>dp</dt>
<dd class="description">Directory pointer</dd>
</dl>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsFileClose">cupsFileClose</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsFileClose">cupsFileClose</a></h3>
<p class="description">Close a CUPS file.</p>
<p class="code">
int cupsFileClose (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">0 on success, -1 on error</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsFileCompression">cupsFileCompression</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsFileCompression">cupsFileCompression</a></h3>
<p class="description">Return whether a file is compressed.</p>
<p class="code">
int cupsFileCompression (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description"><code>CUPS_FILE_NONE</code> or <code>CUPS_FILE_GZIP</code></p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsFileEOF">cupsFileEOF</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsFileEOF">cupsFileEOF</a></h3>
<p class="description">Return the end-of-file status.</p>
<p class="code">
int cupsFileEOF (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">1 on end of file, 0 otherwise</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsFileFind">cupsFileFind</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsFileFind">cupsFileFind</a></h3>
<p class="description">Find a file using the specified path.</p>
<p class="code">
const char *cupsFileFind (<br>
matches the current directory.
</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsFileFlush">cupsFileFlush</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsFileFlush">cupsFileFlush</a></h3>
<p class="description">Flush pending output.</p>
<p class="code">
int cupsFileFlush (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">0 on success, -1 on error</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsFileGetChar">cupsFileGetChar</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsFileGetChar">cupsFileGetChar</a></h3>
<p class="description">Get a single character from a file.</p>
<p class="code">
int cupsFileGetChar (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Character or -1 on end of file</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsFileGetConf">cupsFileGetConf</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsFileGetConf">cupsFileGetConf</a></h3>
<p class="description">Get a line from a configuration file...</p>
<p class="code">
char *cupsFileGetConf (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Line read or <code>NULL</code> on end of file or error</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsFileGetLine">cupsFileGetLine</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsFileGetLine">cupsFileGetLine</a></h3>
<p class="description">Get a CR and/or LF-terminated line that may
contain binary data.</p>
<p class="code">
the number of bytes on the line.
</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsFileGets">cupsFileGets</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsFileGets">cupsFileGets</a></h3>
<p class="description">Get a CR and/or LF-terminated line.</p>
<p class="code">
char *cupsFileGets (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Line read or <code>NULL</code> on end of file or error</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsFileLock">cupsFileLock</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsFileLock">cupsFileLock</a></h3>
<p class="description">Temporarily lock access to a file.</p>
<p class="code">
int cupsFileLock (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">0 on success, -1 on error</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsFileNumber">cupsFileNumber</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsFileNumber">cupsFileNumber</a></h3>
<p class="description">Return the file descriptor associated with a CUPS file.</p>
<p class="code">
int cupsFileNumber (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">File descriptor</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsFileOpen">cupsFileOpen</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsFileOpen">cupsFileOpen</a></h3>
<p class="description">Open a CUPS file.</p>
<p class="code">
<a href="#cups_file_t">cups_file_t</a> *cupsFileOpen (<br>
a choice.
</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsFileOpenFd">cupsFileOpenFd</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsFileOpenFd">cupsFileOpenFd</a></h3>
<p class="description">Open a CUPS file using a file descriptor.</p>
<p class="code">
<a href="#cups_file_t">cups_file_t</a> *cupsFileOpenFd (<br>
not supported for the "a" (append) mode.
</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsFilePeekChar">cupsFilePeekChar</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsFilePeekChar">cupsFilePeekChar</a></h3>
<p class="description">Peek at the next character from a file.</p>
<p class="code">
int cupsFilePeekChar (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Character or -1 on end of file</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsFilePrintf">cupsFilePrintf</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsFilePrintf">cupsFilePrintf</a></h3>
<p class="description">Write a formatted string.</p>
<p class="code">
int cupsFilePrintf (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Number of bytes written or -1 on error</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsFilePutChar">cupsFilePutChar</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsFilePutChar">cupsFilePutChar</a></h3>
<p class="description">Write a character.</p>
<p class="code">
int cupsFilePutChar (<br>
<p class="discussion">This function handles any comment escaping of the value.
</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsFilePuts">cupsFilePuts</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsFilePuts">cupsFilePuts</a></h3>
<p class="description">Write a string.</p>
<p class="code">
int cupsFilePuts (<br>
<p class="discussion">Like the <code>fputs</code> function, no newline is appended to the string.
</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsFileRead">cupsFileRead</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsFileRead">cupsFileRead</a></h3>
<p class="description">Read from a file.</p>
<p class="code">
ssize_t cupsFileRead (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Number of bytes read or -1 on error</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsFileRewind">cupsFileRewind</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsFileRewind">cupsFileRewind</a></h3>
<p class="description">Set the current file position to the beginning of the
file.</p>
<p class="code">
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">New file position or -1 on error</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsFileSeek">cupsFileSeek</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsFileSeek">cupsFileSeek</a></h3>
<p class="description">Seek in a file.</p>
<p class="code">
off_t cupsFileSeek (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">New file position or -1 on error</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsFileStderr">cupsFileStderr</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsFileStderr">cupsFileStderr</a></h3>
<p class="description">Return a CUPS file associated with stderr.</p>
<p class="code">
<a href="#cups_file_t">cups_file_t</a> *cupsFileStderr (void);</p>
<h4 class="returnvalue">Return Value</h4>
<p class="description">CUPS file</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsFileStdin">cupsFileStdin</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsFileStdin">cupsFileStdin</a></h3>
<p class="description">Return a CUPS file associated with stdin.</p>
<p class="code">
<a href="#cups_file_t">cups_file_t</a> *cupsFileStdin (void);</p>
<h4 class="returnvalue">Return Value</h4>
<p class="description">CUPS file</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsFileStdout">cupsFileStdout</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsFileStdout">cupsFileStdout</a></h3>
<p class="description">Return a CUPS file associated with stdout.</p>
<p class="code">
<a href="#cups_file_t">cups_file_t</a> *cupsFileStdout (void);</p>
<h4 class="returnvalue">Return Value</h4>
<p class="description">CUPS file</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsFileTell">cupsFileTell</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsFileTell">cupsFileTell</a></h3>
<p class="description">Return the current file position.</p>
<p class="code">
off_t cupsFileTell (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">File position</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsFileUnlock">cupsFileUnlock</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsFileUnlock">cupsFileUnlock</a></h3>
<p class="description">Unlock access to a file.</p>
<p class="code">
int cupsFileUnlock (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">0 on success, -1 on error</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsFileWrite">cupsFileWrite</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsFileWrite">cupsFileWrite</a></h3>
<p class="description">Write to a file.</p>
<p class="code">
ssize_t cupsFileWrite (<br>
</table></div>
<h2 class="title">Contents</h2>
<ul class="contents">
+<ul class="subcontents">
<li><a href="#OVERVIEW">Overview</a><ul class="subcontents">
<li><a href="#SECURITY">Security Considerations</a></li>
<li><a href="#TEMPFILES">Temporary Files</a></li>
<li><a href="#cups_sc_state_e" title="Printer state bits">cups_sc_state_e</a></li>
<li><a href="#cups_sc_status_e" title="Response status codes">cups_sc_status_e</a></li>
</ul></li>
-</ul>
<!--
"$Id: api-filter.shtml 7962 2008-09-18 17:31:33Z mike $"
<a href="#cupsSideChannelSNMPWalk">cupsSNMPSideChannelWalk</a>(".1.3.6.1.2.1.43", 5.0, my_callback, my_data);
</pre>
<h2 class="title"><a name="FUNCTIONS">Functions</a></h2>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsBackChannelRead">cupsBackChannelRead</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsBackChannelRead">cupsBackChannelRead</a></h3>
<p class="description">Read data from the backchannel.</p>
<p class="code">
ssize_t cupsBackChannelRead (<br>
return immediately if there is no data, -1.0 to wait for data indefinitely.
</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsBackChannelWrite">cupsBackChannelWrite</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsBackChannelWrite">cupsBackChannelWrite</a></h3>
<p class="description">Write data to the backchannel.</p>
<p class="code">
ssize_t cupsBackChannelWrite (<br>
indefinitely.
</p>
-<h3 class="function"><a name="cupsBackendDeviceURI">cupsBackendDeviceURI</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsBackendDeviceURI">cupsBackendDeviceURI</a></h3>
<p class="description">Get the device URI for a backend.</p>
<p class="code">
const char *cupsBackendDeviceURI (<br>
<p class="discussion">The "argv" argument is the argv argument passed to main(). This
function returns the device URI passed in the DEVICE_URI environment
variable or the device URI passed in argv[0], whichever is found
-first.</p>
-<h3 class="function"><a name="cupsBackendReport">cupsBackendReport</a></h3>
+first.
+
+</p>
+<h3 class="function"><span class="info"> CUPS 1.4 </span><a name="cupsBackendReport">cupsBackendReport</a></h3>
<p class="description">Write a device line from a backend.</p>
<p class="code">
void cupsBackendReport (<br>
<h4 class="discussion">Discussion</h4>
<p class="discussion">This function writes a single device line to stdout for a backend.
It handles quoting of special characters in the device-make-and-model,
-device-info, device-id, and device-location strings.</p>
-<h3 class="function"><span class="info"> CUPS 1.3 </span><a name="cupsSideChannelDoRequest">cupsSideChannelDoRequest</a></h3>
+device-info, device-id, and device-location strings.
+
+</p>
+<h3 class="function"><span class="info"> CUPS 1.3/Mac OS X 10.5 </span><a name="cupsSideChannelDoRequest">cupsSideChannelDoRequest</a></h3>
<p class="description">Send a side-channel command to a backend and wait for a response.</p>
<p class="code">
<a href="#cups_sc_status_t">cups_sc_status_t</a> cupsSideChannelDoRequest (<br>
update the value to contain the number of data bytes in the buffer.
</p>
-<h3 class="function"><span class="info"> CUPS 1.3 </span><a name="cupsSideChannelRead">cupsSideChannelRead</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.3/Mac OS X 10.5 </span><a name="cupsSideChannelRead">cupsSideChannelRead</a></h3>
<p class="description">Read a side-channel message.</p>
<p class="code">
int cupsSideChannelRead (<br>
the printer does not respond to the first SNMP query.
</p>
-<h3 class="function"><span class="info"> CUPS 1.3 </span><a name="cupsSideChannelWrite">cupsSideChannelWrite</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.3/Mac OS X 10.5 </span><a name="cupsSideChannelWrite">cupsSideChannelWrite</a></h3>
<p class="description">Write a side-channel message.</p>
<p class="code">
int cupsSideChannelWrite (<br>
</table></div>
<h2 class="title">Contents</h2>
<ul class="contents">
+<ul class="subcontents">
<li><a href="#OVERVIEW">Overview</a><ul class="subcontents">
<li><a href="#CREATING_URI_STRINGS">Creating URI Strings</a></li>
<li><a href="#SENDING_REQUESTS_WITH_FILES">Sending Requests with Files</a></li>
<li><a href="#ipp_status_e" title="IPP status codes...">ipp_status_e</a></li>
<li><a href="#ipp_tag_e" title="Format tags for attributes...">ipp_tag_e</a></li>
</ul></li>
-</ul>
<!--
"$Id: api-httpipp.shtml 7684 2008-06-23 16:47:38Z mike $"
<a href='#ippDelete'>ippDelete</a>(request);
</pre>
<h2 class="title"><a name="FUNCTIONS">Functions</a></h2>
-<h3 class="function"><span class="info"> CUPS 1.1.20 </span><a name="cupsDoAuthentication">cupsDoAuthentication</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.1.20/Mac OS X 10.4 </span><a name="cupsDoAuthentication">cupsDoAuthentication</a></h3>
<p class="description">Authenticate a request.</p>
<p class="code">
int cupsDoAuthentication (<br>
<p class="discussion">This function sends the IPP request to the specified server, retrying
and authenticating as necessary. The request is freed with <a href="#ippDelete"><code>ippDelete</code></a>
after receiving a valid IPP response.</p>
-<h3 class="function"><span class="info"> CUPS 1.3 </span><a name="cupsDoIORequest">cupsDoIORequest</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.3/Mac OS X 10.5 </span><a name="cupsDoIORequest">cupsDoIORequest</a></h3>
<p class="description">Do an IPP request with file descriptors.</p>
<p class="code">
<a href="#ipp_t">ipp_t</a> *cupsDoIORequest (<br>
<p class="discussion">This function adds operation, job, and then subscription attributes,
in that order. Use the cupsEncodeOptions2() function to add attributes
for a single group.</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="cupsEncodeOptions2">cupsEncodeOptions2</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="cupsEncodeOptions2">cupsEncodeOptions2</a></h3>
<p class="description">Encode printer options into IPP attributes for a group.</p>
<p class="code">
void cupsEncodeOptions2 (<br>
the request respectively.
</p>
-<h3 class="function"><span class="info"> CUPS 1.1.20 </span><a name="cupsGetFd">cupsGetFd</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.1.20/Mac OS X 10.4 </span><a name="cupsGetFd">cupsGetFd</a></h3>
<p class="description">Get a file from the server.</p>
<p class="code">
<a href="#http_status_t">http_status_t</a> cupsGetFd (<br>
<p class="discussion">This function returns <code>HTTP_OK</code> when the file is successfully retrieved.
</p>
-<h3 class="function"><span class="info"> CUPS 1.1.20 </span><a name="cupsGetFile">cupsGetFile</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.1.20/Mac OS X 10.4 </span><a name="cupsGetFile">cupsGetFile</a></h3>
<p class="description">Get a file from the server.</p>
<p class="code">
<a href="#http_status_t">http_status_t</a> cupsGetFile (<br>
additional data, use httpRead() after getting a successful response.
</p>
-<h3 class="function"><span class="info"> CUPS 1.1.20 </span><a name="cupsPutFd">cupsPutFd</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.1.20/Mac OS X 10.4 </span><a name="cupsPutFd">cupsPutFd</a></h3>
<p class="description">Put a file on the server.</p>
<p class="code">
<a href="#http_status_t">http_status_t</a> cupsPutFd (<br>
successfully.
</p>
-<h3 class="function"><span class="info"> CUPS 1.1.20 </span><a name="cupsPutFile">cupsPutFile</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.1.20/Mac OS X 10.4 </span><a name="cupsPutFile">cupsPutFile</a></h3>
<p class="description">Put a file on the server.</p>
<p class="code">
<a href="#http_status_t">http_status_t</a> cupsPutFile (<br>
after <a href="#cupsStartDocument"><code>cupsStartDocument</code></a> to provide a document file.
</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="httpAddrAny">httpAddrAny</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="httpAddrAny">httpAddrAny</a></h3>
<p class="description">Check for the "any" address.</p>
<p class="code">
int httpAddrAny (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">1 if "any", 0 otherwise</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="httpAddrEqual">httpAddrEqual</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="httpAddrEqual">httpAddrEqual</a></h3>
<p class="description">Compare two addresses.</p>
<p class="code">
int httpAddrEqual (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">1 if equal, 0 if not</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="httpAddrLength">httpAddrLength</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="httpAddrLength">httpAddrLength</a></h3>
<p class="description">Return the length of the address in bytes.</p>
<p class="code">
int httpAddrLength (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Length in bytes</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="httpAddrLocalhost">httpAddrLocalhost</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="httpAddrLocalhost">httpAddrLocalhost</a></h3>
<p class="description">Check for the local loopback address.</p>
<p class="code">
int httpAddrLocalhost (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">1 if local host, 0 otherwise</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="httpAddrLookup">httpAddrLookup</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="httpAddrLookup">httpAddrLookup</a></h3>
<p class="description">Lookup the hostname associated with the address.</p>
<p class="code">
char *httpAddrLookup (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Host name</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="httpAddrString">httpAddrString</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="httpAddrString">httpAddrString</a></h3>
<p class="description">Convert an address to a numeric string.</p>
<p class="code">
char *httpAddrString (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Numeric address string</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="httpAssembleURI">httpAssembleURI</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="httpAssembleURI">httpAssembleURI</a></h3>
<p class="description">Assemble a uniform resource identifier from its
components.</p>
<p class="code">
URI string.
</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="httpAssembleURIf">httpAssembleURIf</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="httpAssembleURIf">httpAssembleURIf</a></h3>
<p class="description">Assemble a uniform resource identifier from its
components with a formatted resource.</p>
<p class="code">
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">0 = no data, 1 = data available</p>
-<h3 class="function"><span class="info"> CUPS 1.1.19 </span><a name="httpClearCookie">httpClearCookie</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span><a name="httpClearCookie">httpClearCookie</a></h3>
<p class="description">Clear the cookie value(s).</p>
<p class="code">
void httpClearCookie (<br>
which provides buffer length arguments.
</p>
-<h3 class="function"><span class="info"> CUPS 1.1.21 </span><a name="httpDecode64_2">httpDecode64_2</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.1.21/Mac OS X 10.4 </span><a name="httpDecode64_2">httpDecode64_2</a></h3>
<p class="description">Base64-decode a string.</p>
<p class="code">
char *httpDecode64_2 (<br>
which provides buffer length arguments.
</p>
-<h3 class="function"><span class="info"> CUPS 1.1.21 </span><a name="httpEncode64_2">httpEncode64_2</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.1.21/Mac OS X 10.4 </span><a name="httpEncode64_2">httpEncode64_2</a></h3>
<p class="description">Base64-encode a string.</p>
<p class="code">
char *httpEncode64_2 (<br>
<dt>http</dt>
<dd class="description">Connection to server</dd>
</dl>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="httpFlushWrite">httpFlushWrite</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="httpFlushWrite">httpFlushWrite</a></h3>
<p class="description">Flush data in write buffer.</p>
<p class="code">
int httpFlushWrite (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Status of call (0 = success)</p>
-<h3 class="function"><span class="info"> CUPS 1.3 </span><a name="httpGetAuthString">httpGetAuthString</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.3/Mac OS X 10.5 </span><a name="httpGetAuthString">httpGetAuthString</a></h3>
<p class="description">Get the current authorization string.</p>
<p class="code">
char *httpGetAuthString (<br>
value.
</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="httpGetBlocking">httpGetBlocking</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="httpGetBlocking">httpGetBlocking</a></h3>
<p class="description">Get the blocking/non-block state of a connection.</p>
<p class="code">
int httpGetBlocking (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">1 if blocking, 0 if non-blocking</p>
-<h3 class="function"><span class="info"> CUPS 1.1.19 </span><a name="httpGetCookie">httpGetCookie</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span><a name="httpGetCookie">httpGetCookie</a></h3>
<p class="description">Get any cookie data from the response.</p>
<p class="code">
const char *httpGetCookie (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Date/time string</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="httpGetDateString2">httpGetDateString2</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="httpGetDateString2">httpGetDateString2</a></h3>
<p class="description">Get a formatted date/time string from a time value.</p>
<p class="code">
const char *httpGetDateString2 (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">UNIX time</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="httpGetFd">httpGetFd</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="httpGetFd">httpGetFd</a></h3>
<p class="description">Get the file descriptor associated with a connection.</p>
<p class="code">
int httpGetFd (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Host entry</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="httpGetHostname">httpGetHostname</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="httpGetHostname">httpGetHostname</a></h3>
<p class="description">Get the FQDN for the connection or local system.</p>
<p class="code">
const char *httpGetHostname (<br>
2^31 - 1; use httpGetLength2() instead.
</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="httpGetLength2">httpGetLength2</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="httpGetLength2">httpGetLength2</a></h3>
<p class="description">Get the amount of data remaining from the
content-length or transfer-encoding fields.</p>
<p class="code">
content larger than 2^31 - 1.
</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="httpGetStatus">httpGetStatus</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="httpGetStatus">httpGetStatus</a></h3>
<p class="description">Get the status of the last HTTP request.</p>
<p class="code">
<a href="#http_status_t">http_status_t</a> httpGetStatus (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Value or NULL</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="httpGetSubField2">httpGetSubField2</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="httpGetSubField2">httpGetSubField2</a></h3>
<p class="description">Get a sub-field value.</p>
<p class="code">
char *httpGetSubField2 (<br>
read more than 2GB of data.
</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="httpRead2">httpRead2</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="httpRead2">httpRead2</a></h3>
<p class="description">Read data from a HTTP connection.</p>
<p class="code">
ssize_t httpRead2 (<br>
<p class="discussion">This function is deprecated; use the httpSeparateURI() function instead.
</p>
-<h3 class="function"><span class="info"> CUPS 1.1.21 </span><a name="httpSeparate2">httpSeparate2</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.1.21/Mac OS X 10.4 </span><a name="httpSeparate2">httpSeparate2</a></h3>
<p class="description">Separate a Universal Resource Identifier into its
components.</p>
<p class="code">
</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="httpSeparateURI">httpSeparateURI</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="httpSeparateURI">httpSeparateURI</a></h3>
<p class="description">Separate a Universal Resource Identifier into its
components.</p>
<p class="code">
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Result of separation</p>
-<h3 class="function"><span class="info"> CUPS 1.3 </span><a name="httpSetAuthString">httpSetAuthString</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.3/Mac OS X 10.5 </span><a name="httpSetAuthString">httpSetAuthString</a></h3>
<p class="description">Set the current authorization string.</p>
<p class="code">
void httpSetAuthString (<br>
httpHead(), httpOptions(), httpPost, or httpPut().
</p>
-<h3 class="function"><span class="info"> CUPS 1.1.19 </span><a name="httpSetCookie">httpSetCookie</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span><a name="httpSetCookie">httpSetCookie</a></h3>
<p class="description">Set the cookie value(s)...</p>
<p class="code">
void httpSetCookie (<br>
<dt>cookie</dt>
<dd class="description">Cookie string</dd>
</dl>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="httpSetExpect">httpSetExpect</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="httpSetExpect">httpSetExpect</a></h3>
<p class="description">Set the Expect: header in a request.</p>
<p class="code">
void httpSetExpect (<br>
<dt>value</dt>
<dd class="description">Value</dd>
</dl>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="httpSetLength">httpSetLength</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="httpSetLength">httpSetLength</a></h3>
<p class="description">Set the content-length and content-encoding.</p>
<p class="code">
void httpSetLength (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">HTTP status</p>
-<h3 class="function"><span class="info"> CUPS 1.1.19 </span><a name="httpWait">httpWait</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span><a name="httpWait">httpWait</a></h3>
<p class="description">Wait for data available on a connection.</p>
<p class="code">
int httpWait (<br>
write more than 2GB of data.
</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="httpWrite2">httpWrite2</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="httpWrite2">httpWrite2</a></h3>
<p class="description">Write data to a HTTP connection.</p>
<p class="code">
ssize_t httpWrite2 (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">New attribute</p>
-<h3 class="function"><span class="info"> CUPS 1.1.19 </span><a name="ippAddCollection">ippAddCollection</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span><a name="ippAddCollection">ippAddCollection</a></h3>
<p class="description">Add a collection value.</p>
<p class="code">
<a href="#ipp_attribute_t">ipp_attribute_t</a> *ippAddCollection (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">New attribute</p>
-<h3 class="function"><span class="info"> CUPS 1.1.19 </span><a name="ippAddCollections">ippAddCollections</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span><a name="ippAddCollections">ippAddCollections</a></h3>
<p class="description">Add an array of collection values.</p>
<p class="code">
<a href="#ipp_attribute_t">ipp_attribute_t</a> *ippAddCollections (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">New attribute</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="ippAddOctetString">ippAddOctetString</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="ippAddOctetString">ippAddOctetString</a></h3>
<p class="description">Add an octetString value to an IPP message.</p>
<p class="code">
<a href="#ipp_attribute_t">ipp_attribute_t</a> *ippAddOctetString (<br>
<dt>ipp</dt>
<dd class="description">IPP message</dd>
</dl>
-<h3 class="function"><span class="info"> CUPS 1.1.19 </span><a name="ippDeleteAttribute">ippDeleteAttribute</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span><a name="ippDeleteAttribute">ippDeleteAttribute</a></h3>
<p class="description">Delete a single attribute in an IPP message.</p>
<p class="code">
void ippDeleteAttribute (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Text string</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="ippErrorValue">ippErrorValue</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="ippErrorValue">ippErrorValue</a></h3>
<p class="description">Return a status code for the given name.</p>
<p class="code">
ipp_status_t ippErrorValue (<br>
<a href="#ipp_t">ipp_t</a> *ippNew (void);</p>
<h4 class="returnvalue">Return Value</h4>
<p class="description">New IPP message</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="ippNewRequest">ippNewRequest</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="ippNewRequest">ippNewRequest</a></h3>
<p class="description">Allocate a new IPP request message.</p>
<p class="code">
<a href="#ipp_t">ipp_t</a> *ippNewRequest (<br>
attributes-natural-language value is derived from the current locale.
</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="ippOpString">ippOpString</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="ippOpString">ippOpString</a></h3>
<p class="description">Return a name for the given operation id.</p>
<p class="code">
const char *ippOpString (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Name</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="ippOpValue">ippOpValue</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="ippOpValue">ippOpValue</a></h3>
<p class="description">Return an operation id for the given name.</p>
<p class="code">
<a href="#ipp_op_t">ipp_op_t</a> ippOpValue (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Current state</p>
-<h3 class="function"><span class="info"> CUPS 1.1.19 </span><a name="ippReadFile">ippReadFile</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span><a name="ippReadFile">ippReadFile</a></h3>
<p class="description">Read data for an IPP message from a file.</p>
<p class="code">
<a href="#ipp_state_t">ipp_state_t</a> ippReadFile (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Current state</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="ippReadIO">ippReadIO</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="ippReadIO">ippReadIO</a></h3>
<p class="description">Read data for an IPP message.</p>
<p class="code">
<a href="#ipp_state_t">ipp_state_t</a> ippReadIO (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Current state</p>
-<h3 class="function"><span class="info"> CUPS 1.1.19 </span><a name="ippWriteFile">ippWriteFile</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span><a name="ippWriteFile">ippWriteFile</a></h3>
<p class="description">Write data for an IPP message to a file.</p>
<p class="code">
<a href="#ipp_state_t">ipp_state_t</a> ippWriteFile (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Current state</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="ippWriteIO">ippWriteIO</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="ippWriteIO">ippWriteIO</a></h3>
<p class="description">Write data for an IPP message.</p>
<p class="code">
<a href="#ipp_state_t">ipp_state_t</a> ippWriteIO (<br>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Current state</p>
<h2 class="title"><a name="TYPES">Data Types</a></h2>
-<h3 class="typedef"><span class="info"> CUPS 1.2 </span><a name="http_addrlist_t">http_addrlist_t</a></h3>
+<h3 class="typedef"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="http_addrlist_t">http_addrlist_t</a></h3>
<p class="description">Socket address list, which is
used to enumerate all of the
addresses that are associated
<p class="code">
typedef enum <a href="#http_uri_status_e">http_uri_status_e</a> http_uri_status_t;
</p>
-<h3 class="typedef"><span class="info"> CUPS 1.2 </span><a name="http_version_t">http_version_t</a></h3>
+<h3 class="typedef"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="http_version_t">http_version_t</a></h3>
<p class="description">Socket address union, which
makes using IPv6 and other
address types easier and
<p class="code">
typedef enum <a href="#ipp_finish_e">ipp_finish_e</a> ipp_finish_t;
</p>
-<h3 class="typedef"><span class="info"> CUPS 1.2 </span><a name="ipp_iocb_t">ipp_iocb_t</a></h3>
+<h3 class="typedef"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="ipp_iocb_t">ipp_iocb_t</a></h3>
<p class="description">IPP IO Callback Function </p>
<p class="code">
typedef ssize_t (*ipp_iocb_t)(void *, <a href="#ipp_uchar_t">ipp_uchar_t</a> *, size_t);
typedef union <a href="#ipp_value_u">ipp_value_u</a> ipp_value_t;
</p>
<h2 class="title"><a name="STRUCTURES">Structures</a></h2>
-<h3 class="struct"><span class="info"> CUPS 1.2 </span><a name="http_addrlist_s">http_addrlist_s</a></h3>
+<h3 class="struct"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="http_addrlist_s">http_addrlist_s</a></h3>
<p class="description">Socket address list, which is
used to enumerate all of the
addresses that are associated
<dd class="description">Current attribute group tag</dd>
<dt>last </dt>
<dd class="description">Last attribute in list</dd>
-<dt>prev </dt>
-<dd class="description">Previous attribute (for read)</dd>
+<dt>prev <span class="info"> CUPS 1.2/Mac OS X 10.5 </span></dt>
+<dd class="description">Previous attribute (for read) </dd>
<dt>request </dt>
<dd class="description">Request header</dd>
<dt>state </dt>
<dl>
<dt>boolean </dt>
<dd class="description">Boolean value</dd>
-<dt>collection </dt>
-<dd class="description">Collection value</dd>
+<dt>collection <span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span></dt>
+<dd class="description">Collection value </dd>
<dt>date[11] </dt>
<dd class="description">Date/time value</dd>
<dt>integer </dt>
<dd class="description">MD5-session authentication in use</dd>
<dt>HTTP_AUTH_MD5_SESS_INT </dt>
<dd class="description">MD5-session authentication in use for body</dd>
-<dt>HTTP_AUTH_NEGOTIATE <span class="info"> CUPS 1.3 </span></dt>
+<dt>HTTP_AUTH_NEGOTIATE <span class="info"> CUPS 1.3/Mac OS X 10.5 </span></dt>
<dd class="description">GSSAPI authentication in use </dd>
<dt>HTTP_AUTH_NONE </dt>
<dd class="description">No authentication in use</dd>
<dd class="description">Add or modify a class</dd>
<dt>CUPS_ADD_MODIFY_PRINTER </dt>
<dd class="description">Add or modify a printer</dd>
-<dt>CUPS_AUTHENTICATE_JOB <span class="info"> CUPS 1.2 </span></dt>
+<dt>CUPS_AUTHENTICATE_JOB <span class="info"> CUPS 1.2/Mac OS X 10.5 </span></dt>
<dd class="description">Authenticate a job </dd>
<dt>CUPS_DELETE_CLASS </dt>
<dd class="description">Delete a class</dd>
<dd class="description">Get a list of supported devices</dd>
<dt>CUPS_GET_DOCUMENT <span class="info"> CUPS 1.4 </span></dt>
<dd class="description">Get a document file </dd>
-<dt>CUPS_GET_PPD <span class="info"> CUPS 1.3 </span></dt>
+<dt>CUPS_GET_PPD <span class="info"> CUPS 1.3/Mac OS X 10.5 </span></dt>
<dd class="description">Get a PPD file </dd>
<dt>CUPS_GET_PPDS </dt>
<dd class="description">Get a list of supported drivers</dd>
<dd class="description">Set the default printer</dd>
<dt>IPP_CANCEL_JOB </dt>
<dd class="description">Cancel a job</dd>
-<dt>IPP_CANCEL_SUBSCRIPTION <span class="info"> CUPS 1.2 </span></dt>
+<dt>IPP_CANCEL_SUBSCRIPTION <span class="info"> CUPS 1.2/Mac OS X 10.5 </span></dt>
<dd class="description">Cancel a subscription </dd>
<dt>IPP_CREATE_JOB </dt>
<dd class="description">Create an empty print job</dd>
-<dt>IPP_CREATE_JOB_SUBSCRIPTION <span class="info"> CUPS 1.2 </span></dt>
+<dt>IPP_CREATE_JOB_SUBSCRIPTION <span class="info"> CUPS 1.2/Mac OS X 10.5 </span></dt>
<dd class="description">Create a job subscription </dd>
-<dt>IPP_CREATE_PRINTER_SUBSCRIPTION <span class="info"> CUPS 1.2 </span></dt>
+<dt>IPP_CREATE_PRINTER_SUBSCRIPTION <span class="info"> CUPS 1.2/Mac OS X 10.5 </span></dt>
<dd class="description">Create a printer subscription </dd>
<dt>IPP_DISABLE_PRINTER </dt>
<dd class="description">Stop a printer</dd>
<dd class="description">Get a list of jobs</dd>
<dt>IPP_GET_JOB_ATTRIBUTES </dt>
<dd class="description">Get job attributes</dd>
-<dt>IPP_GET_NOTIFICATIONS <span class="info"> CUPS 1.2 </span></dt>
+<dt>IPP_GET_NOTIFICATIONS <span class="info"> CUPS 1.2/Mac OS X 10.5 </span></dt>
<dd class="description">Get notification events </dd>
<dt>IPP_GET_PRINTER_ATTRIBUTES </dt>
<dd class="description">Get printer attributes</dd>
<dt>IPP_GET_PRINTER_SUPPORTED_VALUES </dt>
<dd class="description">Get supported attribute values</dd>
-<dt>IPP_GET_SUBSCRIPTIONS <span class="info"> CUPS 1.2 </span></dt>
+<dt>IPP_GET_SUBSCRIPTIONS <span class="info"> CUPS 1.2/Mac OS X 10.5 </span></dt>
<dd class="description">Get list of subscriptions </dd>
-<dt>IPP_GET_SUBSCRIPTION_ATTRIBUTES <span class="info"> CUPS 1.2 </span></dt>
+<dt>IPP_GET_SUBSCRIPTION_ATTRIBUTES <span class="info"> CUPS 1.2/Mac OS X 10.5 </span></dt>
<dd class="description">Get subscription attributes </dd>
<dt>IPP_HOLD_JOB </dt>
<dd class="description">Hold a job for printing</dd>
<dd class="description">Cancel all jobs</dd>
<dt>IPP_RELEASE_JOB </dt>
<dd class="description">Release a job for printing</dd>
-<dt>IPP_RENEW_SUBSCRIPTION <span class="info"> CUPS 1.2 </span></dt>
+<dt>IPP_RENEW_SUBSCRIPTION <span class="info"> CUPS 1.2/Mac OS X 10.5 </span></dt>
<dd class="description">Renew a printer subscription </dd>
<dt>IPP_RESTART_JOB </dt>
<dd class="description">Reprint a job</dd>
</table></div>
<h2 class="title">Contents</h2>
<ul class="contents">
+<ul class="subcontents">
<li><a href="#OVERVIEW">Overview</a></li>
<li><a href="#COMPILING">Compiling Programs</a><ul class="subcontents">
<li><a href="#XCODE">Compiling with Xcode</a></li>
<li><a href="#COMMANDLINE">Compiling with GCC</a></li>
</ul></li>
<li><a href="#WHERETOGO">Where to Go Next</a></li>
-</ul>
<!--
"$Id: api-cups.header 7279 2008-01-31 01:50:44Z mike $"
</table></div>
<h2 class="title">Contents</h2>
<ul class="contents">
+<ul class="subcontents">
<li><a href="#OVERVIEW">Overview</a><ul class="subcontents">
<li><a href="#LOADING">Loading a PPD File</a></li>
<li><a href="#OPTIONS_AND_GROUPS">Options and Groups</a></li>
<li><a href="#ppd_status_e" title="Types and structures...">ppd_status_e</a></li>
<li><a href="#ppd_ui_e" title="UI Types">ppd_ui_e</a></li>
</ul></li>
-</ul>
<!--
"$Id: api-ppd.shtml 7616 2008-05-28 00:34:13Z mike $"
<h4 class="discussion">Discussion</h4>
<p class="discussion">The choices array should be freed using <code>free</code> when you are
finished with it.</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="ppdCollect2">ppdCollect2</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="ppdCollect2">ppdCollect2</a></h3>
<p class="description">Collect all marked options that reside in the
specified section and minimum order.</p>
<p class="code">
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">0 on success, -1 on failure</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="ppdEmitAfterOrder">ppdEmitAfterOrder</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="ppdEmitAfterOrder">ppdEmitAfterOrder</a></h3>
<p class="description">Emit a subset of the code for marked options to a file.</p>
<p class="code">
int ppdEmitAfterOrder (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">0 on success, -1 on failure</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="ppdEmitJCLEnd">ppdEmitJCLEnd</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="ppdEmitJCLEnd">ppdEmitJCLEnd</a></h3>
<p class="description">Emit JCLEnd code to a file.</p>
<p class="code">
int ppdEmitJCLEnd (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">0 on success, -1 on failure</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="ppdEmitString">ppdEmitString</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="ppdEmitString">ppdEmitString</a></h3>
<p class="description">Get a string containing the code for marked options.</p>
<p class="code">
char *ppdEmitString (<br>
<code>free</code> when you are done with it.
</p>
-<h3 class="function"><span class="info"> CUPS 1.1.19 </span><a name="ppdErrorString">ppdErrorString</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span><a name="ppdErrorString">ppdErrorString</a></h3>
<p class="description">Returns the text assocated with a status.</p>
<p class="code">
const char *ppdErrorString (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Status string</p>
-<h3 class="function"><span class="info"> CUPS 1.1.19 </span><a name="ppdFindAttr">ppdFindAttr</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span><a name="ppdFindAttr">ppdFindAttr</a></h3>
<p class="description">Find the first matching attribute.</p>
<p class="code">
<a href="#ppd_attr_t">ppd_attr_t</a> *ppdFindAttr (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Choice pointer or <code>NULL</code></p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="ppdFindCustomOption">ppdFindCustomOption</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="ppdFindCustomOption">ppdFindCustomOption</a></h3>
<p class="description">Find a custom option.</p>
<p class="code">
<a href="#ppd_coption_t">ppd_coption_t</a> *ppdFindCustomOption (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Custom option or NULL</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="ppdFindCustomParam">ppdFindCustomParam</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="ppdFindCustomParam">ppdFindCustomParam</a></h3>
<p class="description">Find a parameter for a custom option.</p>
<p class="code">
<a href="#ppd_cparam_t">ppd_cparam_t</a> *ppdFindCustomParam (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Pointer to choice or <code>NULL</code></p>
-<h3 class="function"><span class="info"> CUPS 1.1.19 </span><a name="ppdFindNextAttr">ppdFindNextAttr</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span><a name="ppdFindNextAttr">ppdFindNextAttr</a></h3>
<p class="description">Find the next matching attribute.</p>
<p class="code">
<a href="#ppd_attr_t">ppd_attr_t</a> *ppdFindNextAttr (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Pointer to option or <code>NULL</code></p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="ppdFirstCustomParam">ppdFirstCustomParam</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="ppdFirstCustomParam">ppdFirstCustomParam</a></h3>
<p class="description">Return the first parameter for a custom option.</p>
<p class="code">
<a href="#ppd_cparam_t">ppd_cparam_t</a> *ppdFirstCustomParam (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Custom parameter or NULL</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="ppdFirstOption">ppdFirstOption</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="ppdFirstOption">ppdFirstOption</a></h3>
<p class="description">Return the first option in the PPD file.</p>
<p class="code">
<a href="#ppd_option_t">ppd_option_t</a> *ppdFirstOption (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Non-zero if option is marked</p>
-<h3 class="function"><span class="info"> CUPS 1.1.19 </span><a name="ppdLastError">ppdLastError</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span><a name="ppdLastError">ppdLastError</a></h3>
<p class="description">Return the status from the last ppdOpen*().</p>
<p class="code">
<a href="#ppd_status_t">ppd_status_t</a> ppdLastError (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Status code</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="ppdLocalize">ppdLocalize</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="ppdLocalize">ppdLocalize</a></h3>
<p class="description">Localize the PPD file to the current locale.</p>
<p class="code">
int ppdLocalize (<br>
<p class="discussion">This function uses the current locale to find the localized attribute for
the given main and option keywords. If no localized version of the
attribute exists for the current locale, the unlocalized version is returned.</p>
-<h3 class="function"><span class="info"> CUPS 1.3 </span><a name="ppdLocalizeIPPReason">ppdLocalizeIPPReason</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.3/Mac OS X 10.5 </span><a name="ppdLocalizeIPPReason">ppdLocalizeIPPReason</a></h3>
<p class="description">Get the localized version of a cupsIPPReason
attribute.</p>
<p class="code">
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Number of conflicts</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="ppdNextCustomParam">ppdNextCustomParam</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="ppdNextCustomParam">ppdNextCustomParam</a></h3>
<p class="description">Return the next parameter for a custom option.</p>
<p class="code">
<a href="#ppd_cparam_t">ppd_cparam_t</a> *ppdNextCustomParam (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Custom parameter or NULL</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="ppdNextOption">ppdNextOption</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="ppdNextOption">ppdNextOption</a></h3>
<p class="description">Return the next option in the PPD file.</p>
<p class="code">
<a href="#ppd_option_t">ppd_option_t</a> *ppdNextOption (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">PPD file record</p>
-<h3 class="function"><span class="info"> CUPS 1.2 </span><a name="ppdOpen2">ppdOpen2</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="ppdOpen2">ppdOpen2</a></h3>
<p class="description">Read a PPD file into memory.</p>
<p class="code">
<a href="#ppd_file_t">ppd_file_t</a> *ppdOpen2 (<br>
</dl>
<h4 class="returnvalue">Return Value</h4>
<p class="description">Width of page in points or 0.0</p>
-<h3 class="function"><span class="info"> CUPS 1.1.20 </span><a name="ppdSetConformance">ppdSetConformance</a></h3>
+<h3 class="function"><span class="info"> CUPS 1.1.20/Mac OS X 10.4 </span><a name="ppdSetConformance">ppdSetConformance</a></h3>
<p class="description">Set the conformance level for PPD files.</p>
<p class="code">
void ppdSetConformance (<br>
<dd class="description">Conformance level</dd>
</dl>
<h2 class="title"><a name="TYPES">Data Types</a></h2>
-<h3 class="typedef"><span class="info"> CUPS 1.1.19 </span><a name="ppd_attr_t">ppd_attr_t</a></h3>
+<h3 class="typedef"><span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span><a name="ppd_attr_t">ppd_attr_t</a></h3>
<p class="description">PPD Attribute Structure </p>
<p class="code">
typedef struct <a href="#ppd_attr_s">ppd_attr_s</a> ppd_attr_t;
<p class="code">
typedef struct <a href="#ppd_choice_s">ppd_choice_s</a> ppd_choice_t;
</p>
-<h3 class="typedef"><span class="info"> CUPS 1.1.19 </span><a name="ppd_conform_t">ppd_conform_t</a></h3>
+<h3 class="typedef"><span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span><a name="ppd_conform_t">ppd_conform_t</a></h3>
<p class="description">Conformance Levels </p>
<p class="code">
typedef enum <a href="#ppd_conform_e">ppd_conform_e</a> ppd_conform_t;
<p class="code">
typedef struct <a href="#ppd_const_s">ppd_const_s</a> ppd_const_t;
</p>
-<h3 class="typedef"><span class="info"> CUPS 1.2 </span><a name="ppd_coption_t">ppd_coption_t</a></h3>
+<h3 class="typedef"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="ppd_coption_t">ppd_coption_t</a></h3>
<p class="description">Custom Option </p>
<p class="code">
typedef struct <a href="#ppd_coption_s">ppd_coption_s</a> ppd_coption_t;
</p>
-<h3 class="typedef"><span class="info"> CUPS 1.2 </span><a name="ppd_cparam_t">ppd_cparam_t</a></h3>
+<h3 class="typedef"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="ppd_cparam_t">ppd_cparam_t</a></h3>
<p class="description">Custom Parameter </p>
<p class="code">
typedef struct <a href="#ppd_cparam_s">ppd_cparam_s</a> ppd_cparam_t;
</p>
-<h3 class="typedef"><span class="info"> CUPS 1.2 </span><a name="ppd_cplimit_t">ppd_cplimit_t</a></h3>
+<h3 class="typedef"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="ppd_cplimit_t">ppd_cplimit_t</a></h3>
<p class="description">Custom Parameter Limit </p>
<p class="code">
typedef union <a href="#ppd_cplimit_u">ppd_cplimit_u</a> ppd_cplimit_t;
</p>
-<h3 class="typedef"><span class="info"> CUPS 1.2 </span><a name="ppd_cptype_t">ppd_cptype_t</a></h3>
+<h3 class="typedef"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="ppd_cptype_t">ppd_cptype_t</a></h3>
<p class="description">Custom Parameter Type </p>
<p class="code">
typedef enum <a href="#ppd_cptype_e">ppd_cptype_e</a> ppd_cptype_t;
</p>
-<h3 class="typedef"><span class="info"> CUPS 1.2 </span><a name="ppd_cpvalue_t">ppd_cpvalue_t</a></h3>
+<h3 class="typedef"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="ppd_cpvalue_t">ppd_cpvalue_t</a></h3>
<p class="description">Custom Parameter Value </p>
<p class="code">
typedef union <a href="#ppd_cpvalue_u">ppd_cpvalue_u</a> ppd_cpvalue_t;
typedef enum <a href="#ppd_ui_e">ppd_ui_e</a> ppd_ui_t;
</p>
<h2 class="title"><a name="STRUCTURES">Structures</a></h2>
-<h3 class="struct"><span class="info"> CUPS 1.1.19 </span><a name="ppd_attr_s">ppd_attr_s</a></h3>
+<h3 class="struct"><span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span><a name="ppd_attr_s">ppd_attr_s</a></h3>
<p class="description">PPD Attribute Structure </p>
<p class="code">struct ppd_attr_s {<br>
char name[PPD_MAX_NAME];<br>
<dt>option2[PPD_MAX_NAME] </dt>
<dd class="description">Second keyword</dd>
</dl>
-<h3 class="struct"><span class="info"> CUPS 1.2 </span><a name="ppd_coption_s">ppd_coption_s</a></h3>
+<h3 class="struct"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="ppd_coption_s">ppd_coption_s</a></h3>
<p class="description">Custom Option </p>
<p class="code">struct ppd_coption_s {<br>
char keyword[PPD_MAX_NAME];<br>
<dt>params </dt>
<dd class="description">Parameters</dd>
</dl>
-<h3 class="struct"><span class="info"> CUPS 1.2 </span><a name="ppd_cparam_s">ppd_cparam_s</a></h3>
+<h3 class="struct"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="ppd_cparam_s">ppd_cparam_s</a></h3>
<p class="description">Custom Parameter </p>
<p class="code">struct ppd_cparam_s {<br>
<a href="#ppd_cpvalue_t">ppd_cpvalue_t</a> current;<br>
<dd class="description">Number of page sizes</dd>
<dt>patches </dt>
<dd class="description">Patch commands to be sent to printer</dd>
-<dt>pcfilename <span class="info"> CUPS 1.1.19 </span></dt>
+<dt>pcfilename <span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span></dt>
<dd class="description">PCFileName string </dd>
<dt>product </dt>
<dd class="description">Product name (from PS RIP/interpreter)</dd>
<dt>profiles <span class="info"> DEPRECATED </span></dt>
<dd class="description">sRGB color profiles </dd>
-<dt>protocols <span class="info"> CUPS 1.1.19 </span></dt>
+<dt>protocols <span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span></dt>
<dd class="description">Protocols (BCP, TBCP) string </dd>
<dt>shortnickname </dt>
<dd class="description">Short version of nickname</dd>
<dl>
<dt>PPD_MAX_NAME] </dt>
<dd class="description">Human-readable group name</dd>
-<dt>name[PPD_MAX_NAME] <span class="info"> CUPS 1.1.18 </span></dt>
+<dt>name[PPD_MAX_NAME] <span class="info"> CUPS 1.1.18/Mac OS X 10.3 </span></dt>
<dd class="description">Group name </dd>
<dt>num_options </dt>
<dd class="description">Number of options</dd>
<dd class="description">Width of media in points</dd>
</dl>
<h2 class="title"><a name="UNIONS">Unions</a></h2>
-<h3 class="union"><span class="info"> CUPS 1.2 </span><a name="ppd_cplimit_u">ppd_cplimit_u</a></h3>
+<h3 class="union"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="ppd_cplimit_u">ppd_cplimit_u</a></h3>
<p class="description">Custom Parameter Limit </p>
<p class="code">union ppd_cplimit_u {<br>
float custom_curve;<br>
<dt>custom_string </dt>
<dd class="description">String length</dd>
</dl>
-<h3 class="union"><span class="info"> CUPS 1.2 </span><a name="ppd_cpvalue_u">ppd_cpvalue_u</a></h3>
+<h3 class="union"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="ppd_cpvalue_u">ppd_cpvalue_u</a></h3>
<p class="description">Custom Parameter Value </p>
<p class="code">union ppd_cpvalue_u {<br>
float custom_curve;<br>
<dt>PPD_CONFORM_STRICT </dt>
<dd class="description">Require strict conformance</dd>
</dl>
-<h3 class="enumeration"><span class="info"> CUPS 1.2 </span><a name="ppd_cptype_e">ppd_cptype_e</a></h3>
+<h3 class="enumeration"><span class="info"> CUPS 1.2/Mac OS X 10.5 </span><a name="ppd_cptype_e">ppd_cptype_e</a></h3>
<p class="description">Custom Parameter Type </p>
<h4 class="constants">Constants</h4>
<dl>
</table></div>
<h2 class="title">Contents</h2>
<ul class="contents">
+<ul class="subcontents">
<li><a href="#OVERVIEW">Overview</a></li>
<li><a href="#TASKS">Functions by Task</a><ul class="subcontents">
<li><a href="#OPENCLOSE">Opening and Closing Raster Streams</a></li>
<li><a href="#cups_order_e" title="cupsColorOrder attribute values">cups_order_e</a></li>
<li><a href="#cups_orient_e" title="">cups_orient_e</a></li>
</ul></li>
-</ul>
<!--
"$Id$"
<p class="description"></p>
<h4 class="constants">Constants</h4>
<dl>
-<dt>CUPS_CSPACE_CIELab <span class="info"> CUPS 1.1.19 </span></dt>
+<dt>CUPS_CSPACE_CIELab <span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span></dt>
<dd class="description">CIE Lab </dd>
-<dt>CUPS_CSPACE_CIEXYZ <span class="info"> CUPS 1.1.19 </span></dt>
+<dt>CUPS_CSPACE_CIEXYZ <span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span></dt>
<dd class="description">CIE XYZ </dd>
<dt>CUPS_CSPACE_CMY </dt>
<dd class="description">Cyan, magenta, yellow</dd>
<dd class="description">Gold, magenta, yellow, silver</dd>
<dt>CUPS_CSPACE_GOLD </dt>
<dd class="description">Gold foil</dd>
-<dt>CUPS_CSPACE_ICC1 <span class="info"> CUPS 1.1.19 </span></dt>
+<dt>CUPS_CSPACE_ICC1 <span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span></dt>
<dd class="description">ICC-based, 1 color </dd>
-<dt>CUPS_CSPACE_ICC2 <span class="info"> CUPS 1.1.19 </span></dt>
+<dt>CUPS_CSPACE_ICC2 <span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span></dt>
<dd class="description">ICC-based, 2 colors </dd>
-<dt>CUPS_CSPACE_ICC3 <span class="info"> CUPS 1.1.19 </span></dt>
+<dt>CUPS_CSPACE_ICC3 <span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span></dt>
<dd class="description">ICC-based, 3 colors </dd>
-<dt>CUPS_CSPACE_ICC4 <span class="info"> CUPS 1.1.19 </span></dt>
+<dt>CUPS_CSPACE_ICC4 <span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span></dt>
<dd class="description">ICC-based, 4 colors </dd>
-<dt>CUPS_CSPACE_ICC5 <span class="info"> CUPS 1.1.19 </span></dt>
+<dt>CUPS_CSPACE_ICC5 <span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span></dt>
<dd class="description">ICC-based, 5 colors </dd>
-<dt>CUPS_CSPACE_ICC6 <span class="info"> CUPS 1.1.19 </span></dt>
+<dt>CUPS_CSPACE_ICC6 <span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span></dt>
<dd class="description">ICC-based, 6 colors </dd>
-<dt>CUPS_CSPACE_ICC7 <span class="info"> CUPS 1.1.19 </span></dt>
+<dt>CUPS_CSPACE_ICC7 <span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span></dt>
<dd class="description">ICC-based, 7 colors </dd>
-<dt>CUPS_CSPACE_ICC8 <span class="info"> CUPS 1.1.19 </span></dt>
+<dt>CUPS_CSPACE_ICC8 <span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span></dt>
<dd class="description">ICC-based, 8 colors </dd>
-<dt>CUPS_CSPACE_ICC9 <span class="info"> CUPS 1.1.19 </span></dt>
+<dt>CUPS_CSPACE_ICC9 <span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span></dt>
<dd class="description">ICC-based, 9 colors </dd>
-<dt>CUPS_CSPACE_ICCA <span class="info"> CUPS 1.1.19 </span></dt>
+<dt>CUPS_CSPACE_ICCA <span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span></dt>
<dd class="description">ICC-based, 10 colors </dd>
-<dt>CUPS_CSPACE_ICCB <span class="info"> CUPS 1.1.19 </span></dt>
+<dt>CUPS_CSPACE_ICCB <span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span></dt>
<dd class="description">ICC-based, 11 colors </dd>
-<dt>CUPS_CSPACE_ICCC <span class="info"> CUPS 1.1.19 </span></dt>
+<dt>CUPS_CSPACE_ICCC <span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span></dt>
<dd class="description">ICC-based, 12 colors </dd>
-<dt>CUPS_CSPACE_ICCD <span class="info"> CUPS 1.1.19 </span></dt>
+<dt>CUPS_CSPACE_ICCD <span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span></dt>
<dd class="description">ICC-based, 13 colors </dd>
-<dt>CUPS_CSPACE_ICCE <span class="info"> CUPS 1.1.19 </span></dt>
+<dt>CUPS_CSPACE_ICCE <span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span></dt>
<dd class="description">ICC-based, 14 colors </dd>
-<dt>CUPS_CSPACE_ICCF <span class="info"> CUPS 1.1.19 </span></dt>
+<dt>CUPS_CSPACE_ICCF <span class="info"> CUPS 1.1.19/Mac OS X 10.3 </span></dt>
<dd class="description">ICC-based, 15 colors </dd>
<dt>CUPS_CSPACE_K </dt>
<dd class="description">Black</dd>
<dd class="description">Open stream for reading</dd>
<dt>CUPS_RASTER_WRITE </dt>
<dd class="description">Open stream for writing</dd>
-<dt>CUPS_RASTER_WRITE_COMPRESSED <span class="info"> CUPS 1.3 </span></dt>
+<dt>CUPS_RASTER_WRITE_COMPRESSED <span class="info"> CUPS 1.3/Mac OS X 10.5 </span></dt>
<dd class="description">Open stream for compressed writing </dd>
</dl>
<h3 class="enumeration"><a name="cups_order_e">cups_order_e</a></h3>
</table></div>
<h2 class="title">Contents</h2>
<ul class="contents">
+<ul class="subcontents">
<li><a href="#BASICS">Printer Driver Basics</a></li>
<li><a href="#CREATING">Creating New PPD Files</a><ul class="subcontents">
<li><a href="#IMPORT">Importing Existing PPD Files</a></li>
<li><a href="#COLOR">Implementing Color Management</a></li>
<li><a href="#MACOSX">Adding Mac OS X Features</a></li>
<li><a href="#DEPLOY">Deploying Your Driver</a></li>
-</ul>
<h2 class='title'><a name='BASICS'>Printer Driver Basics</a></h2>
<p>A CUPS PostScript printer driver consists of a PostScript Printer Description (PPD) file that describes the features and capabilities of the device, zero or more <em>filter</em> programs that prepare print data for the device, and zero or more support files for color management, online help, and so forth. The PPD file includes references to all of the filters and support files used by the driver.</p>
</table></div>
<h2 class="title">Contents</h2>
<ul class="contents">
+<ul class="subcontents">
<li><a href="#BASICS">The Basics</a></li>
<li><a href="#DRV">Driver Information Files</a><ul class="subcontents">
<li><a href="#SIMPLE">A Simple Example</a></li>
<li><a href="#CONDITIONAL">Conditional Statements</a></li>
<li><a href="#CONSTRAINTS">Defining Constraints</a></li>
</ul></li>
-</ul>
<h2 class='title'><a name='BASICS'>The Basics</a></h2>
<P>The PPD compiler, <a href='man-ppdc.html'><code>ppdc(1)</code></a>, is a
</table></div>
<h2 class="title">Contents</h2>
<ul class="contents">
+<ul class="subcontents">
<li><a href="#BASICS">Printer Driver Basics</a></li>
<li><a href="#CREATING">Creating New PPD Files</a></li>
<li><a href="#FILTERS">Using Filters</a></li>
<li><a href="#COLOR">Implementing Color Management</a></li>
<li><a href="#MACOSX">Adding Mac OS X Features</a></li>
<li><a href="#DEPLOY">Deploying Your Driver</a></li>
-</ul>
<h2 class='title'><a name='BASICS'>Printer Driver Basics</a></h2>
<p>A CUPS raster printer driver consists of a PostScript Printer Description (PPD) file that describes the features and capabilities of the device, one or more <em>filter</em> programs that prepare print data for the device, and zero or more support files for color management, online help, and so forth. The PPD file includes references to all of the filters and support files used by the driver.</p>
*
* Image library definitions for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007 by Apple Inc.
+ * Copyright 2007-2008 by Apple Inc.
* Copyright 1993-2006 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
attr = ippAddStrings(job->attrs, IPP_TAG_JOB, IPP_TAG_NAME, "job-sheets",
2, NULL, NULL);
- attr->values[0].string.text = _cupsStrAlloc(printer->job_sheets[0]);
- attr->values[1].string.text = _cupsStrAlloc(printer->job_sheets[1]);
+ attr->values[0].string.text = _cupsStrRetain(printer->job_sheets[0]);
+ attr->values[1].string.text = _cupsStrRetain(printer->job_sheets[1]);
}
job->job_sheets = attr;
continue;
printer->reasons[printer->num_reasons] =
- _cupsStrAlloc(attr->values[i].string.text);
+ _cupsStrRetain(attr->values[i].string.text);
if (!strcmp(printer->reasons[printer->num_reasons], "paused") &&
printer->state != IPP_PRINTER_STOPPED)
for (i = 0; i < attr->num_values; i ++)
toattr->values[i].string.text = attr->values[i].string.text;
}
- else
+ else if (attr->value_tag & IPP_TAG_COPY)
{
for (i = 0; i < attr->num_values; i ++)
toattr->values[i].string.text =
_cupsStrAlloc(attr->values[i].string.text);
}
+ else
+ {
+ for (i = 0; i < attr->num_values; i ++)
+ toattr->values[i].string.text =
+ _cupsStrRetain(attr->values[i].string.text);
+ }
break;
case IPP_TAG_DATE :
toattr->values[i].string.text = attr->values[i].string.text;
}
}
- else
+ else if (attr->value_tag & IPP_TAG_COPY)
{
for (i = 0; i < attr->num_values; i ++)
{
_cupsStrAlloc(attr->values[i].string.text);
}
}
+ else
+ {
+ for (i = 0; i < attr->num_values; i ++)
+ {
+ if (!i)
+ toattr->values[i].string.charset =
+ _cupsStrRetain(attr->values[i].string.charset);
+ else
+ toattr->values[i].string.charset =
+ toattr->values[0].string.charset;
+
+ toattr->values[i].string.text =
+ _cupsStrRetain(attr->values[i].string.text);
+ }
+ }
break;
case IPP_TAG_BEGIN_COLLECTION :
if ((p2_uri = ippFindAttribute(p2->attrs, "printer-uri-supported",
IPP_TAG_URI)) != NULL)
member_uris->values[i].string.text =
- _cupsStrAlloc(p2_uri->values[0].string.text);
+ _cupsStrRetain(p2_uri->values[0].string.text);
else
{
httpAssembleURIf(HTTP_URI_CODING_ALL, printer_uri,
{
attr->value_tag = newattr->value_tag;
attr->values[0].string.text =
- _cupsStrAlloc(newattr->values[0].string.text);
+ _cupsStrRetain(newattr->values[0].string.text);
}
else
{
for (i = 0; i < p->num_printers; i ++)
{
if (attr != NULL)
- attr->values[i].string.text = _cupsStrAlloc(p->printers[i]->name);
+ attr->values[i].string.text = _cupsStrRetain(p->printers[i]->name);
p->type &= ~CUPS_PRINTER_OPTIONS | p->printers[i]->type;
}
{
for (i = 0; i < oldattr->num_values; i ++)
attr->values[i].string.text =
- _cupsStrAlloc(oldattr->values[i].string.text);
+ _cupsStrRetain(oldattr->values[i].string.text);
}
}
{
for (i = 0; i < oldattr->num_values; i ++)
attr->values[i].string.text =
- _cupsStrAlloc(oldattr->values[i].string.text);
+ _cupsStrRetain(oldattr->values[i].string.text);
}
}
{
for (i = 0; i < oldattr->num_values; i ++)
attr->values[i].string.text =
- _cupsStrAlloc(oldattr->values[i].string.text);
+ _cupsStrRetain(oldattr->values[i].string.text);
}
}
i=`expr $i + 1`
done
-cp /tmp/cups-$user/printers.conf /tmp/cups-$user/printers.conf.orig
+if test -f /tmp/cups-$user/printers.conf; then
+ cp /tmp/cups-$user/printers.conf /tmp/cups-$user/printers.conf.orig
+else
+ touch /tmp/cups-$user/printers.conf.orig
+fi
#
# Setup the paths...