This file is indexed.

/usr/bin/foomatic-ppd-options is in foomatic-db-engine 4.0.12-2+b1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#!/usr/bin/perl -w
use strict;

# This is foomatic-ppd-options, a program which will print out the
# options specified by a PPD file.
#
# foomatic-ppd-options [file*]
#  reads one or more PPD files from the specified file or
#  standard input.  If present, PPD information is separated by
#  lines starting with Printer: .  This makes it compatible with
#  the LPRng 'lpc ppd' command:
#    lpc ppd | foomatic-ppd-options

use Foomatic::Defaults;
use Foomatic::DB;
use Data::Dumper;
use FileHandle;

$0 =~ m!/([^/]+)\s*$!;
my $progname = ($1 || $0);

sub help {
    print STDERR <<EOF;
$progname [-d=debuglevel][files]
  reads one or more PPD files from the specified file or
  standard input.  If present, PPD information is separated by
  lines starting with Printer: .  This makes it compatible with
  the LPRng 'lpc ppd' command:
    lpc ppd | foomatic-ppd-options
  
 -h            - printes help message
 -d debuglevel - sets debugging level (0 is 0ff)
EOF
    exit 1;
}
# Read out the program name with which we were called, but discard the path

my $debug = 0;

# We use the library Getopt::Long here, so that we can have more than
# one "-o" option on one command line.

my( $opt_h, $opt_d );

use Getopt::Long;
Getopt::Long::Configure("no_ignore_case");
GetOptions(
	   "d=i"   => \$opt_d,         # Help!
	   "h"   => \$opt_h,         # Help!
	   "help"=> \$opt_h) || help();

help() if $opt_h;
$debug = $opt_d if $opt_d;

sub getppdinfo( $ $ );
if( @ARGV ){
	while( @ARGV ){
		my $file = shift @ARGV;
		print STDERR "file $file\n" if $debug;
		my $fd = new FileHandle "<$file";
		if( not $fd ){
			die( "$progname: cannot open '$file' - $!\n" );
			next;
		}
		getppdinfo($fd, $file);
		close($fd);
	}
} else {
	getppdinfo( \*STDIN, "STDIN" );
}

exit 0;

my $key;
sub order_by_key{$a->{$key} cmp $b->{$key}};

sub getppdinfo( $ $ ){
	my( $fd, $name ) = @_;
	my @ppd = <$fd>;
	close( $fd );
	print "PPD $name= " . Dumper(\@ppd) if $debug > 1;
	my ($printer);
	$printer = shift @ppd if $ppd[0] =~ /^Printer:/;
	print "$printer\n" if $printer;
	my $ppd = ppdfromvartoperl( \@ppd );
	if( not defined $ppd ){
		die "$progname: bad ppdfile $name\n";
	}
	print STDERR "PPD DB " . Dumper( $ppd ) if $debug;
	my $makemodel = ($ppd->{'makemodel'} or "");
	print "makemodel = $makemodel\n";
	my $args = $ppd->{'args'};
	print STDERR "PPD ARGS " . Dumper( $args ) if $debug;
	for my $argname ( @{$args} ) {
		my $name = $argname->{'name'};
		my $language = "postscript";
		if( $name =~ /^JCL(.*)$/ ){
			$argname->{'name'} = $1;
			$language = "pjl";
		}
		$argname->{'language'} = $language;
	}
	$key = 'name';
	for my $argname ( sort order_by_key @{$args} ) {
		my $name = $argname->{'name'};
		my $comment = ($argname->{'comment'} or "");
		my $type = ($argname->{'type'} or "");
		my $vals = ($argname->{'vals'} or []);
		my $default = ($argname->{'default'} or "");
		my $language = ($argname->{'language'} or "postscript");
		print STDERR "PPD ARG " . $name . "\n" if $debug;
		print STDERR "PPD VALUES " . Dumper( $vals ) . "\n" if $debug;
		my $values = "name=$name";
		$values .= "($comment)" if( $comment );
		$values .= ";";
		$values .= " language=$language;";
		$values .= " type=$type;" if( $type );
		$values .= " default=$default;" if( $default );
		$values .= " options=";
		if( not @{$vals} ){
			if( $type eq "bool" ){
				$values .= "True (True), False (False)";
			}
		} else {
			$key = 'value';
			for my $v ( sort order_by_key @{$vals} ){
				my $value = $v->{'value'};
				my $comment = ($v->{'comment'} or "");
				my $driverval = ($v->{'driverval'} or "");
				$driverval =~ s/[\s\n]+/ /gm;
				$driverval =~ s/^ //gm;
				$driverval =~ s/ $//gm;
				$driverval =~ s/[\W]/\\$&/gm;
				$driverval =~ s/\\ / /gm;
				$comment =~ s/[\W]/\\$&/g;
				$comment =~ s/\\ / /gm;
				$values .= "$value";
				$values .= " ($comment)" if( $comment );
				$values .= " [$driverval]" if( $driverval );
				$values .= ", ";
			}
			$values =~ s/, $/;/;
		}
		print $values . "\n";
	}
}