View | Details | Raw Unified
Collapse All | Expand All

(-) jpeg2ps-1.9-orig/jpeg2ps.c (+43 lines)
 Lines 32-37    Link Here 
#include <unistd.h>
#include <unistd.h>
#endif
#endif
#ifdef HAVE_LIBPAPER
#include <math.h>
#include <paper.h>
#endif
#ifndef MAC
#ifndef MAC
extern char *optarg;
extern char *optarg;
extern int optind;
extern int optind;
 Lines 73-78    Link Here 
static char buffer[BUFFERSIZE];
static char buffer[BUFFERSIZE];
static char *ColorSpaceNames[] = {"", "Gray", "", "RGB", "CMYK" };
static char *ColorSpaceNames[] = {"", "Gray", "", "RGB", "CMYK" };
#ifndef HAVE_LIBPAPER
/* Array of known page sizes including name, width, and height */
/* Array of known page sizes including name, width, and height */
typedef struct { const char *name; int width; int height; } PageSize_s;
typedef struct { const char *name; int width; int height; } PageSize_s;
 Lines 96-101    Link Here 
};
};
#define PAGESIZELIST	(sizeof(PageSizes)/sizeof(PageSizes[0]))
#define PAGESIZELIST	(sizeof(PageSizes)/sizeof(PageSizes[0]))
#endif
#ifdef A4
#ifdef A4
int PageWidth  = 595;           /* page width A4 */
int PageWidth  = 595;           /* page width A4 */
 Lines 294-301    Link Here 
  fprintf(stderr, "-b        binary mode: output 8 bit data (default: 7 bit with ASCII85)\n");
  fprintf(stderr, "-b        binary mode: output 8 bit data (default: 7 bit with ASCII85)\n");
  fprintf(stderr, "-h        hex mode: output 7 bit data in ASCIIHex encoding\n");
  fprintf(stderr, "-h        hex mode: output 7 bit data in ASCIIHex encoding\n");
  fprintf(stderr, "-o <name> output file name\n");
  fprintf(stderr, "-o <name> output file name\n");
#ifdef HAVE_LIBPAPER
  fprintf(stderr, "-p <size> page size name. See \"paperconf -a\" for a list of known names\n");
#else
  fprintf(stderr, "-p <size> page size name. Known names are:\n");
  fprintf(stderr, "-p <size> page size name. Known names are:\n");
  fprintf(stderr, "          a0, a1, a2, a3, a4, a5, a6, b5, letter, legal, ledger, p11x17\n");
  fprintf(stderr, "          a0, a1, a2, a3, a4, a5, a6, b5, letter, legal, ledger, p11x17\n");
#endif
  fprintf(stderr, "-q        quiet mode: suppress all informational messages\n");
  fprintf(stderr, "-q        quiet mode: suppress all informational messages\n");
  fprintf(stderr, "-r <dpi>  resolution value (dots per inch)\n");
  fprintf(stderr, "-r <dpi>  resolution value (dots per inch)\n");
  fprintf(stderr, "          0 means use value given in file, if any (disables autorotate)\n");
  fprintf(stderr, "          0 means use value given in file, if any (disables autorotate)\n");
 Lines 314-319    Link Here 
  int opt, pagesizeindex = -1;
  int opt, pagesizeindex = -1;
#endif
#endif
#ifdef HAVE_LIBPAPER
  const struct paper *pinfo_default, *pinfo = NULL;
#endif
  image.filename = NULL;
  image.filename = NULL;
  image.mode     = ASCII85;
  image.mode     = ASCII85;
  image.startpos = 0L;
  image.startpos = 0L;
 Lines 326-331    Link Here 
 if (argc == 1)
 if (argc == 1)
    usage();
    usage();
#ifdef HAVE_LIBPAPER
  /* get default paper size from libpaper */
  paperinit();
  if ((pinfo_default = paperinfo(systempapername()))) {
    PageWidth = rint(paperpswidth(pinfo_default));
    PageHeight = rint(paperpsheight(pinfo_default));
  }
#endif
#ifndef MAC
#ifndef MAC
  while ((opt = getopt(argc, argv, "abho:p:qr:")) != -1)
  while ((opt = getopt(argc, argv, "abho:p:qr:")) != -1)
    switch (opt) {
    switch (opt) {
 Lines 346-351    Link Here 
	  } 
	  } 
	  break;
	  break;
      case 'p':
      case 'p':
#ifdef HAVE_LIBPAPER
	  for (pinfo = paperfirst(); pinfo; pinfo = papernext(pinfo))
	    if (!strcmp((const char *)optarg, papername(pinfo))) {
	      PageWidth = rint(paperpswidth(pinfo));
	      PageHeight = rint(paperpsheight(pinfo));
	      break;
	    }
	  if (!pinfo) {		/* page size name not found */
	    fprintf(stderr, "Error: Unknown page size %s.\n", optarg);
	    exit(-3);
	  }
#else
	  for(pagesizeindex=0; pagesizeindex < PAGESIZELIST; pagesizeindex++)
	  for(pagesizeindex=0; pagesizeindex < PAGESIZELIST; pagesizeindex++)
	    if (!strcmp((const char *) optarg, PageSizes[pagesizeindex].name)) {
	    if (!strcmp((const char *) optarg, PageSizes[pagesizeindex].name)) {
		PageHeight = PageSizes[pagesizeindex].height;
		PageHeight = PageSizes[pagesizeindex].height;
 Lines 356-361    Link Here 
		fprintf(stderr, "Error: Unknown page size %s.\n", optarg);
		fprintf(stderr, "Error: Unknown page size %s.\n", optarg);
		exit(-3);
		exit(-3);
	  }
	  }
#endif
	  break;
	  break;
      case 'q':
      case 'q':
          quiet = TRUE;
          quiet = TRUE;
 Lines 371-379    Link Here 
	  usage();
	  usage();
    }
    }
#ifdef HAVE_LIBPAPER
  if (pinfo && !quiet)		/* page size user option given */
    fprintf(stderr, "Note: Using %s page size.\n", papername(pinfo));
  paperdone();
#else
  if (pagesizeindex != -1 && ! quiet)	/* page size user option given */
  if (pagesizeindex != -1 && ! quiet)	/* page size user option given */
      fprintf(stderr, "Note: Using %s page size.\n",
      fprintf(stderr, "Note: Using %s page size.\n",
		    PageSizes[pagesizeindex].name);
		    PageSizes[pagesizeindex].name);
#endif
  if (optind == argc)	/* filename missing */
  if (optind == argc)	/* filename missing */
    usage();
    usage();