man tc_create () - tc_create, tc_add, tc_append, tc_destroy, tc_commit - tc batch processing.

NAME

tc_create, tc_add, tc_append, tc_destroy, tc_commit - tc batch processing.

LIBRARIES

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

SYNOPSIS

#include <abz/tc.h>

int tc_create(struct batch *tc, int flags, const char *fmt",...);
int tc_add(struct batch *tc,const char *fmt",...);
int tc_append(struct batch *tc,const char *fmt",...);
void tc_destroy(struct batch *tc");
int tc_commit(struct batch *tc");

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.

tc_create() creates an tc batch. 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 tc_add() and tc_append().

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

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

tc_add() adds a command to tc. It takes a pointer to the tc created with tc_create() and a printf-style string as parameters.

tc_append() appends parameters to the last command in tc.

tc_destroy() free resources allocated for tc.

tc_commit() executes the tc command batch. This function automatically free resources allocated for the tc, i.e. you should not call tc_destroy() after calling this function, except if it fails.

RETURN VALUES

Except for tc_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 :