[sane-devel] PATCH: Call script per output file from scanimage in batch mode
m. allan noah
kitno455 at gmail.com
Mon Aug 23 15:30:41 UTC 2010
On Mon, Aug 23, 2010 at 11:20 AM, Simon Matter <simon.matter at invoca.ch> wrote:
> Hi Allan,
>
>> Simon, this is a great idea, and is also one of the last things
>> missing for users to switch from the (now deprecated) scanadf to
>> scanimage.
>>
>> Is there any chance you could find the time to make your patch
>> compatible with the scanadf -S option? Specifically setting the
>> various SCAN_* environment vars? You could add your page number as
>> SCAN_PAGE or some such. You would need to check if scanadf cares about
>> the return value for the script.
>
> I was afraid this question might come up and I was already looking at
> scanadf because I knew it does something like that. Due to my complete
> lack of experience and knowledge in programming C I found it quite
> difficult to implement the same behaviour which is why I decided to do it
> in a much simpler way.
No problem. If I find some time in the next week or two, I'll do it
(though volunteers are welcome :)
> Scanadf has the ability to call scripts in background and wait or not wait
> for them to finish before exiting. That's so simple to implement in the
> scripts so I see no reason to hardwire it in scanimage.
Agreed.
> From what I understand scanadf does not check the return value of scripts
> but I decided to do it because it gives you more control.
I guess it does let you call sane_cancel. Probably useful enough to
break backwards compat for it.
> The biggest problem are the various SCAN_* environment vars. I have just
> no idea how this could be implemented without changing much code. Since
> all values needed there are only local to scan_it() they are not available
> in main() for exporting them. If I understand this correctly then the
> device var is a global static var used everywhere and if the same could be
> done with parm from scan_it() then it would be usable in main() as well.
> But then I'm afraid that's considered bad style :(
Well, globals are generally frowned upon, but some of that is just
people parroting what they have heard :) Another option is to declare
a param struct outside of scan_it(), and pass the struct ref as an
argument.
allan
--
"The truth is an offense, but not a sin"
More information about the sane-devel
mailing list