Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: dmaphy/pdfmerge
base: 549d82cbee
...
head fork: dmaphy/pdfmerge
compare: 2f52741b4f
  • 5 commits
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Showing with 15 additions and 47 deletions.
  1. +1 −7 ChangeLog
  2. +14 −40 pdfmerge
View
8 ChangeLog
@@ -1,10 +1,4 @@
-2012-01-07 Dominic Hopf <dmaphy@googlemail.com>
-
- * pdfmerge: do not merge foreign documents if pdfmerge is not ran as root
-
-
2011-04-10 Michael Spahn <any0n3@fedoraproject.org>
-
* pdfmerge: Fixed bug #1. (https://github.com/dmaphy/pdfmerge/issues#issue/1)
You are able to open files from one level higher.
@@ -18,7 +12,7 @@
2011-01-28 Dominic Hopf <dmaphy@googlemail.com>
- * release.sh: compress tarball separately from creating it. This makes the
+ * release.sh: compress tarball separately from creating it. This makes the
script a bit more compatible with other systems where the tar command hasn't
a j-flag
View
54 pdfmerge
@@ -2,7 +2,6 @@
use Getopt::Long;
use Term::ANSIColor;
-use File::stat;
############################################################################
# This is pdfmerge4unix version 1.0.4
@@ -49,8 +48,15 @@ END_OF_USAGE
die $usage if ( $opt_help or $opt_h or ( scalar(@ARGV) == 0 ) or ( scalar(@ARGV) < 3 ) );
+$mergedfile = pop(@ARGV);
+if ( -e $mergedfile )
+{
+ print color("red"), "$mergedfile should not exist, it's the name of your output file!\n", color("reset");
+ exit 1;
+}
+
-$incantation = << "END_OF_INCANTATION";
+my $filecontent = << "END_OF_INCANTATION";
%!PS
/_begin_job_
{
@@ -70,62 +76,30 @@ $incantation = << "END_OF_INCANTATION";
END_OF_INCANTATION
-$mergedfile = pop(@ARGV);
-
-if ( -e $mergedfile )
-{
- print color("red"), "$mergedfile should not exist, it's the name of your output file!\n", color("reset");
- exit 1;
-}
-
-open (FILE, ">merged.ps") || die "can't open merged.ps";
-print FILE $incantation;
foreach $ARGV (@ARGV)
{
if ( ! -e $ARGV )
{
print color("red"), "Input file $ARGV does not exist\n", color("reset");
- unlink("./merged.ps");
- exit 1;
- }
-
-
- if (my $fileinfo = stat($ARGV))
- {
- if ($< != 0 && $fileinfo->uid != $<)
- {
- print color("red"), "You are not owner of file $ARGV. Will not merge this.\n", color("reset");
- unlink("./merged.ps");
- exit 1;
- }
- }
-
- else
- {
- print color("red"), "Can not stat file $ARGV. Exiting.\n", color("reset");
- unlink("./merged.ps");
exit 1;
-
}
- print FILE "\n_begin_job_\n";
- print FILE "(./$ARGV)run\n";
- print FILE "_end_job_\n";
+ $filecontent .= "\n_begin_job_\n";
+ $filecontent .= "(./$ARGV)run\n";
+ $filecontent .= "_end_job_\n";
}
-close(FILE);
-`ps2pdf -I. -I.. merged.ps $mergedfile`;
+`echo "$filecontent" | ps2pdf -P - $mergedfile`;
+
if ( $? == 0 )
{
print color("green"), "Successfully merged to $mergedfile\n", color("reset");
- unlink("./merged.ps");
exit 0;
}
else
{
print color("red"), "Merge was not successful\n", color("reset");
- print $output;
- unlink("./merged.ps");
+ unlink($mergedfile);
exit 1;
}

No commit comments for this range

Something went wrong with that request. Please try again.