39#define LOG(to_print) program_wide_logger::get().log(to_print, ALWAYS_PRINT)
55int ini_editor::print_instructions()
58%s: This program needs five parameters to process an ini file.\n\
59There are two major operations, read and write. The type of operation\n\
60should be the first parameter. The other parameters are similar for both\n\
61operations, except for the last parameter. These are as follows:\n\
63\tread inifile section entry defaultvalue\n\
64 This reads the \"inifile\" specified and looks for the \"section\" and\n\
65\"entry\" name in the file. It will either return (via standard output)\n\
66the value found there or it will return the \"defaultvalue\". No error\n\
67will be raised if the entry is missing, but the default signals that no\n\
69 Additionally, if the entry name is the special value \"whole_section\",\n\
70then the entire section will be read and returned as a CSV list. If the\n\
71section is empty, then the default string is returned instead.\n\
73\twrite inifile section entry newvalue\n\
74 This writes a new item with contents \"newvalue\" into the \"inifile\"\n\
75in the \"section\" at the \"entry\" specified. This should always succeed\n\
76unless the ini file is not writable (in which case an error should be\n\
77returned). Nothing is send to standard output for a write operation.\n\
82int ini_editor::execute()
90 if ( (operation[0] ==
'w') || (operation[0] ==
'W') ) read_op =
false;
99 if (entry.
equal_to(
"whole_section")) {
102 bool worked = ini.get_section(section, found);
111 bool worked = ini.get(section, entry, found);
118 bool worked = ini.put(section, entry, value);
119 if (!worked) exit(28);
int print_instructions(bool good, const astring &program_name)
The application_shell is a base object for console programs.
virtual int execute()=0
< retrieves the command line from the /proc hierarchy on linux.
application_shell()
constructs an application_shell to serve as the root of the program.
a_sprintf is a specialization of astring that provides printf style support.
Provides a dynamically resizable ASCII character string.
bool equal_to(const char *that) const
returns true if "that" is equal to this.
virtual outcome log(const base_string &info, int filter)=0
writes the information in "info" to the logger using the "filter".
Supports a configurator-based interface on text initialization files.
Provides operations commonly needed on file names.
static loggers::standard_log_base & get()
Provided by the startup code within each application for logging.
Provides a symbol_table that holds strings as the content.
static void create_csv_line(const structures::string_array &to_csv, basis::astring &target)
#define SETUP_CONSOLE_LOGGER
< a macro that retasks the program-wide logger as a console_logger.
#define DEFINE_CLASS_NAME(objname)
Defines the name of a class by providing a couple standard methods.
Provides macros that implement the 'main' program of an application.
#define HOOPLE_MAIN(obj_name, obj_args)
options that should work for most unix and linux apps.
Implements an application lock to ensure only one is running at once.
The guards collection helps in testing preconditions and reporting errors.
A platform independent way to obtain the timestamp of a file.
A logger that sends to the console screen using the standard output device.
A dynamic container class that holds any kind of object via pointers.