dvipng
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dvipng] Re: Bug#346181: dvipng distorts filenames with periods


From: Jan-Åke Larsson
Subject: [Dvipng] Re: Bug#346181: dvipng distorts filenames with periods
Date: Mon, 09 Jan 2006 09:49:03 +0100
User-agent: Mozilla Thunderbird 1.0.6 (X11/20050927)

address@hidden wrote:
> Package: dvipng
> Version: 1.5-2
> 
> The dvipng tool makes strange changes into filenames which contain
> periods.
> 
> Lets say, I have these two files to convert:
> sample.dvi
> sample3.22.dvi
> 
> The first filename causes no problems:
> $ dvipng sample
> or
> $ dvipng sample.dvi
> 
> both produce sample1.png
> 
> The second filename, however, leads to different results depending on
> whether the .dvi extension is included on the command line or not:
> 
> $ dvipng sample3.22
> 
> produces sample31.png
> while
> 
> $ dvipng sample3.22.dvi
> 
> produces sample3.221.png   
> 
> I think that both should produce sample3.221.png.
> 
> Actually I recommend that another separator, such as a dash, be placed
> in front of the "1", producing sample3.22-1.png . This would allow for
> more readable filenames for cases where the basename ends with a
> digit.

This bug is fixed as follows:
--- dvi.c~      Fri Feb  4 15:42:03 2005
+++ dvi.c       Mon Jan  9 09:25:02 2006
@@ -124,7 +124,7 @@
     }
     strcpy(dvi->outname,basename(dviname));
     tmpstring = strrchr(dvi->outname, '.');
-    if (tmpstring != NULL)
+    if (tmpstring != NULL && strcmp(tmpstring,".dvi") == 0)
       *tmpstring = '\0';
     strcat(dvi->outname, "%d.png");
   } else {

Regarding the separator between a numeric filename and page number,
tastes tend to differ as to what the separator should be. I'd recommend
using the -o switch in this case, as in

   dvipng sample3.22 -o sample3.22-%d.png

which, incidentally, bypasses the bug you reported too.

I won't rerelease on account of this bug, but no doubt something else
will turn up.

Kind regards,
Jan-Åke

-- 
Some people, when confronted with a problem, think "I know, I'll use
regular expressions." Now they have two problems.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]