<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p><br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 03/17/2017 07:31 PM, Sebastian
      Parschauer wrote:<br>
    </div>
    <blockquote cite="mid:1b241ffd-a74b-6a7d-f68e-5f84cc489959@suse.de"
      type="cite">
      <pre wrap="">On 13.02.2017 10:13, Wang Dong wrote:
</pre>
      <blockquote type="cite">
        <pre wrap="">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?
</pre>
      </blockquote>
      <pre wrap="">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?</pre>
    </blockquote>
    Thanks for your reply.<br>
    <br>
    Yeah, I have read the parted.c as you pointed. The switch here is <b><i>opt_script_mode.<br>
      </i></b>But it is a static one<i><b>, </b>and </i>libparted is
    dynamic lib. <i><br>
    </i><b><i><br>
      </i></b>Actually, I got a scenario in which I need to distinguish
    the modes and<br>
    print different messages to user. But it is disk label related. So
    it cannot<br>
    be implemented in the front end.<b><i><br>
      </i></b><br>
    It is an exception, in which I would like to give a interactive
    question in interactive mode<br>
    and a message in script mode. Well this looks like a feature in the
    front end.<br>
    <br>
    I read the code about the initialization of exception handler.<br>
    And all the exception output is redirected to the stderr.<br>
    Is there any way to check this, may I ask this?<b><i><br>
        <br>
      </i></b><br>
    <blockquote cite="mid:1b241ffd-a74b-6a7d-f68e-5f84cc489959@suse.de"
      type="cite">
      <pre wrap="">
Cheers,
Sebastian

</pre>
    </blockquote>
    <br>
    <div class="moz-signature">-- <br>
      Best regards. Wang Dong</div>
  </body>
</html>