]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - systemv/cupstestdsc.c
Fix .PHONY declaration
[thirdparty/cups.git] / systemv / cupstestdsc.c
index e2267c2ade0df6306abda3c3c3026bdf09330f3c..84c4e987ebcd070845c0bb2d0d77f153bef70ebe 100644 (file)
@@ -1,38 +1,25 @@
 /*
- * "$Id: cupstestdsc.c 6649 2007-07-11 21:46:42Z mike $"
+ * DSC test program for CUPS.
  *
- *   DSC test program for the Common UNIX Printing System (CUPS).
+ * Copyright 2007-2010 by Apple Inc.
+ * Copyright 2006 by Easy Software Products, all rights reserved.
  *
- *   Copyright 2007-2008 by Apple Inc.
- *   Copyright 2006 by Easy Software Products, all rights reserved.
+ * These coded instructions, statements, and computer programs are the
+ * property of Apple Inc. and are protected by Federal copyright
+ * law.  Distribution and use rights are outlined in the file "LICENSE.txt"
+ * which should have been included with this file.  If this file is
+ * missing or damaged, see the license at "http://www.cups.org/".
  *
- *   These coded instructions, statements, and computer programs are the
- *   property of Apple Inc. and are protected by Federal copyright
- *   law.  Distribution and use rights are outlined in the file "LICENSE.txt"
- *   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/".
+ * PostScript is a trademark of Adobe Systems, Inc.
  *
- *   PostScript is a trademark of Adobe Systems, Inc.
- *
- *   This file is subject to the Apple OS-Developed Software exception.
- *
- * Contents:
- *
- *   main()  - Main entry for test program.
- *   check() - Check a file for conformance.
- *   usage() - Show program usage.
+ * This file is subject to the Apple OS-Developed Software exception.
  */
 
 /*
  * Include necessary headers...
  */
 
-#include <cups/string.h>
-#include <cups/cups.h>
-#include <cups/file.h>
-#include <cups/i18n.h>
-#include <errno.h>
-#include <stdlib.h>
+#include <cups/cups-private.h>
 
 
 /*
@@ -40,7 +27,7 @@
  */
 
 static int     check_file(const char *filename);
-static void    usage(void);
+static void    usage(void) __attribute__((noreturn));
 
 
 /*
@@ -161,7 +148,8 @@ check_file(const char *filename)    /* I - File to read from */
   status           = 0;
   version          = 0.0f;
 
-  _cupsLangPrintf(stdout, "%s: ", filename);
+  /* TODO: Fixme */
+  printf("%s: ", filename);
   fflush(stdout);
 
   while ((bytes = cupsFileGetLine(fp, line, sizeof(line))) > 0)
@@ -173,12 +161,12 @@ check_file(const char *filename)  /* I - File to read from */
       if (!saw_long_line)
       {
        if (!status)
-          _cupsLangPuts(stdout, _("FAIL\n"));
+          _cupsLangPuts(stdout, _("FAIL"));
 
        status ++;
        _cupsLangPrintf(stdout,
-                       _("    Line %d is longer than 255 characters (%d)!\n"
-                         "        REF: Page 25, Line Length\n"),
+                       _("    Line %d is longer than 255 characters (%d).\n"
+                         "        REF: Page 25, Line Length"),
                        linenum, (int)bytes);
       }
 
@@ -190,16 +178,16 @@ check_file(const char *filename)  /* I - File to read from */
       if (strncmp(line, "%!PS-Adobe-", 11))
       {
        if (!status)
-          _cupsLangPuts(stdout, _("FAIL\n"));
+          _cupsLangPuts(stdout, _("FAIL"));
 
        _cupsLangPuts(stdout,
-                     _("    Missing %!PS-Adobe-3.0 on first line!\n"
-                       "        REF: Page 17, 3.1 Conforming Documents\n"));
+                     _("    Missing %!PS-Adobe-3.0 on first line.\n"
+                       "        REF: Page 17, 3.1 Conforming Documents"));
        cupsFileClose(fp);
        return (1);
       }
       else
-        version = atof(line + 11);
+        version = (float)atof(line + 11);
     }
     else if (level > 0)
     {
@@ -215,12 +203,12 @@ check_file(const char *filename)  /* I - File to read from */
         if (atoi(line + 8) <= 0)
        {
          if (!status)
-            _cupsLangPuts(stdout, _("FAIL\n"));
+            _cupsLangPuts(stdout, _("FAIL"));
 
          status ++;
          _cupsLangPrintf(stdout,
-                         _("    Bad %%%%Pages: on line %d!\n"
-                           "        REF: Page 43, %%%%Pages:\n"),
+                         _("    Bad %%%%Pages: on line %d.\n"
+                           "        REF: Page 43, %%%%Pages:"),
                          linenum);
        }
        else
@@ -232,11 +220,11 @@ check_file(const char *filename)  /* I - File to read from */
                   lbrt + 3) != 4)
         {
          if (!status)
-            _cupsLangPuts(stdout, _("FAIL\n"));
+            _cupsLangPuts(stdout, _("FAIL"));
 
          status ++;
-         _cupsLangPrintf(stdout, _("    Bad %%%%BoundingBox: on line %d!\n"
-                                   "        REF: Page 39, %%%%BoundingBox:\n"),
+         _cupsLangPrintf(stdout, _("    Bad %%%%BoundingBox: on line %d.\n"
+                                   "        REF: Page 39, %%%%BoundingBox:"),
                          linenum);
        }
        else
@@ -256,11 +244,11 @@ check_file(const char *filename)  /* I - File to read from */
        else if (atoi(line + 8) <= 0)
        {
          if (!status)
-            _cupsLangPuts(stdout, _("FAIL\n"));
+            _cupsLangPuts(stdout, _("FAIL"));
 
          status ++;
-         _cupsLangPrintf(stdout, _("    Bad %%%%Pages: on line %d!\n"
-                                   "        REF: Page 43, %%%%Pages:\n"),
+         _cupsLangPrintf(stdout, _("    Bad %%%%Pages: on line %d.\n"
+                                   "        REF: Page 43, %%%%Pages:"),
                          linenum);
        }
        else
@@ -274,11 +262,11 @@ check_file(const char *filename)  /* I - File to read from */
                        lbrt + 3) != 4)
         {
          if (!status)
-            _cupsLangPuts(stdout, _("FAIL\n"));
+            _cupsLangPuts(stdout, _("FAIL"));
 
          status ++;
-         _cupsLangPrintf(stdout, _("    Bad %%%%BoundingBox: on line %d!\n"
-                                   "        REF: Page 39, %%%%BoundingBox:\n"),
+         _cupsLangPrintf(stdout, _("    Bad %%%%BoundingBox: on line %d.\n"
+                                   "        REF: Page 39, %%%%BoundingBox:"),
                          linenum);
        }
        else
@@ -303,11 +291,11 @@ check_file(const char *filename)  /* I - File to read from */
            page_number != (last_page_number + 1) || page_number < 1)
        {
          if (!status)
-            _cupsLangPuts(stdout, _("FAIL\n"));
+            _cupsLangPuts(stdout, _("FAIL"));
 
          status ++;
-         _cupsLangPrintf(stdout, _("    Bad %%%%Page: on line %d!\n"
-                                   "        REF: Page 53, %%%%Page:\n"),
+         _cupsLangPrintf(stdout, _("    Bad %%%%Page: on line %d.\n"
+                                   "        REF: Page 53, %%%%Page:"),
                          linenum);
        }
        else
@@ -328,7 +316,7 @@ check_file(const char *filename)    /* I - File to read from */
         saw_trailer = 1;
     }
 
-    for (i = 0; !binary && i < bytes; i ++)
+    for (i = 0; !binary && i < (int)bytes; i ++)
     {
       ch = line[i];
 
@@ -340,78 +328,78 @@ check_file(const char *filename)  /* I - File to read from */
   if (saw_bounding_box <= 0)
   {
     if (!status)
-      _cupsLangPuts(stdout, _("FAIL\n"));
+      _cupsLangPuts(stdout, _("FAIL"));
 
     status ++;
-    _cupsLangPuts(stdout, _("    Missing or bad %%BoundingBox: comment!\n"
-                           "        REF: Page 39, %%BoundingBox:\n"));
+    _cupsLangPuts(stdout, _("    Missing or bad %%BoundingBox: comment.\n"
+                           "        REF: Page 39, %%BoundingBox:"));
   }
 
   if (saw_pages <= 0)
   {
     if (!status)
-      _cupsLangPuts(stdout, _("FAIL\n"));
+      _cupsLangPuts(stdout, _("FAIL"));
 
     status ++;
-    _cupsLangPuts(stdout, _("    Missing or bad %%Pages: comment!\n"
-                           "        REF: Page 43, %%Pages:\n"));
+    _cupsLangPuts(stdout, _("    Missing or bad %%Pages: comment.\n"
+                           "        REF: Page 43, %%Pages:"));
   }
 
   if (!saw_end_comments)
   {
     if (!status)
-      _cupsLangPuts(stdout, _("FAIL\n"));
+      _cupsLangPuts(stdout, _("FAIL"));
 
     status ++;
-    _cupsLangPuts(stdout, _("    Missing %%EndComments comment!\n"
-                           "        REF: Page 41, %%EndComments\n"));
+    _cupsLangPuts(stdout, _("    Missing %%EndComments comment."
+                           "        REF: Page 41, %%EndComments"));
   }
 
   if (!saw_page)
   {
     if (!status)
-      _cupsLangPuts(stdout, _("FAIL\n"));
+      _cupsLangPuts(stdout, _("FAIL"));
 
     status ++;
-    _cupsLangPuts(stdout, _("    Missing or bad %%Page: comments!\n"
-                           "        REF: Page 53, %%Page:\n"));
+    _cupsLangPuts(stdout, _("    Missing or bad %%Page: comments.\n"
+                           "        REF: Page 53, %%Page:"));
   }
 
   if (level < 0)
   {
     if (!status)
-      _cupsLangPuts(stdout, _("FAIL\n"));
+      _cupsLangPuts(stdout, _("FAIL"));
 
     status ++;
-    _cupsLangPuts(stdout, _("    Too many %%EndDocument comments!\n"));
+    _cupsLangPuts(stdout, _("    Too many %%EndDocument comments."));
   }
   else if (level > 0)
   {
     if (!status)
-      _cupsLangPuts(stdout, _("FAIL\n"));
+      _cupsLangPuts(stdout, _("FAIL"));
 
     status ++;
-    _cupsLangPuts(stdout, _("    Too many %%BeginDocument comments!\n"));
+    _cupsLangPuts(stdout, _("    Too many %%BeginDocument comments."));
   }
 
   if (saw_long_line > 1)
     _cupsLangPrintf(stderr,
-                    _("    Saw %d lines that exceeded 255 characters!\n"),
+                    _("    Saw %d lines that exceeded 255 characters."),
                     saw_long_line);
 
   if (!status)
-    _cupsLangPuts(stdout, _("PASS\n"));
+    _cupsLangPuts(stdout, _("PASS"));
 
   if (binary)
-    _cupsLangPuts(stdout, _("    Warning: file contains binary data!\n"));
+    _cupsLangPuts(stdout, _("    Warning: file contains binary data."));
 
   if (version < 3.0f)
     _cupsLangPrintf(stdout,
-                    _("    Warning: obsolete DSC version %.1f in file!\n"),
+                    _("    Warning: obsolete DSC version %.1f in file."),
                    version);
 
   if (saw_end_comments < 0)
-    _cupsLangPuts(stdout, _("    Warning: no %%EndComments comment in file!\n"));
+    _cupsLangPuts(stdout, _("    Warning: no %%EndComments comment in file."));
 
   cupsFileClose(fp);
 
@@ -426,21 +414,16 @@ check_file(const char *filename)  /* I - File to read from */
 static void
 usage(void)
 {
-  _cupsLangPuts(stdout,
-                _("Usage: cupstestdsc [options] filename.ps [... filename.ps]\n"
-                  "       cupstestdsc [options] -\n"
-                 "\n"
-                 "Options:\n"
-                 "\n"
-                 "    -h       Show program usage\n"
-                 "\n"
-                 "    Note: this program only validates the DSC comments, "
-                 "not the PostScript itself.\n"));
-  
+  _cupsLangPuts(stdout, _("Usage: cupstestdsc [options] filename.ps [... "
+                          "filename.ps]"));
+  _cupsLangPuts(stdout, _("       cupstestdsc [options] -"));
+  _cupsLangPuts(stdout, "");
+  _cupsLangPuts(stdout, _("Options:"));
+  _cupsLangPuts(stdout, "");
+  _cupsLangPuts(stdout, _("    -h       Show program usage"));
+  _cupsLangPuts(stdout, "");
+  _cupsLangPuts(stdout, _("Note: this program only validates the DSC comments, "
+                         "not the PostScript itself."));
+
   exit(1);
 }
-
-
-/*
- * End of "$Id: cupstestdsc.c 6649 2007-07-11 21:46:42Z mike $".
- */