worth the extra complexity.
-const char actions_rcs[] = "$Id: actions.c,v 1.1 2001/05/31 21:16:46 jongfoster Exp $";
+const char actions_rcs[] = "$Id: actions.c,v 1.2 2001/05/31 21:40:00 jongfoster Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/actions.c,v $
*
* Revisions :
* $Log: actions.c,v $
+ * Revision 1.2 2001/05/31 21:40:00 jongfoster
+ * Removing some commented out, obsolete blocks of code.
+ *
* Revision 1.1 2001/05/31 21:16:46 jongfoster
* Moved functions to process the action list into this new file.
*
{
unsigned flags = action->flags;
char * result = strdup("");
- struct list_share * lst;
+ struct list * lst;
#define DEFINE_ACTION_BOOL(__name, __bit) \
if (flags & __bit) \
if (src->multi_remove_all[i])
{
/* Remove everything from dest */
- destroy_list_share(dest->multi[i]);
- list_duplicate_share(dest->multi[i], src->multi_add[i]);
+ destroy_list(dest->multi[i]);
+ list_duplicate(dest->multi[i], src->multi_add[i]);
}
else
{
- list_remove_list_share(dest->multi[i], src->multi_remove[i]);
- list_append_list_unique_share(dest->multi[i], src->multi_add[i]);
+ list_remove_list(dest->multi[i], src->multi_remove[i]);
+ list_append_list_unique(dest->multi[i], src->multi_add[i]);
}
}
}
for (i = 0; i < ACTION_MULTI_COUNT; i++)
{
- destroy_list_share(src->multi[i]);
+ destroy_list(src->multi[i]);
}
memset(src, '\0', sizeof(*src));
-const char jcc_rcs[] = "$Id: jcc.c,v 1.14 2001/05/29 20:14:01 joergs Exp $";
+const char jcc_rcs[] = "$Id: jcc.c,v 1.15 2001/05/31 21:24:47 jongfoster Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/jcc.c,v $
*
* Revisions :
* $Log: jcc.c,v $
+ * Revision 1.15 2001/05/31 21:24:47 jongfoster
+ * Changed "permission" to "action" throughout.
+ * Removed DEFAULT_USER_AGENT - it must now be specified manually.
+ * Moved vanilla wafer check into chat(), since we must now
+ * decide whether or not to add it based on the URL.
+ *
* Revision 1.14 2001/05/29 20:14:01 joergs
* AmigaOS bugfix: PCRS needs a lot of stack, stacksize for child threads
* increased.
&& (csp->action->multi[ACTION_MULTI_WAFER]->next == NULL)
&& ((csp->action->flags & ACTION_VANILLA_WAFER) != 0))
{
- enlist_share(csp->action->multi[ACTION_MULTI_WAFER], VANILLA_WAFER);
+ enlist(csp->action->multi[ACTION_MULTI_WAFER], VANILLA_WAFER);
}
#endif /* def JAR_FILES */
-const char list_rcs[] = "$Id: list.c,v NOT CHECKED IN $";
+const char list_rcs[] = "$Id: list.c,v 1.1 2001/05/31 21:11:53 jongfoster Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/list.c,v $
*
* Revisions :
* $Log: list.c,v $
+ * Revision 1.1 2001/05/31 21:11:53 jongfoster
+ * - Moved linked list support to new "list.c" file.
+ * Structure definitions are still in project.h,
+ * function prototypes are now in "list.h".
+ * - Added support for "struct list_share", which is identical
+ * to "struct list" except it saves memory by not duplicating
+ * the strings. Obviously, this only works if there is some
+ * other way of managing the memory used by the strings.
+ * (These list_share lists are used for lists which last
+ * for only 1 request, and where all the list entries are
+ * just coming directly from entries in the actionsfile.)
+ * Note that you still need to destroy list_share lists
+ * properly to free the nodes - it's only the strings
+ * which are shared.
+ *
*
*********************************************************************/
\f
*
* Function : list_append_list_unique
*
- * Description : Append a string list to another list
+ * Description : Append a string list to another list.
+ * Duplicate items are not added.
*
* Parameters :
* 1 : dest = pointer to destination for merge. Caller allocs.
}
}
-
-/*********************************************************************
- *
- * Function : destroy_list_share
- *
- * Description : Destroy a string list (opposite of enlist)
- *
- * Parameters :
- * 1 : h = pointer to list 'dummy' header
- *
- * Returns : N/A
- *
- *********************************************************************/
-void destroy_list_share(struct list_share *h)
-{
- struct list_share *p, *n;
-
- for (p = h->next; p ; p = n)
- {
- n = p->next;
- free(p);
- }
-
- memset(h, '\0', sizeof(*h));
-
-}
-
-
-/*********************************************************************
- *
- * Function : enlist_share
- *
- * Description : Append a string into a specified string list.
- *
- * Parameters :
- * 1 : header = pointer to list 'dummy' header
- * 2 : str = string to add to the list (maybe NULL)
- *
- * Returns : N/A
- *
- *********************************************************************/
-void enlist_share(struct list_share *header, const char *str)
-{
- struct list_share *cur = (struct list_share *)malloc(sizeof(*cur));
- struct list_share *last;
-
- if (cur)
- {
- cur->str = (str ? strdup(str) : NULL);
- cur->next = NULL;
-
- last = header->last;
- if (last == NULL)
- {
- last = header;
- }
-
- last->next = cur;
- header->last = cur;
- }
-
-}
-
-
-/*********************************************************************
- *
- * Function : enlist_unique_share
- *
- * Description : Append a string into a specified string list,
- * if & only if it's not there already.
- *
- * Parameters :
- * 1 : header = pointer to list 'dummy' header
- * 2 : str = string to add to the list (maybe NULL)
- *
- * Returns : N/A
- *
- *********************************************************************/
-void enlist_unique_share(struct list_share *header, const char *str)
-{
- struct list_share *last;
- struct list_share *cur = header->next;
-
- while (cur != NULL)
- {
- if ((cur->str != NULL) && (0 == strcmp(str, cur->str)))
- {
- /* Already there */
- return;
- }
- cur = cur->next;
- }
-
- cur = (struct list_share *)malloc(sizeof(*cur));
-
- if (cur != NULL)
- {
- cur->str = str;
- cur->next = NULL;
-
- last = header->last;
- if (last == NULL)
- {
- last = header;
- }
- last->next = cur;
- header->last = cur;
- }
-}
-
-
-/*********************************************************************
- *
- * Function : list_append_list_unique_share
- *
- * Description : Append a string list to another list
- *
- * Parameters :
- * 1 : dest = pointer to destination for merge. Caller allocs.
- * 2 : src = pointer to source for merge.
- *
- * Returns : N/A
- *
- *********************************************************************/
-void list_append_list_unique_share(struct list_share *dest, const struct list *src)
-{
- struct list * cur = src->next;
-
- while (cur)
- {
- enlist_unique_share(dest, cur->str);
- cur = cur->next;
- }
-}
-
-
-/*********************************************************************
- *
- * Function : list_remove_item_share
- *
- * Description : Remove a string from a specified string list.
- *
- * Parameters :
- * 1 : header = pointer to list 'dummy' header
- * 2 : str = string to remove from the list
- *
- * Returns : Number of times it was removed.
- *
- *********************************************************************/
-int list_remove_item_share(struct list_share *header, const char *str)
-{
- struct list_share *prev = header;
- struct list_share *cur = prev->next;
- int count = 0;
-
- while (cur != NULL)
- {
- if ((cur->str != NULL) && (0 == strcmp(str, cur->str)))
- {
- count++;
-
- prev->next = cur->next;
- free(cur);
- }
- else
- {
- prev = cur;
- }
- cur = prev->next;
- }
-
- header->last = prev;
-
- return count;
-}
-
-
-/*********************************************************************
- *
- * Function : list_remove_list_share
- *
- * Description : Remove all strings in one list from another list.
- * This is currently a brute-force algorithm
- * (it compares every pair of strings).
- *
- * Parameters :
- * 1 : dest = list to change
- * 2 : src = list of strings to remove
- *
- * Returns : Total number of strings removed.
- *
- *********************************************************************/
-int list_remove_list_share(struct list_share *dest, const struct list *src)
-{
- struct list *cur = src->next;
- int count = 0;
-
- while (cur != NULL)
- {
- if (cur->str != NULL)
- {
- count += list_remove_item_share(dest, cur->str);
- }
- cur = cur->next;
- }
-
- return count;
-}
-
-
-/*********************************************************************
- *
- * Function : list_duplicate_share
- *
- * Description : Duplicate a string list
- *
- * Parameters :
- * 1 : dest = pointer to destination for copy. Caller allocs.
- * 2 : src = pointer to source for copy.
- *
- * Returns : N/A
- *
- *********************************************************************/
-void list_duplicate_share(struct list_share *dest, const struct list *src)
-{
- struct list * cur_src = src->next;
- struct list_share * cur_dest = dest;
-
- memset(dest, '\0', sizeof(*dest));
-
- while (cur_src)
- {
- cur_dest = cur_dest->next = (struct list_share *)zalloc(sizeof(*cur_dest));
- if (cur_dest == NULL)
- {
- return;
- }
- cur_dest->str = cur_src->str;
- cur_src = cur_src->next;
- }
-
- dest->last = cur_dest;
-
-}
-
+/*
+ Local Variables:
+ tab-width: 3
+ end:
+*/
#ifndef _LIST_H
#define _LIST_H
-#define LIST_H_VERSION "$Id: list.h,v NOT CHECKED IN YET $"
+#define LIST_H_VERSION "$Id: list.h,v 1.1 2001/05/31 21:11:53 jongfoster Exp $"
/*********************************************************************
*
- * File : $Source: /cvsroot/ijbswa/current/list.c,v $
+ * File : $Source: /cvsroot/ijbswa/current/list.h,v $
*
* Purpose : Declares functions to handle lists.
* Functions declared include:
* Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Revisions :
- * $Log: list.c,v $
+ * $Log: list.h,v $
+ * Revision 1.1 2001/05/31 21:11:53 jongfoster
+ * - Moved linked list support to new "list.c" file.
+ * Structure definitions are still in project.h,
+ * function prototypes are now in "list.h".
+ * - Added support for "struct list_share", which is identical
+ * to "struct list" except it saves memory by not duplicating
+ * the strings. Obviously, this only works if there is some
+ * other way of managing the memory used by the strings.
+ * (These list_share lists are used for lists which last
+ * for only 1 request, and where all the list entries are
+ * just coming directly from entries in the actionsfile.)
+ * Note that you still need to destroy list_share lists
+ * properly to free the nodes - it's only the strings
+ * which are shared.
+ *
*
*********************************************************************/
\f
#endif
-extern void enlist(struct list *h, const char *s);
-extern void destroy_list(struct list *h);
+extern void enlist(struct list *h, const char *s);
+extern void enlist_unique(struct list *header, const char *str);
+
+extern void destroy_list(struct list *h);
+
extern char *list_to_text(struct list *h);
-void enlist_unique(struct list *header, const char *str);
+extern int list_remove_item(struct list *header, const char *str);
+extern int list_remove_list(struct list *header, const struct list *to_remove);
-int list_remove_item(struct list *header, const char *str);
-int list_remove_list(struct list *header, const struct list *to_remove);
+extern void list_append_list_unique(struct list *dest, const struct list *src);
-void list_duplicate(struct list *dest, const struct list *src);
-void list_append_list_unique(struct list *dest, const struct list *src);
+extern void list_duplicate(struct list *dest, const struct list *src);
-void destroy_list_share(struct list_share *h);
-void enlist_share(struct list_share *header, const char *str);
-void enlist_unique_share(struct list_share *header, const char *str);
-int list_remove_item_share(struct list_share *header, const char *str);
-int list_remove_list_share(struct list_share *dest, const struct list *src);
-void list_duplicate_share(struct list_share *dest, const struct list *src);
-void list_append_list_unique_share(struct list_share *dest, const struct list *src);
/* Revision control strings from this header and associated .c file */
extern const char list_rcs[];
-const char parsers_rcs[] = "$Id: parsers.c,v 1.12 2001/05/31 17:33:13 oes Exp $";
+const char parsers_rcs[] = "$Id: parsers.c,v 1.13 2001/05/31 21:30:33 jongfoster Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/parsers.c,v $
*
* Revisions :
* $Log: parsers.c,v $
+ * Revision 1.13 2001/05/31 21:30:33 jongfoster
+ * Removed list code - it's now in list.[ch]
+ * Renamed "permission" to "action", and changed many features
+ * to use the actions file rather than the global config.
+ *
* Revision 1.12 2001/05/31 17:33:13 oes
*
* CRLF -> LF
void client_cookie_adder(struct client_state *csp)
{
struct list *lst;
- struct list_share *lsts;
char *tmp = NULL;
char *e;
tmp = strsav(tmp, lst->str);
}
- for (lsts = csp->action->multi[ACTION_MULTI_WAFER]->next; lsts ; lsts = lsts->next)
+ for (lst = csp->action->multi[ACTION_MULTI_WAFER]->next; lst ; lst = lst->next)
{
if (tmp)
{
tmp = strsav(tmp, "; ");
}
- if ((e = cookie_encode(lsts->str)))
+ if ((e = cookie_encode(lst->str)))
{
tmp = strsav(tmp, e);
freez(e);
*********************************************************************/
void client_xtra_adder(struct client_state *csp)
{
- struct list_share *l = csp->action->multi[ACTION_MULTI_ADD_HEADER];
+ struct list *lst = csp->action->multi[ACTION_MULTI_ADD_HEADER];
- for (l = l->next; l ; l = l->next)
+ for (lst = lst->next; lst ; lst = lst->next)
{
- log_error(LOG_LEVEL_HEADER, "addh: %s", l->str);
- enlist(csp->headers, l->str);
+ log_error(LOG_LEVEL_HEADER, "addh: %s", lst->str);
+ enlist(csp->headers, lst->str);
}
}
#ifndef _PROJECT_H
#define _PROJECT_H
-#define PROJECT_H_VERSION "$Id: project.h,v 1.10 2001/05/31 21:33:53 jongfoster Exp $"
+#define PROJECT_H_VERSION "$Id: project.h,v 1.11 2001/06/01 10:32:47 oes Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/project.h,v $
*
* Revisions :
* $Log: project.h,v $
+ * Revision 1.11 2001/06/01 10:32:47 oes
+ * Added constants for anchoring selection bitmap
+ *
* Revision 1.10 2001/05/31 21:33:53 jongfoster
* Changes for new actions file, replacing permissionsfile
* and parts of the config file. Also added support for
};
-/* Generic linked list of strings */
-struct list_share /* FIXME: Why not separate entries and header? */
-{
- const char * str; /* valid in an entry */
- struct list_share *last; /* valid in header */
- struct list_share *next;
-};
-
-
/* A URL pattern */
struct url_spec
{
char * string[ACTION_STRING_COUNT];
/* Strings to add */
- struct list_share multi[ACTION_MULTI_COUNT][1];
+ struct list multi[ACTION_MULTI_COUNT][1];
};
struct action_spec