Index: man/cupsd.man.in =================================================================== --- man/cupsd.man.in (revision 6874) +++ man/cupsd.man.in (working copy) @@ -12,14 +12,14 @@ .\" 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/". .\" -.TH cupsd 8 "Common UNIX Printing System" "12 February 2006" "Apple Inc." +.TH cupsd 8 "Common UNIX Printing System" "27 August 2006" "Apple Inc." .SH NAME cupsd \- common unix printing system daemon .SH SYNOPSIS .B cupsd [ -c .I config-file -] [ -f ] [ -F ] [ -h ] [ -l ] +] [ -f ] [ -F ] [ -h ] [ -l ] [ -t ] .SH DESCRIPTION \fIcupsd\fR is the scheduler for the Common UNIX Printing System. It implements a printing system based upon the Internet Printing Protocol, @@ -51,6 +51,10 @@ .br This option is passed to \fIcupsd\fR when it is run from \fIlaunchd(8)\fR. +.TP 5 +-t +.br +Test the configuration file for syntax errors. .SH COMPATIBILITY \fIcupsd\fR implements all of the required IPP/1.1 attributes and operations. It also implements several CUPS-specific administration Index: scheduler/log.c =================================================================== --- scheduler/log.c (revision 6874) +++ scheduler/log.c (working copy) @@ -196,6 +196,19 @@ * See if we want to log this message... */ + if (TestConfigFile) + { + if (level <= CUPSD_LOG_WARN) + { + va_start(ap, message); + vfprintf(stderr, message, ap); + putc('\n', stderr); + va_end(ap); + } + + return (1); + } + if (level > LogLevel || !ErrorLog) return (1); Index: scheduler/cupsd.h =================================================================== --- scheduler/cupsd.h (revision 6874) +++ scheduler/cupsd.h (working copy) @@ -152,6 +152,8 @@ * Globals... */ +VAR int TestConfigFile VALUE(0); + /* Test the cupsd.conf file? */ VAR int MaxFDs; /* Maximum number of files */ VAR time_t ReloadTime VALUE(0); Index: scheduler/main.c =================================================================== --- scheduler/main.c (revision 6874) +++ scheduler/main.c (working copy) @@ -242,6 +242,11 @@ fg = 1; break; + case 't' : /* Test the cupsd.conf file... */ + TestConfigFile = 1; + fg = 1; + break; + default : /* Unknown option */ _cupsLangPrintf(stderr, _("cupsd: Unknown option \"%c\" - " "aborting!\n"), *opt); @@ -398,10 +403,18 @@ if (!cupsdReadConfiguration()) { - syslog(LOG_LPR, "Unable to read configuration file \'%s\' - exiting!", - ConfigurationFile); + if (TestConfigFile) + printf("%s contains errors\n", ConfigurationFile); + else + syslog(LOG_LPR, "Unable to read configuration file \'%s\' - exiting!", + ConfigurationFile); return (1); } + else if (TestConfigFile) + { + printf("%s is OK\n", ConfigurationFile); + return (0); + } if (!strncmp(TempDir, RequestRoot, strlen(RequestRoot))) {