/*
- * "$Id: adminutil.c 6270 2007-02-12 14:27:47Z mike $"
+ * "$Id: adminutil.c 6649 2007-07-11 21:46:42Z mike $"
*
* Administration utility API definitions for the Common UNIX Printing
* System (CUPS).
*
- * MANY OF THE FUNCTIONS IN THIS HEADER ARE PRIVATE AND SUBJECT TO
- * CHANGE AT ANY TIME. USE AT YOUR OWN RISK.
- *
+ * Copyright 2007 by Apple Inc.
* Copyright 2001-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
- * property of Easy Software Products and are protected by Federal
- * copyright law. Distribution and use rights are outlined in the file
- * "LICENSE.txt" which should have been included with this file. If this
- * file is missing or damaged please contact Easy Software Products
- * at:
- *
- * Attn: CUPS Licensing Information
- * Easy Software Products
- * 44141 Airport View Drive, Suite 204
- * Hollywood, Maryland 20636 USA
- *
- * Voice: (301) 373-9600
- * EMail: cups-info@cups.org
- * WWW: http://www.cups.org
+ * property of Apple Inc. and are protected by Federal copyright
+ * law. Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file. If this file is
+ * file is missing or damaged, see the license at "http://www.cups.org/".
*
* This file is subject to the Apple OS-Developed Software exception.
*
*
* cupsAdminCreateWindowsPPD() - Create the Windows PPD file for a printer.
* cupsAdminExportSamba() - Export a printer to Samba.
- * _cupsAdminGetServerSettings() - Get settings from the server.
- * _cupsAdminSetServerSettings() - Set settings on the server.
+ * cupsAdminGetServerSettings() - Get settings from the server.
+ * _cupsAdminGetServerSettings() - Get settings from the server (private).
+ * cupsAdminSetServerSettings() - Set settings on the server.
+ * _cupsAdminSetServerSettings() - Set settings on the server (private).
* do_samba_command() - Do a SAMBA command.
* get_cupsd_conf() - Get the current cupsd.conf file.
* invalidate_cupsd_cache() - Invalidate the cached cupsd.conf settings.
* Local functions...
*/
+extern int _cupsAdminGetServerSettings(http_t *http,
+ int *num_settings,
+ cups_option_t **settings);
+extern int _cupsAdminSetServerSettings(http_t *http,
+ int num_settings,
+ cups_option_t *settings);
static int do_samba_command(const char *command,
const char *address,
const char *subcommand,
option[41], /* Option */
choice[41]; /* Choice */
int jcloption, /* In a JCL option? */
+ jclorder, /* Next JCL order dependency */
linenum; /* Current line number */
time_t curtime; /* Current time */
struct tm *curdate; /* Current date */
*/
jcloption = 0;
+ jclorder = 0;
linenum = 0;
language = cupsLangDefault();
jcloption = 0;
cupsFilePrintf(dstfp, "%s\n", line);
}
+ else if (jcloption && !strncmp(line, "*OrderDependency:", 17))
+ {
+ for (ptr = line + 17; *ptr && isspace(*ptr & 255); ptr ++);
+
+ ptr = strchr(ptr, ' ');
+
+ if (ptr)
+ {
+ cupsFilePrintf(dstfp, "*OrderDependency: %d%s\n", jclorder, ptr);
+ jclorder ++;
+ }
+ else
+ cupsFilePrintf(dstfp, "%s\n", line);
+ }
else if (jcloption &&
strncmp(line, "*End", 4) &&
- strncmp(line, "*Default", 8) &&
- strncmp(line, "*OrderDependency", 16))
+ strncmp(line, "*Default", 8))
{
if ((ptr = strchr(line, ':')) == NULL)
{
IPP_TAG_ZERO)) != NULL &&
(suppattr = ippFindAttribute(response, "job-hold-until-supported",
IPP_TAG_ZERO)) != NULL)
- write_option(dstfp, 10, "cupsJobHoldUntil", "Hold Until", "job-hold-until",
- suppattr, defattr, 0, 1);
+ write_option(dstfp, jclorder ++, "cupsJobHoldUntil", "Hold Until",
+ "job-hold-until", suppattr, defattr, 0, 1);
if ((defattr = ippFindAttribute(response, "job-priority-default",
IPP_TAG_INTEGER)) != NULL &&
(suppattr = ippFindAttribute(response, "job-priority-supported",
IPP_TAG_RANGE)) != NULL)
- write_option(dstfp, 11, "cupsJobPriority", "Priority", "job-priority",
- suppattr, defattr, 0, 1);
+ write_option(dstfp, jclorder ++, "cupsJobPriority", "Priority",
+ "job-priority", suppattr, defattr, 0, 1);
if ((defattr = ippFindAttribute(response, "job-sheets-default",
IPP_TAG_ZERO)) != NULL &&
(suppattr = ippFindAttribute(response, "job-sheets-supported",
IPP_TAG_ZERO)) != NULL)
{
- write_option(dstfp, 20, "cupsJobSheetsStart", "Start Banner",
+ write_option(dstfp, jclorder ++, "cupsJobSheetsStart", "Start Banner",
"job-sheets", suppattr, defattr, 0, 2);
- write_option(dstfp, 21, "cupsJobSheetsEnd", "End Banner",
+ write_option(dstfp, jclorder ++, "cupsJobSheetsEnd", "End Banner",
"job-sheets", suppattr, defattr, 1, 2);
}
"are installed!")),
sizeof(message));
- _cupsSetError(IPP_INTERNAL_ERROR, message);
+ _cupsSetError(IPP_NOT_FOUND, message);
_cupsLangPrintf(logfile, "%s\n", message);
}
if (have_drivers == 0)
+ {
+ _cupsSetError(IPP_NOT_FOUND, message);
return (0);
+ }
/*
* Finally, associate the drivers we just added with the queue...
}
+/*
+ * 'cupsAdminGetServerSettings()' - Get settings from the server.
+ *
+ * The returned settings should be freed with cupsFreeOptions() when
+ * you are done with them.
+ *
+ * @since CUPS 1.3@
+ */
+
+int /* O - 1 on success, 0 on failure */
+cupsAdminGetServerSettings(
+ http_t *http, /* I - Connection to server */
+ int *num_settings, /* O - Number of settings */
+ cups_option_t **settings) /* O - Settings */
+{
+ return (_cupsAdminGetServerSettings(http, num_settings, settings));
+}
+
+
/*
* '_cupsAdminGetServerSettings()' - Get settings from the server.
*
}
+/*
+ * 'cupsAdminSetServerSettings()' - Set settings on the server.
+ *
+ * @since CUPS 1.3@
+ */
+
+int /* O - 1 on success, 0 on failure */
+cupsAdminSetServerSettings(
+ http_t *http, /* I - Connection to server */
+ int num_settings, /* I - Number of settings */
+ cups_option_t *settings) /* I - Settings */
+{
+ return (_cupsAdminSetServerSettings(http, num_settings, settings));
+}
+
+
/*
* '_cupsAdminSetServerSettings()' - Set settings on the server.
*
{
if (!wrote_browsing)
{
+ int new_remote_printers = (remote_printers > 0 ||
+ (remote_printers == -1 &&
+ old_remote_printers > 0));
+ int new_share_printers = (share_printers > 0 ||
+ (share_printers == -1 &&
+ old_share_printers > 0));
+
wrote_browsing = 1;
- if (remote_printers > 0 || share_printers > 0)
+ if (new_remote_printers || new_share_printers)
{
- if (remote_printers > 0 && share_printers > 0)
+ if (new_remote_printers && new_share_printers)
cupsFilePuts(temp,
"# Enable printer sharing and shared printers.\n");
- else if (remote_printers > 0)
+ else if (new_remote_printers)
cupsFilePuts(temp,
"# Show shared printers on the local network.\n");
else
cupsFilePuts(temp, "Browsing On\n");
cupsFilePuts(temp, "BrowseOrder allow,deny\n");
- if (remote_printers > 0)
+ if (new_remote_printers)
cupsFilePuts(temp, "BrowseAllow all\n");
- if (share_printers > 0)
+ if (new_share_printers)
cupsFilePuts(temp, "BrowseAddress @LOCAL\n");
}
else
}
}
else if (!in_policy && !in_location &&
- (val = cupsGetOption(line, num_settings, settings)) != NULL &&
- !cupsGetOption(line, cupsd_num_settings, cupsd_settings))
+ (val = cupsGetOption(line, num_settings, settings)) != NULL)
{
/*
- * Add this directive to the list of directives we have written...
+ * Replace this directive's value with the new one...
*/
- cupsd_num_settings = cupsAddOption(line, value, cupsd_num_settings,
+ cupsd_num_settings = cupsAddOption(line, val, cupsd_num_settings,
&cupsd_settings);
/*
* only support setting root directives, not in sections...
*/
- cupsFilePrintf(temp, "%s %s\n", line, value);
+ cupsFilePrintf(temp, "%s %s\n", line, val);
}
else if (value)
{
cupsd_num_settings, &cupsd_settings);
/*
- * Write the new value in its place, without indentation since we
- * only support setting root directives, not in sections...
+ * Write the new value, without indentation since we only support
+ * setting root directives, not in sections...
*/
cupsFilePrintf(temp, "%s %s\n", setting->name, setting->value);
/*
- * End of "$Id: adminutil.c 6270 2007-02-12 14:27:47Z mike $".
+ * End of "$Id: adminutil.c 6649 2007-07-11 21:46:42Z mike $".
*/