Simple UART Echo Program

hi,
Thank you…The code was very much useful to me.Now m trying to write a code to recieve events(eg:alarm,fire detection,smoke detection)from some external application(eg:NFN gateway,hyperterminal) through serial com port on gsm and gsm should parse the events and send those events in terms of sms to other mobile phones… plz help me out to write a code or if you have any code plz post it…