misc.c

Tue, 16 Mar 2004 21:35:13 +0100

author
tuomov
date
Tue, 16 Mar 2004 21:35:13 +0100
changeset 70
e866dc825481
parent 64
f20d97d852ce
child 80
c60bc05a6d38
permissions
-rw-r--r--

trunk: changeset 1408
Changed include directives to reflect change in locations of headers.

0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
1 /*
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
2 * libtu/misc.c
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
3 *
36
63cd573ffbcf trunk: changeset 39
tuomov
parents: 32
diff changeset
4 * Copyright (c) Tuomo Valkonen 1999-2002.
53
f8f9366b359c trunk: changeset 57
tuomov
parents: 42
diff changeset
5 *
f8f9366b359c trunk: changeset 57
tuomov
parents: 42
diff changeset
6 * You may distribute and modify this library under the terms of either
f8f9366b359c trunk: changeset 57
tuomov
parents: 42
diff changeset
7 * the Clarified Artistic License or the GNU LGPL, version 2.1 or later.
0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
8 */
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
9
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
10 #include <stdlib.h>
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
11 #include <stdio.h>
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
12 #include <string.h>
64
f20d97d852ce trunk: changeset 1362
tuomov
parents: 63
diff changeset
13 #include <ctype.h>
0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
14
70
e866dc825481 trunk: changeset 1408
tuomov
parents: 64
diff changeset
15 #include "misc.h"
0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
16
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
17
1
6e704fc09528 trunk: changeset 4
tuomov
parents: 0
diff changeset
18 void *malloczero(size_t size)
0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
19 {
62
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
20 void *p=malloc(size);
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
21
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
22 if(p!=NULL)
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
23 memset(p, 0, size);
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
24
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
25 return p;
0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
26 }
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
27
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
28
1
6e704fc09528 trunk: changeset 4
tuomov
parents: 0
diff changeset
29 void *remalloczero(void *ptr, size_t oldsize, size_t newsize)
0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
30 {
62
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
31 void *p=NULL;
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
32
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
33 if(newsize!=0){
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
34 p=realloc(ptr, newsize);
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
35
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
36 if(p==NULL)
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
37 return NULL;
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
38
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
39 if(newsize>oldsize)
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
40 memset((char*)p+oldsize, 0, newsize-oldsize);
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
41 }
0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
42
62
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
43 return p;
0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
44 }
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
45
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
46
63
5b732dd506d3 trunk: changeset 1360
tuomov
parents: 62
diff changeset
47 char *scopyn(const char *p, size_t l)
0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
48 {
63
5b732dd506d3 trunk: changeset 1360
tuomov
parents: 62
diff changeset
49 char *pn=(char*)malloc(l+1);
62
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
50
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
51 if(pn==NULL)
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
52 return NULL;
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
53
64
f20d97d852ce trunk: changeset 1362
tuomov
parents: 63
diff changeset
54 memcpy(pn, p, l);
f20d97d852ce trunk: changeset 1362
tuomov
parents: 63
diff changeset
55 pn[l]='\0';
62
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
56
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
57 return pn;
0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
58 }
63
5b732dd506d3 trunk: changeset 1360
tuomov
parents: 62
diff changeset
59
5b732dd506d3 trunk: changeset 1360
tuomov
parents: 62
diff changeset
60
5b732dd506d3 trunk: changeset 1360
tuomov
parents: 62
diff changeset
61 char *scopy(const char *p)
5b732dd506d3 trunk: changeset 1360
tuomov
parents: 62
diff changeset
62 {
5b732dd506d3 trunk: changeset 1360
tuomov
parents: 62
diff changeset
63 size_t l=strlen(p);
5b732dd506d3 trunk: changeset 1360
tuomov
parents: 62
diff changeset
64 return scopyn(p, l);
5b732dd506d3 trunk: changeset 1360
tuomov
parents: 62
diff changeset
65 }
62
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
66
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
67
0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
68 char *scat(const char *p1, const char *p2)
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
69 {
62
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
70 size_t l1, l2;
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
71 char*pn;
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
72
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
73 l1=strlen(p1);
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
74 l2=strlen(p2);
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
75
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
76 pn=(char*)malloc(l1+l2+1);
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
77
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
78 if(pn==NULL)
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
79 return NULL;
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
80
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
81 memcpy(pn, p1, l1);
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
82 memcpy(pn+l1, p2, l2+1);
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
83
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
84 return pn;
0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
85 }
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
86
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
87
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
88 char *scat3(const char *p1, const char *p2, const char *p3)
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
89 {
62
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
90 size_t l1, l2, l3;
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
91 char *pn;
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
92
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
93 l1=strlen(p1);
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
94 l2=strlen(p2);
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
95 l3=strlen(p3);
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
96
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
97 pn=(char*)malloc(l1+l2+l3+1);
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
98
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
99 if(pn==NULL)
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
100 return NULL;
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
101
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
102 memcpy(pn, p1, l1);
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
103 memcpy(pn+l1, p2, l2);
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
104 memcpy(pn+l1+l2, p3, l3+1);
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
105
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
106 return pn;
0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
107 }
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
108
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
109
1
6e704fc09528 trunk: changeset 4
tuomov
parents: 0
diff changeset
110 char *scatn(const char *s1, ssize_t l1, const char *s2, ssize_t l2)
6e704fc09528 trunk: changeset 4
tuomov
parents: 0
diff changeset
111 {
62
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
112 size_t tlen=1;
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
113 char *s;
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
114
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
115 if(l1<0)
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
116 l1=strlen(s1);
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
117
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
118 if(l2<0)
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
119 l2=strlen(s2);
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
120
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
121 tlen+=l1+l2;
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
122
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
123 s=(char*)malloc(tlen);
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
124
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
125 if(s==NULL)
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
126 return NULL;
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
127
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
128 memcpy(s, s1, l1);
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
129 memcpy(s+l1, s2, l2);
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
130 s[l1+l2]='\0';
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
131
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
132 return s;
1
6e704fc09528 trunk: changeset 4
tuomov
parents: 0
diff changeset
133 }
6e704fc09528 trunk: changeset 4
tuomov
parents: 0
diff changeset
134
6e704fc09528 trunk: changeset 4
tuomov
parents: 0
diff changeset
135
0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
136 /* */
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
137
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
138
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
139 const char *simple_basename(const char *name)
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
140 {
62
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
141 const char *p;
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
142
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
143 p=name+strlen(name)-1;
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
144
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
145 /* Skip any trailing slashes */
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
146 while(*p=='/'){
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
147 /* root? */
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
148 if(p==name)
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
149 return name;
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
150 p--;
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
151 }
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
152
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
153 while(p!=name){
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
154 if(*p=='/')
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
155 return p+1;
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
156 p--;
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
157 }
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
158
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
159 return name;
0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
160 }
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
161
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
162
32
7e74a8d61b76 trunk: changeset 35
tuomov
parents: 9
diff changeset
163 void stripws(char *p)
7e74a8d61b76 trunk: changeset 35
tuomov
parents: 9
diff changeset
164 {
62
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
165 int l;
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
166
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
167 l=strspn(p, " ");
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
168 if(l!=0)
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
169 strcpy(p, p+l);
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
170 l=strlen(p);
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
171
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
172 while(--l>=0){
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
173 if(*(p+l)!=' ')
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
174 break;
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
175 }
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
176 *(p+l+1)='\0';
32
7e74a8d61b76 trunk: changeset 35
tuomov
parents: 9
diff changeset
177 }
7e74a8d61b76 trunk: changeset 35
tuomov
parents: 9
diff changeset
178
7e74a8d61b76 trunk: changeset 35
tuomov
parents: 9
diff changeset
179
64
f20d97d852ce trunk: changeset 1362
tuomov
parents: 63
diff changeset
180 const char *libtu_strcasestr(const char *str, const char *ptn)
f20d97d852ce trunk: changeset 1362
tuomov
parents: 63
diff changeset
181 {
f20d97d852ce trunk: changeset 1362
tuomov
parents: 63
diff changeset
182 const char *s2, *p2;
f20d97d852ce trunk: changeset 1362
tuomov
parents: 63
diff changeset
183 for(; *str; str++) {
f20d97d852ce trunk: changeset 1362
tuomov
parents: 63
diff changeset
184 for(s2=str, p2=ptn; ; s2++, p2++) {
f20d97d852ce trunk: changeset 1362
tuomov
parents: 63
diff changeset
185 if(!*p2)
f20d97d852ce trunk: changeset 1362
tuomov
parents: 63
diff changeset
186 return str;
f20d97d852ce trunk: changeset 1362
tuomov
parents: 63
diff changeset
187 if(toupper(*s2)!=toupper(*p2))
f20d97d852ce trunk: changeset 1362
tuomov
parents: 63
diff changeset
188 break;
f20d97d852ce trunk: changeset 1362
tuomov
parents: 63
diff changeset
189 }
f20d97d852ce trunk: changeset 1362
tuomov
parents: 63
diff changeset
190 }
f20d97d852ce trunk: changeset 1362
tuomov
parents: 63
diff changeset
191 return NULL;
f20d97d852ce trunk: changeset 1362
tuomov
parents: 63
diff changeset
192 }
f20d97d852ce trunk: changeset 1362
tuomov
parents: 63
diff changeset
193
0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
194 /* */
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
195
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
196
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
197 bool readf(FILE *f, void *buf, size_t n)
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
198 {
62
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
199 return fread(buf, 1, n, f)!=1;
0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
200 }
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
201
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
202
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
203 bool writef(FILE *f, const void *buf, size_t n)
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
204 {
62
aae5facf9fc5 trunk: changeset 1318
tuomov
parents: 53
diff changeset
205 return fwrite(buf, 1, n, f)!=1;
0
86b7f6f9c5c0 Tailorization of trunk
tailor@f281.ttorni.ton.tut.fi
parents:
diff changeset
206 }

mercurial