CF_INT("BorderBonus", &image_sig_border_bonus),
CF_DOUBLE_ARY("InertiaScale", image_sig_inertia_scale, 3),
CF_DOUBLE("TexturedThreshold", &image_sig_textured_threshold),
- CF_LOOKUP("CompareMethod", &image_sig_compare_method, ((byte *[]){"integrated", "fuzzy", "average", NULL})),
+ CF_LOOKUP("CompareMethod", &image_sig_compare_method, ((char *[]){"integrated", "fuzzy", "average", NULL})),
CF_UNS_ARY("CompareFeaturesWeights", image_sig_cmp_features_weights, IMAGE_REG_F + IMAGE_REG_H),
CF_END
}
return mp_alloc_zero(cf_pool, size);
}
-byte *
-cf_strdup(byte *s)
+char *
+cf_strdup(const char *s)
{
return mp_strdup(cf_pool, s);
}
-byte *
-cf_printf(char *fmt, ...)
+char *
+cf_printf(const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
- byte *res = mp_vprintf(cf_pool, fmt, args);
+ char *res = mp_vprintf(cf_pool, fmt, args);
va_end(args);
return res;
}
else
bprintf(fb, "NULL ");
break;
- case CT_LOOKUP: bprintf(fb, "%s ", *(int*)ptr >= 0 ? u->lookup[ *(int*)ptr ] : (byte*) "???"); break;
+ case CT_LOOKUP: bprintf(fb, "%s ", *(int*)ptr >= 0 ? u->lookup[ *(int*)ptr ] : "???"); break;
case CT_USER:
if (u->utype->dumper)
u->utype->dumper(fb, ptr);
static void dump_section(struct fastbuf *fb, struct cf_section *sec, int level, void *ptr);
-static byte *class_names[] = { "end", "static", "dynamic", "parser", "section", "list", "bitmap" };
+static char *class_names[] = { "end", "static", "dynamic", "parser", "section", "list", "bitmap" };
static void
dump_item(struct fastbuf *fb, struct cf_item *item, int level, void *ptr)
/* Text file parser */
-static const byte *name_parse_fb;
+static const char *name_parse_fb;
static struct fastbuf *parse_fb;
static uns line_num;
#define MAX_LINE 4096
-static byte line_buf[MAX_LINE];
-static byte *line = line_buf;
+static char line_buf[MAX_LINE];
+static char *line = line_buf;
#include "lib/bbuf.h"
static bb_t copy_buf;
static uns ends_by_brace; // the line is ended by "{"
static int
-get_line(byte **msg)
+get_line(char **msg)
{
int err = bgets_nodie(parse_fb, line_buf, MAX_LINE);
line_num++;
}
static void
-append(byte *start, byte *end)
+append(char *start, char *end)
{
uns len = end - start;
bb_grow(©_buf, copied + len + 1);
copy_buf.ptr[copied-1] = 0;
}
-static byte *
+static char *
get_word(uns is_command_name)
{
- byte *msg;
+ char *msg;
if (*line == '\'') {
line++;
while (1) {
- byte *start = line;
+ char *start = line;
while (*line && *line != '\'')
line++;
append(start, line);
break;
copy_buf.ptr[copied-1] = '\n';
if (!get_line(&msg))
- return msg ? : (byte*) "Unterminated apostrophe word at the end";
+ return msg ? : "Unterminated apostrophe word at the end";
}
line++;
line++;
uns start_copy = copied;
while (1) {
- byte *start = line;
+ char *start = line;
uns escape = 0;
while (*line) {
if (*line == '"' && !escape)
else // merge two lines
copied -= 2;
if (!get_line(&msg))
- return msg ? : (byte*) "Unterminated quoted word at the end";
+ return msg ? : "Unterminated quoted word at the end";
}
line++;
- byte *tmp = stk_str_unesc(copy_buf.ptr + start_copy);
+ char *tmp = stk_str_unesc(copy_buf.ptr + start_copy);
uns l = strlen(tmp);
bb_grow(©_buf, start_copy + l + 1);
strcpy(copy_buf.ptr + start_copy, tmp);
} else {
// promised that *line is non-null and non-blank
- byte *start = line;
+ char *start = line;
while (*line && !Cblank(*line)
&& *line != '{' && *line != '}' && *line != ';'
&& (*line != '=' || !is_command_name))
return NULL;
}
-static byte *
-get_token(uns is_command_name, byte **err)
+static char *
+get_token(uns is_command_name, char **err)
{
*err = NULL;
while (1) {
return NULL;
}
if (!*line || *line == '#')
- msg(L_WARN, "The line %s:%d following a backslash is empty", name_parse_fb ? : (byte*) "", line_num);
+ msg(L_WARN, "The line %s:%d following a backslash is empty", name_parse_fb ? : "", line_num);
} else {
split_grow(&word_buf, words+1);
uns start = copied;
}
}
-static byte *
+static char *
split_command(void)
{
words = copied = ends_by_brace = 0;
- byte *msg, *start_word;
+ char *msg, *start_word;
if (!(start_word = get_token(1, &msg)))
return msg;
if (*start_word == '{') // only one opening brace
/* Parsing multiple files */
-static byte *
-parse_fastbuf(const byte *name_fb, struct fastbuf *fb, uns depth)
+static char *
+parse_fastbuf(const char *name_fb, struct fastbuf *fb, uns depth)
{
- byte *err;
+ char *err;
name_parse_fb = name_fb;
parse_fb = fb;
line_num = 0;
goto error;
if (!words)
return NULL;
- byte *name = copy_buf.ptr + word_buf.ptr[0];
- byte *pars[words-1];
+ char *name = copy_buf.ptr + word_buf.ptr[0];
+ char *pars[words-1];
for (uns i=1; i<words; i++)
pars[i-1] = copy_buf.ptr + word_buf.ptr[i];
if (!strcasecmp(name, "include"))
continue;
}
enum cf_operation op;
- byte *c = strchr(name, ':');
+ char *c = strchr(name, ':');
if (!c)
op = strcmp(name, "}") ? OP_SET : OP_CLOSE;
else {
#ifndef DEFAULT_CONFIG
#define DEFAULT_CONFIG NULL
#endif
-byte *cf_def_file = DEFAULT_CONFIG;
+char *cf_def_file = DEFAULT_CONFIG;
static uns postpone_commit; // only for cf_getopt()
static uns everything_committed; // after the 1st load, this flag is set on
}
static int
-load_file(const byte *file)
+load_file(const char *file)
{
cf_init_stack();
struct fastbuf *fb = bopen_try(file, O_RDONLY, 1<<14);
msg(L_ERROR, "Cannot open %s: %m", file);
return 1;
}
- byte *err_msg = parse_fastbuf(file, fb, 0);
+ char *err_msg = parse_fastbuf(file, fb, 0);
bclose(fb);
int err = !!err_msg || done_stack();
if (!err)
}
static int
-load_string(const byte *string)
+load_string(const char *string)
{
cf_init_stack();
struct fastbuf fb;
fbbuf_init_read(&fb, (byte *)string, strlen(string), 0);
- byte *msg = parse_fastbuf(NULL, &fb, 0);
+ char *msg = parse_fastbuf(NULL, &fb, 0);
return !!msg || done_stack();
}
/* Safe loading and reloading */
int
-cf_reload(const byte *file)
+cf_reload(const char *file)
{
cf_journal_swap();
struct cf_journal_item *oldj = cf_journal_new_transaction(1);
}
int
-cf_load(const byte *file)
+cf_load(const char *file)
{
struct cf_journal_item *oldj = cf_journal_new_transaction(1);
int err = load_file(file);
}
int
-cf_set(const byte *string)
+cf_set(const char *string)
{
struct cf_journal_item *oldj = cf_journal_new_transaction(0);
int err = load_string(string);
#define OP_1ST 0x200 // in the 1st phase selectors are recorded into the mask
#define OP_2ND 0x400 // in the 2nd phase real data are entered
enum cf_operation;
-extern byte *cf_op_names[];
-extern byte *cf_type_names[];
+extern char *cf_op_names[];
+extern char *cf_type_names[];
uns cf_type_size(enum cf_type type, struct cf_user_type *utype);
-byte *cf_interpret_line(byte *name, enum cf_operation op, int number, byte **pars);
+char *cf_interpret_line(char *name, enum cf_operation op, int number, char **pars);
void cf_init_stack(void);
int cf_check_stack(void);
enum cf_commit_mode { CF_NO_COMMIT, CF_COMMIT, CF_COMMIT_ALL };
extern struct cf_section cf_sections;
-struct cf_item *cf_find_subitem(struct cf_section *sec, const byte *name);
+struct cf_item *cf_find_subitem(struct cf_section *sec, const char *name);
int cf_commit_all(enum cf_commit_mode cm);
void cf_add_dirty(struct cf_section *sec, void *ptr);
#include <string.h>
#include <stdio.h>
-#define TRY(f) do { byte *_msg = f; if (_msg) return _msg; } while (0)
+#define TRY(f) do { char *_msg = f; if (_msg) return _msg; } while (0)
/* Register size of and parser for each basic type */
-static byte *
-cf_parse_string(byte *str, byte **ptr)
+static char *
+cf_parse_string(char *str, char **ptr)
{
*ptr = cf_strdup(str);
return NULL;
}
-typedef byte *cf_basic_parser(byte *str, void *ptr);
+typedef char *cf_basic_parser(char *str, void *ptr);
static struct {
uns size;
void *parser;
{ sizeof(u64), cf_parse_u64 },
{ sizeof(double), cf_parse_double },
{ sizeof(u32), cf_parse_ip },
- { sizeof(byte*), cf_parse_string },
+ { sizeof(char*), cf_parse_string },
{ sizeof(int), NULL }, // lookups are parsed extra
{ 0, NULL }, // user-defined types are parsed extra
};
return utype->size;
}
-static byte *
-cf_parse_lookup(byte *str, int *ptr, byte **t)
+static char *
+cf_parse_lookup(char *str, int *ptr, char **t)
{
- byte **n = t;
+ char **n = t;
uns total_len = 0;
while (*n && strcasecmp(*n, str)) {
total_len += strlen(*n) + 2;
*ptr = n - t;
return NULL;
}
- byte *err = cf_malloc(total_len + strlen(str) + 60), *c = err;
+ char *err = cf_malloc(total_len + strlen(str) + 60), *c = err;
c += sprintf(err, "Invalid value %s, possible values are: ", str);
for (n=t; *n; n++)
c+= sprintf(c, "%s, ", *n);
return err;
}
-static byte *
-cf_parse_ary(uns number, byte **pars, void *ptr, enum cf_type type, union cf_union *u)
+static char *
+cf_parse_ary(uns number, char **pars, void *ptr, enum cf_type type, union cf_union *u)
{
for (uns i=0; i<number; i++)
{
- byte *msg;
+ char *msg;
uns size = cf_type_size(type, u->utype);
if (type < CT_LOOKUP)
msg = ((cf_basic_parser*) parsers[type].parser) (pars[i], ptr + i * size);
/* Interpreter */
#define T(x) #x,
-byte *cf_op_names[] = { CF_OPERATIONS };
+char *cf_op_names[] = { CF_OPERATIONS };
#undef T
-byte *cf_type_names[] = { "int", "u64", "double", "ip", "string", "lookup", "user" };
+char *cf_type_names[] = { "int", "u64", "double", "ip", "string", "lookup", "user" };
#define DARY_HDR_SIZE ALIGN_TO(sizeof(uns), CPU_STRUCT_ALIGN)
-static byte *
-interpret_set_dynamic(struct cf_item *item, int number, byte **pars, void **ptr)
+static char *
+interpret_set_dynamic(struct cf_item *item, int number, char **pars, void **ptr)
{
enum cf_type type = item->type;
cf_journal_block(ptr, sizeof(void*));
return cf_parse_ary(number, pars, *ptr, type, &item->u);
}
-static byte *
-interpret_add_dynamic(struct cf_item *item, int number, byte **pars, int *processed, void **ptr, enum cf_operation op)
+static char *
+interpret_add_dynamic(struct cf_item *item, int number, char **pars, int *processed, void **ptr, enum cf_operation op)
{
enum cf_type type = item->type;
void *old_p = *ptr;
return cf_printf("Dynamic arrays do not support operation %s", cf_op_names[op]);
}
-static byte *interpret_set_item(struct cf_item *item, int number, byte **pars, int *processed, void *ptr, uns allow_dynamic);
+static char *interpret_set_item(struct cf_item *item, int number, char **pars, int *processed, void *ptr, uns allow_dynamic);
-static byte *
-interpret_section(struct cf_section *sec, int number, byte **pars, int *processed, void *ptr, uns allow_dynamic)
+static char *
+interpret_section(struct cf_section *sec, int number, char **pars, int *processed, void *ptr, uns allow_dynamic)
{
cf_add_dirty(sec, ptr);
*processed = 0;
for (struct cf_item *ci=sec->cfg; ci->cls; ci++)
{
int taken;
- byte *msg = interpret_set_item(ci, number, pars, &taken, ptr + (uintptr_t) ci->ptr, allow_dynamic && !ci[1].cls);
+ char *msg = interpret_set_item(ci, number, pars, &taken, ptr + (uintptr_t) ci->ptr, allow_dynamic && !ci[1].cls);
if (msg)
return cf_printf("Item %s: %s", ci->name, msg);
*processed += taken;
}
}
-static byte *
-interpret_add_list(struct cf_item *item, int number, byte **pars, int *processed, void *ptr, enum cf_operation op)
+static char *
+interpret_add_list(struct cf_item *item, int number, char **pars, int *processed, void *ptr, enum cf_operation op)
{
if (op >= OP_REMOVE)
return cf_printf("You have to open a block for operation %s", cf_op_names[op]);
/* If the node contains any dynamic attribute at the end, we suppress
* auto-repetition here and pass the flag inside instead. */
index++;
- byte *msg = interpret_section(sec, number, pars, &taken, node, sec->flags & SEC_FLAG_DYNAMIC);
+ char *msg = interpret_section(sec, number, pars, &taken, node, sec->flags & SEC_FLAG_DYNAMIC);
if (msg)
return sec->flags & SEC_FLAG_DYNAMIC ? msg : cf_printf("Node %d of list %s: %s", index, item->name, msg);
*processed += taken;
return NULL;
}
-static byte *
-interpret_add_bitmap(struct cf_item *item, int number, byte **pars, int *processed, u32 *ptr, enum cf_operation op)
+static char *
+interpret_add_bitmap(struct cf_item *item, int number, char **pars, int *processed, u32 *ptr, enum cf_operation op)
{
if (op != OP_SET && op != OP_REMOVE)
return cf_printf("Cannot apply operation %s on a bitmap", cf_op_names[op]);
return NULL;
}
-static byte *
-interpret_set_item(struct cf_item *item, int number, byte **pars, int *processed, void *ptr, uns allow_dynamic)
+static char *
+interpret_set_item(struct cf_item *item, int number, char **pars, int *processed, void *ptr, uns allow_dynamic)
{
int taken;
switch (item->cls)
}
}
-static byte *
+static char *
interpret_set_all(struct cf_item *item, void *ptr, enum cf_operation op)
{
if (item->cls == CC_BITMAP) {
return NULL;
}
-static byte *
+static char *
record_selector(struct cf_item *item, struct cf_section *sec, u32 *mask)
{
uns nr = sec->flags & SEC_FLAG_NUMBER;
} stack[MAX_STACK_SIZE];
static uns level;
-static byte *
+static char *
opening_brace(struct cf_item *item, void *ptr, enum cf_operation op)
{
if (level >= MAX_STACK_SIZE-1)
return NULL;
}
-static byte *
-closing_brace(struct item_stack *st, enum cf_operation op, int number, byte **pars)
+static char *
+closing_brace(struct item_stack *st, enum cf_operation op, int number, char **pars)
{
if (st->op == OP_CLOSE) // top-level
return "Unmatched } parenthesis";
}
static struct cf_item *
-find_item(struct cf_section *curr_sec, const byte *name, byte **msg, void **ptr)
+find_item(struct cf_section *curr_sec, const char *name, char **msg, void **ptr)
{
*msg = NULL;
if (name[0] == '^') // absolute name instead of relative
{
if (curr_sec != &cf_sections)
cf_add_dirty(curr_sec, *ptr);
- byte *c = strchr(name, '.');
+ char *c = strchr(name, '.');
if (c)
*c++ = 0;
struct cf_item *ci = cf_find_subitem(curr_sec, name);
}
}
-byte *
-cf_interpret_line(byte *name, enum cf_operation op, int number, byte **pars)
+char *
+cf_interpret_line(char *name, enum cf_operation op, int number, char **pars)
{
- byte *msg;
+ char *msg;
if ((op & OP_MASK) == OP_CLOSE)
return closing_brace(stack+level, op, number, pars);
void *ptr = stack[level].base_ptr;
return NULL;
}
-byte *
-cf_find_item(const byte *name, struct cf_item *item)
+char *
+cf_find_item(const char *name, struct cf_item *item)
{
- byte *msg;
+ char *msg;
void *ptr = NULL;
struct cf_item *ci = find_item(&cf_sections, name, &msg, &ptr);
if (msg)
return NULL;
}
-byte *
-cf_write_item(struct cf_item *item, enum cf_operation op, int number, byte **pars)
+char *
+cf_write_item(struct cf_item *item, enum cf_operation op, int number, char **pars)
{
- byte *msg;
+ char *msg;
int taken = 0;
switch (op) {
case OP_SET:
};
static const struct unit *
-lookup_unit(const byte *value, const byte *end, byte **msg)
+lookup_unit(const char *value, const char *end, char **msg)
{
if (end && *end) {
if (end == value || end[1] || *end >= '0' && *end <= '9')
*msg = "Invalid number";
else {
for (const struct unit *u=units; u->name; u++)
- if (u->name == *end)
+ if ((char)u->name == *end)
return u;
*msg = "Invalid unit";
}
static char cf_rngerr[] = "Number out of range";
-byte *
-cf_parse_int(const byte *str, int *ptr)
+char *
+cf_parse_int(const char *str, int *ptr)
{
- byte *msg = NULL;
+ char *msg = NULL;
if (!*str)
msg = "Missing number";
else {
return msg;
}
-byte *
-cf_parse_u64(const byte *str, u64 *ptr)
+char *
+cf_parse_u64(const char *str, u64 *ptr)
{
- byte *msg = NULL;
+ char *msg = NULL;
if (!*str)
msg = "Missing number";
else {
return msg;
}
-byte *
-cf_parse_double(const byte *str, double *ptr)
+char *
+cf_parse_double(const char *str, double *ptr)
{
- byte *msg = NULL;
+ char *msg = NULL;
if (!*str)
msg = "Missing number";
else {
return msg;
}
-byte *
-cf_parse_ip(const byte *p, u32 *varp)
+char *
+cf_parse_ip(const char *p, u32 *varp)
{
if (!*p)
return "Missing IP address";
struct cf_section cf_sections; // root section
struct cf_item *
-cf_find_subitem(struct cf_section *sec, const byte *name)
+cf_find_subitem(struct cf_section *sec, const char *name)
{
struct cf_item *ci = sec->cfg;
for (; ci->cls; ci++)
}
void
-cf_declare_section(byte *name, struct cf_section *sec, uns allow_unknown)
+cf_declare_section(const char *name, struct cf_section *sec, uns allow_unknown)
{
if (!cf_sections.cfg)
{
}
void
-cf_init_section(byte *name, struct cf_section *sec, void *ptr, uns do_bzero)
+cf_init_section(const char *name, struct cf_section *sec, void *ptr, uns do_bzero)
{
if (do_bzero) {
ASSERT(sec->size);
}
}
if (sec->init) {
- byte *msg = sec->init(ptr);
+ char *msg = sec->init(ptr);
if (msg)
die("Cannot initialize section %s: %s", name, msg);
}
}
-static byte *
+static char *
commit_section(struct cf_section *sec, void *ptr, uns commit_all)
{
- byte *err;
+ char *err;
for (struct cf_item *ci=sec->cfg; ci->cls; ci++)
if (ci->cls == CC_SECTION) {
if ((err = commit_section(ci->u.sec, ptr + (uintptr_t) ci->ptr, commit_all))) {
};
struct fastbuf;
-typedef byte *cf_parser(uns number, byte **pars, void *ptr);
+typedef char *cf_parser(uns number, char **pars, void *ptr);
/* A parser function gets an array of (strdup'ed) strings and a pointer with
* the customized information (most likely the target address). It can store
* the parsed value anywhere in any way it likes, however it must first call
* cf_journal_block() on the overwritten memory block. It returns an error
* message or NULL if everything is all right. */
-typedef byte *cf_parser1(byte *string, void *ptr);
+typedef char *cf_parser1(char *string, void *ptr);
/* A parser function for user-defined types gets a string and a pointer to
* the destination variable. It must store the value within [ptr,ptr+size),
* where size is fixed for each type. It should not call cf_journal_block(). */
-typedef byte *cf_hook(void *ptr);
+typedef char *cf_hook(void *ptr);
/* An init- or commit-hook gets a pointer to the section or NULL if this
* is the global section. It returns an error message or NULL if everything
* is all right. The init-hook should fill in default values (needed for
* use cf_malloc() but normal xmalloc(). */
typedef void cf_dumper1(struct fastbuf *fb, void *ptr);
/* Dumps the contents of a variable of a user-defined type. */
-typedef byte *cf_copier(void *dest, void *src);
+typedef char *cf_copier(void *dest, void *src);
/* Similar to init-hook, but it copies attributes from another list node
* instead of setting the attributes to default values. You have to provide
* it if your node contains parsed values and/or sub-lists. */
struct cf_user_type {
uns size; // of the parsed attribute
- byte *name; // name of the type (for dumping)
+ char *name; // name of the type (for dumping)
cf_parser1 *parser; // how to parse it
cf_dumper1 *dumper; // how to dump the type
};
struct cf_section;
struct cf_item {
- byte *name; // case insensitive
+ const char *name; // case insensitive
int number; // length of an array or #parameters of a parser (negative means at most)
void *ptr; // pointer to a global variable or an offset in a section
union cf_union {
struct cf_section *sec; // declaration of a section or a list
cf_parser *par; // parser function
- byte **lookup; // NULL-terminated sequence of allowed strings for lookups
+ char **lookup; // NULL-terminated sequence of allowed strings for lookups
struct cf_user_type *utype; // specification of the user-defined type
} u;
enum cf_class cls:16; // attribute class
#define CF_IP(n,p) CF_STATIC(n,p,IP,u32,1)
#define CF_IP_ARY(n,p,c) CF_STATIC(n,p,IP,u32,c)
#define CF_IP_DYN(n,p,c) CF_DYNAMIC(n,p,IP,u32,c)
-#define CF_STRING(n,p) CF_STATIC(n,p,STRING,byte*,1)
-#define CF_STRING_ARY(n,p,c) CF_STATIC(n,p,STRING,byte*,c)
-#define CF_STRING_DYN(n,p,c) CF_DYNAMIC(n,p,STRING,byte*,c)
+#define CF_STRING(n,p) CF_STATIC(n,p,STRING,char*,1)
+#define CF_STRING_ARY(n,p,c) CF_STATIC(n,p,STRING,char*,c)
+#define CF_STRING_DYN(n,p,c) CF_DYNAMIC(n,p,STRING,char*,c)
#define CF_LOOKUP(n,p,t) { .cls = CC_STATIC, .type = CT_LOOKUP, .name = n, .number = 1, .ptr = CHECK_PTR_TYPE(p,int*), .u.lookup = t }
#define CF_LOOKUP_ARY(n,p,t,c) { .cls = CC_STATIC, .type = CT_LOOKUP, .name = n, .number = c, .ptr = CHECK_PTR_TYPE(p,int*), .u.lookup = t }
#define CF_LOOKUP_DYN(n,p,t,c) { .cls = CC_DYNAMIC, .type = CT_LOOKUP, .name = n, .number = c, .ptr = CHECK_PTR_TYPE(p,int**), .u.lookup = t }
extern struct mempool *cf_pool;
void *cf_malloc(uns size);
void *cf_malloc_zero(uns size);
-byte *cf_strdup(byte *s);
-byte *cf_printf(char *fmt, ...) FORMAT_CHECK(printf,1,2);
+char *cf_strdup(const char *s);
+char *cf_printf(const char *fmt, ...) FORMAT_CHECK(printf,1,2);
/* Undo journal for error recovery: conf-journal.c */
extern uns cf_need_journal;
#define CF_JOURNAL_VAR(var) cf_journal_block(&(var), sizeof(var))
/* Declaration: conf-section.c */
-void cf_declare_section(byte *name, struct cf_section *sec, uns allow_unknown);
-void cf_init_section(byte *name, struct cf_section *sec, void *ptr, uns do_bzero);
+void cf_declare_section(const char *name, struct cf_section *sec, uns allow_unknown);
+void cf_init_section(const char *name, struct cf_section *sec, void *ptr, uns do_bzero);
/* Parsers for basic types: conf-parse.c */
-byte *cf_parse_int(const byte *str, int *ptr);
-byte *cf_parse_u64(const byte *str, u64 *ptr);
-byte *cf_parse_double(const byte *str, double *ptr);
-byte *cf_parse_ip(const byte *p, u32 *varp);
+char *cf_parse_int(const char *str, int *ptr);
+char *cf_parse_u64(const char *str, u64 *ptr);
+char *cf_parse_double(const char *str, double *ptr);
+char *cf_parse_ip(const char *p, u32 *varp);
#endif
#include <unistd.h>
#include <sys/fcntl.h>
-static byte *temp_prefix = "/tmp/temp";
+static char *temp_prefix = "/tmp/temp";
static struct cf_section temp_config = {
CF_ITEMS {
struct fastbuf *
bopen_tmp(uns buflen)
{
- byte buf[TEMP_FILE_NAME_LEN];
+ char buf[TEMP_FILE_NAME_LEN];
struct fastbuf *f;
temp_file_name(buf);
/* Safe loading and reloading of configuration files: conf-input.c */
-extern byte *cf_def_file; /* DEFAULT_CONFIG; NULL if already loaded */
-int cf_reload(const byte *file);
-int cf_load(const byte *file);
-int cf_set(const byte *string);
+extern char *cf_def_file; /* DEFAULT_CONFIG; NULL if already loaded */
+int cf_reload(const char *file);
+int cf_load(const char *file);
+int cf_set(const char *string);
/* Direct access to configuration items: conf-intr.c */
#undef T
struct cf_item;
-byte *cf_find_item(const byte *name, struct cf_item *item);
-byte *cf_write_item(struct cf_item *item, enum cf_operation op, int number, byte **pars);
+char *cf_find_item(const char *name, struct cf_item *item);
+char *cf_write_item(struct cf_item *item, enum cf_operation op, int number, char **pars);
/* Debug dumping: conf-dump.c */
struct ip_addrmask addr;
};
-static byte *
-addrmask_parser(byte *c, void *ptr)
+static char *
+addrmask_parser(char *c, void *ptr)
{
/*
* This is tricky: addrmasks will be compared by memcmp(), so we must ensure
struct ip_addrmask *am = ptr;
bzero(am, sizeof(*am));
- byte *p = strchr(c, '/');
+ char *p = strchr(c, '/');
if (p)
*p++ = 0;
- byte *err = cf_parse_ip(c, &am->addr);
+ char *err = cf_parse_ip(c, &am->addr);
if (err)
return err;
if (p)
struct cf_section ipaccess_cf = {
CF_TYPE(struct ipaccess_entry),
CF_ITEMS {
- CF_LOOKUP("Mode", PTR_TO(struct ipaccess_entry, allow), ((byte*[]) { "deny", "allow", NULL })),
+ CF_LOOKUP("Mode", PTR_TO(struct ipaccess_entry, allow), ((char*[]) { "deny", "allow", NULL })),
CF_USER("IP", PTR_TO(struct ipaccess_entry, addr), &ip_addrmask_type),
CF_END
}
byte buf[256];
while (fgets(buf, sizeof(buf), stdin))
{
- byte *c = strchr(buf, '\n');
+ char *c = strchr(buf, '\n');
if (c)
*c = 0;
u32 ip;
typedef struct simp_node {
cnode n;
union {
- byte *s;
+ char *s;
void *p;
int i;
uns u;
typedef struct simp2_node {
cnode n;
union {
- byte *s1;
+ char *s1;
void *p1;
int i1;
uns u1;
};
union {
- byte *s2;
+ char *s2;
void *p2;
int i2;
uns u2;
static uns url_ignore_spaces;
static uns url_ignore_underflow;
-static byte *url_component_separators = "";
+static char *url_component_separators = "";
static uns url_min_repeat_count = 0x7fffffff;
static uns url_max_repeat_length = 0;