]>
git.cameronkatri.com Git - mandoc.git/blob - out.c
1 /* $Id: out.c,v 1.1 2009/09/21 00:39:02 kristaps Exp $ */
3 * Copyright (c) 2009 Kristaps Dzonsons <kristaps@kth.se>
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 #include <sys/types.h>
29 out_a2list(const struct mdoc_node
*n
)
33 assert(MDOC_BLOCK
== n
->type
&& MDOC_Bl
== n
->tok
);
36 for (i
= 0; i
< (int)n
->args
->argc
; i
++)
37 switch (n
->args
->argv
[i
].arg
) {
59 return(n
->args
->argv
[i
].arg
);
70 out_a2width(const char *p
)
74 if (0 == (len
= (int)strlen(p
)))
76 for (i
= 0; i
< len
- 1; i
++)
77 if ( ! isdigit((u_char
)p
[i
]))
81 if ('n' == p
[len
- 1] || 'm' == p
[len
- 1])
89 out_a2offs(const char *p
, int indent
)
93 if (0 == strcmp(p
, "left"))
95 if (0 == strcmp(p
, "indent"))
97 if (0 == strcmp(p
, "indent-two"))
98 return((indent
+ 1) * 2);
100 if (0 == (len
= (int)strlen(p
)))
103 for (i
= 0; i
< len
- 1; i
++)
104 if ( ! isdigit((u_char
)p
[i
]))
108 if ('n' == p
[len
- 1] || 'm' == p
[len
- 1])