summaryrefslogtreecommitdiff
path: root/unproto/vstring.h
blob: c2e1f88a77f43806bd677e800ac9b1a6a52f6d99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* @(#) vstring.h 1.2 92/01/15 21:53:19 */

struct vstring {
    char   *str;			/* string value */
    char   *last;			/* last position */
};

extern struct vstring *vs_alloc();	/* initial allocation */
extern char *vs_realloc();		/* string extension */
extern char *vs_strcpy();		/* copy string */

/* macro to add one character to auto-resized string */

#define	VS_ADDCH(vs,wp,c) \
    ((wp < (vs)->last || (wp = vs_realloc(vs,wp))) ? (*wp++ = c) : 0)