diff options
| author | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-02-01 22:59:06 +0000 |
|---|---|---|
| committer | oroborus <oroborus@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-02-01 22:59:06 +0000 |
| commit | 6d4e1eae16b84918009625a866104ec26a234277 (patch) | |
| tree | a340a8a547a60c9f63c8dfafe8909242f9c9bbd8 /src/configFile.c | |
nahranie tarballu tuxanci-ng na SVN server
Dusan Durech ( Oroborus )
git-svn-id: http://opensvn.csie.org/tuxanci_ng@1 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/configFile.c')
| -rw-r--r-- | src/configFile.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/configFile.c b/src/configFile.c new file mode 100644 index 0000000..5bbbf97 --- /dev/null +++ b/src/configFile.c @@ -0,0 +1,50 @@ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <assert.h> + +#include "configFile.h" + +char* getValueInConfigFile(textFile_t *p, char *s) +{ + int i; + + assert( s != NULL ); + assert( p != NULL ); + + for( i = 0 ; i < p->text->count ; i++ ) + { + char *line; + char *offset; + + line = (char *) (p->text->list[i]); + + if( ( offset = strstr(line, s) ) != NULL ) + { + return offset + ( strlen(s) + 1 ); + } + } + + return NULL; +} + +void delRemInConfigFile(textFile_t *p) +{ + int i; + + assert( p != NULL ); + + for( i = 0 ; i < p->text->count ; i++ ) + { + char *line; + char *offset; + + line = (char *) (p->text->list[i]); + + if( ( offset = strchr(line, '#') ) != NULL ) + { + *offset = '\0'; + } + } +} |