-const char loaders_rcs[] = "$Id: loaders.c,v 1.9 2001/05/26 17:12:07 jongfoster Exp $";
+const char loaders_rcs[] = "$Id: loaders.c,v 1.10 2001/05/29 09:50:24 jongfoster Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/loaders.c,v $
*
* Revisions :
* $Log: loaders.c,v $
+ * Revision 1.10 2001/05/29 09:50:24 jongfoster
+ * Unified blocklist/imagelist/permissionslist.
+ * File format is still under discussion, but the internal changes
+ * are (mostly) done.
+ *
+ * Also modified interceptor behaviour:
+ * - We now intercept all URLs beginning with one of the following
+ * prefixes (and *only* these prefixes):
+ * * http://i.j.b/
+ * * http://ijbswa.sf.net/config/
+ * * http://ijbswa.sourceforge.net/config/
+ * - New interceptors "home page" - go to http://i.j.b/ to see it.
+ * - Internal changes so that intercepted and fast redirect pages
+ * are not replaced with an image.
+ * - Interceptors now have the option to send a binary page direct
+ * to the client. (i.e. ijb-send-banner uses this)
+ * - Implemented show-url-info interceptor. (Which is why I needed
+ * the above interceptors changes - a typical URL is
+ * "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif".
+ * The previous mechanism would not have intercepted that, and
+ * if it had been intercepted then it then it would have replaced
+ * it with an image.)
+ *
* Revision 1.9 2001/05/26 17:12:07 jongfoster
* Fatal errors loading configuration files now give better error messages.
*
}
}
- /* Trim leading whitespace */
- p = linebuf;
- while (*p && ijb_isspace(*p))
- {
- p++;
- }
+ /* Remove leading and trailing whitespace */
+ chomp(linebuf);
- if (*p)
+ if (*linebuf)
{
- /* There is something other than whitespace on the line. */
-
- /* Move the data to the start of buf */
- if (p != linebuf)
- {
- /* strcpy that can cope with overlap. */
- q = linebuf;
- while ((*q++ = *p++) != '\0')
- {
- /* Do nothing */
- }
- }
-
- /* Trim trailing whitespace */
- p = linebuf + strlen(linebuf) - 1;
-
- /*
- * Note: the (p >= linebuf) below is paranoia, it's not really needed.
- * When p == linebuf then ijb_isspace(*p) will be false and we'll drop
- * out of the loop.
- */
- while ((p >= linebuf) && ijb_isspace(*p))
+ strncat(buf, linebuf, buflen - strlen(buf));
+ if (contflag)
{
- p--;
+ contflag = 0;
+ continue;
}
- p[1] = '\0';
-
- /* More paranoia. This if statement is always true. */
- if (*linebuf)
+ else
{
- strncat(buf, linebuf, buflen - strlen(buf));
- if (contflag)
- {
- contflag = 0;
- continue;
- }
- else
- {
- return buf;
- }
+ return buf;
}
}
}
-
/* EOF */
return NULL;
+
}
}
/* Trim leading and trailing whitespace. */
- while ((*end == ' ') || (*end == '\t'))
- {
- /*
- * don't need to worry about going off front of string
- * because we know there's a '{' there.
- */
- end--;
- }
end[1] = '\0';
- while ((*start == ' ') || (*start == '\t'))
- {
- start++;
- }
+ chomp(start);
if (*start == '\0')
{
return 1; /* never get here */
}
- /* Trim leading and trailing whitespace. */
- while ((*end == ' ') || (*end == '\t'))
- {
- /*
- * don't need to worry about going off front of string
- * because we know there's a '{' there.
- */
- end--;
- }
end[1] = '\0';
- while ((*start == ' ') || (*start == '\t'))
- {
- start++;
- }
+ chomp(start);
if (*start == '\0')
{