scanimage: support $SANE_DEFAULT_DEVICE (patch)

Ingo Wilken (Ingo.Wilken@Informatik.Uni-Oldenburg.DE)
Wed, 23 Jun 1999 17:03:08 +0200 (MET DST)

This patch adds support for an environment-variable SANE_DEFAULT_DEVICE
to scanimage (SANE 1.0.1). Quite useful if you have several SANE devices
available and the first on the list is not your preferred device.

Regards,
Ingo

*** doc/scanimage.man.orig Wed Jun 23 16:13:42 1999
--- doc/scanimage.man Wed Jun 23 16:28:31 1999
***************
*** 38,43 ****
--- 38,46 ----
.B --list-devices
option (see below). If no device-name is specified explicitly,
.B scanimage
+ takes it from the environment-variable SANE_DEFAULT_DEVICE.
+ If this does not exist,
+ .B scanimage
will attempt to open the first available device.
.PP
The
***************
*** 227,232 ****
--- 230,240 ----
filename
.BR /tmp/input.ppm .
.RE
+
+ .SH ENVIRONMENT
+ .TP
+ .I SANE_DEFAULT_DEVICE
+ The default device name.

.SH FILES
.TP
*** frontend/scanimage.c.orig Wed Jun 23 16:00:25 1999
--- frontend/scanimage.c Wed Jun 23 16:29:33 1999
***************
*** 1125,1133 ****

if (!devname)
{
! /* If no device name was specified explicitly, we open the first
! device we find (if any): */
!
status = sane_get_devices (&device_list, SANE_FALSE);
if (status != SANE_STATUS_GOOD)
{
--- 1125,1136 ----

if (!devname)
{
! /* If no device name was specified explicitly, we use
! $SANE_DEFAULT_DEVICE. If it does not exist, we open
! the first device we find (if any): */
! devname = getenv("SANE_DEFAULT_DEVICE");
! if (!devname )
! {
status = sane_get_devices (&device_list, SANE_FALSE);
if (status != SANE_STATUS_GOOD)
{
***************
*** 1141,1146 ****
--- 1144,1150 ----
exit (1);
}
devname = device_list[0]->name;
+ }
}

status = sane_open (devname, &device);

--
Source code, list archive, and docs: http://www.mostang.com/sane/
To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com