[system] # GAL engine gal_engine=fbcon # IAL engine ial_engine=console mdev=/dev/mouse mtype=PS2 [fbcon] defaultmode=1024x768-16bpp [qvfb] defaultmode=640x480-16bpp display=0
Assume that the configuration file named my.cfg, if you want get the value of mdev in system section, you can call GetValueFromEtcFile in the following way:
char buffer [51]; GetValueFromEtcFile ("my.cfg", "system", "mdev", buffer, 51);
Example:
/* * The following code is used by MDE to get the applications information. * * It gets the information from a INI-like configuration file. */ #define APP_INFO_FILE "mginit.rc" static BOOL get_app_info (void) { int i; APPITEM* item; /* Get the number of the applications */ if (GetIntValueFromEtcFile (APP_INFO_FILE, "mginit", "nr", &app_info.nr_apps) != ETC_OK) return FALSE; if (app_info.nr_apps <= 0) return FALSE; /* Get the index of the autostart application. */ GetIntValueFromEtcFile (APP_INFO_FILE, "mginit", "autostart", &app_info.autostart); if (app_info.autostart >= app_info.nr_apps || app_info.autostart < 0) app_info.autostart = 0; /* Allocate application information structures. */ if ((app_info.app_items = (APPITEM*)calloc (app_info.nr_apps, sizeof (APPITEM))) == NULL) { return FALSE; } /* Get the path, name, and icon of every application. */ item = app_info.app_items; for (i = 0; i < app_info.nr_apps; i++, item++) { char section [10]; sprintf (section, "app%d", i); if (GetValueFromEtcFile (APP_INFO_FILE, section, "path", item->path, PATH_MAX) != ETC_OK) goto error; if (GetValueFromEtcFile (APP_INFO_FILE, section, "name", item->name, NAME_MAX) != ETC_OK) goto error; if (GetValueFromEtcFile (APP_INFO_FILE, section, "layer", item->layer, LEN_LAYER_NAME) != ETC_OK) goto error; if (GetValueFromEtcFile (APP_INFO_FILE, section, "tip", item->tip, TIP_MAX) != ETC_OK) goto error; strsubchr (item->tip, '&', ' '); if (GetValueFromEtcFile (APP_INFO_FILE, section, "icon", item->bmp_path, PATH_MAX + NAME_MAX) != ETC_OK) goto error; if (LoadBitmap (HDC_SCREEN, &item->bmp, item->bmp_path) != ERR_BMP_OK) goto error; item->cdpath = TRUE; } return TRUE; error: free_app_info (); return FALSE; }
|
|
IO operation failed to etc file.
|
|
|
No found etc file.
|
|
|
Convert the value string to an integer failed.
|
|
|
Invalid object to etc file.
|
|
|
No found key in etc file.
|
|
|
The max line number of etc file.
|
|
|
Operate success to etc file.
|
|
|
Read only to etc file.
|
|
|
No found section in etc file.
|
|
|
Create tmpfile failed.
|
|
|
Sets the value in the etc object. This fuctions sets the value in the etc object, somewhat similiar to
|
|
|
ETC_S The current config file information |
|
|
Etc The current config section information |
|
|
Data type of pointer to a ETCSECTION |
|
||||||||||||||||
|
Finds/Creates a section from an etc object. This function look for a section named pSection from the etc object hEtc. If there is no such section in the etc object and bCreateNew is TRUE, the function will create an empty section.
|
|
||||||||||||||||||||
|
Gets the integer value from a configuration etc object.
Referenced by GetMgEtcIntValue(). |
|
||||||||||||||||||||
|
Gets integer value from a configuration file. This function gets the integer value of the key pKey in the section pSection of the configuration file pEtcFile, and returns the integer value through the buffer pointed to by value.
Referenced by GetMgEtcIntValue(). |
|
||||||||||||||||
|
Gets an integer value from an etc section object. This function gets an integer value from an etc section object, similar to GetIntValueFromEtc. It gets the value of the key pKey in the section hSect, and saves the value to the buffer pointed to by pValue.
|
|
||||||||||||||||
|
Gets integer value from MiniGUI configuration etc object. This fuctions get integer value from MiniGUI configuration etc object some what similiar to GetIntValueFromEtcFile and GetIntValueFromEtc
Definition at line 1890 of file minigui.h. References GetIntValueFromEtc(), and GetIntValueFromEtcFile(). |
|
||||||||||||||||||||
|
Gets value from MiniGUI configuration etc object. This fuctions gets the value from MiniGUi configuration etc object, somewhat similiar to GetValueFromEtcFile and GetValueFromEtc
Definition at line 1870 of file minigui.h. References GetValueFromEtc(), and GetValueFromEtcFile(). |
|
||||||||||||||||||||||||
|
Gets value from a configuration etc object. This function gets value from an etc object, similar to GetValueFromEtcFile. This function gets the value of the key pKey in the section pSection of the etc object hEtc, and saves the value to the buffer pointed to by pValue.
Referenced by GetMgEtcValue(). |
|
||||||||||||||||||||||||
|
Gets value from a configuration file. This function gets the value of the key pKey in the section pSection of the configuration file pEtcFile, and saves the value to the buffer pointed to by pValue.
Referenced by GetMgEtcValue(). |
|
||||||||||||||||||||
|
Gets value from an etc section object. This function gets value from an etc section object, similar to GetValueFromEtc. It gets the value of the key pKey in the section hSect, and saves the value to the buffer pointed to by pValue.
|
|
|
Loads an etc file into memory. This function loads the content of an etc file into the memory, later, you can visit the content using GetValueFromEtc function.
|
|
||||||||||||
|
Removes a section in etc object. This function removes a section named pSection from the etc object hEtc.
|
|
||||||||||||
|
Removes a section in an etc file. This function removes a section named pSection from the etc file named pEtcFile.
|
|
||||||||||||
|
Saves an ETC object into a file. This function saves the etc object into the file named file_name;
|
|
||||||||||||
|
Sets a section value in a configuration file. This function sets the value of a section pointed to by psect to the configuration file.
|
|
||||||||||||||||||||
|
Sets a value in a configuration file. This function sets the value of the key pKey in the section pSection of the configuration file pEtcFile to be the string pointed to by pValue.
|
|
||||||||||||||||
|
Sets the value in the etc section object. This fuctions sets the value in the etc section object hSect, somewhat similiar to SetValueToEtc
|
|
|
Unloads an etc file. This function unloads the etc object generated by using
|
|
|
The path name of MiniGUI configuration file. By default, the configuration file of MiniGUI must be installed in /etc, /usr/local/etc or your home directory. When you install it in your home directory, the name should be ".MiniGUI.cfg". MiniGUI will try to use MiniGUI.cfg in the current directory, ~/.MiniGUI.cfg, then /usr/local/etc/MiniGUI.cfg, and /etc/MiniGUI.cfg last. If MiniGUI can not find any MiniGUI.cfg file, or find a bad formated configure file, the initialzation of MiniGUI will be canceled. |
1.4.2