It's great fun to try different things with C, but when you are serious about working on a program, it's time to limit the guessing on this, guessing on that, approach.
Take it step by step (don't jump ahead of what you're doing atm), and don't go crazy with guesses and emotions. Let's see what's up now.
Let's change this part, from == NULL, to != NULL, and add the curly braces to it as well. The curly braces aren't required, but your other if statements have them, and it's VERY good to be consistent and clear in your code and coding style.
Code:
if(fgets(command, MAX_CMD_LEN, stdin) != NULL) { //add curly braces
if((p = strchr( command, '\n')) != NULL) //change from == NULL to != NULL
*p = '\0';
} //add curly brace.
Give that a try.