File:  [Coherent Logic Development] / freem / src / iniconf.h
Revision 1.4: download - view: text, annotated - select for diffs
Wed Apr 2 19:59:38 2025 UTC (12 months ago) by snw
Branches: MAIN
CVS tags: v0-63-1-rc1, v0-63-0-rc1, v0-63-0, HEAD
Automatically modify env.conf from fmadm reconfigure

    1: /*
    2:  *   $Id: iniconf.h,v 1.4 2025/04/02 19:59:38 snw Exp $
    3:  *    Function prototypes, structs, and macros for reading
    4:  *    FreeM configuration files
    5:  *
    6:  *  
    7:  *   Author: Serena Willis <snw@coherent-logic.com>
    8:  *    Copyright (C) 1998 MUG Deutschland
    9:  *    Copyright (C) 2020, 2025 Coherent Logic Development LLC
   10:  *
   11:  *
   12:  *   This file is part of FreeM.
   13:  *
   14:  *   FreeM is free software: you can redistribute it and/or modify
   15:  *   it under the terms of the GNU Affero Public License as published by
   16:  *   the Free Software Foundation, either version 3 of the License, or
   17:  *   (at your option) any later version.
   18:  *
   19:  *   FreeM is distributed in the hope that it will be useful,
   20:  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
   21:  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   22:  *   GNU Affero Public License for more details.
   23:  *
   24:  *   You should have received a copy of the GNU Affero Public License
   25:  *   along with FreeM.  If not, see <https://www.gnu.org/licenses/>.
   26:  *
   27:  *   $Log: iniconf.h,v $
   28:  *   Revision 1.4  2025/04/02 19:59:38  snw
   29:  *   Automatically modify env.conf from fmadm reconfigure
   30:  *
   31:  *   Revision 1.3  2025/03/09 19:14:25  snw
   32:  *   First phase of REUSE compliance and header reformat
   33:  *
   34:  *
   35:  * SPDX-FileCopyrightText:  (C) 2025 Coherent Logic Development LLC
   36:  * SPDX-License-Identifier: AGPL-3.0-or-later
   37:  **/
   38: 
   39: #ifndef _CONFIG_H
   40:  #define _CONFIG_H
   41: 
   42: #define CONF_BUFSIZE 255
   43: 
   44: typedef struct ini_keyvalue {
   45:     char *key;
   46:     char *value;
   47: 
   48:     struct ini_keyvalue *next;
   49: } ini_keyvalue;
   50: 
   51: typedef struct ini_section {
   52:     char *name;
   53: 
   54:     ini_keyvalue *head;
   55:     
   56:     struct ini_section *next;
   57: } ini_section;
   58: 
   59: extern int get_conf(char *section, char *key, char *value);
   60: extern int file_exists(char *filename);
   61: extern void write_profile_string(char *file, char *section, char *key, char *value);
   62: extern int modify_profile_string(char *file, char *section, char *key, char *value);
   63: extern ini_keyvalue *ini_insert(ini_section *s, char *section, char *key, char *value);
   64: extern ini_keyvalue *ini_kv_insert(ini_section *s, char *key, char *value);
   65: extern void ini_section_delete(ini_section *head, char *name);
   66: extern void ini_key_delete(ini_section *head, char *key);
   67: extern int read_profile_string(char *file, char *section, char *key, char *value);
   68: #endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>