<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;"># hpux-driver.pl
# Functions for webmin print and smb drivers.
# Very similar to the webmin driver, but with a different interface
# program selector

$webmin_windows_driver = 1;
$webmin_print_driver = 1;

# is_windows_driver(path)
# Returns a driver structure if some path is a windows driver
sub is_windows_driver
{
return &amp;is_webmin_windows_driver(@_);
}

# is_driver(path)
# Returns a structure containing the details of a driver
sub is_driver
{
return &amp;is_webmin_driver(@_);
}

# create_windows_driver(&amp;printer, &amp;driver)
# Creates a new windows printer driver
sub create_windows_driver
{
return &amp;create_webmin_windows_driver(@_);
}

# create_driver(&amp;printer, &amp;driver)
# Creates a new local printer driver and returns the path
sub create_driver
{
return &amp;create_webmin_driver(@_);
}

# delete_driver(name)
sub delete_driver
{
&amp;delete_webmin_driver(@_);
}

# driver_input(&amp;printer, &amp;driver)
sub driver_input
{
local ($prn, $drv) = @_;

printf "&lt;tr&gt; &lt;td&gt;&lt;input type=radio name=drv value=0 %s&gt; %s&lt;/td&gt;\n",
	$drv-&gt;{'mode'} == 0 ? "checked" : "", $text{'webmin_none'};
print "&lt;td&gt;($text{'webmin_remotemsg'})&lt;/td&gt; &lt;/tr&gt;\n";

printf "&lt;tr&gt; &lt;td&gt;&lt;input type=radio name=drv value=2 %s&gt; %s&lt;/td&gt;\n",
	$drv-&gt;{'mode'} == 2 ? "checked" : "", $text{'webmin_model'};
print "&lt;td&gt;&lt;select name=iface&gt;\n";
opendir(DIR, $config{'model_path'});
while($f = readdir(DIR)) {
	if ($f =~ /^\./) { next; }
	$path = "$config{'model_path'}/$f";
	printf "&lt;option value=\"$path\" %s&gt;$f&lt;/option&gt;\n",
		$path eq $prn{'iface'} ? "selected" : "";
	}
closedir(DIR);
print "&lt;/select&gt;&lt;/td&gt; &lt;/tr&gt;\n";

if (&amp;has_ghostscript()) {
	local $out = &amp;backquote_command("$config{'gs_path'} -help 2&gt;&amp;1", 1);
	if ($out =~ /Available devices:\n((\s+.*\n)+)/) {
		print "&lt;tr&gt; &lt;td valign=top&gt;\n";
		printf "&lt;input type=radio name=drv value=1 %s&gt;\n",
			$drv-&gt;{'mode'} == 1 ? "checked" : "";
		print "$text{'webmin_driver'}&lt;/td&gt; &lt;td valign=top&gt;";
		foreach $d (split(/\s+/, $1)) { $drvsupp{$d}++; }
		print "&lt;select name=driver size=7&gt;\n";
		foreach $d (&amp;list_webmin_drivers()) {
			if ($drvsupp{$d-&gt;[0]}) {
				printf "&lt;option %s&gt;%s&lt;/option&gt;\n",
				    $d-&gt;[1] eq $drv-&gt;{'type'} ? "selected" : "",
				    $d-&gt;[1];
				}
			}
		print "&lt;/select&gt;&amp;nbsp;&amp;nbsp;";
		print "&lt;select name=dpi size=7&gt;\n";
		printf "&lt;option value=\"\" %s&gt;Default&lt;/option&gt;\n",
			$drv-&gt;{'dpi'} ? "" : "selected";
		foreach $d (75, 100, 150, 200, 300, 600) {
			printf "&lt;option value=\"$d\" %s&gt;$d DPI&lt;/option&gt;\n",
				$drv-&gt;{'dpi'} == $d ? "selected" : "";
			}
		print "&lt;/select&gt;&lt;/td&gt; &lt;/tr&gt;\n";
		}
	else {
		print "&lt;tr&gt; &lt;td colspan=2&gt;",
		      &amp;text('webmin_edrivers', "&lt;tt&gt;$config{'gs_path'}&lt;/tt&gt;"),
		      "&lt;/td&gt; &lt;/tr&gt;\n";
		}
	}
else {
	print "&lt;tr&gt; &lt;td colspan=2&gt;",
	      &amp;text('webmin_egs', "&lt;tt&gt;$config{'gs_path'}&lt;/tt&gt;"),
	      "&lt;/td&gt; &lt;/tr&gt;\n";
	}
return undef;
}

# parse_driver()
# Parse driver selection from %in and return a driver structure
sub parse_driver
{
if ($in{'drv'} == 0) {
	return { 'mode' =&gt; 0 };
	}
elsif ($in{'drv'} == 2) {
	(-x $in{'iface'}) || &amp;error("'$in{'iface'}' does not exist");
	return { 'mode' =&gt; 2,
		 'program' =&gt; $in{'iface'} };
	}
elsif ($in{'drv'} == 1) {
	return { 'mode' =&gt; 1,
		 'type' =&gt; $in{'driver'},
		 'dpi' =&gt; $in{'dpi'} };
	}
}

1;

</pre></body></html>