11abf7346Smrg/* 21abf7346Smrg 31abf7346SmrgCopyright (c) 1987, 1988 X Consortium 41abf7346Smrg 51abf7346SmrgPermission is hereby granted, free of charge, to any person obtaining 61abf7346Smrga copy of this software and associated documentation files (the 71abf7346Smrg"Software"), to deal in the Software without restriction, including 81abf7346Smrgwithout limitation the rights to use, copy, modify, merge, publish, 91abf7346Smrgdistribute, sublicense, and/or sell copies of the Software, and to 101abf7346Smrgpermit persons to whom the Software is furnished to do so, subject to 111abf7346Smrgthe following conditions: 121abf7346Smrg 131abf7346SmrgThe above copyright notice and this permission notice shall be included 141abf7346Smrgin all copies or substantial portions of the Software. 151abf7346Smrg 161abf7346SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 171abf7346SmrgOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 181abf7346SmrgMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 191abf7346SmrgIN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR 201abf7346SmrgOTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 211abf7346SmrgARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 221abf7346SmrgOTHER DEALINGS IN THE SOFTWARE. 231abf7346Smrg 241abf7346SmrgExcept as contained in this notice, the name of the X Consortium shall 251abf7346Smrgnot be used in advertising or otherwise to promote the sale, use or 261abf7346Smrgother dealings in this Software without prior written authorization 271abf7346Smrgfrom the X Consortium. 281abf7346Smrg 291abf7346Smrg*/ 301abf7346Smrg 311abf7346Smrg/* Vendor-specific data structures and operations */ 321abf7346Smrg 331abf7346Smrg#include "globals.h" 341abf7346Smrg#include "vendor.h" 351abf7346Smrg 361abf7346Smrgtypedef struct sectionName { 376d36ef34Smrg const char *name; 386d36ef34Smrg const char *suffix; 391abf7346Smrg} SectionNameRec; 401abf7346Smrg 411abf7346Smrg#if defined(sun) && defined(SVR4) 421abf7346Smrg/* losing man.cf is useless because it has no section names */ 431abf7346Smrg 441abf7346Smrgstatic SectionNameRec SectionNames[] = { 456d36ef34Smrg {"(1) User Commands", "1"}, 466d36ef34Smrg {"(1b) SunOS/BSD Compatibility Commands", "1b"}, 476d36ef34Smrg {"(1c) Communication Commands", "1c"}, 486d36ef34Smrg {"(1f) FMLI Commands", "1f"}, 496d36ef34Smrg {"(1m) Maintenance Commands", "1m"}, 506d36ef34Smrg {"(1s) SunOS Specific Commands", "1s"}, 516d36ef34Smrg {"(2) System Calls", "2"}, 526d36ef34Smrg {"(3) Introduction to Library Functions", "3"}, 536d36ef34Smrg {"(3adm) General Administrative Library Functions", "3adm"}, 546d36ef34Smrg {"(3aio) Asynchronous I/O Library Functions", "3aio"}, 556d36ef34Smrg {"(3b) SunOS/BSD Compatibility Functions", "3b"}, 566d36ef34Smrg {"(3bsm) Security and Auditing Library Functions", "3bsm"}, 576d36ef34Smrg {"(3c) C Library Functions", "3c"}, 586d36ef34Smrg {"(3cfgadm) Configuration Administration Library Functions", "3cfgadm"}, 596d36ef34Smrg {"(3crypt) Encryption and Decryption Library", "3crypt"}, 606d36ef34Smrg {"(3curses) Curses Library Functions", "3curses"}, 616d36ef34Smrg {"(3devid) Device ID Library Functions", "3devid"}, 626d36ef34Smrg {"(3devinfo) Device Information Library Functions", "3devinfo"}, 636d36ef34Smrg {"(3dl) Dynamic Linking Library Functions", "3dl"}, 646d36ef34Smrg {"(3dmi) DMI Library Functions", "3dmi"}, 656d36ef34Smrg {"(3door) Door Library Functions", "3door"}, 666d36ef34Smrg {"(3e) ELF Library Functions", "3e"}, 676d36ef34Smrg {"(3elf) ELF Library Functions", "3elf"}, 686d36ef34Smrg {"(3ext) Extended Library Functions", "3ext"}, 696d36ef34Smrg {"(3g) C Library Functions", "3g"}, 706d36ef34Smrg {"(3gen) String Pattern-Matching Library Functions", "3gen"}, 716d36ef34Smrg {"(3head) Headers", "3head"}, 726d36ef34Smrg {"(3i) Wide Character Functions", "3i"}, 736d36ef34Smrg {"(3k) Kernel VM Library Functions", "3k"}, 746d36ef34Smrg {"(3krb) Kerberos Library Functions", "3krb"}, 756d36ef34Smrg {"(3kstat) Kernel Statistics Library Functions", "3kstat"}, 766d36ef34Smrg {"(3kvm) Kernel VM Library Functions", "3kvm"}, 776d36ef34Smrg {"(3layout) Layout Services Library Functions", "3layout"}, 786d36ef34Smrg {"(3ldap) LDAP Library Functions", "3ldap"}, 796d36ef34Smrg {"(3lib) Interface Libraries", "3lib"}, 806d36ef34Smrg {"(3libucb) SunOS/BSD Compatibility Interface Libraries", "3libucb"}, 816d36ef34Smrg {"(3m) Mathematical Library Functions", "3m"}, 826d36ef34Smrg {"(3mail) User Mailbox Library Functions", "3mail"}, 836d36ef34Smrg {"(3malloc) Memory Allocation Library Functions", "3malloc"}, 846d36ef34Smrg {"(3mp) Integer Mathematical Library Functions", "3mp"}, 856d36ef34Smrg {"(3n) Network Functions", "3n"}, 866d36ef34Smrg {"(3nsl) Networking Services Library Functions", "3nsl"}, 876d36ef34Smrg {"(3pam) PAM Library Functions", "3pam"}, 886d36ef34Smrg {"(3plot) Graphics Interface Library Functions", "3plot"}, 896d36ef34Smrg {"(3proc) Process Control Library Functions", "3proc"}, 906d36ef34Smrg {"(3r) Realtime Library", "3r"}, 916d36ef34Smrg {"(3rac) Remote Asynchronous Calls Library Functions", "3rac"}, 926d36ef34Smrg {"(3resolv) Resolver Library Functions", "3resolv"}, 936d36ef34Smrg {"(3rpc) RPC Library Functions", "3rpc"}, 946d36ef34Smrg {"(3rt) Realtime Library Functions", "3rt"}, 956d36ef34Smrg {"(3s) Standard I/O Functions", "3s"}, 966d36ef34Smrg {"(3sched) LWP Scheduling Library Functions", "3sched"}, 976d36ef34Smrg {"(3sec) File Access Control Library Functions", "3sec"}, 986d36ef34Smrg {"(3secdb) Security Attributes Database Library Functions", "3secdb"}, 996d36ef34Smrg {"(3snmp) SNMP Library Functions", "3snmp"}, 1006d36ef34Smrg {"(3socket) Sockets Library Functions", "3socket"}, 1016d36ef34Smrg {"(3t) Threads Library Functions", "3t"}, 1026d36ef34Smrg {"(3thr) Threads Library Functions", "3thr"}, 1036d36ef34Smrg {"(3tnf) TNF Library Functions", "3tnf"}, 1046d36ef34Smrg {"(3ucb) SunOS/BSD Compatibility Library Functions", "3ucb"}, 1056d36ef34Smrg {"(3volmgt) Volume Management Library Functions", "3volmgt"}, 1066d36ef34Smrg {"(3x) Miscellaneous Library Functions", "3x"}, 1076d36ef34Smrg {"(3xc) X/Open Curses Library Functions", "3xc"}, 1086d36ef34Smrg {"(3xcurses) X/Open Curses Library Functions", "3xcurses"}, 1096d36ef34Smrg {"(3xfn) XFN Interface Library Functions", "3xfn"}, 1106d36ef34Smrg {"(3xn) X/Open Networking Services Library Functions", "3xn"}, 1116d36ef34Smrg {"(3xnet) X/Open Networking Services Library Functions", "3xnet"}, 1126d36ef34Smrg {"(3x11) X Window System: Xlib Functions", "3x11"}, 1136d36ef34Smrg {"(3xcb) X Window System: X C Binding Functions", "3xcb"}, 1146d36ef34Smrg {"(3xext) X Window System: Protocol Extension Functions", "3xext"}, 1156d36ef34Smrg {"(3xi) X Window System: Input Extension Functions", "3xi"}, 1166d36ef34Smrg {"(3xmu) X Window System: Miscellaneous Utility Functions","3xmu"}, 1176d36ef34Smrg {"(3xp) X Window System: Print Extension Functions", "3xp"}, 1186d36ef34Smrg {"(3xt) X Window System: Toolkit Intrinsics Functions", "3xt"}, 1196d36ef34Smrg {"(4) File Formats", "4"}, 1206d36ef34Smrg {"(4b) Misc. Reference Manual Pages", "4b"}, 1211abf7346Smrg {"(5) Environments, Tables, and TROFF Macros", "5"}, 1226d36ef34Smrg {"(6) Games and Demos", "6"}, 1236d36ef34Smrg {"(7) Special Files", "7"}, 1246d36ef34Smrg {"(7d) Devices", "7d"}, 1256d36ef34Smrg {"(7fs) File Systems", "7fs"}, 1266d36ef34Smrg {"(7i) Ioctl Requests", "7i"}, 1276d36ef34Smrg {"(7m) STREAMS Modules", "7m"}, 1286d36ef34Smrg {"(7p) Protocols", "7p"}, 1296d36ef34Smrg {"(9) Device Driver Information", "9"}, 1306d36ef34Smrg {"(9e) DDI and DKI Driver Entry Points", "9e"}, 1316d36ef34Smrg {"(9f) DDI and DKI Kernel Functions", "9f"}, 1326d36ef34Smrg {"(9s) DDI and DKI Data Structures", "9s"}, 1336d36ef34Smrg {"(l) Local", "l"}, 1346d36ef34Smrg {"(n) New", "n"}, 1356d36ef34Smrg {"(o) Old", "o"} 1361abf7346Smrg}; 1371abf7346Smrg 1381abf7346Smrg#else 1391abf7346Smrg 1401abf7346Smrgstatic SectionNameRec SectionNames[] = { 1416d36ef34Smrg {"(1) User Commands", "1"}, 1426d36ef34Smrg {"(2) System Calls", "2"}, 1436d36ef34Smrg {"(3) Subroutines", "3"}, 1446d36ef34Smrg {"(4) Devices", "4"}, 1456d36ef34Smrg {"(5) File Formats", "5"}, 1466d36ef34Smrg {"(6) Games", "6"}, 1476d36ef34Smrg {"(7) Miscellaneous", "7"}, 1486d36ef34Smrg {"(8) Sys. Administration", "8"}, 1491abf7346Smrg#if defined(__OpenBSD__) || defined(__NetBSD__) 1506d36ef34Smrg {"(9) Kernel Manual", "9"}, 1511abf7346Smrg#endif 1521abf7346Smrg#if defined(__FreeBSD__) 1536d36ef34Smrg {"(9) Kernel Interfaces", "9"}, 1541abf7346Smrg#endif 1556d36ef34Smrg {"(l) Local", "l"}, 1566d36ef34Smrg {"(n) New", "n"}, 1576d36ef34Smrg {"(o) Old", "o"}, 1581abf7346Smrg}; 1591abf7346Smrg 1601abf7346Smrg#endif 161a5a2a776Smrg 1621abf7346Smrg 1631abf7346Smrg/* Function Name: AddStandardSections 1641abf7346Smrg * Description: Adds all the standard sections to the list for this path. 1651abf7346Smrg * Arguments: list - a pointer to the section list. 1661abf7346Smrg * path - the path to these standard sections. 1671abf7346Smrg * Returns: none. 1681abf7346Smrg */ 1691abf7346Smrg 1706d36ef34Smrgvoid 1716d36ef34SmrgAddStandardSections(SectionList ** list, const char *path) 1721abf7346Smrg{ 1736d36ef34Smrg register int i; 1746d36ef34Smrg char file[BUFSIZ]; 1756d36ef34Smrg int numSections = sizeof(SectionNames) / sizeof(SectionNames[0]); 1761abf7346Smrg 1776d36ef34Smrg for (i = 0; i < numSections; i++) { 1786d36ef34Smrg snprintf(file, sizeof(file), "%s%s", SEARCHDIR, SectionNames[i].suffix); 1796d36ef34Smrg AddNewSection(list, path, file, SectionNames[i].name, TRUE); 1801abf7346Smrg#ifdef SEARCHOTHER 1816d36ef34Smrg snprintf(file, sizeof(file), "%s%s", SEARCHOTHER, 1826d36ef34Smrg SectionNames[i].suffix); 1836d36ef34Smrg AddNewSection(list, path, file, SectionNames[i].name, TRUE); 1841abf7346Smrg#endif 1851abf7346Smrg } 1861abf7346Smrg} 1876d36ef34Smrg 1881abf7346Smrg 1891abf7346Smrg 1901abf7346Smrg/* Function Name: CreateManpageName 1911abf7346Smrg * Description: Creates the manual page name for a given item. 1921abf7346Smrg * Arguments: entry - the entry to convert. 1931abf7346Smrg * Returns: the manual page properly allocated. 1941abf7346Smrg */ 1951abf7346Smrg 1961abf7346Smrg/* 1971abf7346Smrg * If the filename is foo.3 - Create an entry of the form: foo 1981abf7346Smrg * If the filename is foo.3X11 - Create an entry of the form: foo(X11) 1991abf7346Smrg * IF the filename is a.out.1 - Create an entry of the form: a.out 2001abf7346Smrg */ 2011abf7346Smrg 2021abf7346Smrgchar * 2036d36ef34SmrgCreateManpageName(const char *entry, int section, /* FIXME: unused */ 2046d36ef34Smrg int flags) 2051abf7346Smrg{ 2066d36ef34Smrg char *cp; 2076d36ef34Smrg char page[BUFSIZ]; 2086d36ef34Smrg char sect[BUFSIZ]; 2096d36ef34Smrg 2106d36ef34Smrg ParseEntry(entry, NULL, sect, page); 2116d36ef34Smrg 2126d36ef34Smrg if ((cp = strrchr(page, '.')) != NULL) { 2136d36ef34Smrg if ((int) strlen(cp) > 2) { 2146d36ef34Smrg *cp++ = '('; 2156d36ef34Smrg while ((cp[1] != '\0')) { 2166d36ef34Smrg *cp = *(cp + 1); 2176d36ef34Smrg cp++; 2186d36ef34Smrg } 2196d36ef34Smrg *cp++ = ')'; 2206d36ef34Smrg *cp = '\0'; 2216d36ef34Smrg } 2226d36ef34Smrg else 2236d36ef34Smrg *cp = '\0'; 2241abf7346Smrg } 2251abf7346Smrg 2261abf7346Smrg 2276d36ef34Smrg return (XtNewString(page)); 2281abf7346Smrg} 229