1 /* File z-form.h */ 2 3 #ifndef INCLUDED_Z_FORM_H 4 #define INCLUDED_Z_FORM_H 5 6 #include "h-basic.h" 7 8 /* 9 * This file provides functions very similar to "sprintf()", but which 10 * not only parse some additional "format sequences", but also enforce 11 * bounds checking, and allow repeated "appends" to the same buffer. 12 * 13 * See "z-form.c" for more detailed information about the routines, 14 * including a list of the legal "format sequences". 15 * 16 * This file makes use of both "z-util.c" and "z-virt.c" 17 */ 18 19 20 /**** Available Functions ****/ 21 22 /* Format arguments into given bounded-length buffer */ 23 extern uint vstrnfmt(char *buf, uint max, cptr fmt, va_list vp); 24 25 /* Simple interface to "vstrnfmt()" */ 26 extern uint strnfmt(char *buf, uint max, cptr fmt, ...); 27 28 /* Simple interface to "vstrnfmt()", assuming infinite length */ 29 extern uint strfmt(char *buf, cptr fmt, ...); 30 31 /* Format arguments into a static resizing buffer */ 32 extern char *vformat(cptr fmt, va_list vp); 33 34 /* Simple interface to "vformat()" */ 35 extern char *format(cptr fmt, ...); 36 37 /* Vararg interface to "plog()", using "format()" */ 38 extern void plog_fmt(cptr fmt, ...); 39 40 /* Vararg interface to "quit()", using "format()" */ 41 extern void quit_fmt(cptr fmt, ...); 42 43 /* Vararg interface to "core()", using "format()" */ 44 extern void core_fmt(cptr fmt, ...); 45 46 47 #endif 48