LICK
 All Data Structures Files Functions Variables Enumerations Enumerator
Functions
file-utils.h File Reference

An assortment of functions used to manipulate files and directories. More...

#include <stdio.h>
Include dependency graph for file-utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

char * read_line (FILE *f)
 read a line of any size from a file More...
 
char * file_to_str (FILE *f)
 read a file into a string More...
 
void conf_option (char *ln, char **keyword_start, char **item_start)
 extract info from a line of a configuration file More...
 
int is_conf_path (const char *name)
 determine if a file is a configuration file, from the file name More...
 

Detailed Description

An assortment of functions used to manipulate files and directories.

Function Documentation

void conf_option ( char *  ln,
char **  keyword_start,
char **  item_start 
)

extract info from a line of a configuration file

Given a line of a configuration file, such as "key value", separates the key from the value, and returns strings of each. Note ln is no longer a valid string. If ln is on the heap, it must be freed in an appropriate manner, which frees the strings pointed to by keyword_start and item_start. ln must be freed if it is on the heap, regardless of the output of this function.

Parameters
[in]lna line of a configuration file
[out]keyword_startwhere to place the keyword string, or null if no items found
[out]item_startwhere to place the item string, or null if no item found
char* file_to_str ( FILE *  f)

read a file into a string

Parameters
fthe file to read
Returns
the contents of the file, in a string
int is_conf_path ( const char *  name)

determine if a file is a configuration file, from the file name

Parameters
namethe file name
Returns
1 if a configuration file, otherwise 0
char* read_line ( FILE *  f)

read a line of any size from a file

Parameters
fthe file to read from
Returns
the line. Free with free().