+/*********************************************************************
+ *
+ * Function : map_conditional
+ *
+ * Description : Convenience function.
+ * Adds an "if-then-else" for the conditional HTML-template
+ * block <name>, i.e. a substitution of the form:
+ * @if-<name>-then@
+ * True text
+ * @else-not-<name>@
+ * False text
+ * @endif-<name>@
+ *
+ * The control structure and one of the alternatives
+ * will be hidden.
+ *
+ * Parameters :
+ * 1 : exports = map to extend
+ * 2 : name = name of conditional block
+ * 3 : choose_first = nonzero for first, zero for second.
+ *
+ * Returns : extended map
+ *
+ *********************************************************************/
+struct map *map_conditional(struct map *exports, char *name, int choose_first)
+{
+ char buf[1000]; /* Will do, since the names are hardwired */
+
+ snprintf(buf, 1000, (choose_first
+ ? "else-not-%s@.*@endif-%s"
+ : "if-%s-then@.*@else-not-%s"),
+ name, name);
+ exports = map(exports, buf, 1, "", 1);
+
+ snprintf(buf, 1000, (choose_first ? "if-%s-then" : "endif-%s"), name);
+ exports = map(exports, buf, 1, "", 1);
+
+ return(exports);
+
+}
+
+