]>
git.cameronkatri.com Git - mandoc.git/blob - literals.c
f4252e94bcd53462a57a850ba80aa064c436f6ed
1 /* $Id: literals.c,v 1.5 2008/12/09 17:09:12 kristaps Exp $ */
3 * Copyright (c) 2008 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
7 * above copyright notice and this permission notice appear in all
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17 * PERFORMANCE OF THIS SOFTWARE.
25 #define ROFF_ATTname_V1 "v1"
26 #define ROFF_ATTname_V2 "v1"
27 #define ROFF_ATTname_V3 "v3"
28 #define ROFF_ATTname_V6 "v6"
29 #define ROFF_ATTname_V7 "v7"
30 #define ROFF_ATTname_32V "32v"
31 #define ROFF_ATTname_V_1 "V.1"
32 #define ROFF_ATTname_V_4 "V.4"
34 #define ROFFSecname_NAME "NAME"
35 #define ROFFSecname_SYNOP "SYNOPSIS"
36 #define ROFFSecname_DESC "DESCRIPTION"
37 #define ROFFSecname_ENV "ENVIRONMENT"
38 #define ROFFSecname_FILES "FILES"
39 #define ROFFSecname_EX "EXAMPLES"
40 #define ROFFSecname_DIAG "DIAGNOSTICS"
41 #define ROFFSecname_ERRS "ERRORS"
42 #define ROFFSecname_STAND "STANDARDS"
43 #define ROFFSecname_HIST "HISTORY"
44 #define ROFFSecname_AUTH "AUTHORS"
45 #define ROFFSecname_CAVEATS "CAVEATS"
46 #define ROFFSecname_BUGS "BUGS"
47 #define ROFFSecname_RETVAL "RETURN VALUES"
48 #define ROFFSecname_RETVAL1 "RETURN"
49 #define ROFFSecname_RETVAL2 "VALUES"
50 #define ROFFSecname_SEEALSO "SEE ALSO"
51 #define ROFFSecname_SEEALSO1 "SEE"
52 #define ROFFSecname_SEEALSO2 "ALSO"
54 #define ROFF_MSECname_1 "1"
55 #define ROFF_MSECname_2 "2"
56 #define ROFF_MSECname_3 "3"
57 #define ROFF_MSECname_3p "3p"
58 #define ROFF_MSECname_4 "4"
59 #define ROFF_MSECname_5 "5"
60 #define ROFF_MSECname_6 "6"
61 #define ROFF_MSECname_7 "7"
62 #define ROFF_MSECname_8 "8"
63 #define ROFF_MSECname_9 "9"
64 #define ROFF_MSECname_UNASS "unass"
65 #define ROFF_MSECname_DRAFT "draft"
66 #define ROFF_MSECname_PAPER "paper"
69 roff_sec(const char **p
)
73 if (NULL
!= *(p
+ 1)) {
75 return(ROFFSec_OTHER
);
76 if (0 == strcmp(*p
, ROFFSecname_RETVAL1
) &&
77 0 == strcmp(*(p
+ 1), ROFFSecname_RETVAL2
))
78 return(ROFFSec_RETVAL
);
79 if (0 == strcmp(*p
, ROFFSecname_SEEALSO1
) &&
80 0 == strcmp(*(p
+ 1), ROFFSecname_SEEALSO2
))
81 return(ROFFSec_SEEALSO
);
82 return(ROFFSec_OTHER
);
85 if (0 == strcmp(*p
, ROFFSecname_NAME
))
87 else if (0 == strcmp(*p
, ROFFSecname_SYNOP
))
88 return(ROFFSec_SYNOP
);
89 else if (0 == strcmp(*p
, ROFFSecname_DESC
))
91 else if (0 == strcmp(*p
, ROFFSecname_ENV
))
93 else if (0 == strcmp(*p
, ROFFSecname_FILES
))
94 return(ROFFSec_FILES
);
95 else if (0 == strcmp(*p
, ROFFSecname_EX
))
97 else if (0 == strcmp(*p
, ROFFSecname_DIAG
))
99 else if (0 == strcmp(*p
, ROFFSecname_ERRS
))
100 return(ROFFSec_ERRS
);
101 else if (0 == strcmp(*p
, ROFFSecname_STAND
))
102 return(ROFFSec_STAND
);
103 else if (0 == strcmp(*p
, ROFFSecname_HIST
))
104 return(ROFFSec_HIST
);
105 else if (0 == strcmp(*p
, ROFFSecname_AUTH
))
106 return(ROFFSec_AUTH
);
107 else if (0 == strcmp(*p
, ROFFSecname_CAVEATS
))
108 return(ROFFSec_CAVEATS
);
109 else if (0 == strcmp(*p
, ROFFSecname_BUGS
))
110 return(ROFFSec_BUGS
);
111 else if (0 == strcmp(*p
, ROFFSecname_RETVAL
))
112 return(ROFFSec_RETVAL
);
113 else if (0 == strcmp(*p
, ROFFSecname_SEEALSO
))
114 return(ROFFSec_SEEALSO
);
116 return(ROFFSec_OTHER
);
121 roff_msec(const char *p
)
125 if (0 == strcmp(p
, ROFF_MSECname_1
))
127 else if (0 == strcmp(p
, ROFF_MSECname_2
))
129 else if (0 == strcmp(p
, ROFF_MSECname_3
))
131 else if (0 == strcmp(p
, ROFF_MSECname_3p
))
132 return(ROFF_MSEC_3p
);
133 else if (0 == strcmp(p
, ROFF_MSECname_4
))
135 else if (0 == strcmp(p
, ROFF_MSECname_5
))
137 else if (0 == strcmp(p
, ROFF_MSECname_6
))
139 else if (0 == strcmp(p
, ROFF_MSECname_7
))
141 else if (0 == strcmp(p
, ROFF_MSECname_8
))
143 else if (0 == strcmp(p
, ROFF_MSECname_9
))
145 else if (0 == strcmp(p
, ROFF_MSECname_UNASS
))
146 return(ROFF_MSEC_UNASS
);
147 else if (0 == strcmp(p
, ROFF_MSECname_DRAFT
))
148 return(ROFF_MSEC_DRAFT
);
149 else if (0 == strcmp(p
, ROFF_MSECname_PAPER
))
150 return(ROFF_MSEC_PAPER
);
152 return(ROFF_MSEC_MAX
);
157 roff_msecname(enum roffmsec sec
)
162 return(ROFF_MSECname_1
);
164 return(ROFF_MSECname_2
);
166 return(ROFF_MSECname_3
);
168 return(ROFF_MSECname_3p
);
170 return(ROFF_MSECname_4
);
172 return(ROFF_MSECname_5
);
174 return(ROFF_MSECname_6
);
176 return(ROFF_MSECname_7
);
178 return(ROFF_MSECname_8
);
180 return(ROFF_MSECname_9
);
181 case(ROFF_MSEC_UNASS
):
182 return(ROFF_MSECname_UNASS
);
183 case(ROFF_MSEC_DRAFT
):
184 return(ROFF_MSECname_DRAFT
);
185 case(ROFF_MSEC_PAPER
):
186 return(ROFF_MSECname_PAPER
);
197 roff_fmtstring(int tok
)
202 return ("The %s utility exits 0 on success, and "
203 ">0 if an error occurs.");
205 return ("The %s() function returns the value 0 if "
206 "successful; otherwise the value -1 "
207 "is returned and the global variable "
208 "errno is set to indicate the error.");
210 return("#include \\*(Lt%s\\*(Gt");
221 roff_literal(int tok
, const int *argc
,
222 const char **argv
, const char **morep
)
227 assert(NULL
== *argv
);
228 assert(ROFF_ARGMAX
== *argc
);
232 switch (roff_att(*morep
)) {
234 return("Version 1 AT&T UNIX");
236 return("Version 2 AT&T UNIX");
238 return("Version 3 AT&T UNIX");
240 return("Version 6 AT&T UNIX");
242 return("Version 7 AT&T UNIX");
244 return("Version 32v AT&T UNIX");
246 return("AT&T System V.1 UNIX");
248 return("AT&T System V.4 UNIX");
257 assert(ROFF_ARGMAX
!= *argc
);
258 assert(NULL
== *argv
);
260 case(ROFF_p1003_1_88
):
261 return("IEEE Std 1003.1-1988 "
262 "(\\*(LqPOSIX\\*(Rq)");
263 case(ROFF_p1003_1_90
):
264 return("IEEE Std 1003.1-1990 "
265 "(\\*(LqPOSIX\\*(Rq)");
266 case(ROFF_p1003_1_96
):
267 return("ISO/IEC 9945-1:1996 "
268 "(\\*(LqPOSIX\\*(Rq)");
269 case(ROFF_p1003_1_2001
):
270 return("IEEE Std 1003.1-2001 "
271 "(\\*(LqPOSIX\\*(Rq)");
272 case(ROFF_p1003_1_2004
):
273 return("IEEE Std 1003.1-2004 "
274 "(\\*(LqPOSIX\\*(Rq)");
276 return("IEEE Std 1003.1 "
277 "(\\*(LqPOSIX\\*(Rq)");
279 return("IEEE Std 1003.1b "
280 "(\\*(LqPOSIX\\*(Rq)");
281 case(ROFF_p1003_1b_93
):
282 return("IEEE Std 1003.1b-1993 "
283 "(\\*(LqPOSIX\\*(Rq)");
284 case(ROFF_p1003_1c_95
):
285 return("IEEE Std 1003.1c-1995 "
286 "(\\*(LqPOSIX\\*(Rq)");
287 case(ROFF_p1003_1g_2000
):
288 return("IEEE Std 1003.1g-2000 "
289 "(\\*(LqPOSIX\\*(Rq)");
290 case(ROFF_p1003_2_92
):
291 return("IEEE Std 1003.2-1992 "
292 "(\\*(LqPOSIX.2\\*(Rq)");
293 case(ROFF_p1387_2_95
):
294 return("IEEE Std 1387.2-1995 "
295 "(\\*(LqPOSIX.7.2\\*(Rq)");
297 return("IEEE Std 1003.2 "
298 "(\\*(LqPOSIX.2\\*(Rq)");
300 return("IEEE Std 1387.2 "
301 "(\\*(LqPOSIX.7.2\\*(Rq)");
303 return("ISO/IEC 9899:1990 "
304 "(\\*(LqISO C90\\*(Rq)");
305 case(ROFF_isoC_amd1
):
306 return("ISO/IEC 9899/AMD1:1995 "
307 "(\\*(LqISO C90\\*(Rq)");
308 case(ROFF_isoC_tcor1
):
309 return("ISO/IEC 9899/TCOR1:1994 "
310 "(\\*(LqISO C90\\*(Rq)");
311 case(ROFF_isoC_tcor2
):
312 return("ISO/IEC 9899/TCOR2:1995 "
313 "(\\*(LqISO C90\\*(Rq)");
315 return("ISO/IEC 9899:1999 "
316 "(\\*(LqISO C99\\*(Rq)");
318 return("ANSI X3.159-1989 "
319 "(\\*(LqANSI C\\*(Rq)");
321 return("ANSI X3.159-1989 "
322 "(\\*(LqANSI C\\*(Rq)");
324 return("ANSI/ISO/IEC 9899-1999 "
325 "(\\*(LqANSI C99\\*(Rq)");
327 return("IEEE Std 754-1985");
328 case(ROFF_iso8802_3
):
329 return("ISO 8802-3: 1989");
331 return("X/Open Portability Guide Issue 3 "
332 "(\\*(LqXPG3\\*(Rq)");
334 return("X/Open Portability Guide Issue 4 "
335 "(\\*(LqXPG4\\*(Rq)");
337 return("X/Open Portability Guide Issue 4.2 "
338 "(\\*(LqXPG4.2\\*(Rq)");
340 return("X/Open Portability Guide Issue 4.3 "
341 "(\\*(LqXPG4.3\\*(Rq)");
343 return("X/Open System Interface Definitions "
344 "Issue 5 (\\*(LqXBD5\\*(Rq)");
346 return("X/Open Commands and Utilities Issue 5 "
347 "(\\*(LqXCU5\\*(Rq)");
349 return("X/Open System Interfaces and Headers "
350 "Issue 5 (\\*(LqXSH5\\*(Rq)");
352 return("X/Open Networking Services Issue 5 "
353 "(\\*(LqXNS5\\*(Rq)");
354 case(ROFF_xns5_2d2_0
):
355 return("X/Open Networking Services "
356 "Issue 5.2 Draft 2.0 "
357 "(\\*(LqXNS5.2D2.0\\*(Rq)");
358 case(ROFF_xcurses4_2
):
359 return("X/Open Curses Issue 4 Version 2 "
360 "(\\*(LqXCURSES4.2\\*(Rq)");
362 return("Version 2 of the Single "
363 "UNIX Specification");
365 return("Version 3 of the Single "
366 "UNIX Specification");
368 return("System V Interface Definition, Fourth "
369 "Edition (\\*(LqSVID4\\*(Rq)");
377 return("is currently in beta test.");
379 return("currently under development.");
391 return("BSDI BSD/OS");
402 roff_att(const char *p
)
406 if (0 == strcmp(p
, ROFF_ATTname_V1
))
408 else if (0 == strcmp(p
, ROFF_ATTname_V2
))
410 else if (0 == strcmp(p
, ROFF_ATTname_V3
))
412 else if (0 == strcmp(p
, ROFF_ATTname_V6
))
414 else if (0 == strcmp(p
, ROFF_ATTname_V7
))
416 else if (0 == strcmp(p
, ROFF_ATTname_32V
))
417 return(ROFF_ATT_32V
);
418 else if (0 == strcmp(p
, ROFF_ATTname_V_1
))
419 return(ROFF_ATT_V_1
);
420 else if (0 == strcmp(p
, ROFF_ATTname_V_4
))
421 return(ROFF_ATT_V_4
);
423 return(ROFF_ATT_MAX
);