Files
MiniGUI/doc/man3/miniguiEtcFile.3
2017-05-29 12:20:05 +08:00

84 lines
4.0 KiB
Plaintext

.\" This manpage is Copyright (C) 2000 Wei Yongming
.\" 2000 BluePoint Software
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one
.\"
.\" Since MiniGUI is constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.TH "EtcFile" "3" "July 2000" "MiniGUI"
.SH "NAME"
EtcFile \- get/set values from/to MiniGUI configuration (etc) file.
.SH "SYNOPSIS"
.B #include <minigui/minigui.h>
.PP
.BI "extern char ETCFILEPATH [];"
.PP
.BI "int GUIAPI GetValueFromEtcFile" "(const char* pEtcFile, const char* pSection, const char* pKey, char* pValue, int iLen);"
.br
.BI "int GUIAPI GetIntValueFromEtcFile" "(const char* pEtcFile, const char* pSection, const char* pKey, int* value);"
.br
.BI "int GUIAPI SetValueToEtcFile" "(const char* pEtcFile, const char* pSection, const char* pKey, char* pValue);"
.br
.SH "DESCRIPTION"
.PP
In MiniGUI, you can get specific values from \fBetc\fP files using \fBGetValueFromEtcFile\fP and \fBGetIntValueFromEtcFile\fP. Etc files are text configuration files with same format as Windows INI files. A etc file has following simple format:
.PP
.nf
[section0]
key0=value0
key1=value1
[section1]
key0=value0
key1=value1
.fi
.PP
As you have seen, etc files are composed by \fBsections\fP. Every \fBvalue\fP in etc file is refrenced by \fBkey\fP. You should specify section name and key name to find a specific value.
.PP
\fBGetValueFromEtcFile\fP function gets a value (a string) with \fBpKey\fP key from \fBpSection\fP section in \fBpEtcFile\fP file, and store the value in buffer \fBpValue\fP with \fBiLen\fP length.
.PP
\fBGetIntValueFromEtcFile\fP function gets a integer with \fBpKey\fP key from \fBpSection\fP section in \fBpEtcFile\fP file, and store the value in the buffer \fBvalue\fP.
.PP
\fBSetValueToEtcFile\fP function sets the value of \fBpKey\fP key in \fBpSection\fP section in \fBpEtcFile\fP file as \fBpValue\fP. This function will create etc file, section or key when missing the specified file, section or key.
.PP
The two functions return zero if suceess, or else will return nonzero.
.SH "RETURN VALUE"
.PP
If the return value is less than zero, there is an error occured. The returned value indicates the error type:
.IP \fBETC_FILENOTFOUND\fP
The specified etc file not found or file open error.
.IP \fBETC_SECTIONNOTFOUND\fP
The specified section not found in the etc file.
.IP \fBETC_KEYNOTFOUND\fP
The specified key not found in the section.
.IP \fBETC_TMPFILEFAILED\fP
Temporary file operations error when setting value to etc file.
.IP \fBETC_FILEIOFAILED\fP
Error in file I/O.
.SH "NOTES"
.PP
MiniGUI use /etc/MiniGUI.cfg as its configuration file. However, you can put your own configuration in /usr/local/etc/MiniGUI.cfg or ~/.MiniGUI.cfg to override the configurations in /etc/MiniGUI.cfg. The global variable \fBETCFILEPATH\fP store the actual MiniGUI.cfg file path used by MiniGUI.
.PP
The maximal length of line in etc file are \fBETC_MAXLINE\fP, which is definded 1024 as default.
.SH "SEE ALSO"
.BR MiniGUI.cfg "(5)"
.SH "AUTHOR"
.PP
This manual page was edited by WEI Yongming <ymwei@minigui.org>.
If you have any problems, comments or found some bugs, please send messages to me.