File: support.h

package info (click to toggle)
ppxp 0.99120923-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 2,812 kB
  • ctags: 3,704
  • sloc: ansic: 24,532; tcl: 3,992; makefile: 517; sh: 80
file content (97 lines) | stat: -rw-r--r-- 1,644 bytes parent folder | download
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#ifndef	_LIB_SUPPORT_H
#define	_LIB_SUPPORT_H

#ifdef	FALSE
#undef	FALSE
#undef	TRUE
#endif
typedef	enum {FALSE, TRUE} bool_t;

#ifndef	INADDR_ANY
# define	INADDR_ANY	0
#endif

#ifndef	INADDR_NONE
# define	INADDR_NONE	0xffffffff
#endif

#ifndef	HAVE_U_INT32_T
typedef	unsigned int	u_int32_t;
typedef	unsigned short	u_int16_t;
typedef	unsigned char	u_int8_t;
typedef	signed int	int32_t;
typedef	signed short	int16_t;
typedef	signed char	int8_t;
#endif

extern void *Malloc(), *Calloc(), *Realloc();
extern char *Strdup();
extern char *usrPPxP, *sysPPxP;

/*
#define	DEBUG_MALLOC
*/

#ifdef	DEBUG_MALLOC
inline static void
Free(void *p)
{
printf("Free  :%x\n", p);
    free(p);
}
#else
#ifdef Free
#undef Free
#endif
#define	Free(p)	free(p)
#endif

#define	TALLOC(type)	(type *)Malloc(sizeof(type))
#define	TCALLOC(type)	(type *)Calloc(1, sizeof(type))

struct list_s {
    struct list_s *next;
    char *name;
    char *data;
    void *priv;
};

typedef struct b256_s {
    u_int32_t b[8];
} b256_t;

static inline void
B256_SET(b256_t *bp, int type)
{
    bp->b[type>>5] |= 1 << (type&0x1F);
}

static inline void
B256_CLR(b256_t *bp, int type)
{
    bp->b[type>>5] &= ~(1 << (type&0x1F));
}

static inline bool_t
B256_ISSET(b256_t *bp, int type)
{
    return((bp->b[type>>5] & (1 << (type&0x1F))) ? TRUE: FALSE);
}

inline static void
B256_ZERO(b256_t *bp)
{
    memset((void *)bp, 0, sizeof(b256_t));
}

static inline void
B256_CPY(b256_t *dst, b256_t *src)
{
    memcpy((void *)dst, (void *)src, sizeof(b256_t));
}

extern int DecodeArgs();
extern void FreeArgs();
extern struct list_s *FileList(), *SortList();

#endif	/* _LIB_SUPPORT_H */