codice:
while ( *(fgets(buffer,BUFFER_LENGTH, stdin)) != '\n')
{
...
}
o in alternativa:

codice:
do 
{
    fgets(buffer, BUFFER_LENGTH, stdin);
}while ( buffer[0] != '\n');