It is not immediately obvious what “X is a challenge response string” means.
I was able to get the program to run to a limited extend after a bit of searching the internet and trial and error with the option “-B x=y”.

Having stepped through the program, it transpires that where I have put “x”, the program expects a pattern to match with the title and content of any messages that would otherwise have been shown to the user, and “y” is the pre-programmed response. This is in the “interface_none” section.
“x” has to match the question in the form “message title/message content” and is compared using fnmatch which allows * as a wildcard (anyone got a good reference for fnmatch?).
If the program hits a question for the user, and cannot find a matching answer in the command arguments, “CInterfaceNone::invalid_programmed_response()” fires “exit(8)” and the program dies.

So far I have been running the program as a normal user, which will inevitably fail where it attempts to work with block devices / root owned files & folders. This produces a warning in the user interface, followed by program termination.

To bypass this first “not root” warning, I successfully used this pre-programmed answer:

./partimage -B Warning*=Continue Alternatively the following is more specific and also works:
./partimage -B Warning*root*=continue

I haven’t figured out how to pass more than one predefined answer in batch mode.

The run arguments can be set in KDevelop here:
project > options > debugger > program arguments

Side note:

The program has a base class of user interface defined, and then either instantiates interface_none or interface_newt depending on command line arguments.

If not using full batch mode it helps to set “enable separate terminal for application IO” in KDevelop (project > options > debugger) so that you can see the full user interface. However if the program exits then the console closes and any output is lost.

As part of stepping through the code, I came across a macro, which makes the program harder to follow while debugging due to not being able to step through. So I figured out what it did, and wrote out its output C++ code in full:

So in summary, I have made progress in understanding the ways of this useful utility, and am a step closer to making a useful contribution to the project.

The rambling nature of this post reflects the way in which one begins to understand a new program. Hopefully it’s not too hard to follow, or pick out the useful pieces. All feedback gratefully appreciated.