+ bool send_z3950_present = true;
+
+ // recordXPath unsupported.
+ if (sr_req->recordXPath)
+ {
+ send_z3950_present = false;
+ yaz_add_srw_diagnostic(odr_en,
+ &(sru_pdu_res->u.response->diagnostics),
+ &(sru_pdu_res->u.response->num_diagnostics),
+ YAZ_SRW_XPATH_RETRIEVAL_UNSUPP, 0);
+ }
+
+ // resultSetTTL unsupported.
+ // resultSetIdleTime in response
+ if (sr_req->resultSetTTL)
+ {
+ send_z3950_present = false;
+ yaz_add_srw_diagnostic(odr_en,
+ &(sru_pdu_res->u.response->diagnostics),
+ &(sru_pdu_res->u.response->num_diagnostics),
+ YAZ_SRW_RESULT_SETS_UNSUPP, 0);
+ }
+
+ // sort unsupported
+ if (sr_req->sort_type != Z_SRW_sort_type_none)
+ {
+ send_z3950_present = false;
+ yaz_add_srw_diagnostic(odr_en,
+ &(sru_pdu_res->u.response->diagnostics),
+ &(sru_pdu_res->u.response->num_diagnostics),
+ YAZ_SRW_SORT_UNSUPP, 0);
+ }
+
+ // start record requested negative, or larger than number of records
+ if (start < 0 || start > *sru_pdu_res->u.response->numberOfRecords)
+ {
+ send_z3950_present = false;
+ yaz_add_srw_diagnostic(odr_en,
+ &(sru_pdu_res->u.response->diagnostics),
+ &(sru_pdu_res->u.response->num_diagnostics),
+ YAZ_SRW_FIRST_RECORD_POSITION_OUT_OF_RANGE, 0);
+ }
+
+ // maximumRecords requested negative
+ if (max_recs < 0)
+ {
+ send_z3950_present = false;
+ yaz_add_srw_diagnostic(odr_en,
+ &(sru_pdu_res->u.response->diagnostics),
+ &(sru_pdu_res->u.response->num_diagnostics),
+ YAZ_SRW_UNSUPP_PARAMETER_VALUE,
+ "maximumRecords");
+ }
+
+ // exit on all these above diagnostics
+ if (!send_z3950_present)
+ return false;
+
+ // now packaging the z3950 present request