*** doc/scanimage.man.orig Thu Mar 16 05:25:19 2000 --- doc/scanimage.man Thu Mar 16 05:38:45 2000 *************** *** 38,43 **** --- 38,47 ---- .B --list-devices option (see below). If no device-name is specified explicitly, .B scanimage + reads a device-name from the environment variable + .BR SANE_DEFAULT_DEVICE . + If this variable is not set, + .B scanimage will attempt to open the first available device. .PP The *************** *** 228,233 **** --- 232,241 ---- .BR /tmp/input.ppm . .RE + .SH ENVIRONMENT + .TP + .B SANE_DEFAULT_DEVICE + The default device-name. .SH FILES .TP .I @CONFIGDIR@ *** frontend/scanimage.c.orig Wed Mar 15 17:30:38 2000 --- frontend/scanimage.c Wed Mar 15 18:05:17 2000 *************** *** 1062,1067 **** --- 1062,1068 ---- const SANE_Device ** device_list; SANE_Int num_dev_options = 0; const char * devname = 0; + const char * defdevname = 0; const char * format = 0; int batch = 0; SANE_Status status; *************** *** 1075,1080 **** --- 1076,1083 ---- else prog_name = argv[0]; + defdevname = getenv("SANE_DEFAULT_DEVICE"); + sane_init (0, 0); /* make a first pass through the options with error printing and argument *************** *** 1113,1118 **** --- 1116,1124 ---- device_list[i]->name, device_list[i]->vendor, device_list[i]->model, device_list[i]->type); } + if (defdevname) + printf ("default device is `%s'\n", defdevname); + exit (0); } *************** *** 1142,1150 **** 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) { --- 1148,1159 ---- if (!devname) { ! /* If no device name was specified explicitly, we look at the ! environment variable SANE_DEFAULT_DEVICE. If this variable ! is not set, we open the first device we find (if any): */ ! devname = defdevname; ! if (!devname ) ! { status = sane_get_devices (&device_list, SANE_FALSE); if (status != SANE_STATUS_GOOD) { *************** *** 1158,1163 **** --- 1167,1173 ---- exit (1); } devname = device_list[0]->name; + } } status = sane_open (devname, &device);