+byte *
+cf_write_item(struct cf_item *item, enum operation op, int number, byte **pars)
+{
+ byte *msg;
+ int taken;
+ switch (op) {
+ case OP_SET:
+ msg = interpret_set_item(item, number, pars, &taken, item->ptr, 1);
+ break;
+ case OP_CLEAR:
+ taken = 0;
+ msg = interpret_clear(item, item->ptr);
+ break;
+ case OP_APPEND:
+ case OP_PREPEND:
+ if (item->cls == CC_DYNAMIC)
+ msg = interpret_add_dynamic(item, number, pars, &taken, item->ptr, op);
+ else if (item->cls == CC_LIST)
+ msg = interpret_add_list(item, number, pars, &taken, item->ptr, op);
+ else
+ return "The attribute class does not support append/prepend";
+ break;
+ default:
+ return "Unsupported operation";
+ }
+ if (msg)
+ return msg;
+ if (taken < number)
+ return "Too many parameters";
+ return NULL;
+}
+