1 /*
2 
3 Copyright (c) 1991  X Consortium
4 
5 Permission is hereby granted, free of charge, to any person obtaining
6 a copy of this software and associated documentation files (the
7 "Software"), to deal in the Software without restriction, including
8 without limitation the rights to use, copy, modify, merge, publish,
9 distribute, sublicense, and/or sell copies of the Software, and to
10 permit persons to whom the Software is furnished to do so, subject to
11 the following conditions:
12 
13 The above copyright notice and this permission notice shall be included
14 in all copies or substantial portions of the Software.
15 
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19 IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 OTHER DEALINGS IN THE SOFTWARE.
23 
24 Except as contained in this notice, the name of the X Consortium shall
25 not be used in advertising or otherwise to promote the sale, use or
26 other dealings in this Software without prior written authorization
27 from the X Consortium.
28 
29 */
30 
31 /* Vendor-specific definitions */
32 #ifdef HAVE_CONFIG_H
33 # include "config.h"
34 #endif
35 
36 #ifdef CSRG_BASED
37 #include <sys/param.h>
38 #endif
39 
40 #define SUFFIX "suffix"
41 #define FOLD "fold"
42 #define FOLDSUFFIX "foldsuffix"
43 #define MNULL 0
44 #define MSUFFIX 1
45 #define MFOLD 2
46 #define MFOLDSUFFIX 3
47 
48 /*
49  * The directories to search.  Assume that the manual directories are more
50  * complete than the cat directories.
51  */
52 
53 #define SEARCHDIR  MAN
54 
55 #if (defined(sgi) || (defined(SVR4) && !defined(sun)) || (defined(BSD) && (BSD >= 199103)) || defined(linux) || defined(__CYGWIN__) )
56 # define SEARCHOTHER CAT
57 #endif
58 
59 /*
60  * The default manual page directory.
61  *
62  * The MANPATH environment variable will override this.
63  */
64 
65 #ifndef SYSMANPATH
66 
67 #if defined(__bsdi__)
68 #  define SYSMANPATH "/usr/share/man:/usr/contrib/man:/usr/contrib/isode/man:/usr/local/man"
69 #elif defined(__OpenBSD__) || defined(__DARWIN__)
70 #  define SYSMANPATH "/usr/share/man:/usr/local/man:/usr/X11R6/man"
71 #elif defined(SVR4) && defined(sun)
72 #  define SYSMANPATH "/usr/share/man:/usr/X11/man:/usr/openwin/share/man:/usr/dt/share/man:/usr/sfw/share/man"
73 #elif defined(SVR4) || defined(__osf__) || (defined(BSD) && (BSD >= 199103))
74 #  define SYSMANPATH "/usr/share/man"
75 #elif defined(sgi)
76 #  define SYSMANPATH "/usr/catman/a_man:/usr/catman/g_man:/usr/catman/p_man:/usr/catman/u_man:/usr/man/p_man:/usr/man/u_man:/usr/man"
77 #endif
78 
79 #ifndef SYSMANPATH
80 #  define SYSMANPATH "/usr/man"
81 #endif
82 
83 #endif
84 
85 /*
86  * Compression Definitions.
87  */
88 
89 #if defined(sgi)
90 #  define COMPRESSION_EXTENSION   "z"
91 #  define UNCOMPRESS_FORMAT       "pcat %s > %s"
92 #  define NO_COMPRESS           /* mac can't handle using pack as a filter and
93                                    xman needs it to be done that way. */
94 #elif defined (ISC) || defined(__SCO__) || defined(__UNIXWARE__)
95 #  define COMPRESSION_EXTENSION   "Z"           /* dummy */
96 #  if !defined(__SCO__) && !defined(__UNIXWARE__)
97 #    define COMPRESSION_EXTENSIONS  "zZF"       /* pack, compress, freeze */
98 #  else
99 #    define COMPRESSION_EXTENSIONS  "zZ"        /* pack, compress */
100 #  endif
101 #  define UNCOMPRESS_FORMAT       uncompress_format
102 #  define UNCOMPRESS_FORMAT_1     "pcat %s > %s"
103 #  define UNCOMPRESS_FORMAT_2     "zcat < %s > %s"
104 #  define UNCOMPRESS_FORMAT_3     "fcat < %s > %s"
105 #  define NO_COMPRESS
106 #else
107 #  define COMPRESSION_EXTENSION "Z"
108 #  define UNCOMPRESS_FORMAT     "zcat < %s >> %s"
109 #  define COMPRESS              "compress"
110 #  define GZIP_EXTENSION "gz"
111 #  define GUNZIP_FORMAT "gzip -c -d < %s >> %s"
112 #  define GZIP_COMPRESS "gzip"
113 #  define BZIP2_EXTENSION "bz2"
114 #  define BUNZIP2_FORMAT "bunzip2 -c -d < %s >> %s"
115 #  define BZIP2_COMPRESS "bzip2"
116 #  define LZMA_EXTENSION "lzma"
117 #  define UNLZMA_FORMAT "unlzma -c -d < %s >> %s"
118 #  define LZMA_COMPRESS "lzma"
119 #endif
120 
121 
122 
123 /*
124  * The command filters for the manual and apropos searches.
125  */
126 
127 #if defined(hpux)
128 #  define NO_MANPATH_SUPPORT
129 #endif
130 
131 #ifdef NO_MANPATH_SUPPORT
132 #  define APROPOS_FORMAT ("man -k %s | pr -h Apropos >> %s")
133 #else
134 #  define APROPOS_FORMAT ("man -M %s -k %s | pr -h Apropos >> %s")
135 #endif
136 
137 #ifndef HANDLE_ROFFSEQ
138 # if defined(CSRG_BASED)
139 #  define FORMAT "| eqn | tbl | nroff -mandoc"
140 # elif defined(BSD) && (BSD >= 199103)
141 #  define FORMAT "| eqn | tbl | nroff -man"
142 # elif defined(linux) || defined(__CYGWIN__)
143 #  define FORMAT "| pic | eqn | tbl -Tlatin1 | GROFF_NO_SGR= groff -Tlatin1 -mandoc"
144 # else
145 #  define FORMAT "| neqn | nroff -man"  /* The format command. */
146 # endif
147 # define TBL "tbl"
148 #else                           /* HANDLE_ROFFSEQ */
149 # if defined(linux)
150 #  define ZSOELIM	"zsoelim"
151 # else
152 #  define ZSOELIM	"soelim"
153 #endif
154 # define EQN		"eqn"
155 # define TBL		"tbl"
156 # define GRAP		"grap"
157 # define ROFF_PIC	"pic"
158 # define VGRIND		"vgrind"
159 # define REFER		"refer"
160 # if defined(CSRG_BASED)
161 #  define FORMAT	"nroff -mandoc"
162 # elif defined(linux) || defined(__CYGWIN__)
163 #  define FORMAT	"GROFF_NO_SGR= groff -Tlatin1 -mandoc"
164 # elif defined(__DARWIN__)
165 #  define FORMAT	"nroff -man"
166 # else
167 #  define FORMAT	"GROFF_NO_SGR= groff -Tlatin1 -man"
168 # endif
169 # define DEFAULT_MANROFFSEQ "et"
170 #endif                          /*HANDLE_ROFFSEQ */
171 
172 /*
173  * Names of the man and cat dirs.
174  */
175 
176 #ifdef __bsdi__
177 #define MAN "cat"
178 #else
179 #define MAN "man"
180 #endif
181 
182 #if defined(SCO)
183 #  define CAT "cat."
184 #else
185 #  define CAT "cat"
186 #endif
187 
188 /* Solaris has nroff man pages in "man" and sgml man pages in "sman" */
189 #if defined(sun) && defined(SVR4)
190 #  define SFORMAT		"/usr/lib/sgml/sgml2roff"
191 #  define SMAN			"sman"
192 #  undef SEARCHOTHER
193 #  define SEARCHOTHER 		SMAN
194 #  define SGMLENT_EXTENSION	"ent"   /* SGML entity files end in ".ent" */
195 #endif
196 
197 
198 typedef struct _SectionList {
199     struct _SectionList *next;
200     char *label;                /* section label */
201     char *directory;            /* section directory */
202     int flags;
203 } SectionList;
204 
205 extern char *CreateManpageName(const char *entry, int section, int flags);
206 extern void AddStandardSections(SectionList ** list, const char *path);
207 extern void AddNewSection(SectionList ** list, const char *path,
208                           const char *file, const char *label, int flags);
209