-const char actions_rcs[] = "$Id: actions.c,v 1.21 2002/01/17 20:54:44 jongfoster Exp $";
+const char actions_rcs[] = "$Id: actions.c,v 1.22 2002/01/21 00:27:02 jongfoster Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/actions.c,v $
*
* Revisions :
* $Log: actions.c,v $
+ * Revision 1.22 2002/01/21 00:27:02 jongfoster
+ * Allowing free_action(NULL).
+ * Moving the functions that #include actionlist.h to the end of the file,
+ * because the Visual C++ 97 debugger gets extremely confused if you try
+ * to debug any code that comes after them in the file.
+ *
* Revision 1.21 2002/01/17 20:54:44 jongfoster
* Renaming free_url to free_url_spec, since it frees a struct url_spec.
*
{
/* append multi string. */
- struct list * remove = cur_action->multi_remove[action->index];
- struct list * add = cur_action->multi_add[action->index];
+ struct list * remove_p = cur_action->multi_remove[action->index];
+ struct list * add_p = cur_action->multi_add[action->index];
if ((value == NULL) || (*value == '\0'))
{
return JB_ERR_PARSE;
}
- list_remove_item(remove, value);
- err = enlist_unique(add, value, 0);
+ list_remove_item(remove_p, value);
+ err = enlist_unique(add_p, value, 0);
if (err)
{
return err;
{
/* remove multi string. */
- struct list * remove = cur_action->multi_remove[action->index];
- struct list * add = cur_action->multi_add[action->index];
+ struct list * remove_p = cur_action->multi_remove[action->index];
+ struct list * add_p = cur_action->multi_add[action->index];
if ( (value == NULL) || (*value == '\0')
|| ((*value == '*') && (value[1] == '\0')) )
*
* Remove *ALL*.
*/
- list_remove_all(remove);
- list_remove_all(add);
+ list_remove_all(remove_p);
+ list_remove_all(add_p);
cur_action->multi_remove_all[action->index] = 1;
}
else
if ( !cur_action->multi_remove_all[action->index] )
{
/* there isn't a catch-all in the remove list already */
- err = enlist_unique(remove, value, 0);
+ err = enlist_unique(remove_p, value, 0);
if (err)
{
return err;
}
}
- list_remove_item(add, value);
+ list_remove_item(add_p, value);
}
break;
}
-const char cgiedit_rcs[] = "$Id: cgiedit.c,v 1.14 2002/03/05 00:24:51 jongfoster Exp $";
+const char cgiedit_rcs[] = "$Id: cgiedit.c,v 1.15 2002/03/06 22:54:35 jongfoster Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/cgiedit.c,v $
*
* Revisions :
* $Log: cgiedit.c,v $
+ * Revision 1.15 2002/03/06 22:54:35 jongfoster
+ * Automated function-comment nitpicking.
+ *
* Revision 1.14 2002/03/05 00:24:51 jongfoster
* Patch to always edit the current actions file.
*
static jb_err map_radio(struct map * exports,
const char * optionname,
const char * values,
- char value);
+ int value);
static jb_err actions_to_radio(struct map * exports,
const struct action_spec *action);
static jb_err actions_from_radio(const struct map * parameters,
/* Allocate new memory for string */
len = strlen(cur_line->unprocessed);
- if (NULL == (str = malloc(len + 1 + numhash)))
+ if (NULL == (str = malloc((size_t) len + 1 + numhash)))
{
/* Uh oh, just trashed file! */
fclose(fp);
*********************************************************************/
static int match_actions_file_header_line(const char * line, const char * name)
{
- int len;
+ size_t len;
assert(line);
assert(name);
{
const char * name_end;
const char * value_start;
- int name_len;
+ size_t name_len;
assert(line);
assert(pname);
jb_err edit_parse_actions_file(struct editable_file * file)
{
struct file_line * cur_line;
- int len;
+ size_t len;
const char * text; /* Text from a line */
char * name; /* For lines of the form name=value */
char * value; /* For lines of the form name=value */
assert(name);
assert(pvalue);
- *pvalue = -1;
+ *pvalue = 0;
param = lookup(parameters, name);
if (!*param)
*pvalue = value;
return JB_ERR_OK;
+
}
static jb_err map_radio(struct map * exports,
const char * optionname,
const char * values,
- char value)
+ int value)
{
- int len;
+ size_t len;
char * buf;
char * p;
char c;
unsigned sectionid;
char * actiontext;
char * newtext;
- int len;
+ size_t len;
struct editable_file * file;
struct file_line * cur_line;
unsigned line_number;
-const char deanimate_rcs[] = "$Id: deanimate.c,v 1.4 2001/07/18 12:28:49 oes Exp $";
+const char deanimate_rcs[] = "$Id: deanimate.c,v 1.5 2001/09/10 10:16:06 oes Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/deanimate.c,v $
*
* Revisions :
* $Log: deanimate.c,v $
+ * Revision 1.5 2001/09/10 10:16:06 oes
+ * Silenced compiler warnings
+ *
* Revision 1.4 2001/07/18 12:28:49 oes
* - Added feature for extracting the first frame
* to gif_deanimate
* Returns : 0 on success, 1 on failiure.
*
*********************************************************************/
-int buf_extend(struct binbuffer *buf, int length)
+int buf_extend(struct binbuffer *buf, size_t length)
{
char *newbuf;
* Returns : 0 on success, 1 on failiure.
*
*********************************************************************/
-int buf_copy(struct binbuffer *src, struct binbuffer *dst, int length)
+int buf_copy(struct binbuffer *src, struct binbuffer *dst, size_t length)
{
/*
*/
if (c & 0x80)
{
- if (buf_copy(src, dst, 3 * (1 << ((c & 0x07) + 1))))
+ if (buf_copy(src, dst, (size_t) 3 * (1 << ((c & 0x07) + 1))))
{
return 1;
}
*/
while((c = buf_getbyte(src, 0)))
{
- if (buf_copy(src, dst, c + 1)) return 1;
+ if (buf_copy(src, dst, (size_t) c + 1)) return 1;
}
if (buf_copy(src, dst, 1)) return 1;
/*
* Trim and rewind the dst buffer
*/
- if (NULL == (dst->buffer = (char *)realloc(dst->buffer, dst->offset))) return 1;
+ if (NULL == (dst->buffer = (char *)realloc(dst->buffer, (size_t) dst->offset))) return 1;
dst->size = dst->offset;
dst->offset = 0;
*/
if(c & 0x80)
{
- if (buf_copy(src, dst, 3 * (1 << ((c & 0x07) + 1))))
+ if (buf_copy(src, dst, (size_t) 3 * (1 << ((c & 0x07) + 1))))
{
return 1;
}
#ifndef DEANIMATE_H_INCLUDED
#define DEANIMATE_H_INCLUDED
-#define DEANIMATE_H_VERSION "$Id: deanimate.h,v 1.3 2001/07/18 12:29:05 oes Exp $"
+#define DEANIMATE_H_VERSION "$Id: deanimate.h,v 1.4 2001/07/29 18:50:04 jongfoster Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/deanimate.h,v $
*
* Revisions :
* $Log: deanimate.h,v $
+ * Revision 1.4 2001/07/29 18:50:04 jongfoster
+ * Fixing "extern C" block, and renaming #define _DEANIMATE_H
+ *
* Revision 1.3 2001/07/18 12:29:05 oes
* Updated prototype for gif_deanimate
*
{
char *buffer;
int offset;
- int size;
+ size_t size;
};
/*
-const char errlog_rcs[] = "$Id: errlog.c,v 1.30 2002/03/05 22:43:45 david__schmidt Exp $";
+const char errlog_rcs[] = "$Id: errlog.c,v 1.31 2002/03/06 23:02:57 jongfoster Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/errlog.c,v $
*
* Revisions :
* $Log: errlog.c,v $
+ * Revision 1.31 2002/03/06 23:02:57 jongfoster
+ * Removing tabs
+ *
* Revision 1.30 2002/03/05 22:43:45 david__schmidt
* - Better error reporting on OS/2
* - Fix double-slash comment (oops)
outc += ival;
if (outc < BUFFER_SIZE-1)
{
- memcpy(outbuf + oldoutc, sval, ival);
+ memcpy(outbuf + oldoutc, sval, (size_t) ival);
}
else
{
-const char list_rcs[] = "$Id: list.c,v 1.11 2001/10/23 21:21:03 jongfoster Exp $";
+const char list_rcs[] = "$Id: list.c,v 1.12 2001/10/25 03:40:48 david__schmidt Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/list.c,v $
*
* Revisions :
* $Log: list.c,v $
+ * Revision 1.12 2001/10/25 03:40:48 david__schmidt
+ * Change in porting tactics: OS/2's EMX porting layer doesn't allow multiple
+ * threads to call select() simultaneously. So, it's time to do a real, live,
+ * native OS/2 port. See defines for __EMX__ (the porting layer) vs. __OS2__
+ * (native). Both versions will work, but using __OS2__ offers multi-threading.
+ *
* Revision 1.11 2001/10/23 21:21:03 jongfoster
* New error handling - error codes are now jb_errs, not ints.
* Changed the way map() handles out-of-memory, to dramatically
*
*********************************************************************/
jb_err enlist_unique(struct list *the_list, const char *str,
- int num_significant_chars)
+ size_t num_significant_chars)
{
struct list_entry *cur_entry;
assert(list_is_valid(the_list));
assert(str);
assert(num_significant_chars >= 0);
- assert((size_t)num_significant_chars <= strlen(str));
+ assert(num_significant_chars <= strlen(str));
if (num_significant_chars > 0)
{
jb_err enlist_unique_header(struct list *the_list, const char *name,
const char *value)
{
- int length;
+ size_t length;
jb_err result;
char *str;
assert(list_is_valid(the_list));
return result;
+
}
struct list_entry *cur_entry;
char *ret = NULL;
char *s;
- int size = 2;
+ size_t size = 2;
assert(the_list);
assert(list_is_valid(the_list));
#ifndef LIST_H_INCLUDED
#define LIST_H_INCLUDED
-#define LIST_H_VERSION "$Id: list.h,v 1.8 2001/09/16 17:30:24 jongfoster Exp $"
+#define LIST_H_VERSION "$Id: list.h,v 1.9 2001/10/23 21:21:03 jongfoster Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/list.h,v $
*
* Revisions :
* $Log: list.h,v $
+ * Revision 1.9 2001/10/23 21:21:03 jongfoster
+ * New error handling - error codes are now jb_errs, not ints.
+ * Changed the way map() handles out-of-memory, to dramatically
+ * reduce the amount of error-checking clutter needed.
+ *
* Revision 1.8 2001/09/16 17:30:24 jongfoster
* Fixing a compiler warning.
*
extern void destroy_list (struct list *the_list);
extern jb_err enlist (struct list *the_list, const char *str);
-extern jb_err enlist_unique (struct list *the_list, const char *str, int num_significant_chars);
+extern jb_err enlist_unique (struct list *the_list, const char *str, size_t num_significant_chars);
extern jb_err enlist_unique_header (struct list *the_list, const char *name, const char *value);
extern jb_err enlist_first (struct list *the_list, const char *str);
extern jb_err list_append_list_unique(struct list *dest, const struct list *src);
-const char loaders_rcs[] = "$Id: loaders.c,v 1.37 2002/03/03 15:07:49 oes Exp $";
+const char loaders_rcs[] = "$Id: loaders.c,v 1.38 2002/03/06 22:54:35 jongfoster Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/loaders.c,v $
*
* Revisions :
* $Log: loaders.c,v $
+ * Revision 1.38 2002/03/06 22:54:35 jongfoster
+ * Automated function-comment nitpicking.
+ *
* Revision 1.37 2002/03/03 15:07:49 oes
* Re-enabled automatic config reloading
*
jb_err simple_read_line(FILE *fp, char **dest, int *newline)
{
int len = 0;
- int buflen = BUFFER_SIZE;
+ size_t buflen = BUFFER_SIZE;
char * buf;
char * p;
int ch;
* Otherwise, returns buf.
*
*********************************************************************/
-char *read_config_line(char *buf, int buflen, FILE *fp, unsigned long *linenum)
+char *read_config_line(char *buf, size_t buflen, FILE *fp, unsigned long *linenum)
{
jb_err err;
char *buf2 = NULL;
else
{
assert(buf2);
- assert(strlen(buf2) + 1U < (unsigned)buflen);
+ assert(strlen(buf2) + 1U < buflen);
strncpy(buf, buf2, buflen - 1);
free(buf2);
buf[buflen - 1] = '\0';
#ifndef LOADERS_H_INCLUDED
#define LOADERS_H_INCLUDED
-#define LOADERS_H_VERSION "$Id: loaders.h,v 1.14 2002/01/17 21:03:08 jongfoster Exp $"
+#define LOADERS_H_VERSION "$Id: loaders.h,v 1.15 2002/01/22 23:46:18 jongfoster Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/loaders.h,v $
*
* Revisions :
* $Log: loaders.h,v $
+ * Revision 1.15 2002/01/22 23:46:18 jongfoster
+ * Moving edit_read_line() and simple_read_line() to loaders.c, and
+ * extending them to support reading MS-DOS, Mac and UNIX style files
+ * on all platforms.
+ *
+ * Modifying read_config_line() (without changing it's prototype) to
+ * be a trivial wrapper for edit_read_line(). This means that we have
+ * one function to read a line and handle comments, which is common
+ * between the initialization code and the edit interface.
+ *
* Revision 1.14 2002/01/17 21:03:08 jongfoster
* Moving all our URL and URL pattern parsing code to urlmatch.c.
*
struct url_spec;
extern void sweep(void);
-extern char *read_config_line(char *buf, int buflen, FILE *fp, unsigned long *linenum);
+extern char *read_config_line(char *buf, size_t buflen, FILE *fp, unsigned long *linenum);
extern int check_file_changed(const struct file_list * current,
const char * filename,
struct file_list ** newfl);
#ifndef MISCUTIL_H_INCLUDED
#define MISCUTIL_H_INCLUDED
-#define MISCUTIL_H_VERSION "$Id: miscutil.h,v 1.16 2002/01/21 00:53:36 jongfoster Exp $"
+#define MISCUTIL_H_VERSION "$Id: miscutil.h,v 1.17 2002/03/04 18:28:32 oes Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/miscutil.h,v $
*
* Revisions :
* $Log: miscutil.h,v $
+ * Revision 1.17 2002/03/04 18:28:32 oes
+ * Deleted deletePidFile, played syleguide police
+ *
* Revision 1.16 2002/01/21 00:53:36 jongfoster
* Adding string_join()
*
#endif
extern const char *basedir;
-extern void *zalloc(int size);
+extern void *zalloc(size_t size);
#if defined(unix)
extern void write_pid_file(void);
extern char *chomp(char *string);
extern int simplematch(char *pattern, char *text);
-extern char *bindup(const char *string, int n);
+extern char *bindup(const char *string, size_t len);
extern char *make_path(const char * dir, const char * file);
#ifndef PARSERS_H_INCLUDED
#define PARSERS_H_INCLUDED
-#define PARSERS_H_VERSION "$Id: parsers.h,v 1.19 2002/01/17 21:03:47 jongfoster Exp $"
+#define PARSERS_H_VERSION "$Id: parsers.h,v 1.20 2002/02/20 23:15:13 jongfoster Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/parsers.h,v $
*
* Revisions :
* $Log: parsers.h,v $
+ * Revision 1.20 2002/02/20 23:15:13 jongfoster
+ * Parsing functions now handle out-of-memory gracefully by returning
+ * an error code.
+ *
* Revision 1.19 2002/01/17 21:03:47 jongfoster
* Moving all our URL and URL pattern parsing code to urlmatch.c.
*
extern const add_header_func_ptr add_client_headers[];
extern const add_header_func_ptr add_server_headers[];
-extern int flush_socket(int fd, struct client_state *csp);
-extern int add_to_iob(struct client_state *csp, char *buf, int n);
+extern size_t flush_socket(int fd, struct client_state *csp);
+extern size_t add_to_iob(struct client_state *csp, char *buf, size_t n);
extern char *get_header(struct client_state *csp);
extern char *get_header_value(const struct list *header_list, const char *header_name);
extern char *sed(const struct parsers pats[], const add_header_func_ptr more_headers[], struct client_state *csp);
#ifndef PROJECT_H_INCLUDED
#define PROJECT_H_INCLUDED
-#define PROJECT_H_VERSION "$Id: project.h,v 1.50 2002/03/04 19:32:07 oes Exp $"
+#define PROJECT_H_VERSION "$Id: project.h,v 1.51 2002/03/05 04:52:42 oes Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/project.h,v $
*
* Revisions :
* $Log: project.h,v $
+ * Revision 1.51 2002/03/05 04:52:42 oes
+ * Deleted non-errlog debugging code
+ *
* Revision 1.50 2002/03/04 19:32:07 oes
* Changed default port to 8118
*
int dcount; /* How many parts to this domain? (length of dvec) */
};
-/* Response generated by CGI, blocker, or error handler */
+/*
+ * Response generated by CGI, blocker, or error handler
+ */
struct http_response
{
- char *status; /* HTTP status (string)*/
+ char *status; /* HTTP status (string) */
struct list headers[1]; /* List of header lines */
- char *head; /* Formatted http response head */
- int head_length; /* Length of http response head */
- char *body; /* HTTP document body */
- int content_length; /* Length of body, REQUIRED if binary body */
- int is_static; /* Nonzero if the content will never change and
- * should be cached by the broser (e.g. images) */
+ char *head; /* Formatted http response head */
+ size_t head_length; /* Length of http response head */
+ char *body; /* HTTP document body */
+ size_t content_length; /* Length of body, REQUIRED if binary body */
+ int is_static; /* Nonzero if the content will never change and
+ * should be cached by the brwoser (e.g. images) */
};
/* A URL pattern */
*/
struct parsers
{
- char *str;
- char len;
+ char *str;
+ size_t len;
parser_func_ptr parser;
};
-const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.2 2002/01/21 00:14:09 jongfoster Exp $";
+const char urlmatch_rcs[] = "$Id: urlmatch.c,v 1.3 2002/03/03 14:51:11 oes Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/urlmatch.c,v $
*
* Revisions :
* $Log: urlmatch.c,v $
+ * Revision 1.3 2002/03/03 14:51:11 oes
+ * Fixed CLF logging: Added ocmd member for client's request to struct http_request
+ *
* Revision 1.2 2002/01/21 00:14:09 jongfoster
* Correcting comment style
* Fixing an uninitialized memory bug in create_url_spec()
*/
{
char *vec[BUFFER_SIZE];
- int size;
+ size_t size;
char *p;
http->dbuffer = strdup(http->host);
if (buf[0] != '\0')
{
char *v[150];
- int size;
+ size_t size;
/* Parse domain part */
if (buf[strlen(buf) - 1] == '.')