One way is to eliminate the line break from the userinput string:
printf(">");
getline(&userinput,&length,stdin);
char *cp=strchr(userinput, '\n'); /* Find the line-break character (if it exists) */
if(cp)
*cp = '\0'; /* Convert the line-break character to a string termination character. */
printf("userinput:%s",userinput);
printf("DONE");