/**********************************************************************
 * luc_undelete.c -- undelete transaction
 *
 * $Author: brlewis $
 * $Source: /afs/athena.mit.edu/astaff/project/lucydev/src/lib/RCS/luc_undelete.c,v $
 * $Header: /afs/athena.mit.edu/astaff/project/lucydev/src/lib/RCS/luc_undelete.c,v 1.1 91/09/24 14:39:28 brlewis Exp Locker: brlewis $
 *
 * Copyright 1991 by the Massachusetts Institute of Technology.
 *
 * For copying and distribution information, please see the file
 * <mit-copyright.h>.
 **********************************************************************/
#include <mit-copyright.h>

#ifndef lint
static char rcsid_luc_undelete_c[] = "$Header: /afs/athena.mit.edu/astaff/project/lucydev/src/lib/RCS/luc_undelete.c,v 1.1 91/09/24 14:39:28 brlewis Exp Locker: brlewis $";
#endif /* lint */

#include <stdio.h>
#include "lucy/lucy.h"

/**********************************************************************
 * luc_undelete(lmeeting *mp, int n)
 *	caller sets mp (usually luv_curmtgp) to specify meeting
 *	caller sets n to specify transaction number
 *
 * - returns error code
 **********************************************************************/

long
luc_undelete(mp, n)
     LMEETING *mp;
     int n;
{
  long code;
  int i;

  dsc_retrieve_trn(&(mp->nb), n, &code);
  if (code) {
    sprintf(luv_context, "%d", n); /* error context */
    return(code);
  }

  /* Free cached transaction info if necessary */
  if (mp->trn == NULL) return(0L);
  for(i=0; i < mp->ntrn; i++)
    dsc_destroy_trn_info3(mp->trn[i]);
  free(mp->trn);
  mp->trn = NULL;
  mp->ntrn = 0;
  return(0L);
}
