/*
- * "$Id: type.c 6649 2007-07-11 21:46:42Z mike $"
+ * "$Id: type.c 7694 2008-06-26 00:23:20Z mike $"
*
* MIME typing routines for the Common UNIX Printing System (CUPS).
*
logic = MIME_MAGIC_NOP;
invert = 0;
- DEBUG_printf(("%s/%s: %s\n", mt->super, mt->type, rule));
+ DEBUG_printf(("mimeAddTypeRule: %s/%s: %s\n", mt->super, mt->type, rule));
while (*rule != '\0')
{
if (*rule == '(')
{
- DEBUG_puts("new parenthesis group");
+ DEBUG_puts("mimeAddTypeRule: New parenthesis group");
logic = MIME_MAGIC_NOP;
rule ++;
}
else if (*rule == ')')
{
- DEBUG_puts("close paren...");
+ DEBUG_puts("mimeAddTypeRule: Close paren...");
if (current == NULL || current->parent == NULL)
return (-1);
current->prev = NULL;
current->parent = temp;
- DEBUG_printf(("creating new AND group %p...\n", temp));
+ DEBUG_printf(("mimeAddTypeRule: Creating new AND group %p...\n", temp));
}
else
{
- DEBUG_printf(("setting group %p op to AND...\n", current->parent));
+ DEBUG_printf(("mimeAddTypeRule: Setting group %p op to AND...\n",
+ current->parent));
current->parent->op = MIME_MAGIC_AND;
}
if ((temp = calloc(1, sizeof(mime_magic_t))) == NULL)
return (-1);
- DEBUG_printf(("creating new AND group %p inside OR group\n", temp));
+ DEBUG_printf(("mimeAddTypeRule: Creating new AND group %p inside OR "
+ "group\n", temp));
while (current->prev != NULL)
{
* This isn't the top rule, so go up one level...
*/
- DEBUG_puts("going up one level");
+ DEBUG_puts("mimeAddTypeRule: Going up one level");
current = current->parent;
}
}
}
else if (*rule == '!')
{
- DEBUG_puts("NOT");
+ DEBUG_puts("mimeAddTypeRule: NOT");
invert = 1;
rule ++;
}
* Add parenthetical grouping...
*/
- DEBUG_printf(("making new OR group %p for parenthesis...\n", temp));
+ DEBUG_printf(("mimeAddTypeRule: Making new OR group %p for "
+ "parenthesis...\n", temp));
temp->op = MIME_MAGIC_OR;
logic = MIME_MAGIC_OR;
}
- DEBUG_printf(("adding %p: %s, op = %d, logic = %d, invert = %d\n",
- temp, name, op, logic, invert));
+ DEBUG_printf(("mimeAddTypeRule: adding %p: %s, op=%d, logic=%d, "
+ "invert=%d\n", temp, name, op, logic, invert));
/*
* Fill in data for the rule...
DEBUG_printf(("mimeFileType(mime=%p, pathname=\"%s\", filename=\"%s\", "
- "compression=%p)\n",
- mime, pathname ? pathname : "(nil)",
- filename ? filename : "(nil)",
- compression));
+ "compression=%p)\n", mime, pathname, filename, compression));
/*
* Range check input parameters...
break;
case MIME_MAGIC_STRING :
- DEBUG_printf((" string(%d, \"%s\")\n", rules->offset,
+ DEBUG_printf(("checkrules: string(%d, \"%s\")\n", rules->offset,
rules->value.stringv));
/*
sizeof(fb->buffer));
fb->offset = rules->offset;
- DEBUG_printf((" loaded %d byte fb->buffer at %d, starts "
+ DEBUG_printf(("checkrules: loaded %d byte fb->buffer at %d, starts "
"with \"%c%c%c%c\"...\n",
fb->length, fb->offset, fb->buffer[0], fb->buffer[1],
fb->buffer[2], fb->buffer[3]));
else
result = (memcmp(fb->buffer + rules->offset - fb->offset,
rules->value.stringv, rules->length) == 0);
- DEBUG_printf((" result=%d\n", result));
+ DEBUG_printf(("checkrules: result=%d\n", result));
break;
case MIME_MAGIC_ISTRING :
* the the rule set is false...
*/
- DEBUG_printf((" result of test %p (MIME_MAGIC_%s) is %d\n", rules,
- debug_tests[rules->op], result));
+ DEBUG_printf(("checkrules: result of test %p (MIME_MAGIC_%s) is %d\n",
+ rules, debug_tests[rules->op], result));
if ((result && logic == MIME_MAGIC_OR) ||
(!result && logic == MIME_MAGIC_AND))
/*
- * End of "$Id: type.c 6649 2007-07-11 21:46:42Z mike $".
+ * End of "$Id: type.c 7694 2008-06-26 00:23:20Z mike $".
*/