added LINE_ENDING define and improved detecting of these chars in getIncomingChars() function