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? Cheers, Sebastian

