The Linux distillery
Real world Linux programming | Real world Linux programming |
|
|
| by David M Williams | |
| Tuesday, 11 December 2007 | |
|
Page 1 of 3
Related storiesIt wasn’t desirable to recompile the application whenever a new menu option was needed, so the first thing it does is read a configuration file and dynamically builds up its list of features that the user is offered. Additional programs and shell scripts perform the actual tasks, and these are referenced in the config file. Also, some functions require privileged access – ie superuser access – and it’s best to run programs with the least permissions required. So, by hiving off the functionality out of the main app, the app itself need just not have any special permission. Not all users are equal, so the config file also specifies a minimum access level required to perform each task, and another list of users stipulates the access level each user has. If a user doesn’t meet the minimum criteria for any option they simply do not see that option in the list – no point teasing people! The first file in our program, constants.h, simply defines – as you might guess – some constant values which will be used by the rest of the program. This lets the behaviour be changed in one spot. #define BANNER "ISP Help-Desk operations menu\nPlease log in\n\n"
#define LOGGING_ENABLED
#define LOGFILE "/usr/local/menu/menu.log"
#include <crypt.h>
|
| < Next story in category | Previous story in the category > |
|---|


- 








