The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
info.c File Reference

librat: the fields of .RATINFO, and the rules for names and versions. More...

#include "internal.h"
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "conf.h"

Functions

bool rat_name_ok (const char *name)
 check a package name: 1 to RAT_NAME_MAX characters of a-z, 0-9, '-', '+' and '.
bool rat_version_ok (const char *version)
 a version: 1 to RAT_VERSION_MAX characters of 0-9 a-z A-Z .
bool rat_text_ok (const char *text)
 a text field: at most RAT_TEXT_MAX bytes, and no control characters
int rat_parse_number (const char *text, uint64_t max, uint64_t *out)
 a whole number of decimal digits only, at most max.
int rat_info_from_conf (const conf_t *conf, const char *section, const char *where, rat_info_t *info, rat_error_t *err)
 fill info from one section of a parsed file and check its fields.
int rat_parse_info (const char *text, rat_info_t *info, rat_error_t *err)
 fill info from the text of .RATINFO and check its fields.
void rat_info_free (rat_info_t *info)
 release the strings of an info (not the struct itself).
void rat_infos_free (rat_info_t *infos, int count)
 release an array from rat_list.

Detailed Description

librat: the fields of .RATINFO, and the rules for names and versions.

Function Documentation

◆ rat_name_ok()

bool rat_name_ok ( const char * name)

check a package name: 1 to RAT_NAME_MAX characters of a-z, 0-9, '-', '+' and '.

', the first a letter or a digit.

◆ rat_version_ok()

bool rat_version_ok ( const char * version)

a version: 1 to RAT_VERSION_MAX characters of 0-9 a-z A-Z .

  • ~ _

◆ rat_text_ok()

bool rat_text_ok ( const char * text)

a text field: at most RAT_TEXT_MAX bytes, and no control characters

◆ rat_parse_number()

int rat_parse_number ( const char * text,
uint64_t max,
uint64_t * out )

a whole number of decimal digits only, at most max.

Returns
0, or -1.

◆ rat_info_from_conf()

int rat_info_from_conf ( const conf_t * conf,
const char * section,
const char * where,
rat_info_t * info,
rat_error_t * err )

fill info from one section of a parsed file and check its fields.

Parameters
wherethe place for messages: ".RATINFO" or "index.conf [lua]".
Returns
0, or -1.

◆ rat_parse_info()

int rat_parse_info ( const char * text,
rat_info_t * info,
rat_error_t * err )

fill info from the text of .RATINFO and check its fields.

Returns
0, or -1.

◆ rat_info_free()

void rat_info_free ( rat_info_t * info)

release the strings of an info (not the struct itself).

◆ rat_infos_free()

void rat_infos_free ( rat_info_t * infos,
int count )

release an array from rat_list.