texlive[43367] Build/source/texk/dvipdfm-x: dvipdfm-x: -p option wins

commits+kakuto at tug.org commits+kakuto at tug.org
Wed Mar 1 06:01:56 CET 2017


Revision: 43367
          http://tug.org/svn/texlive?view=revision&revision=43367
Author:   kakuto
Date:     2017-03-01 06:01:56 +0100 (Wed, 01 Mar 2017)
Log Message:
-----------
dvipdfm-x: -p option wins papersize and pagesize specials, as dvips

Modified Paths:
--------------
    trunk/Build/source/texk/dvipdfm-x/ChangeLog
    trunk/Build/source/texk/dvipdfm-x/dvipdfmx.c

Modified: trunk/Build/source/texk/dvipdfm-x/ChangeLog
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/ChangeLog	2017-03-01 01:05:54 UTC (rev 43366)
+++ trunk/Build/source/texk/dvipdfm-x/ChangeLog	2017-03-01 05:01:56 UTC (rev 43367)
@@ -1,3 +1,8 @@
+2017-03-01  Akira Kakuto  <kakuto at fuk.kindai.ac.jp>
+
+	* dvipdfmx.c: Command line -p option wins papersize and pagesize
+	specials, as dvips.
+
 2017-02-17  Akira Kakuto  <kakuto at fuk.kindai.ac.jp>
 
 	* dvi.c: Add possibly forgotten braces.

Modified: trunk/Build/source/texk/dvipdfm-x/dvipdfmx.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/dvipdfmx.c	2017-03-01 01:05:54 UTC (rev 43366)
+++ trunk/Build/source/texk/dvipdfm-x/dvipdfmx.c	2017-03-01 05:01:56 UTC (rev 43367)
@@ -119,6 +119,8 @@
 static double x_offset = 72.0;
 static double y_offset = 72.0;
 int    landscape_mode  = 0;
+static int psize_optionp = 0;
+static char *psize_optarg = NULL;
 
 int always_embed = 0; /* always embed fonts, regardless of licensing flags */
 
@@ -471,6 +473,12 @@
   const char *nnextptr;
 
   optind = 1;
+  /* clear psize_optionp and psize_optarg here, since do_args()
+     is called several times */
+  psize_optionp = 0;
+  if (psize_optarg)
+    RELEASE(psize_optarg);
+  psize_optarg = NULL;
 
   while ((c = getopt_long(argc, argv, optstrig, long_options, NULL)) != -1) {
     switch(c) {
@@ -533,6 +541,14 @@
 
     case 'p':
       select_paper(optarg);
+      /* save data for later use in order to overwrite papersize and
+         pagesize specials */
+      psize_optionp = 1;
+      /* there may be multiple -p options */
+      if (psize_optarg)
+        RELEASE(psize_optarg);
+      psize_optarg = NEW(strlen(optarg) + 1, char);
+      strcpy(psize_optarg, optarg);
       break;
 
     case 'c':
@@ -1089,6 +1105,13 @@
         pdf_enc_set_passwd(key_bits, permission, owner_pw, user_pw);
       }
     }
+    /* overwrite previous papersize by that given in -p option */
+    if (psize_optionp) {
+      select_paper(psize_optarg);
+      RELEASE(psize_optarg);
+      psize_optarg = NULL;
+      psize_optionp = 0;
+    }
     if (landscape_mode) {
       SWAP(paper_width, paper_height);
     }



More information about the tex-live-commits mailing list