/* $Id: tag.c,v 1.12 2016/07/08 20:42:15 schwarze Exp $ */
/*
* Copyright (c) 2015 Ingo Schwarze <schwarze@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "config.h"
#include <signal.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "mandoc_aux.h"
#include "mandoc_ohash.h"
#include "tag.h"
struct tag_entry {
int prio;
char s[];
};
static void tag_signal(int);
/*
* Prepare for using a pager.
* Not all pagers are capable of using a tag file,
* but for simplicity, create it anyway.
*/
struct tag_files *
tag_init(void)
{
int ofd;
ofd = -1;
/* Clean up when dying from a signal. */
/*
* POSIX requires that a process calling tcsetpgrp(3)
* from the background gets a SIGTTOU signal.
* In that case, do not stop.
*/
/* Save the original standard output for use by the pager. */
goto fail;
/* Create both temporary output files. */
goto fail;
goto fail;
goto fail;
/*
* Set up the ohash table to collect output line numbers
* where various marked-up terms are documented.
*/
return &tag_files;
fail:
tag_unlink();
if (ofd != -1)
return NULL;
}
/*
* Set the line number where a term is defined,
* unless it is already defined at a higher priority.
*/
void
{
unsigned int slot;
return;
return;
}
/*
* Write out the tags file using the previously collected
* information and clear the ohash table while going along.
*/
void
tag_write(void)
{
unsigned int slot;
return;
}
}
void
tag_unlink(void)
{
}
}
static void
{
tag_unlink();
/* NOTREACHED */
_exit(1);
}