libite 2.6.1
procval.c File Reference
#include <errno.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include "lite.h"

Go to the source code of this file.

Functions

char * vreadsnf (char *line, size_t len, const char *fmt, va_list ap)
 
char * readsnf (char *line, size_t len, const char *fmt,...)
 
int writesf (const char *str, const char *mode, const char *fmt,...)
 
int vreadllf (long long *value, const char *fmt, va_list ap)
 
int readllf (long long *value, const char *fmt,...)
 
int readdf (int *value, const char *fmt,...)
 
int writellf (long long value, const char *mode, const char *fmt,...)
 
int writedf (int value, const char *mode, const char *fmt,...)
 

Detailed Description

Author
Joachim Wiberg
Date
2023

Definition in file procval.c.

Function Documentation

◆ readdf()

int readdf ( int * value,
const char * fmt,
... )

Read integer value from a file composed from fmt and optional args.

Parameters
valuePointer to where to store read integer value.
modeAn fopen() mode string, e.g. "w+".
fmtFormatted string to be composed into a pathname.
Returns
result of operation, with errno set on error.

Definition at line 154 of file procval.c.

◆ readllf()

int readllf ( long long * value,
const char * fmt,
... )

Read 64-bit integer value from a file composed from fmt and optional args.

Parameters
valuePointer to where to store read 64-bit integer value.
modeAn fopen() mode string, e.g. "w+".
fmtFormatted string to be composed into a pathname.
Returns
result of operation, with errno set on error.

Definition at line 133 of file procval.c.

◆ readsnf()

char * readsnf ( char * line,
size_t len,
const char * fmt,
... )

Read first line from a file composed from fmt and optional args.

Parameters
linePointer to line buffer.
lenSize of line buffer.
fmtFormatted string to be composed into a pathname.
Returns
On success, this function returns the line read from the file, with any trailing '
' chomp()ed out. On error, NULL.

Definition at line 74 of file procval.c.

◆ vreadllf()

int vreadllf ( long long * value,
const char * fmt,
va_list ap )

Same as readllf() except it takes a va_list argument.

Definition at line 112 of file procval.c.

◆ vreadsnf()

char * vreadsnf ( char * line,
size_t len,
const char * fmt,
va_list ap )

Similar to readsnf() except it takes a va_list argument

Parameters
linePointer to line buffer.
lenSize of line buffer.
fmtFormatted string to be composed into a pathname.
apList of variable arguemnts from va_start().

For details, see readsnf().

Returns
same as readsnf().

Definition at line 44 of file procval.c.

◆ writedf()

int writedf ( int value,
const char * mode,
const char * fmt,
... )

Write integer value to a file composed from fmt and optional args.

Parameters
valueInteger value to write.
modeAn fopen() mode string, e.g. "w+".
fmtFormatted string to be composed into a pathname.
Returns
result of operation, with errno set on error.

Definition at line 208 of file procval.c.

◆ writellf()

int writellf ( long long value,
const char * mode,
const char * fmt,
... )

Write 64-bit integer value to a file composed from fmt and optional args.

Parameters
value64-bit integer value to write.
modeAn fopen() mode string, e.g. "w+".
fmtFormatted string to be composed into a pathname.
Returns
result of operation, with errno set on error.

Definition at line 184 of file procval.c.

◆ writesf()

int writesf ( const char * str,
const char * mode,
const char * fmt,
... )

Write a string buffer to a file composed from fmt and optional args.

Parameters
strPointer to string buffer, may be multiple lines.
modeAn fopen() mode string, e.g. "w+".
fmtFormatted string to be composed into a pathname.
Returns
result of operation, with errno set on error.

Definition at line 94 of file procval.c.