summaryrefslogtreecommitdiff
path: root/src/devices/gropdf/pdfmom.pl
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/gropdf/pdfmom.pl')
-rw-r--r--src/devices/gropdf/pdfmom.pl34
1 files changed, 29 insertions, 5 deletions
diff --git a/src/devices/gropdf/pdfmom.pl b/src/devices/gropdf/pdfmom.pl
index 89977d496..3a410d8ad 100644
--- a/src/devices/gropdf/pdfmom.pl
+++ b/src/devices/gropdf/pdfmom.pl
@@ -1,6 +1,6 @@
#!@PERL@
#
-# pdfmom : Frontend to run groff -mom to produce PDFs
+# pdfmom : Frontend to run groff to produce PDFs
# Deri James : Friday 16 Mar 2012
#
@@ -29,6 +29,19 @@ my @cmd;
my $dev='pdf';
my $preconv='';
my $readstdin=1;
+my $mom='-mom';
+if ($0=~m/pdf(\w+)$/)
+{
+ my $m=$1;
+ if ($m=~m/^(mom|mm|ms|me|man|mandoc)$/)
+ {
+ $mom="-".$m;
+ }
+ else
+ {
+ $mom='';
+ }
+}
my $RT_SEP='@RT_SEP@';
$ENV{PATH}=$ENV{GROFF_BIN_PATH}.$RT_SEP.$ENV{PATH} if exists($ENV{GROFF_BIN_PATH});
@@ -73,6 +86,10 @@ while (my $c=shift)
$dev=$c;
next;
}
+ elsif ($c eq '-roff' or $c eq '--roff')
+ {
+ $mom='';
+ }
elsif ($c eq '-v' or $c eq '--version')
{
print "GNU pdfmom (groff) version @VERSION@\n";
@@ -123,19 +140,26 @@ if ($readstdin)
if ($dev eq 'pdf')
{
- system("groff -Tpdf -dLABEL.REFS=1 -mom -z $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | groff -Tpdf -dPDF.EXPORT=1 -dLABEL.REFS=1 -mom -z - $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | groff -Tpdf -mom $preconv - $cmdstring");
+ if ($mom)
+ {
+ system("groff -Tpdf -dLABEL.REFS=1 $mom -z $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | groff -Tpdf -dPDF.EXPORT=1 -dLABEL.REFS=1 $mom -z - $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | groff -Tpdf $mom $preconv - $cmdstring");
+ }
+ else
+ {
+ system("groff -Tpdf -dPDF.EXPORT=1 -z $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | groff -Tpdf $preconv - $cmdstring");
+ }
}
elsif ($dev eq 'ps')
{
- system("groff -Tpdf -dLABEL.REFS=1 -mom -z $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | pdfroff -mpdfmark -mom --no-toc - $preconv $cmdstring");
+ system("groff -Tpdf -dLABEL.REFS=1 $mom -z $cmdstring 2>&1 | LC_ALL=C grep '^\\. *ds' | pdfroff -mpdfmark $mom --no-toc - $preconv $cmdstring");
}
elsif ($dev eq '-z') # pseudo dev - just compile for warnings
{
- system("groff -Tpdf -mom -z $cmdstring");
+ system("groff -Tpdf $mom -z $cmdstring");
}
elsif ($dev eq '-Z') # pseudo dev - produce troff output
{
- system("groff -Tpdf -mom -Z $cmdstring");
+ system("groff -Tpdf $mom -Z $cmdstring");
}
else
{