nsgenbind
Loading...
Searching...
No Matches
Macros | Functions
utils.h File Reference

Go to the source code of this file.

Macros

#define SLEN(s)   (sizeof((s)) - 1) /* -1 for '\0' */
 
#define UNUSED(x)   ((void)(x))
 

Functions

char * genb_fpath (const char *fname)
 
FILE * genb_fopen (const char *fname, const char *mode)
 
FILE * genb_fopen_tmp (const char *fname)
 
int genb_fclose_tmp (FILE *filef, const char *fname)
 

Macro Definition Documentation

◆ SLEN

#define SLEN (   s)    (sizeof((s)) - 1) /* -1 for '\0' */

Definition at line 46 of file utils.h.

◆ UNUSED

#define UNUSED (   x)    ((void)(x))

Definition at line 50 of file utils.h.

Function Documentation

◆ genb_fclose_tmp()

int genb_fclose_tmp ( FILE *  filef,
const char *  fname 
)

Close file opened with genb_fopen

Definition at line 93 of file utils.c.

◆ genb_fopen()

FILE * genb_fopen ( const char *  fname,
const char *  mode 
)

Open file allowing for output path prefix

Definition at line 46 of file utils.c.

◆ genb_fopen_tmp()

FILE * genb_fopen_tmp ( const char *  fname)

Open file allowing for output path prefix

file is opened for reading/writing with a temporary suffix allowing for the matching close call to check the output is different before touching the target file.

Definition at line 70 of file utils.c.

◆ genb_fpath()

char * genb_fpath ( const char *  fname)

get a pathname with the output prefix prepended

Parameters
fnameleaf filename.
Returns
full prefixed path to file caller must free

Definition at line 21 of file utils.c.