vitalnix user management suite 3.2.0


Description

libvxmdfmt (and its frontend mdpwlfmt) is used to beautify MDSYNC transaction logfiles (as generated by libvxmdsync and frontends like mdsync or xmd) into nice, user-readable documents like HTML, RTF, Plain Text or others. It takes an input, an output, and optionally a style template file, as well as a so-called style name which describes what the beautified file looks like. (Those styles which do not take a style filename have their output hardcoded in the source code currently.) Please see the index for detailed descriptions of the available styles.

Structures

Only the fields of interest are listed.

#include <vitalnix/libvxmdfmt/libvxmdfmt.h>

struct pwlfmt_workspace {
    ...
    char *style_name;
    char *input_file;
    char *output_file;
    char *template_file;
    void (*report)(const struct pwlfmt_workspace *, int, int);
    ...
};

Function overview

#include <vitalnix/libvxmdfmt/libvxmdfmt.h>

int pwlfmt_new(struct pwlfmt_workspace *ws);
int pwlfmt_process(struct pwlfmt_workspace *ws);
const char *pwlfmt_strerror(int errnum);

#include <vitalnix/libvxmdfmt/libvxmdfmt.h>
#include <vitalnix/libvxmdfmt/vtable.h>

struct pwlstyle_vtable *pwlstyles_trav(void **trav);

pwlfmt_new

Initializes the workspace and opens the files and style for I/O. Returns an AEE code.

PWLFMT_ENOSTYLE The specified style was not found
PWLFMT_EREQTPL The style requires a template file, but no file has been specified
PWLFMT_EEINPUT Could not open the input file. The exact error (e.g. ENOENT, etc.) is in errno.
PWLFMT_EEOUTPUT Could not open the output file. The exact error (e.g. EPERM, etc.) is in errno.
PWLFMT_EINPUTVER The input file's format is not supported

pwlfmt_process

Starts the process by reading from the input stream, sorting the data and printing it out to the output stream. Returns an AEE code.

pwlfmt_strerror

pwlfmt_strerror() returns a string describing the error errnum. If errnum is not an error code as returned by pwlfmt_new() or pwlfmt_process(), this function will return NULL.

pwlstyles_trav

Allows an application to traverse the list of available styles. *trav must be NULL on the first call to pwlstyles_trav(). The function returns a pointer to struct pwlstyle_vtable for each style, which can then be examined for name, description and requirement of a style. Returns NULL when there are no more styles. Example see below.

Examples

struct pwlfmt_workspace w = {
    .style_name  = "pg_html",
    .input_file  = "synclog-20060220-083226.log",
    .output_file = "synclog-20060220.html",
};
pwlfmt_new(&w);

struct pwlstyle_vtable *table;
void *trav = NULL;
while((table = pwlstyles_trav(&trav)) != NULL)
    printf("%s: %s%s\n", table->name, table->desc,
      table->require_template ? " (requires template)" : "");