于 2011年08月23日 22:31, Adam Litke 写道:
On 08/22/2011 10:04 PM, Osier Yang wrote:
> Hi, Adam
>
> I likes the idea to wrap the checking as a function seperately, but the
> function
> won't work well if the command is "help info", though we don't have
a use
> of "help info" yet.
>
> My point is since the function is intending to work for all the command,
> as a
> common function, it needs to consider some boudary too.
>
> How about below?
Good points. The function below looks good.
Given there was an ACK from Eric, I pushed with modifying the function as
below. Thanks.
> qemuMonitorTextCommandNotFound(const char *cmd, const char
*reply)
> {
> if (STRPREFIX(cmd, "info ")) {
> if (strstr(reply, "info version"))
> return 1;
> } else {
> if (strstr(reply, "unknown command:"))
> return 1;
> }
>
> return 0;
> }
>
> And there might be other different info qemu will output for a unknown
> command
> we don't known yet. Using "cmd" as an argument will allow us to extend
> the checking
> methods.
>
> Thanks
> Osier