fis-gtm/sr_unix_cm/omi_prc_rord.c

75 lines
1.6 KiB
C
Raw Normal View History

/****************************************************************
* *
* Copyright 2001, 2007 Fidelity Information Services, Inc *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
* under a license. If you do not know the terms of *
* the license, please stop and do not read further. *
* *
****************************************************************/
/*
* omi_prc_rord.c ---
*
* Process a REVERSEORDER request.
*
*/
#ifndef lint
2024-07-19 11:43:27 -04:00
static char rcsid[] = "$Header: /cvsroot/fis-gtm/gtm/sr_unix_cm/omi_prc_rord.c,v 1.7 2013/10/23 03:49:32 tuskentower Exp $";
#endif
#include "mdef.h"
#include "gtm_string.h"
#include "omi.h"
#include "error.h"
#include "op.h"
int
omi_prc_rord(omi_conn *cptr, char *xend, char *buff, char *bend)
{
char *bptr;
int rv;
omi_li len;
mval v;
bptr = buff;
/* Global Ref */
OMI_LI_READ(&len, cptr->xptr);
/* Condition handler for DBMS operations */
ESTABLISH_RET(omi_dbms_ch,0);
rv = omi_gvextnam(cptr, len.value, cptr->xptr);
/* If true, there was an error finding the global reference in the DBMS */
if (rv < 0) {
REVERT;
return rv;
}
cptr->xptr += len.value;
/* Bounds checking */
if (cptr->xptr > xend) {
REVERT;
return -OMI_ER_PR_INVMSGFMT;
}
op_zprevious(&v);
REVERT;
if (v.str.len > 255)
return -OMI_ER_DB_UNRECOVER;
OMI_SI_WRIT(v.str.len, bptr);
if (v.str.len) {
memcpy(bptr, v.str.addr, v.str.len);
bptr += v.str.len;
}
return (int)(bptr - buff);
}