cups/cups-1.2.0-ppdsdat_generation.patch

100 lines
2.8 KiB
Diff

Index: cups-1.3.11/scheduler/main.c
===================================================================
--- cups-1.3.11.orig/scheduler/main.c
+++ cups-1.3.11/scheduler/main.c
@@ -172,6 +172,7 @@ main(int argc, /* I - Number of comm
*/
fg = 0;
+ ppds_generation = 0;
#ifdef HAVE_LAUNCHD
if (getenv("CUPSD_LAUNCHD"))
@@ -272,6 +273,10 @@ main(int argc, /* I - Number of comm
fg = 1;
break;
+ case 'P' : /* generate ppds only */
+ ppds_generation = 1;
+ break;
+
default : /* Unknown option */
_cupsLangPrintf(stderr, _("cupsd: Unknown option \"%c\" - "
"aborting!\n"), *opt);
@@ -340,17 +345,18 @@ main(int argc, /* I - Number of comm
perror("cupsd");
return (1);
}
- else if (WIFEXITED(i))
+ else if (!ppds_generation && WIFEXITED(i))
{
fprintf(stderr, "cupsd: Child exited with status %d!\n",
WEXITSTATUS(i));
return (2);
}
- else
+ else if (!ppds_generation || WTERMSIG(i)!=0)
{
fprintf(stderr, "cupsd: Child exited on signal %d!\n", WTERMSIG(i));
return (3);
- }
+ } else
+ return (0);
}
#ifdef __OpenBSD__
@@ -625,6 +631,9 @@ main(int argc, /* I - Number of comm
}
#endif /* __sgi */
+ if (ppds_generation > 0)
+ return (stop_scheduler);
+
/*
* Initialize authentication certificates...
*/
@@ -2031,13 +2040,14 @@ static void
usage(int status) /* O - Exit status */
{
_cupsLangPuts(status ? stderr : stdout,
- _("Usage: cupsd [-c config-file] [-f] [-F] [-h] [-l]\n"
+ _("Usage: cupsd [-c config-file] [-f] [-F] [-h] [-l] [-P]\n"
"\n"
"-c config-file Load alternate configuration file\n"
"-f Run in the foreground\n"
"-F Run in the foreground but detach\n"
"-h Show this usage message\n"
- "-l Run cupsd from launchd(8)\n"));
+ "-l Run cupsd from launchd(8)\n"
+ "-P Generate ppds.dat and exit\n"));
exit(status);
}
Index: cups-1.3.11/scheduler/cupsd.h
===================================================================
--- cups-1.3.11.orig/scheduler/cupsd.h
+++ cups-1.3.11/scheduler/cupsd.h
@@ -180,6 +180,8 @@ VAR PSQUpdateQuotaProcPtr PSQUpdateQuota
+VAR int ppds_generation;/* Generate ppds.dat and exit() */
+
/*
* Prototypes...
Index: cups-1.3.11/scheduler/conf.c
===================================================================
--- cups-1.3.11.orig/scheduler/conf.c
+++ cups-1.3.11/scheduler/conf.c
@@ -941,6 +941,9 @@ cupsdReadConfiguration(void)
return (0);
}
+ if (ppds_generation > 0)
+ return(1);
+
/*
* Setup environment variables...
*/