/**********************************************************************
 * ti library's routine for getting the paths to an item
 *
 * $Author: brlewis $
 * $Source: /afs/net.mit.edu/dapps/project/techinfodev/src/libti/RCS/pathto.c,v $
 * $Header: /afs/net.mit.edu/dapps/project/techinfodev/src/libti/RCS/pathto.c,v 1.0 92/11/03 14:04:12 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_pathto_c[] = "$Header: /afs/net.mit.edu/dapps/project/techinfodev/src/libti/RCS/pathto.c,v 1.0 92/11/03 14:04:12 brlewis Exp $";
#endif /* lint */

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

/**********************************************************************
 * ti_pathto(TI *tp, ti_menu **mp, long id, char *title)
 *	caller should have opened tp
 *
 * - gets paths to node with "id"
 * - creates menu with "title" given
 * - returns error code
 **********************************************************************/

long
ti_pathto(tp, mp, id, title)
     TI *tp;
     ti_menu **mp;
     long id;
     char *title;
{
  long code;

  /* get paths */
  if (code = ti_otl(tp, mp, TI_ABOVE, id, 32767)) return(code);

  /* insert title */
  TI_MEM((*mp)->title = newstring(title)); /* XXX memory leak */
  strcpy((*mp)->title, title);

  /* success */
  (*mp)->type = TI_MPTH;
  return(0L);
}
