int im_histlin( IMAGE *im, const char *fmt, ... );
int im_updatehist( IMAGE *out, const char *name, int argc, char *argv[]
);
const char *im_history_get( IMAGE *im );
im_updatehist(3) is given a standard argc/argv, formats them appropriately, and calls im_histlin(3) for you. Note that the program name is passed separately.
im_history_get(3) returns the entire history of an image as a single C string, one action per line. No need to free, but you mustn’t modify either.