]> asedeno.scripts.mit.edu Git - PuTTY.git/blob - misc.h
Pageant is now able to avoid asking for the passphrase when asked to
[PuTTY.git] / misc.h
1 #ifndef PUTTY_MISC_H
2 #define PUTTY_MISC_H
3
4 #include "puttymem.h"
5
6 #ifndef FALSE
7 #define FALSE 0
8 #endif
9 #ifndef TRUE
10 #define TRUE 1
11 #endif
12
13 char *dupstr(char *s);
14 char *dupcat(char *s1, ...);
15
16 struct bufchain_granule;
17 typedef struct bufchain_tag {
18     struct bufchain_granule *head, *tail;
19     int buffersize;                    /* current amount of buffered data */
20 } bufchain;
21
22 void bufchain_init(bufchain *ch);
23 void bufchain_clear(bufchain *ch);
24 int bufchain_size(bufchain *ch);
25 void bufchain_add(bufchain *ch, void *data, int len);
26 void bufchain_prefix(bufchain *ch, void **data, int *len);
27 void bufchain_consume(bufchain *ch, int len);
28
29 /*
30  * Debugging functions.
31  *
32  * Output goes to debug.log
33  *
34  * debug(()) (note the double brackets) is like printf().
35  *
36  * dmemdump() and dmemdumpl() both do memory dumps.  The difference
37  * is that dmemdumpl() is more suited for when where the memory is is
38  * important (say because you'll be recording pointer values later
39  * on).  dmemdump() is more concise.
40  */
41
42 #ifdef DEBUG
43 void dprintf(char *fmt, ...);
44 void debug_memdump(void *buf, int len, int L);
45 #define debug(x) (dprintf x)
46 #define dmemdump(buf,len) debug_memdump (buf, len, 0);
47 #define dmemdumpl(buf,len) debug_memdump (buf, len, 1);
48 #else
49 #define debug(x)
50 #define dmemdump(buf,len)
51 #define dmemdumpl(buf,len)
52 #endif
53
54
55 #ifndef lenof
56 #define lenof(x) ( (sizeof((x))) / (sizeof(*(x))))
57 #endif
58
59
60 #endif