summaryrefslogtreecommitdiff
path: root/src/z-form.h
blob: f67d1484a7ba70156d00ddf0a9973f034fe33d44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#pragma once

#ifdef __cplusplus
extern "C" {
#endif

#include "h-basic.h"

/*
 * This file provides functions very similar to "sprintf()", but which
 * not only parse some additional "format sequences", but also enforce
 * bounds checking, and allow repeated "appends" to the same buffer.
 *
 * See "z-form.c" for more detailed information about the routines,
 * including a list of the legal "format sequences".
 *
 * This file makes use "z-util.c"
 */


/**** Available Functions ****/

/* Format arguments into given bounded-length buffer */
uint vstrnfmt(char *buf, uint max, cptr fmt, va_list vp);

/* Simple interface to "vstrnfmt()" */
uint strnfmt(char *buf, uint max, cptr fmt, ...);

/* Simple interface to "vformat()" */
char *format(cptr fmt, ...);

/* Vararg interface to "quit()", using "format()" */
void quit_fmt(cptr fmt, ...);

#ifdef __cplusplus
} /* extern "C" */
#endif