+static interactivity_t *
+read_interactivity(
+ char *name,
+ FILE *from,
+ char *fname,
+ int *linenum)
+{
+ int save_overwrites;
+ FILE *saved_conf = NULL;
+ char *saved_fname = NULL;
+
+ if (from) {
+ saved_conf = current_file;
+ current_file = from;
+ }
+
+ if (fname) {
+ saved_fname = current_filename;
+ current_filename = get_seen_filename(fname);
+ }
+
+ if (linenum)
+ current_line_num = *linenum;
+
+ save_overwrites = allow_overwrites;
+ allow_overwrites = 1;
+
+ init_interactivity_defaults();
+ if (name) {
+ ivcur.name = name;
+ } else {
+ get_conftoken(CONF_IDENT);
+ ivcur.name = stralloc(tokenval.v.s);
+ }
+ current_block = g_strconcat("interactivity ", ivcur.name, NULL);
+ ivcur.seen.block = current_block;
+ ivcur.seen.filename = current_filename;
+ ivcur.seen.linenum = current_line_num;
+
+ read_block(interactivity_var, ivcur.value,
+ _("interactivity parameter expected"),
+ (name == NULL), *copy_interactivity,
+ "INTERACTIVITY", ivcur.name);
+ if(!name)
+ get_conftoken(CONF_NL);
+
+ save_interactivity();
+
+ allow_overwrites = save_overwrites;
+
+ if (linenum)
+ *linenum = current_line_num;
+
+ if (fname)
+ current_filename = saved_fname;
+
+ if (from)
+ current_file = saved_conf;
+
+ return lookup_interactivity(ivcur.name);
+}
+
+static void
+get_interactivity(
+ void)
+{
+ read_interactivity(NULL, NULL, NULL, NULL);
+}
+
+static void
+init_interactivity_defaults(
+ void)
+{
+ ivcur.name = NULL;
+ conf_init_str(&ivcur.value[INTERACTIVITY_COMMENT] , "");
+ conf_init_str(&ivcur.value[INTERACTIVITY_PLUGIN] , "");
+ conf_init_proplist(&ivcur.value[INTERACTIVITY_PROPERTY]);
+}
+
+static void
+save_interactivity(
+ void)
+{
+ interactivity_t *iv, *iv1;
+
+ iv = lookup_interactivity(ivcur.name);
+
+ if (iv != (interactivity_t *)0) {
+ conf_parserror(_("interactivity %s already defined at %s:%d"),
+ iv->name, iv->seen.filename, iv->seen.linenum);
+ return;
+ }
+
+ iv = alloc(sizeof(interactivity_t));
+ *iv = ivcur;
+ iv->next = NULL;
+ /* add at end of list */
+ if (!interactivity_list)
+ interactivity_list = iv;
+ else {
+ iv1 = interactivity_list;
+ while (iv1->next != NULL) {
+ iv1 = iv1->next;
+ }
+ iv1->next = iv;
+ }
+}
+
+static void
+copy_interactivity(void)
+{
+ interactivity_t *iv;
+ int i;
+
+ iv = lookup_interactivity(tokenval.v.s);
+
+ if (iv == NULL) {
+ conf_parserror(_("interactivity parameter expected"));
+ return;
+ }
+
+ for (i=0; i < INTERACTIVITY_INTERACTIVITY; i++) {
+ if(iv->value[i].seen.linenum) {
+ merge_val_t(&ivcur.value[i], &iv->value[i]);
+ }
+ }
+}
+
+static taperscan_t *
+read_taperscan(
+ char *name,
+ FILE *from,
+ char *fname,
+ int *linenum)
+{
+ int save_overwrites;
+ FILE *saved_conf = NULL;
+ char *saved_fname = NULL;
+
+ if (from) {
+ saved_conf = current_file;
+ current_file = from;
+ }
+
+ if (fname) {
+ saved_fname = current_filename;
+ current_filename = get_seen_filename(fname);
+ }
+
+ if (linenum)
+ current_line_num = *linenum;
+
+ save_overwrites = allow_overwrites;
+ allow_overwrites = 1;
+
+ init_taperscan_defaults();
+ if (name) {
+ tscur.name = name;
+ } else {
+ get_conftoken(CONF_IDENT);
+ tscur.name = stralloc(tokenval.v.s);
+ }
+ current_block = g_strconcat("taperscan ", tscur.name, NULL);
+ tscur.seen.block = current_block;
+ tscur.seen.filename = current_filename;
+ tscur.seen.linenum = current_line_num;
+
+ read_block(taperscan_var, tscur.value,
+ _("taperscan parameter expected"),
+ (name == NULL), *copy_taperscan,
+ "TAPERSCAN", tscur.name);
+ if(!name)
+ get_conftoken(CONF_NL);
+
+ save_taperscan();
+
+ allow_overwrites = save_overwrites;
+
+ if (linenum)
+ *linenum = current_line_num;
+
+ if (fname)
+ current_filename = saved_fname;
+
+ if (from)
+ current_file = saved_conf;
+
+ return lookup_taperscan(tscur.name);
+}
+
+static void
+get_taperscan(
+ void)
+{
+ read_taperscan(NULL, NULL, NULL, NULL);
+}
+
+static void
+init_taperscan_defaults(
+ void)
+{
+ tscur.name = NULL;
+ conf_init_str(&tscur.value[TAPERSCAN_COMMENT] , "");
+ conf_init_str(&tscur.value[TAPERSCAN_PLUGIN] , "");
+ conf_init_proplist(&tscur.value[TAPERSCAN_PROPERTY]);
+}
+
+static void
+save_taperscan(
+ void)
+{
+ taperscan_t *ts, *ts1;
+
+ ts = lookup_taperscan(tscur.name);
+
+ if (ts != (taperscan_t *)0) {
+ conf_parserror(_("taperscan %s already defined at %s:%d"),
+ ts->name, ts->seen.filename, ts->seen.linenum);
+ return;
+ }
+
+ ts = alloc(sizeof(taperscan_t));
+ *ts = tscur;
+ ts->next = NULL;
+ /* add at end of list */
+ if (!taperscan_list)
+ taperscan_list = ts;
+ else {
+ ts1 = taperscan_list;
+ while (ts1->next != NULL) {
+ ts1 = ts1->next;
+ }
+ ts1->next = ts;
+ }
+}
+
+static void
+copy_taperscan(void)
+{
+ taperscan_t *ts;
+ int i;
+
+ ts = lookup_taperscan(tokenval.v.s);
+
+ if (ts == NULL) {
+ conf_parserror(_("taperscan parameter expected"));
+ return;
+ }
+
+ for (i=0; i < TAPERSCAN_TAPERSCAN; i++) {
+ if(ts->value[i].seen.linenum) {
+ merge_val_t(&tscur.value[i], &ts->value[i]);
+ }
+ }
+}
+
+static pp_script_t *