Error reporting in c
Hi guys!
Im writing my first command line program used for communicating with a device on serial port. The program takes options on communication speed from command line or from a configuration file. Command line options override the ones in config file. I have one function which is used to check if the specified com speed is valid; this function is called by command line parsig and config file parsing functions. If the speed is invalid it prints "Error: invalid baud rate specified\n". But this sucks, because the user won't know, where the error came from: eather from cmd line or from config file. The problem is that the function doesn't know from where was it called, so it doesn't know the source of the error. So how do you guys usually handle these kind for error messages?
Best regards
George
|