|
Lines 30-35
Link Here
|
| 30 |
#include <sys/time.h> |
30 |
#include <sys/time.h> |
| 31 |
#include <time.h> |
31 |
#include <time.h> |
| 32 |
#include <sys/wait.h> |
32 |
#include <sys/wait.h> |
|
|
33 |
#include <stdint.h> |
| 33 |
|
34 |
|
| 34 |
#include <expat.h> |
35 |
#include <expat.h> |
| 35 |
|
36 |
|
|
Lines 70-83
Link Here
|
| 70 |
if (!strcmp("preferences", name)) { |
71 |
if (!strcmp("preferences", name)) { |
| 71 |
while (atts[i]) { |
72 |
while (atts[i]) { |
| 72 |
if (!strcmp("nick", atts[i])) { |
73 |
if (!strcmp("nick", atts[i])) { |
|
|
74 |
free(prefs->nick); |
| 73 |
prefs->nick = strdup(atts[i+1]); |
75 |
prefs->nick = strdup(atts[i+1]); |
| 74 |
} else if (!strcmp("url", atts[i])) { |
76 |
} else if (!strcmp("url", atts[i])) { |
|
|
77 |
free(prefs->url); |
| 75 |
prefs->url = strdup(atts[i+1]); |
78 |
prefs->url = strdup(atts[i+1]); |
| 76 |
} else if (!strcmp("password", atts[i])) { |
79 |
} else if (!strcmp("password", atts[i])) { |
|
|
80 |
free(prefs->password); |
| 77 |
prefs->password = strdup(atts[i+1]); |
81 |
prefs->password = strdup(atts[i+1]); |
| 78 |
} else if (!strcmp("video_driver", atts[i])) { |
82 |
} else if (!strcmp("video_driver", atts[i])) { |
|
|
83 |
free(prefs->video_driver); |
| 79 |
prefs->video_driver = strdup(atts[i+1]); |
84 |
prefs->video_driver = strdup(atts[i+1]); |
| 80 |
} else if (!strcmp("uid", atts[i])) { |
85 |
} else if (!strcmp("uid", atts[i])) { |
|
|
86 |
free(prefs->uid); |
| 81 |
prefs->uid = strdup(atts[i+1]); |
87 |
prefs->uid = strdup(atts[i+1]); |
| 82 |
} else if (!strcmp("cache", atts[i])) { |
88 |
} else if (!strcmp("cache", atts[i])) { |
| 83 |
prefs->cache_size = atoi(atts[i+1]); |
89 |
prefs->cache_size = atoi(atts[i+1]); |
|
Lines 168-174
Link Here
|
| 168 |
/* 64 random bits encoded as ascii */ |
174 |
/* 64 random bits encoded as ascii */ |
| 169 |
void make_uniqueid(prefs_t *prefs) { |
175 |
void make_uniqueid(prefs_t *prefs) { |
| 170 |
static char *rdevice = "/dev/urandom"; |
176 |
static char *rdevice = "/dev/urandom"; |
| 171 |
unsigned long d[2]; |
177 |
uint32_t d[2]; |
| 172 |
int rfd; |
178 |
int rfd; |
| 173 |
struct timeval tv; |
179 |
struct timeval tv; |
| 174 |
char ub[17]; |
180 |
char ub[17]; |
|
Lines 190-204
Link Here
|
| 190 |
d[0] ^= tv.tv_sec; |
196 |
d[0] ^= tv.tv_sec; |
| 191 |
d[1] ^= tv.tv_usec; |
197 |
d[1] ^= tv.tv_usec; |
| 192 |
snprintf(ub, 17, "%08lX%08lX", d[0], d[1]); |
198 |
snprintf(ub, 17, "%08lX%08lX", d[0], d[1]); |
|
|
199 |
free(prefs->uid); |
| 193 |
prefs->uid = strdup(ub); |
200 |
prefs->uid = strdup(ub); |
| 194 |
} |
201 |
} |
| 195 |
|
202 |
|
| 196 |
void default_rc(prefs_t *prefs) { |
203 |
void default_rc(prefs_t *prefs) { |
| 197 |
prefs->nick = ""; |
204 |
free(prefs->nick); |
| 198 |
prefs->url = ""; |
205 |
prefs->nick = strdup(""); |
| 199 |
prefs->password = ""; |
206 |
free(prefs->url); |
|
|
207 |
prefs->url = strdup(""); |
| 208 |
free(prefs->password); |
| 209 |
prefs->password = strdup(""); |
| 200 |
prefs->cache_size = 2000; |
210 |
prefs->cache_size = 2000; |
| 201 |
prefs->video_driver = ""; |
211 |
free(prefs->video_driver); |
|
|
212 |
prefs->video_driver = strdup(""); |
| 202 |
make_uniqueid(prefs); |
213 |
make_uniqueid(prefs); |
| 203 |
prefs->frame_rate = 23.0; |
214 |
prefs->frame_rate = 23.0; |
| 204 |
prefs->nrepeats = 2; |
215 |
prefs->nrepeats = 2; |