On 03/17/2017 07:31 PM, Sebastian Parschauer wrote:
On 13.02.2017 10:13, Wang Dong wrote:
Hi,

I wonder if I can have an interactive exception in libparted.

As I know, parted is composed of libparted + some front end.

libparted will be compiled into .so file and parted will be compiled
from front end

files, linked with this .so file. (If I missed something, please so kind
let me know.)


Now I want to have an interactive exception in libparted.

But the point is:  the exception messages should be different in script
mode and interactive mode.

Now I have to adjudge the mode status from the input from front end. I
tried for a while but I can

not make it.  I do it as following:

add global function in *parted.c* as well as *parted.in.h* and try to make.

But it fails always. It seems this is not good.


I am not so familiar with framework of parted. Just need your help.

I just want to ask what I have missed. And is  it possible to realize
what I mentioned above.

Or do you have a better idea?
If you look at parted/parted.c, then you can see that the parted
executable differentiates between script mode and interactive mode with
the opt_script_mode variable. Also isatty() can be used to verify.

libparted doesn't and shouldn't know about interactive or not.

Does this help?
Thanks for your reply.

Yeah, I have read the parted.c as you pointed. The switch here is */opt_script_mode.
/*But it is a static one/*, *and /libparted is dynamic lib. /
/*/
/*Actually, I got a scenario in which I need to distinguish the modes and
print different messages to user. But it is disk label related. So it cannot
be implemented in the front end.*/
/*
It is an exception, in which I would like to give a interactive question in interactive mode and a message in script mode. Well this looks like a feature in the front end.

I read the code about the initialization of exception handler.
And all the exception output is redirected to the stderr.
Is there any way to check this, may I ask this?*/

/*
Cheers,
Sebastian


--
Best regards. Wang Dong

Reply via email to