mandocd.c (6d38604fc532a3fc060788e3ce40464b46047eaf) mandocd.c (c1c95add8c80843ba15d784f95c361d795b1f593)
1/* $Id: mandocd.c,v 1.12 2020/06/14 23:40:31 schwarze Exp $ */
1/* $Id: mandocd.c,v 1.13 2022/04/14 16:43:44 schwarze Exp $ */
2/*
3 * Copyright (c) 2017 Michael Stapelberg <stapelberg@debian.org>
2/*
3 * Copyright (c) 2017 Michael Stapelberg <stapelberg@debian.org>
4 * Copyright (c) 2017, 2019 Ingo Schwarze <schwarze@openbsd.org>
4 * Copyright (c) 2017, 2019, 2021 Ingo Schwarze <schwarze@openbsd.org>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR

--- 17 unchanged lines hidden (view full) ---

30#include <limits.h>
31#include <stdint.h>
32#include <stdio.h>
33#include <stdlib.h>
34#include <string.h>
35#include <unistd.h>
36
37#include "mandoc.h"
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR

--- 17 unchanged lines hidden (view full) ---

30#include <limits.h>
31#include <stdint.h>
32#include <stdio.h>
33#include <stdlib.h>
34#include <string.h>
35#include <unistd.h>
36
37#include "mandoc.h"
38#if DEBUG_MEMORY
39#define DEBUG_NODEF 1
40#include "mandoc_dbg.h"
41#endif
38#include "roff.h"
39#include "mdoc.h"
40#include "man.h"
41#include "mandoc_parse.h"
42#include "main.h"
43#include "manconf.h"
44
45enum outt {

--- 78 unchanged lines hidden (view full) ---

124 int clientfd;
125 int old_stdin;
126 int old_stdout;
127 int old_stderr;
128 int fds[3];
129 int state, opt;
130 enum outt outtype;
131
42#include "roff.h"
43#include "mdoc.h"
44#include "man.h"
45#include "mandoc_parse.h"
46#include "main.h"
47#include "manconf.h"
48
49enum outt {

--- 78 unchanged lines hidden (view full) ---

128 int clientfd;
129 int old_stdin;
130 int old_stdout;
131 int old_stderr;
132 int fds[3];
133 int state, opt;
134 enum outt outtype;
135
136#if DEBUG_MEMORY
137 mandoc_dbg_init(argc, argv);
138#endif
139
132 defos = NULL;
133 outtype = OUTT_ASCII;
134 while ((opt = getopt(argc, argv, "I:T:")) != -1) {
135 switch (opt) {
136 case 'I':
137 if (strncmp(optarg, "os=", 3) == 0)
138 defos = optarg + 3;
139 else {

--- 95 unchanged lines hidden (view full) ---

235 ascii_free(formatter);
236 break;
237 case OUTT_HTML:
238 html_free(formatter);
239 break;
240 }
241 mparse_free(parser);
242 mchars_free();
140 defos = NULL;
141 outtype = OUTT_ASCII;
142 while ((opt = getopt(argc, argv, "I:T:")) != -1) {
143 switch (opt) {
144 case 'I':
145 if (strncmp(optarg, "os=", 3) == 0)
146 defos = optarg + 3;
147 else {

--- 95 unchanged lines hidden (view full) ---

243 ascii_free(formatter);
244 break;
245 case OUTT_HTML:
246 html_free(formatter);
247 break;
248 }
249 mparse_free(parser);
250 mchars_free();
251#if DEBUG_MEMORY
252 mandoc_dbg_finish();
253#endif
243 return state == -1 ? 1 : 0;
244}
245
246static void
247process(struct mparse *parser, enum outt outtype, void *formatter)
248{
249 struct roff_meta *meta;
250

--- 32 unchanged lines hidden ---
254 return state == -1 ? 1 : 0;
255}
256
257static void
258process(struct mparse *parser, enum outt outtype, void *formatter)
259{
260 struct roff_meta *meta;
261

--- 32 unchanged lines hidden ---