if(cmd=="OPM"){
The address of an array will NEVER equal that string literal.
strcmp() suggests itself...