]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - filter/pstops.c
Load cups into easysw/current.
[thirdparty/cups.git] / filter / pstops.c
index 5aea4696b3dda9c0fa5b2fedc136d396dc625f27..c74dbd3d03b9eca925090e047edad345c8218bde 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: pstops.c 6391 2007-03-24 14:35:56Z mike $"
+ * "$Id: pstops.c 6420 2007-03-30 20:00:59Z mike $"
  *
  *   PostScript filter for the Common UNIX Printing System (CUPS).
  *
@@ -61,6 +61,7 @@
 #include <math.h>
 #include <cups/file.h>
 #include <cups/array.h>
+#include <cups/i18n.h>
 
 
 /*
@@ -240,7 +241,8 @@ main(int  argc,                             /* I - Number of command-line args */
 
   if (argc < 6 || argc > 7)
   {
-    fputs("ERROR: pstops job-id user title copies options [file]\n", stderr);
+    fprintf(stderr, _("Usage: %s job-id user title copies options [file]\n"),
+            argv[0]);
     return (1);
   }
 
@@ -259,7 +261,7 @@ main(int  argc,                             /* I - Number of command-line args */
 
     if ((fp = cupsFileOpen(argv[6], "r")) == NULL)
     {
-      fprintf(stderr, "ERROR: Unable to open print file \"%s\" - %s\n",
+      fprintf(stderr, _("ERROR: Unable to open file \"%s\" - %s\n"),
               argv[6], strerror(errno));
       return (1);
     }
@@ -271,7 +273,7 @@ main(int  argc,                             /* I - Number of command-line args */
 
   if ((len = cupsFileGetLine(fp, line, sizeof(line))) == 0)
   {
-    fputs("ERROR: Empty print file!\n", stderr);
+    fputs(_("ERROR: Empty print file!\n"), stderr);
     return (1);
   }
 
@@ -405,14 +407,14 @@ add_page(pstops_doc_t *doc,               /* I - Document information */
 
   if (!doc->pages)
   {
-    fprintf(stderr, "EMERG: Unable to allocate memory for pages array: %s\n",
+    fprintf(stderr, _("EMERG: Unable to allocate memory for pages array: %s\n"),
             strerror(errno));
     exit(1);
   }
 
   if ((pageinfo = calloc(1, sizeof(pstops_page_t))) == NULL)
   {
-    fprintf(stderr, "EMERG: Unable to allocate memory for page info: %s\n",
+    fprintf(stderr, _("EMERG: Unable to allocate memory for page info: %s\n"),
             strerror(errno));
     exit(1);
   }
@@ -512,8 +514,12 @@ copy_bytes(cups_file_t *fp,                /* I - File to read from */
 
   if (cupsFileSeek(fp, offset) < 0)
   {
-    fprintf(stderr, "ERROR: Unable to seek to offset " CUPS_LLFMT
-                    " in file - %s\n",
+    fprintf(stderr,
+#ifdef HAVE_LONG_LONG
+            _("ERROR: Unable to seek to offset %lld in file - %s\n"),
+#else
+            _("ERROR: Unable to seek to offset %ld in file - %s\n"),
+#endif /* HAVE_LONG_LONG */
             CUPS_LLCAST offset, strerror(errno));
     return;
   }
@@ -597,7 +603,7 @@ copy_comments(cups_file_t  *fp,             /* I - File to read from */
 
 
       if (saw_pages)
-        fputs("ERROR: Duplicate %%Pages: comment seen!\n", stderr);
+        fputs(_("ERROR: Duplicate %%Pages: comment seen!\n"), stderr);
 
       saw_pages = 1;
 
@@ -644,7 +650,7 @@ copy_comments(cups_file_t  *fp,             /* I - File to read from */
     else if (!strncmp(line, "%%BoundingBox:", 14))
     {
       if (saw_bounding_box)
-        fputs("ERROR: Duplicate %%BoundingBox: comment seen!\n", stderr);
+        fputs(_("ERROR: Duplicate %%BoundingBox: comment seen!\n"), stderr);
       else if (strstr(line + 14, "(atend)"))
       {
        /*
@@ -655,7 +661,7 @@ copy_comments(cups_file_t  *fp,             /* I - File to read from */
                      doc->bounding_box + 1, doc->bounding_box + 2,
                      doc->bounding_box + 3) != 4)
       {
-       fputs("ERROR: Bad %%BoundingBox: comment seen!\n", stderr);
+       fputs(_("ERROR: Bad %%BoundingBox: comment seen!\n"), stderr);
 
        doc->bounding_box[0] = (int)PageLeft;
        doc->bounding_box[1] = (int)PageBottom;
@@ -707,10 +713,10 @@ copy_comments(cups_file_t  *fp,           /* I - File to read from */
   }
 
   if (!saw_bounding_box)
-    fputs("ERROR: No %%BoundingBox: comment in header!\n", stderr);
+    fputs(_("ERROR: No %%BoundingBox: comment in header!\n"), stderr);
 
   if (!saw_pages)
-    fputs("ERROR: No %%Pages: comment in header!\n", stderr);
+    fputs(_("ERROR: No %%Pages: comment in header!\n"), stderr);
 
   if (!saw_for)
     WriteTextComment("For", doc->user);
@@ -1026,8 +1032,8 @@ copy_non_dsc(cups_file_t  *fp,            /* I - File to read from */
   * that may not print correctly...
   */
 
-  fputs("WARNING: This document does not conform to the Adobe Document "
-        "Structuring Conventions and may not print correctly!\n", stderr);
+  fputs(_("WARNING: This document does not conform to the Adobe Document "
+          "Structuring Conventions and may not print correctly!\n"), stderr);
 
  /*
   * Then write a standard DSC comment section...
@@ -1211,13 +1217,13 @@ copy_page(cups_file_t  *fp,             /* I - File to read from */
 
   if (!parse_text(line + 7, &ptr, label, sizeof(label)))
   {
-    fputs("ERROR: Bad %%Page: comment in file!\n", stderr);
+    fputs(_("ERROR: Bad %%Page: comment in file!\n"), stderr);
     label[0] = '\0';
     number   = doc->page;
   }
   else if (strtol(ptr, &ptr, 10) == LONG_MAX || !isspace(*ptr & 255))
   {
-    fputs("ERROR: Bad %%Page: comment in file!\n", stderr);
+    fputs(_("ERROR: Bad %%Page: comment in file!\n"), stderr);
     number = doc->page;
   }
 
@@ -1245,7 +1251,9 @@ copy_page(cups_file_t  *fp,               /* I - File to read from */
       pageinfo->num_options = cupsAddOption("InputSlot", doc->ap_input_slot,
                                             pageinfo->num_options,
                                            &(pageinfo->options));
-      pageinfo->num_options = cupsAddOption("ManualFeed", doc->ap_manual_feed,
+      pageinfo->num_options = cupsAddOption("ManualFeed",
+                                            doc->ap_input_slot ? "False" :
+                                               doc->ap_manual_feed,
                                             pageinfo->num_options,
                                            &(pageinfo->options));
     }
@@ -1258,7 +1266,9 @@ copy_page(cups_file_t  *fp,               /* I - File to read from */
       pageinfo->num_options = cupsAddOption("InputSlot", doc->input_slot,
                                             pageinfo->num_options,
                                            &(pageinfo->options));
-      pageinfo->num_options = cupsAddOption("ManualFeed", doc->manual_feed,
+      pageinfo->num_options = cupsAddOption("ManualFeed",
+                                            doc->input_slot ? "False" :
+                                               doc->manual_feed,
                                             pageinfo->num_options,
                                            &(pageinfo->options));
     }
@@ -1283,7 +1293,7 @@ copy_page(cups_file_t  *fp,               /* I - File to read from */
                  bounding_box + 1, bounding_box + 2,
                 bounding_box + 3) != 4)
       {
-        fputs("ERROR: Bad %%PageBoundingBox: comment in file!\n", stderr);
+        fputs(_("ERROR: Bad %%PageBoundingBox: comment in file!\n"), stderr);
         memcpy(bounding_box, doc->bounding_box,
               sizeof(bounding_box));
       }
@@ -1689,7 +1699,7 @@ copy_prolog(cups_file_t  *fp,             /* I - File to read from */
     if (!strncmp(line, "%%EndProlog", 11))
       linelen = cupsFileGetLine(fp, line, linesize);
     else
-      fputs("ERROR: Missing %%EndProlog!\n", stderr);
+      fputs(_("ERROR: Missing %%EndProlog!\n"), stderr);
   }
 
   doc_puts(doc, "%%EndProlog\n");
@@ -1754,7 +1764,7 @@ copy_setup(cups_file_t  *fp,              /* I - File to read from */
     if (!strncmp(line, "%%EndSetup", 10))
       linelen = cupsFileGetLine(fp, line, linesize);
     else
-      fputs("ERROR: Missing %%EndSetup!\n", stderr);
+      fputs(_("ERROR: Missing %%EndSetup!\n"), stderr);
   }
 
   doc_puts(doc, "%%EndSetup\n");
@@ -1993,7 +2003,7 @@ doc_printf(pstops_doc_t *doc,             /* I - Document information */
   if (bytes > sizeof(buffer))
   {
     fprintf(stderr,
-            "ERROR: doc_printf overflow (%d bytes) detected, aborting!\n",
+            _("ERROR: doc_printf overflow (%d bytes) detected, aborting!\n"),
             (int)bytes);
     exit(1);
   }
@@ -2124,7 +2134,7 @@ include_feature(
 
   if (sscanf(line + 17, "%254s%254s", name, value) != 2)
   {
-    fputs("ERROR: Bad %%IncludeFeature: comment!\n", stderr);
+    fputs(_("ERROR: Bad %%IncludeFeature: comment!\n"), stderr);
     return (num_options);
   }
 
@@ -2134,21 +2144,21 @@ include_feature(
 
   if ((option = ppdFindOption(ppd, name + 1)) == NULL)
   {
-    fprintf(stderr, "WARNING: Unknown option \"%s\"!\n", name + 1);
+    fprintf(stderr, _("WARNING: Unknown option \"%s\"!\n"), name + 1);
     return (num_options);
   }
 
   if (option->section == PPD_ORDER_EXIT ||
       option->section == PPD_ORDER_JCL)
   {
-    fprintf(stderr, "WARNING: Option \"%s\" cannot be included via "
-                    "IncludeFeature!\n", name + 1);
+    fprintf(stderr, _("WARNING: Option \"%s\" cannot be included via "
+                      "IncludeFeature!\n"), name + 1);
     return (num_options);
   }
 
   if ((choice = ppdFindChoice(option, value)) == NULL)
   {
-    fprintf(stderr, "WARNING: Unknown choice \"%s\" for option \"%s\"!\n",
+    fprintf(stderr, _("WARNING: Unknown choice \"%s\" for option \"%s\"!\n"),
             value, name + 1);
     return (num_options);
   }
@@ -2321,8 +2331,8 @@ set_pstops_options(
 
     if (intval < 10 || intval > 1000)
     {
-      fprintf(stderr, "ERROR: Unsupported brightness value %s, using "
-                      "brightness=100!\n", val);
+      fprintf(stderr, _("ERROR: Unsupported brightness value %s, using "
+                        "brightness=100!\n"), val);
       doc->brightness = 1.0f;
     }
     else
@@ -2388,8 +2398,8 @@ set_pstops_options(
 
     if (intval < 1 || intval > 10000)
     {
-      fprintf(stderr, "ERROR: Unsupported gamma value %s, using "
-                      "gamma=1000!\n", val);
+      fprintf(stderr, _("ERROR: Unsupported gamma value %s, using "
+                        "gamma=1000!\n"), val);
       doc->gamma = 1.0f;
     }
     else
@@ -2435,8 +2445,8 @@ set_pstops_options(
          break;
       default :
           fprintf(stderr,
-                 "ERROR: Unsupported number-up value %d, using number-up=1!\n",
-                 intval);
+                 _("ERROR: Unsupported number-up value %d, using "
+                   "number-up=1!\n"), intval);
           doc->number_up = 1;
          break;
     }
@@ -2468,8 +2478,8 @@ set_pstops_options(
       doc->number_up_layout = PSTOPS_LAYOUT_BTRL;
     else
     {
-      fprintf(stderr, "ERROR: Unsupported number-up-layout value %s, using "
-                      "number-up-layout=lrtb!\n", val);
+      fprintf(stderr, _("ERROR: Unsupported number-up-layout value %s, using "
+                        "number-up-layout=lrtb!\n"), val);
       doc->number_up_layout = PSTOPS_LAYOUT_LRTB;
     }
   }
@@ -2518,8 +2528,8 @@ set_pstops_options(
       doc->page_border = PSTOPS_BORDERDOUBLE2;
     else
     {
-      fprintf(stderr, "ERROR: Unsupported page-border value %s, using "
-                      "page-border=none!\n", val);
+      fprintf(stderr, _("ERROR: Unsupported page-border value %s, using "
+                        "page-border=none!\n"), val);
       doc->page_border = PSTOPS_BORDERNONE;
     }
   }
@@ -2613,7 +2623,7 @@ set_pstops_options(
     if ((doc->temp = cupsTempFile2(doc->tempfile,
                                    sizeof(doc->tempfile))) == NULL)
     {
-      fprintf(stderr, "ERROR: Unable to create temporary file: %s\n",
+      fprintf(stderr, _("ERROR: Unable to create temporary file: %s\n"),
               strerror(errno));
       exit(1);
     }
@@ -3288,5 +3298,5 @@ write_labels(pstops_doc_t *doc,           /* I - Document information */
 
 
 /*
- * End of "$Id: pstops.c 6391 2007-03-24 14:35:56Z mike $".
+ * End of "$Id: pstops.c 6420 2007-03-30 20:00:59Z mike $".
  */