LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File cups-1.2.0-ppdsdat_generation.patch of Package cups (Project DISCONTINUED:openSUSE:11.1)

--- cups-1.2.0/scheduler/main.c.orig	2006-03-18 04:05:12.000000000 +0100
+++ cups-1.2.0/scheduler/main.c	2006-03-29 19:02:22.000000000 +0200
@@ -148,6 +148,7 @@
   */
 
   fg = 0;
+  ppds_generation = 0;
 
   for (i = 1; i < argc; i ++)
     if (argv[i][0] == '-')
@@ -219,6 +220,10 @@
 #endif /* HAVE_LAUNCHD */
 	      break;
 
+	  case 'P' : /* generate ppds only */
+	      ppds_generation = 1;
+	      break;
+
 	  default : /* Unknown option */
               _cupsLangPrintf(stderr, _("cupsd: Unknown option \"%c\" - "
 	                                "aborting!\n"), *opt);
@@ -287,17 +292,18 @@
         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);
     }
   }
 
@@ -482,6 +488,9 @@
   }
 #endif /* __sgi */
 
+ if (ppds_generation > 0)
+    return (stop_scheduler);
+
  /*
   * Initialize authentication certificates...
   */
@@ -2260,13 +2269,14 @@
 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);
 }
 
--- cups-1.2.0/scheduler/cupsd.h.orig	2006-03-18 04:05:12.000000000 +0100
+++ cups-1.2.0/scheduler/cupsd.h	2006-03-29 17:30:47.000000000 +0200
@@ -202,6 +202,8 @@
 				  char *envp[], int infd, int outfd,
 				  int errfd, int backfd, int root, int *pid);
 
+VAR int			ppds_generation;/* Generate ppds.dat and exit() */
+
 
 /*
  * End of "$Id: cupsd.h 5305 2006-03-18 03:05:12Z mike $".
--- cups-1.2.0/scheduler/conf.c.orig	2006-03-14 12:54:45.000000000 +0100
+++ cups-1.2.0/scheduler/conf.c	2006-03-29 17:30:47.000000000 +0200
@@ -716,6 +716,9 @@
                       TempDir, strerror(errno));
   }
 
+  if (ppds_generation > 0)
+    return(1);
+
  /*
   * Setup environment variables...
   */