/*++ /* NAME /* line_wrap 3 /* SUMMARY /* wrap long lines upon output /* SYNOPSIS /* #include <line_wrap.h> /* /* void line_wrap(string, len, indent, output_fn, context) /* const char *buf; /* int len; /* int indent; /* void (*output_fn)(const char *str, int len, int indent, void *context); /* void *context; /* DESCRIPTION /* The \fBline_wrap\fR routine outputs the specified string via /* the specified output function, and attempts to keep output lines /* shorter than the specified length. The routine does not attempt to /* break long words that do not fit on a single line. Upon output, /* trailing whitespace is stripped. /* /* Arguments /* .IP string /* The input, which cannot contain any newline characters. /* .IP len /* The desired maximal output line length. /* .IP indent /* The desired amount of indentation of the second etc. output lines /* with respect to the first output line. A negative indent causes /* only the first line to be indented; a positive indent causes all /* but the first line to be indented. A zero count causes no indentation. /* .IP output_fn /* The output function that is called with as arguments a string /* pointer, a string length, a non-negative indentation count, and /* application context. A typical implementation looks like this: /* .sp /* .nf /* .na voidprint(constchar*str,intlen,intindent,void*context) { VSTREAM*fp=(VSTREAM*)context;
vstream_fprintf(fp,"%*s%.*s",indent,"",len,str); } /* .fi /* .ad /* .IP context /* Application context that is passed on to the output function. /* For example, a VSTREAM pointer, or a structure that contains /* a VSTREAM pointer. /* BUGS /* No tab expansion and no backspace processing. /* LICENSE /* .ad /* .fi /* The Secure Mailer license must be distributed with this software. /* AUTHOR(S) /* Wietse Venema /* IBM T.J. Watson Research /* P.O. Box 704 /* Yorktown Heights, NY 10598, USA
/*--*/
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.