Although the various formatting functions (see Formatting Text) differ slightly in usage, they each take a common set of arguments to control the formatted output. The meaning of each of these arguments is described in the table below:
This parameter is the goal width. Lines will be wrapped at this width as long as that does not cause words to be split into more than one line, but will be continued beyond this width if wrapping would split words into more than one line.
A goal of 0
is treated as infinite.
This is the absolute maximum length lines are allowed to be. If a line is any longer than this, it will be wrapped even if that means splitting in the middle of a word. If the line is split in the middle of a word, a ‘-’ will be appended to the end of the line (if there is room9) to indicate that the word is continued on the next line.
A width of 0
is treated as infinite.
This is the address of an unsigned short
which holds the current
column of output text. You should initialize the value whose address is
cursor to 0
before calling any of the formatting functions
for the first time with that cursor argument. See Formatting Example for an example of how this is used.
Note: cursor may not be NULL
.
This specifies the column that the first line of text should be indented
to. If *cursor
is already greater than indent, then
no indentation will be performed (i.e., it will be as though
indent
were 0
).
Lines following the first one are indented according to subindent.
This is the indentation to use for lines after the first one (see above). Note that this only applies to a single call of a formatting function. For example, if you do this:
unsigned short cursor = 0; mu_format(stdout, 0, 0, &cursor, 10, 5, "foo\n"); mu_format(stdout, 0, 0, &cursor, 10, 5, "bar\n");
both ‘foo’ and ‘bar’ will be indented 10 characters. If you
want ‘bar’ to be indented 5 characters, say that explicitly by
passing indent as 5 (i.e., mu_format(stdout, 0, 0, &cursor,
5, 5, "bar\n")
).