/**********************************************************************
 * do_mark.c  -- SS command for setting transaction flags
 * tty lucy client using SS library
 *
 * $Author: brlewis $
 * $Source: /afs/athena.mit.edu/astaff/project/lucydev/src/tty/do_mark.c,v $
 * $Header: /afs/athena.mit.edu/astaff/project/lucydev/src/tty/do_mark.c,v 1.1 91/09/24 14:44:51 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_do_mark_c[] = "$Header: /afs/athena.mit.edu/astaff/project/lucydev/src/tty/do_mark.c,v 1.1 91/09/24 14:44:51 brlewis Exp Locker: brlewis $";
#endif /* lint */

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

void
do_mark(argc, argv)
     int argc;
     char *argv[];
{
  long code;
  int i;
  ltrn *t;

  if (argc != 3 || !(i=atoi(argv[1]))) {
    printf("Usage:  %s number FAPR\n", argv[0]);
    return;
  }

  /* Make sure cached transaction info is up-to-date. */
  code = luc_reset_mtg(luv_curmtgp);
  if (code) {
    com_err(argv[0], code, luv_context);
    return;
  }

  /* mark transaction */
  code = luc_mark(luv_curmtgp, i, luc_flgset(argv[2]));
  if (code) {
    com_err(argv[0], code, luv_context);
    return;
  }
  code = luc_unmark(luv_curmtgp, i, luc_flgclr(argv[2]));
  if (code) {
    com_err(argv[0], code, luv_context);
    return;
  }

  /* verify to userthat proper flags have been set */
  code = luc_trn_info(luv_curmtgp, i, &t);
  if (code) {
    com_err(argv[0], code, "(%s)", luv_context);
    return;
  }
  printf("%s\n", list_trn(t));
  return;
}
