* to catch it now.
*/
filename = make_filename(INDEX_SESSIONDIR, NULL);
- if (!mkdir(filename, 0700)) {
+ if (mkdir(filename, 0700) != 0) {
char *filename2 = make_filename(INDEX_DIR, NULL);
mkdir(filename2, 0700);
sfree(filename2);
* FIXME: the above comment is a bit out of date. Did it happen?
*/
-struct keyval {
+struct skeyval {
const char *key;
const char *value;
};
int keycmp(void *av, void *bv)
{
- struct keyval *a = (struct keyval *)av;
- struct keyval *b = (struct keyval *)bv;
+ struct skeyval *a = (struct skeyval *)av;
+ struct skeyval *b = (struct skeyval *)bv;
return strcmp(a->key, b->key);
}
void provide_xrm_string(char *string)
{
char *p, *q, *key;
- struct keyval *xrms, *ret;
+ struct skeyval *xrms, *ret;
p = q = strchr(string, ':');
if (!q) {
q++;
while (p > string && p[-1] != '.' && p[-1] != '*')
p--;
- xrms = snew(struct keyval);
+ xrms = snew(struct skeyval);
key = snewn(q-p, char);
memcpy(key, p, q-p);
key[q-p-1] = '\0';
const char *get_setting(const char *key)
{
- struct keyval tmp, *ret;
+ struct skeyval tmp, *ret;
tmp.key = key;
if (xrmtree) {
ret = find234(xrmtree, &tmp, NULL);
while ( (line = fgetline(fp)) ) {
char *value = strchr(line, '=');
- struct keyval *kv;
+ struct skeyval *kv;
if (!value)
continue;
*value++ = '\0';
value[strcspn(value, "\r\n")] = '\0'; /* trim trailing NL */
- kv = snew(struct keyval);
+ kv = snew(struct skeyval);
kv->key = dupstr(line);
kv->value = dupstr(value);
add234(ret, kv);
{
tree234 *tree = (tree234 *)handle;
const char *val;
- struct keyval tmp, *kv;
+ struct skeyval tmp, *kv;
tmp.key = key;
if (tree != NULL &&
{
tree234 *tree = (tree234 *)handle;
const char *val;
- struct keyval tmp, *kv;
+ struct skeyval tmp, *kv;
tmp.key = key;
if (tree != NULL &&
void close_settings_r(void *handle)
{
tree234 *tree = (tree234 *)handle;
- struct keyval *kv;
+ struct skeyval *kv;
if (!tree)
return;
fname = make_filename(INDEX_RANDSEED, NULL);
fd = open(fname, O_RDONLY);
sfree(fname);
- if (fd) {
+ if (fd >= 0) {
char buf[512];
int ret;
while ( (ret = read(fd, buf, sizeof(buf))) > 0)