github.com/bugraaydogar/snapd@v0.0.0-20210315170335-8c70bb858939/cmd/libsnap-confine-private/infofile.h (about)

     1  /*
     2   * Copyright (C) 2019 Canonical Ltd
     3   *
     4   * This program is free software: you can redistribute it and/or modify
     5   * it under the terms of the GNU General Public License version 3 as
     6   * published by the Free Software Foundation.
     7   *
     8   * This program is distributed in the hope that it will be useful,
     9   * but WITHOUT ANY WARRANTY; without even the implied warranty of
    10   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    11   * GNU General Public License for more details.
    12   *
    13   * You should have received a copy of the GNU General Public License
    14   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    15   *
    16   */
    17  
    18  #ifndef SNAP_CONFINE_INFOFILE_H
    19  #define SNAP_CONFINE_INFOFILE_H
    20  
    21  #include <stdio.h>
    22  
    23  #include "../libsnap-confine-private/error.h"
    24  
    25  /**
    26   * sc_infofile_get_key extracts a single value of a key=value pair from a given
    27   * stream.
    28   *
    29   * On success the return value is zero and err_out, if not NULL, is deferences
    30   * and set to NULL.  On failure the return value is -1 is and detailed error
    31   * information is stored by dereferencing err_out.  If an error occurs and
    32   * err_out is NULL then the program dies, printing the error message.
    33   **/
    34  int sc_infofile_get_key(FILE *stream, const char *key, char **value, sc_error **err_out);
    35  
    36  /**
    37   * sc_infofile_get_ini_section_key extracts a single value of a key=value pair
    38   * from a given ini section of the stream.
    39   *
    40   * On success the return value is zero and err_out, if not NULL, is deferences
    41   * and set to NULL. On failure the return value is -1 is and detailed error
    42   * information is stored by dereferencing err_out. If an error occurs and
    43   * err_out is NULL then the program dies, printing the error message.
    44   **/
    45  int sc_infofile_get_ini_section_key(FILE *stream, const char *section, const char *key, char **value,
    46                                      sc_error **err_out);
    47  
    48  #endif