/**********************************************************************
 * ti library's routine for getting any outline
 *
 * $Author: brlewis $
 * $Source: /mit/techinfodev/src/libti/RCS/otl.c,v $
 * $Header: /mit/techinfodev/src/libti/RCS/otl.c,v 1.1 1995/04/10 20:21:57 brlewis Exp $
 *
 * Copyright 1992 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_ti_otl_c[] = "$Header: /mit/techinfodev/src/libti/RCS/otl.c,v 1.1 1995/04/10 20:21:57 brlewis Exp $";
#endif /* lint */

#include <errno.h>
#include <string.h>
#include <ti/memory.h>
#include <ti/ti.h>

/**********************************************************************
 * ti_otl(TI *tp, ti_menu **mp, char updown, long top, int depth)
 *	caller should have opened tp
 *
 * - outlines from node "top"
 * - in direction "updown" (TI_ABOVE or TI_BELOW)
 * - to depth "depth"
 * - returns error code
 **********************************************************************/

long
ti_otl(tp, mp, updown, top, depth)
     TI *tp;
     ti_menu **mp;
     char updown;
     long top;
     int depth;
{
  char newquery[64];

  TI_MEM(*mp = New(ti_menu));
  memset(*mp, 0, sizeof(ti_menu));
  sprintf(newquery, "w:%c:%d:%d", updown, top, depth);
  TI_MEM((*mp)->query = newstring(newquery)); /* XXX small leak */
  strcpy((*mp)->query, newquery);
  (*mp)->type = TI_MOTL;
  tp->links++;
  (*mp)->tp=tp;
  return(0L);
}
