[dpdk-dev] RFC on changing cmdline_set_prompt()

Wiles, Roger Keith keith.wiles at windriver.com
Wed Oct 1 19:27:54 CEST 2014


I was needing cmdline_set_prompt(struct cmdline * cl, const char * prompt) to be more dynamic with the prompt.

What I would like to be able to do is change the prompt on the fly in my Pktgen-DPDK application. The reason is I have added some limited ANSI color support and would like to remove the color sequence codes when color support is turned off.

I could just call cmdline_set_prompt() again with the new prompt, which would the simplest method.
But what is the fun in that design and being a programmer I was thinking about making it even more complex :-)

I was thinking about adding a function pointer to cmdline_set_prompt(cl, “Foobar>”, myGet_prompt) or replacing cmdline_set_prompt(cl, myGet_prompt); or adding a new set prompt function to add a function callback routine cmdline_set_prompt_callback(cl, myGet_prompt); Where ‘char * myGet_prompt(struct cmdline *cl);’

Comments?

Thanks
++Keith
Keith Wiles, Principal Technologist with CTO office, Wind River mobile 972-213-5533



More information about the dev mailing list