move 'Mark all read' to folder view menu
[claws.git] / libkcc / buffer.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <sys/types.h>
4
5 #include "kcc.h"
6 #include "libkcc.h"
7
8 /**********************************************************************
9  *                                                                    *
10  *  Hold Buffer Operations                                            *
11  *                                                                    *
12  **********************************************************************/
13 char *holdbuf, *bufend;
14 char *bufp;
15
16 /*---------------------------------------------------------------------
17     NAME
18         buffalloc
19  ---------------------------------------------------------------------*/
20 char *Kcc_buffalloc(len)
21     unsigned len;
22 {
23     if ((bufp = holdbuf = (char *) malloc(len)) == NULL)
24       return NULL;
25     bufend = holdbuf + len;
26     return bufend;
27 }
28
29 /*---------------------------------------------------------------------
30     NAME
31         append
32  ---------------------------------------------------------------------*/
33 bool Kcc_append(s, len)
34     register char *s;
35     register int len;
36 {
37     if (bufp + len > bufend)
38         return (0);
39     for (; len; --len)
40         *bufp++ = *(u_char *) s++;
41     return (1);
42 }
43
44 /*---------------------------------------------------------------------
45     NAME
46         flush
47  ---------------------------------------------------------------------*/
48 void Kcc_flush(code, ddd, outcode, inmode, insi, inso, innj, ingj)
49     unsigned code;
50     char **ddd;
51     enum mode *inmode;
52     unsigned long *insi, *inso, *innj, *ingj;
53     unsigned outcode;
54 {
55     unsigned out();
56
57     Kcc_out(ddd, holdbuf, bufp - holdbuf, code, outcode, inmode, insi, inso, innj, ingj);
58     bufp = holdbuf;
59 }
60
61 /*---------------------------------------------------------------------
62     NAME
63         bufffree
64  ---------------------------------------------------------------------*/
65 void Kcc_bufffree(void)
66 {
67     if (holdbuf) {
68         free(holdbuf);
69         holdbuf = NULL;
70     }
71 }