- char tval[16];
- sprintf(tval, "%02d:%02d:%02d",
- tm_ptr->tm_hour, tm_ptr->tm_min, tm_ptr->tm_sec);
-
- if (gom_set_string(tv, tval))
- return 0;
- else
- return 1;
+ struct xref_value* result = NULL;
+ struct xref_value* newval = NULL;
+ struct xref_list* xrl = NULL;
+
+ if (data && xref) {
+ newval = gedcom_get_by_xref(xref);
+ if (!newval)
+ gedcom_error(_("No record found for xref '%s'"), xref);
+ else {
+ result = gedcom_link_xref(newval->type, newval->string);
+ if (result != NULL) {
+ MAKE_CHAIN_ELT(xref_list, *data, xrl);
+ if (xrl) xrl->xref = newval;
+ }
+ }
+ }
+
+ return xrl;
+}
+
+struct xref_list* find_xref(struct xref_list** data, const char* xref)
+{
+ struct xref_list* result = NULL;
+ struct xref_value* xr = gedcom_get_by_xref(xref);
+ if (!xr)
+ gedcom_error(_("No record found for xref '%s'"), xref);
+ else {
+ struct xref_list* xrl;
+ for (xrl = *data ; xrl ; xrl = xrl->next) {
+ if (xrl->xref == xr) {
+ result = xrl;
+ break;
+ }
+ }
+ if (! result)
+ gedcom_error(_("Xref '%s' not part of chain"), xref);
+ }
+ return result;