ggiParseMode, ggiPrintMode, ggiSPrintMode, ggiFPrintMode — Parse and print formatted strings specifying LibGGI modes
#include <ggi/ggi.h>
int ggiParseMode(
s, m)
;
const char *s
;
ggi_mode *m
;
int ggiPrintMode(
m)
;
ggi_mode *m
;
int ggiSPrintMode(
s, m)
;
char *s
;
ggi_mode *m
;
int ggiFPrintMode(
s, m)
;
FILE *s
;
ggi_mode *m
;
ggiParseMode parses a string into a ggi_mode.
The ggi*PrintMode functions print all the members of ggi_mode in a human-readable form. ggiSPrintMode outputs to a preallocated string buffer, ggiFPrintMode outputs to a stdio FILE, and ggiPrintMode outputs to standard output. These functions correspond to sprintf (3), fprintf (3), printf (3), respectively.
The format of the string used by these functions is exactly the same as the one used in the GGI_DEFMODE environment variable.
ggiParseMode returns:
on success, i.e. the string was correct. However, errors involving GT_*, position information, or mismatched brackets do not make it fail; these errors are simply ignored.
if there is text that can not be parsed. This text is printed to stderr. All parameters parsed so far are written into m.
So m contains all parameters that have been successfully parsed. For most applications there will be no need for testing ggiParseMode for failure.