File: ini.h

package info (click to toggle)
berusky 1.7.2-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 14,048 kB
  • sloc: cpp: 14,762; sh: 10,005; makefile: 91; xml: 20; ansic: 14
file content (59 lines) | stat: -rw-r--r-- 2,090 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* Martin Stransky <stransky@redhat.com>
 *
 * Copyright (C) 2003,2005 Red Hat, Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

/* ini file handling
*/

#ifndef __INI_H__
#define __INI_H__

#define MAX_TOKEN_LEN       1000

#define TOKEN_TRUE1         "yes"
#define TOKEN_TRUE2         "on"

#define TOKEN_FALSE1        "no"
#define TOKEN_FALSE2        "off"

#ifndef TRUE
#define TRUE                (1==1)
#endif

#ifndef FALSE
#define FALSE               (1!=1)
#endif

#define SPR '='

char *ini_remove_end_of_line(char *p_line);
char *ini_skip_spaces(char *p_line);
char *ini_skip_separator(char *p_line);
char *ini_read_param(char *p_line, char *p_param, int max_len);
char *ini_read_string(FILE *f, const char *p_template, char *p_out, int max_len, const char *p_default);
char *ini_read_string_file(const char *p_file, const char *p_template, char *p_out, int max_len, const char *p_default);
int ini_read_int(FILE *f, const char *p_template, int dflt);
int ini_read_int_file(const char *p_file, const char *p_template, int dflt);
int ini_read_bool(FILE *f, const char *p_template, int dflt);
int ini_read_bool_file(const char *p_file, const char *p_template, int dflt);
bool ini_write_string(const char *p_file, const char *p_template, const char *p_value);
int is_token(char *p_line, const char *p_token);
int read_token(FILE *f_in, char *p_line, size_t max, char separator);

#endif  // __INI_H__