/**********************************************************************
 * do_hire.c  -- SS command for giving access to a helper
 * tty lucy client using SS library
 *
 * $Author: brlewis $
 * $Source: /afs/athena.mit.edu/astaff/project/lucydev/src/tty/do_hire.c,v $
 * $Header: /afs/athena.mit.edu/astaff/project/lucydev/src/tty/do_hire.c,v 1.1 91/09/24 14:44:37 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_hire_c[] = "$Header: /afs/athena.mit.edu/astaff/project/lucydev/src/tty/do_hire.c,v 1.1 91/09/24 14:44:37 brlewis Exp Locker: brlewis $";
#endif /* lint */

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

void
do_hire(argc, argv)
     int argc;
     char *argv[];
{
  long code;
  int n, i;
  static char *levs[] = { "given no access",
			  "allowed to scan, show",
			  "allowed to forw",
			  "allowed to archive",
			  "allowed to hire" };

  /* Check usage */
  if (argc != 3 || argv[2][0] < '0' || argv[2][0] > '4'
      || (n=atoi(argv[2])) > 4) {
    printf("Usage: %s user level.\n", argv[0]);
    for (i=0; i<5; i++)
      printf("\tlevel %d: %s\n", i, levs[i]);
    return;
  }

  /* call luc_hire */
  if (code=luc_hire(argv[1], n)) {
    com_err(argv[0], code, "(%s)", luv_context);
    return;
  }

  printf("Now %s is %s.\n", luc_fullname(argv[1]), levs[n]);
  return;
}
