man batch_create () - batch_create, batch_add, batch_append, batch_destroy, batch_commit - batch processing.

NAME

batch_create, batch_add, batch_append, batch_destroy, batch_commit - batch processing.

LIBRARIES

Abz Library (-labz), Debug Library (-ldebug)

SYNOPSIS

#include <abz/batch.h>

int batch_create(struct batch *batch, int flags, const char *fmt",...);
int batch_add(struct batch *batch,const char *fmt",...);
int batch_append(struct batch *batch,const char *fmt",...);
void batch_destroy(struct batch *batch");
int batch_commit(struct batch *batch");

DESCRIPTION

These functions enables the caller to construct a list of commands which are then piped to the specified program's stdin file descriptor. The called program's output is discarded.

batch_create() creates a batch of commands. It should be called before any of the other functions. The specified arguments specify the command that should be executed. When executed, its output will be discarded and its stdin file descriptor will be a file containing the list of commands added with batch_add() and batch_append().

The flags argument to batch_create() is an OR of any of these:

BATCH_TESTING
Don't execute the batch, rather log the commands that would have been executed. Useful for debugging.
BATCH_FORCE
Ignore program return code (i.e. do not return an error if the program fails).

batch_add() adds a command to the batch. It takes a pointer to the batch created with batch_create() and a printf-style string as parameters.

batch_append() appends parameters to the last command in the batch.

batch_destroy() free resources allocated for the batch.

batch_commit() executes a batch of commands. This function automatically free resources allocated for the batch, i.e. you should not call batch_destroy() after calling this function, except if it fails.

RETURN VALUES

Except for batch_destroy(), all of these functions returns 0 if successful or -1 if some error occurred. Call abz_get_error() to retrieve error messages.

NOTES

None of the libabz routines are thread-safe. I'm not planning to change this either! For more information, please see http://threading.2038bug.com/

SEE ALSO

AUTHOR

Written by Abraham vd Merwe <abz@blio.com>

CETTE PAGE DOCUMENTE AUSSI :