/*
- * "$Id: cupsctl.c 6379 2007-03-21 14:57:22Z mike $"
+ * "$Id$"
*
- * CUPS control program for the Common UNIX Printing System (CUPS).
+ * Scheduler control program for CUPS.
*
- * Copyright 2007 by Apple Inc.
+ * Copyright 2007-2011 by Apple Inc.
* Copyright 2006-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
* Include necessary headers...
*/
+#include <cups/cups-private.h>
#include <cups/adminutil.h>
-#include <cups/string.h>
-#include <cups/i18n.h>
/*
{
if (argv[i][1] == '-')
{
- if (!strcmp(argv[i], "--debug_logging"))
+ if (!strcmp(argv[i], "--debug-logging"))
num_settings = cupsAddOption(CUPS_SERVER_DEBUG_LOGGING, "1",
num_settings, &settings);
else if (!strcmp(argv[i], "--no-debug-logging"))
usage(argv[i]);
}
+ if (cupsGetOption("Listen", num_settings, settings) ||
+ cupsGetOption("Port", num_settings, settings))
+ {
+ _cupsLangPuts(stderr, _("cupsctl: Cannot set Listen or Port directly."));
+ return (1);
+ }
+
/*
* Connect to the server using the defaults...
*/
- http = httpConnectEncrypt(cupsServer(), ippPort(), cupsEncryption());
+ if ((http = httpConnectEncrypt(cupsServer(), ippPort(),
+ cupsEncryption())) == NULL)
+ {
+ _cupsLangPrintf(stderr, _("cupsctl: Unable to connect to server: %s"),
+ strerror(errno));
+ return (1);
+ }
/*
* Set the current configuration if we have anything on the command-line...
{
if (!cupsAdminSetServerSettings(http, num_settings, settings))
{
- _cupsLangPrintf(stderr, "cupsctl: %s\n", cupsLastErrorString());
+ _cupsLangPrintf(stderr, "cupsctl: %s", cupsLastErrorString());
return (1);
}
}
else if (!cupsAdminGetServerSettings(http, &num_settings, &settings))
{
- _cupsLangPrintf(stderr, "cupsctl: %s\n", cupsLastErrorString());
+ _cupsLangPrintf(stderr, "cupsctl: %s", cupsLastErrorString());
return (1);
}
else
{
for (i = 0; i < num_settings; i ++)
- _cupsLangPrintf(stdout, "%s=%s\n", settings[i].name, settings[i].value);
+ _cupsLangPrintf(stdout, "%s=%s", settings[i].name, settings[i].value);
}
cupsFreeOptions(num_settings, settings);
if (opt)
{
if (*opt == '-')
- _cupsLangPrintf(stderr, _("cupsctl: Unknown option \"%s\"!\n"), opt);
+ _cupsLangPrintf(stderr, _("cupsctl: Unknown option \"%s\""), opt);
else
- _cupsLangPrintf(stderr, _("cupsctl: Unknown option \"-%c\"!\n"), *opt);
+ _cupsLangPrintf(stderr, _("cupsctl: Unknown option \"-%c\""), *opt);
}
- _cupsLangPuts(stdout,
- _("Usage: cupsctl [options] [param=value ... paramN=valueN]\n"
- "\n"
- "Options:\n"
- "\n"
- " -E Enable encryption\n"
- " -U username Specify username\n"
- " -h server[:port] Specify server address\n"
- "\n"
- " --[no-]debug-logging Turn debug logging on/off\n"
- " --[no-]remote-admin Turn remote administration "
- "on/off\n"
- " --[no-]remote-any Allow/prevent access from the "
- "Internet\n"
- " --[no-]remote-printers Show/hide remote printers\n"
- " --[no-]share-printers Turn printer sharing on/off\n"
- " --[no-]user-cancel-any Allow/prevent users to cancel "
- "any job\n"));
+ _cupsLangPuts(stdout, _("Usage: cupsctl [options] [param=value ... "
+ "paramN=valueN]"));
+ _cupsLangPuts(stdout, "");
+ _cupsLangPuts(stdout, _("Options:"));
+ _cupsLangPuts(stdout, "");
+ _cupsLangPuts(stdout, _(" -E Enable encryption."));
+ _cupsLangPuts(stdout, _(" -U username Specify username."));
+ _cupsLangPuts(stdout, _(" -h server[:port] Specify server "
+ "address."));
+ _cupsLangPuts(stdout, "");
+ _cupsLangPuts(stdout, _(" --[no-]debug-logging Turn debug logging "
+ "on/off."));
+ _cupsLangPuts(stdout, _(" --[no-]remote-admin Turn remote "
+ "administration on/off."));
+ _cupsLangPuts(stdout, _(" --[no-]remote-any Allow/prevent access "
+ "from the Internet."));
+ _cupsLangPuts(stdout, _(" --[no-]remote-printers Show/hide remote "
+ "printers."));
+ _cupsLangPuts(stdout, _(" --[no-]share-printers Turn printer sharing "
+ "on/off."));
+ _cupsLangPuts(stdout, _(" --[no-]user-cancel-any Allow/prevent users to "
+ "cancel any job."));
exit(1);
}
/*
- * End of "$Id: cupsctl.c 6379 2007-03-21 14:57:22Z mike $".
+ * End of "$Id$".
*/