- csiescseq.mode = *p; + csiescseq.mode[0] = *p; + p++; + if (strchr("q", *p)) + csiescseq.mode[1] = *p; }
The strchr is not needed, you can do something like: csiescseq.mode[0] = *p++; csiescseq.mode[1] = *p; if the string has only one character then csiescseq.mode[1] will have only a '\0', but it is not a problem. And in this way the code is more generic because it can deal with sequences like: CSI num $ l (DECSCPP) [I don't talk about add this sequence is only an example) Regards,