/*
- * Copyright (C) 1994, Index Data I/S
+ * Copyright (C) 1994-1999, Index Data
* All rights reserved.
* Sebastian Hammer, Adam Dickmeiss
*
* $Log: res.c,v $
- * Revision 1.21 1997-11-18 10:04:03 adam
+ * Revision 1.24 1999-02-02 14:51:42 adam
+ * Updated WIN32 code specific sections. Changed header.
+ *
+ * Revision 1.23 1998/10/28 15:18:55 adam
+ * Fix for DOS-formatted configuration files.
+ *
+ * Revision 1.22 1998/01/12 15:04:32 adam
+ * Removed exit - call.
+ *
+ * Revision 1.21 1997/11/18 10:04:03 adam
* Function res_trav returns number of 'hits'.
*
* Revision 1.20 1997/10/31 12:39:15 adam
#include <stdlib.h>
#include <string.h>
#include <assert.h>
-#ifdef WINDOWS
+#ifdef WIN32
#include <io.h>
#else
#include <unistd.h>
fr = fopen (r->name, "r");
if (!fr)
{
- logf (LOG_FATAL|LOG_ERRNO, "Cannot open %s", r->name);
- exit (1);
+ logf (LOG_WARN|LOG_ERRNO, "Cannot open %s", r->name);
+ return ;
}
while (1)
{
val_size = 0;
while (1)
{
- if (fr_buf[no] == '\0' || fr_buf[no] == '\n')
+ if (fr_buf[no] == '\0' || strchr("\n\r\f", fr_buf[no]))
{
while (val_size > 0 &&
(val_buf[val_size-1] == ' ' ||
resp->name, resp->value);
break;
}
- else if (fr_buf[no] == '\\' && fr_buf[no+1] == '\n')
+ else if (fr_buf[no] == '\\' && strchr ("\n\r\f", fr_buf[no+1]))
{
line = fgets (fr_buf, sizeof(fr_buf)-1, fr);
if (!line)
Res res_open (const char *name)
{
Res r;
-#ifdef WINDOWS
+#ifdef WIN32
if (access (name, 4))
#else
if (access (name, R_OK))
#endif
- logf (LOG_LOG|LOG_ERRNO, "Cannot access `%s'", name);
+ {
+ logf (LOG_LOG|LOG_ERRNO, "Cannot access resource file `%s'", name);
+ return NULL;
+ }
r = xmalloc (sizeof(*r));
r->init = 0;
r->first = r->last = NULL;