]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - scheduler/main.c
Merge changes from CUPS 1.7svn-r10710.
[thirdparty/cups.git] / scheduler / main.c
index b0185e1aba3baf9ac4adc3191477b5f80cb72203..0f6098963387af30531ff1b0d1c6f37cdc9efd3e 100644 (file)
@@ -208,7 +208,6 @@ main(int  argc,                             /* I - Number of command-line args */
 
                 char *current;         /* Current directory */
 
-
               /*
                * Allocate a buffer for the current working directory to
                * reduce run-time stack usage; this approximates the
@@ -234,6 +233,35 @@ main(int  argc,                            /* I - Number of command-line args */
                cupsdSetStringf(&ConfigurationFile, "%s/%s", current, argv[i]);
                free(current);
               }
+
+             if (!CupsFilesFile)
+             {
+               char    *filename,      /* Copy of cupsd.conf filename */
+                       *slash;         /* Final slash in cupsd.conf filename */
+               size_t  len;            /* Size of buffer */
+
+               len = strlen(ConfigurationFile) + 15;
+               if ((filename = malloc(len)) == NULL)
+               {
+                 _cupsLangPrintf(stderr,
+                                 _("cupsd: Unable to get path to "
+                                   "cups-files.conf file."));
+                  return (1);
+               }
+
+               strlcpy(filename, ConfigurationFile, len);
+               if ((slash = strrchr(filename, '/')) == NULL)
+               {
+                 _cupsLangPrintf(stderr,
+                                 _("cupsd: Unable to get path to "
+                                   "cups-files.conf file."));
+                  return (1);
+               }
+
+               strlcpy(slash, "/cups-files.conf", len - (slash - filename));
+               cupsdSetString(&CupsFilesFile, filename);
+               free(filename);
+             }
              break;
 
           case 'f' : /* Run in foreground... */
@@ -272,6 +300,29 @@ main(int  argc,                            /* I - Number of command-line args */
              UseProfiles = 0;
              break;
 
+          case 's' : /* Set cups-files.conf location */
+              i ++;
+             if (i >= argc)
+             {
+               _cupsLangPuts(stderr, _("cupsd: Expected cups-files.conf "
+                                       "filename after \"-s\" option."));
+               usage(1);
+             }
+
+              if (argv[i][0] != '/')
+             {
+              /*
+               * Relative filename not allowed...
+               */
+
+               _cupsLangPuts(stderr, _("cupsd: Relative cups-files.conf "
+                                       "filename not allowed."));
+               usage(1);
+              }
+
+             cupsdSetString(&CupsFilesFile, argv[i]);
+             break;
+
 #ifdef __APPLE__
           case 'S' : /* Disable system management functions */
               fputs("cupsd: -S (disable system management) for internal "