From 64bc6412188b141c010ac3b8e813b837dd991e80 Mon Sep 17 00:00:00 2001 From: Erik Andersen Date: Sun, 14 May 2000 04:16:35 +0000 Subject: Initial revision --- COPYING.LIB | 481 ++++++++++++++++++ Makefile | 63 +++ include/a.out.h | 115 +++++ include/ar.h | 18 + include/arpa/inet.h | 12 + include/arpa/nameser.h | 392 ++++++++++++++ include/arpa/telnet.h | 319 ++++++++++++ include/arpa/tftp.h | 80 +++ include/assert.h | 23 + include/cfgfile.h | 8 + include/ctype.h | 38 ++ include/dirent.h | 155 ++++++ include/endian.h | 43 ++ include/err.h | 7 + include/errno.h | 25 + include/fcntl.h | 20 + include/features.h | 39 ++ include/getopt.h | 17 + include/grp.h | 37 ++ include/limits.h | 140 +++++ include/malloc.h | 30 ++ include/math.h | 0 include/memory.h | 1 + include/mntent.h | 110 ++++ include/netdb.h | 215 ++++++++ include/netinet/igmp.h | 24 + include/netinet/in.h | 88 ++++ include/netinet/in_systm.h | 1 + include/netinet/ip.h | 39 ++ include/netinet/ip_fw.h | 1 + include/netinet/ip_icmp.h | 1 + include/netinet/ip_tcp.h | 72 +++ include/netinet/ip_udp.h | 1 + include/netinet/protocols.h | 62 +++ include/netinet/tcp.h | 1 + include/netinet/udp.h | 1 + include/paths.h | 22 + include/pwd.h | 40 ++ include/regexp.h | 21 + include/resolv.h | 85 ++++ include/rpc/auth.h | 166 ++++++ include/rpc/auth_des.h | 46 ++ include/rpc/auth_unix.h | 72 +++ include/rpc/clnt.h | 331 ++++++++++++ include/rpc/pmap_clnt.h | 65 +++ include/rpc/pmap_prot.h | 94 ++++ include/rpc/pmap_rmt.h | 53 ++ include/rpc/rpc.h | 79 +++ include/rpc/rpc_msg.h | 187 +++++++ include/rpc/svc.h | 280 ++++++++++ include/rpc/svc_auth.h | 42 ++ include/rpc/types.h | 65 +++ include/rpc/xdr.h | 270 ++++++++++ include/search.h | 94 ++++ include/setjmp.h | 22 + include/signal.h | 166 ++++++ include/stdarg.h | 47 ++ include/stdio.h | 118 +++++ include/stdlib.h | 75 +++ include/string.h | 56 ++ include/strings.h | 1 + include/sys/bitypes.h | 94 ++++ include/sys/cdefs.h | 36 ++ include/sys/dir.h | 17 + include/sys/errno.h | 1 + include/sys/fcntl.h | 1 + include/sys/file.h | 35 ++ include/sys/ioctl.h | 17 + include/sys/mman.h | 35 ++ include/sys/mount.h | 17 + include/sys/param.h | 46 ++ include/sys/resource.h | 73 +++ include/sys/signal.h | 1 + include/sys/socket.h | 135 +++++ include/sys/socketcall.h | 22 + include/sys/socketio.h | 1 + include/sys/socketvar.h | 8 + include/sys/stat.h | 192 +++++++ include/sys/syscall.h | 182 +++++++ include/sys/syslog.h | 200 ++++++++ include/sys/termios.h | 4 + include/sys/time.h | 81 +++ include/sys/times.h | 21 + include/sys/types.h | 4 + include/sys/uio.h | 65 +++ include/sys/un.h | 1 + include/sys/utsname.h | 18 + include/sys/vfs.h | 17 + include/sys/vm86.h | 125 +++++ include/sys/wait.h | 146 ++++++ include/syscall.h | 6 + include/syslog.h | 1 + include/termcap.h | 21 + include/termio.h | 1 + include/termios.h | 32 ++ include/time.h | 128 +++++ include/unistd.h | 108 ++++ include/utime.h | 15 + include/utmp.h | 52 ++ include/wait.h | 3 + libc/inet/Makefile | 43 ++ libc/inet/addr.c | 85 ++++ libc/inet/resolv.c | 892 ++++++++++++++++++++++++++++++++ libc/inet/rpc/Makefile | 27 + libc/inet/rpc/auth_none.c | 133 +++++ libc/inet/rpc/auth_unix.c | 319 ++++++++++++ libc/inet/rpc/authunix_prot.c | 66 +++ libc/inet/rpc/bindresvport.c | 78 +++ libc/inet/rpc/clnt_generic.c | 115 +++++ libc/inet/rpc/clnt_perror.c | 310 ++++++++++++ libc/inet/rpc/clnt_raw.c | 238 +++++++++ libc/inet/rpc/clnt_simple.c | 112 ++++ libc/inet/rpc/clnt_tcp.c | 466 +++++++++++++++++ libc/inet/rpc/clnt_udp.c | 442 ++++++++++++++++ libc/inet/rpc/get_myaddress.c | 108 ++++ libc/inet/rpc/getrpcent.c | 286 +++++++++++ libc/inet/rpc/getrpcport.c | 55 ++ libc/inet/rpc/pmap_clnt.c | 115 +++++ libc/inet/rpc/pmap_getmaps.c | 84 +++ libc/inet/rpc/pmap_getport.c | 87 ++++ libc/inet/rpc/pmap_prot.c | 57 +++ libc/inet/rpc/pmap_prot2.c | 116 +++++ libc/inet/rpc/pmap_rmt.c | 408 +++++++++++++++ libc/inet/rpc/rpc_callmsg.c | 190 +++++++ libc/inet/rpc/rpc_commondata.c | 41 ++ libc/inet/rpc/rpc_dtablesize.c | 46 ++ libc/inet/rpc/rpc_prot.c | 289 +++++++++++ libc/inet/rpc/svc.c | 492 ++++++++++++++++++ libc/inet/rpc/svc_auth.c | 114 +++++ libc/inet/rpc/svc_auth_unix.c | 134 +++++ libc/inet/rpc/svc_raw.c | 166 ++++++ libc/inet/rpc/svc_run.c | 72 +++ libc/inet/rpc/svc_simple.c | 143 ++++++ libc/inet/rpc/svc_tcp.c | 421 ++++++++++++++++ libc/inet/rpc/svc_udp.c | 475 +++++++++++++++++ libc/inet/rpc/xdr.c | 576 +++++++++++++++++++++ libc/inet/rpc/xdr_array.c | 153 ++++++ libc/inet/rpc/xdr_float.c | 272 ++++++++++ libc/inet/rpc/xdr_mem.c | 184 +++++++ libc/inet/rpc/xdr_rec.c | 580 +++++++++++++++++++++ libc/inet/rpc/xdr_reference.c | 132 +++++ libc/inet/rpc/xdr_stdio.c | 189 +++++++ libc/misc/time/Makefile | 24 + libc/misc/time/README | 8 + libc/misc/time/asc_conv.c | 49 ++ libc/misc/time/asctime.c | 15 + libc/misc/time/asctime_r.c | 15 + libc/misc/time/ctime.c | 26 + libc/misc/time/ctime_r.c | 26 + libc/misc/time/gmtime.c | 16 + libc/misc/time/gmtime_r.c | 14 + libc/misc/time/localtime.c | 22 + libc/misc/time/localtime_r.c | 22 + libc/misc/time/mktime.c | 259 ++++++++++ libc/misc/time/tm_conv.c | 138 +++++ libc/pwd_grp/Makefile | 33 ++ libc/pwd_grp/__getgrent.c | 168 ++++++ libc/pwd_grp/config.h | 65 +++ libc/pwd_grp/fgetgrent.c | 35 ++ libc/pwd_grp/fgetpwent.c | 35 ++ libc/pwd_grp/getgrgid.c | 48 ++ libc/pwd_grp/getgrnam.c | 51 ++ libc/pwd_grp/getpw.c | 51 ++ libc/pwd_grp/getpwnam.c | 52 ++ libc/pwd_grp/getpwuid.c | 44 ++ libc/pwd_grp/grent.c | 57 +++ libc/pwd_grp/initgroups.c | 80 +++ libc/pwd_grp/putpwent.c | 39 ++ libc/pwd_grp/pwent.c | 62 +++ libc/stdio/Makefile | 53 ++ libc/stdio/printf.c | 387 ++++++++++++++ libc/stdio/scanf.c | 536 ++++++++++++++++++++ libc/stdio/stdio.c | 925 ++++++++++++++++++++++++++++++++++ libc/stdlib/Makefile | 64 +++ libc/stdlib/atexit.c | 117 +++++ libc/stdlib/bsearch.c | 46 ++ libc/stdlib/getenv.c | 31 ++ libc/stdlib/malloc/Makefile | 33 ++ libc/stdlib/malloc/alloc.c | 82 +++ libc/stdlib/mkstemp.c | 43 ++ libc/stdlib/mktemp.c | 40 ++ libc/stdlib/putenv.c | 62 +++ libc/stdlib/qsort.c | 166 ++++++ libc/stdlib/rand.c | 61 +++ libc/stdlib/setenv.c | 73 +++ libc/stdlib/strtod.c | 96 ++++ libc/stdlib/system.c | 48 ++ libc/string/Makefile | 37 ++ libc/string/config.c | 93 ++++ libc/string/strcasecmp.c | 26 + libc/string/strcspn.c | 32 ++ libc/string/string.c | 672 ++++++++++++++++++++++++ libc/string/strncasecmp.c | 28 + libc/string/strpbrk.c | 21 + libc/string/strsep.c | 38 ++ libc/string/strspn.c | 44 ++ libc/string/strstr.c | 54 ++ libc/string/strtok.c | 71 +++ libc/sysdeps/linux/i386/bits/setjmp.h | 176 +++++++ libc/termios/Makefile | 36 ++ libc/termios/termios.c | 348 +++++++++++++ libc/termios/ttyname.c | 45 ++ 202 files changed, 22487 insertions(+) create mode 100644 COPYING.LIB create mode 100644 Makefile create mode 100644 include/a.out.h create mode 100644 include/ar.h create mode 100644 include/arpa/inet.h create mode 100644 include/arpa/nameser.h create mode 100644 include/arpa/telnet.h create mode 100644 include/arpa/tftp.h create mode 100644 include/assert.h create mode 100644 include/cfgfile.h create mode 100644 include/ctype.h create mode 100644 include/dirent.h create mode 100644 include/endian.h create mode 100644 include/err.h create mode 100644 include/errno.h create mode 100644 include/fcntl.h create mode 100644 include/features.h create mode 100644 include/getopt.h create mode 100644 include/grp.h create mode 100644 include/limits.h create mode 100644 include/malloc.h create mode 100644 include/math.h create mode 100644 include/memory.h create mode 100644 include/mntent.h create mode 100644 include/netdb.h create mode 100644 include/netinet/igmp.h create mode 100644 include/netinet/in.h create mode 100644 include/netinet/in_systm.h create mode 100644 include/netinet/ip.h create mode 100644 include/netinet/ip_fw.h create mode 100644 include/netinet/ip_icmp.h create mode 100644 include/netinet/ip_tcp.h create mode 100644 include/netinet/ip_udp.h create mode 100644 include/netinet/protocols.h create mode 100644 include/netinet/tcp.h create mode 100644 include/netinet/udp.h create mode 100644 include/paths.h create mode 100644 include/pwd.h create mode 100644 include/regexp.h create mode 100644 include/resolv.h create mode 100644 include/rpc/auth.h create mode 100644 include/rpc/auth_des.h create mode 100644 include/rpc/auth_unix.h create mode 100644 include/rpc/clnt.h create mode 100644 include/rpc/pmap_clnt.h create mode 100644 include/rpc/pmap_prot.h create mode 100644 include/rpc/pmap_rmt.h create mode 100644 include/rpc/rpc.h create mode 100644 include/rpc/rpc_msg.h create mode 100644 include/rpc/svc.h create mode 100644 include/rpc/svc_auth.h create mode 100644 include/rpc/types.h create mode 100644 include/rpc/xdr.h create mode 100644 include/search.h create mode 100644 include/setjmp.h create mode 100644 include/signal.h create mode 100644 include/stdarg.h create mode 100644 include/stdio.h create mode 100644 include/stdlib.h create mode 100644 include/string.h create mode 100644 include/strings.h create mode 100644 include/sys/bitypes.h create mode 100644 include/sys/cdefs.h create mode 100644 include/sys/dir.h create mode 100644 include/sys/errno.h create mode 100644 include/sys/fcntl.h create mode 100644 include/sys/file.h create mode 100644 include/sys/ioctl.h create mode 100644 include/sys/mman.h create mode 100644 include/sys/mount.h create mode 100644 include/sys/param.h create mode 100644 include/sys/resource.h create mode 100644 include/sys/signal.h create mode 100644 include/sys/socket.h create mode 100644 include/sys/socketcall.h create mode 100644 include/sys/socketio.h create mode 100644 include/sys/socketvar.h create mode 100644 include/sys/stat.h create mode 100644 include/sys/syscall.h create mode 100644 include/sys/syslog.h create mode 100644 include/sys/termios.h create mode 100644 include/sys/time.h create mode 100644 include/sys/times.h create mode 100644 include/sys/types.h create mode 100644 include/sys/uio.h create mode 100644 include/sys/un.h create mode 100644 include/sys/utsname.h create mode 100644 include/sys/vfs.h create mode 100644 include/sys/vm86.h create mode 100644 include/sys/wait.h create mode 100644 include/syscall.h create mode 100644 include/syslog.h create mode 100644 include/termcap.h create mode 100644 include/termio.h create mode 100644 include/termios.h create mode 100644 include/time.h create mode 100644 include/unistd.h create mode 100644 include/utime.h create mode 100644 include/utmp.h create mode 100644 include/wait.h create mode 100644 libc/inet/Makefile create mode 100644 libc/inet/addr.c create mode 100644 libc/inet/resolv.c create mode 100644 libc/inet/rpc/Makefile create mode 100644 libc/inet/rpc/auth_none.c create mode 100644 libc/inet/rpc/auth_unix.c create mode 100644 libc/inet/rpc/authunix_prot.c create mode 100644 libc/inet/rpc/bindresvport.c create mode 100644 libc/inet/rpc/clnt_generic.c create mode 100644 libc/inet/rpc/clnt_perror.c create mode 100644 libc/inet/rpc/clnt_raw.c create mode 100644 libc/inet/rpc/clnt_simple.c create mode 100644 libc/inet/rpc/clnt_tcp.c create mode 100644 libc/inet/rpc/clnt_udp.c create mode 100644 libc/inet/rpc/get_myaddress.c create mode 100644 libc/inet/rpc/getrpcent.c create mode 100644 libc/inet/rpc/getrpcport.c create mode 100644 libc/inet/rpc/pmap_clnt.c create mode 100644 libc/inet/rpc/pmap_getmaps.c create mode 100644 libc/inet/rpc/pmap_getport.c create mode 100644 libc/inet/rpc/pmap_prot.c create mode 100644 libc/inet/rpc/pmap_prot2.c create mode 100644 libc/inet/rpc/pmap_rmt.c create mode 100644 libc/inet/rpc/rpc_callmsg.c create mode 100644 libc/inet/rpc/rpc_commondata.c create mode 100644 libc/inet/rpc/rpc_dtablesize.c create mode 100644 libc/inet/rpc/rpc_prot.c create mode 100644 libc/inet/rpc/svc.c create mode 100644 libc/inet/rpc/svc_auth.c create mode 100644 libc/inet/rpc/svc_auth_unix.c create mode 100644 libc/inet/rpc/svc_raw.c create mode 100644 libc/inet/rpc/svc_run.c create mode 100644 libc/inet/rpc/svc_simple.c create mode 100644 libc/inet/rpc/svc_tcp.c create mode 100644 libc/inet/rpc/svc_udp.c create mode 100644 libc/inet/rpc/xdr.c create mode 100644 libc/inet/rpc/xdr_array.c create mode 100644 libc/inet/rpc/xdr_float.c create mode 100644 libc/inet/rpc/xdr_mem.c create mode 100644 libc/inet/rpc/xdr_rec.c create mode 100644 libc/inet/rpc/xdr_reference.c create mode 100644 libc/inet/rpc/xdr_stdio.c create mode 100644 libc/misc/time/Makefile create mode 100644 libc/misc/time/README create mode 100644 libc/misc/time/asc_conv.c create mode 100644 libc/misc/time/asctime.c create mode 100644 libc/misc/time/asctime_r.c create mode 100644 libc/misc/time/ctime.c create mode 100644 libc/misc/time/ctime_r.c create mode 100644 libc/misc/time/gmtime.c create mode 100644 libc/misc/time/gmtime_r.c create mode 100644 libc/misc/time/localtime.c create mode 100644 libc/misc/time/localtime_r.c create mode 100644 libc/misc/time/mktime.c create mode 100644 libc/misc/time/tm_conv.c create mode 100644 libc/pwd_grp/Makefile create mode 100644 libc/pwd_grp/__getgrent.c create mode 100644 libc/pwd_grp/config.h create mode 100644 libc/pwd_grp/fgetgrent.c create mode 100644 libc/pwd_grp/fgetpwent.c create mode 100644 libc/pwd_grp/getgrgid.c create mode 100644 libc/pwd_grp/getgrnam.c create mode 100644 libc/pwd_grp/getpw.c create mode 100644 libc/pwd_grp/getpwnam.c create mode 100644 libc/pwd_grp/getpwuid.c create mode 100644 libc/pwd_grp/grent.c create mode 100644 libc/pwd_grp/initgroups.c create mode 100644 libc/pwd_grp/putpwent.c create mode 100644 libc/pwd_grp/pwent.c create mode 100644 libc/stdio/Makefile create mode 100644 libc/stdio/printf.c create mode 100644 libc/stdio/scanf.c create mode 100644 libc/stdio/stdio.c create mode 100644 libc/stdlib/Makefile create mode 100644 libc/stdlib/atexit.c create mode 100644 libc/stdlib/bsearch.c create mode 100644 libc/stdlib/getenv.c create mode 100644 libc/stdlib/malloc/Makefile create mode 100644 libc/stdlib/malloc/alloc.c create mode 100644 libc/stdlib/mkstemp.c create mode 100644 libc/stdlib/mktemp.c create mode 100644 libc/stdlib/putenv.c create mode 100644 libc/stdlib/qsort.c create mode 100644 libc/stdlib/rand.c create mode 100644 libc/stdlib/setenv.c create mode 100644 libc/stdlib/strtod.c create mode 100644 libc/stdlib/system.c create mode 100644 libc/string/Makefile create mode 100644 libc/string/config.c create mode 100644 libc/string/strcasecmp.c create mode 100644 libc/string/strcspn.c create mode 100644 libc/string/string.c create mode 100644 libc/string/strncasecmp.c create mode 100644 libc/string/strpbrk.c create mode 100644 libc/string/strsep.c create mode 100644 libc/string/strspn.c create mode 100644 libc/string/strstr.c create mode 100644 libc/string/strtok.c create mode 100644 libc/sysdeps/linux/i386/bits/setjmp.h create mode 100644 libc/termios/Makefile create mode 100644 libc/termios/termios.c create mode 100644 libc/termios/ttyname.c diff --git a/COPYING.LIB b/COPYING.LIB new file mode 100644 index 000000000..eb685a5ec --- /dev/null +++ b/COPYING.LIB @@ -0,0 +1,481 @@ + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, so that any problems introduced by others will not reflect on +the original authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + d) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the source code distributed need not include anything that is normally +distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Library General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..bfde99562 --- /dev/null +++ b/Makefile @@ -0,0 +1,63 @@ +DIRS = headers error gtermcap misc stdio2 time getent regexp string termios sysdeps \ +malloc-simple net rpc + +all: libc.a crt0.o + +libc.a: $(DIRS) dummy + m68k-pic-coff-ranlib $@ + +crt0.o: crt + +headers: dummy + if [ ! -L "include/asm" ]; then ln -s ../../linux/include/asm include/asm ; fi + if [ ! -L "include/net" ]; then ln -s ../../linux/include/net include/net ; fi + if [ ! -L "include/linux" ]; then ln -s ../../linux/include/linux include/linux ; fi + +error: dummy + make -C error + +gtermcap: dummy + make -C gtermcap + +misc: dummy + make -C misc + +stdio2: dummy + make -C stdio2 + +time: dummy + make -C time + +getent: dummy + make -C getent + +regexp: dummy + make -C regexp + +string: dummy + make -C string + +termios: dummy + make -C termios + +sysdeps: dummy + make -C sysdeps + +malloc-simple: dummy + make -C malloc-simple + +net: dummy + make -C net + +rpc: dummy + make -C rpc + +crt: dummy + make -C crt + +dummy: + +clean: + -rm `find -name \*.[oa]` `find -name \*~` core + -rm include/asm include/net include/linux + diff --git a/include/a.out.h b/include/a.out.h new file mode 100644 index 000000000..bd58346c1 --- /dev/null +++ b/include/a.out.h @@ -0,0 +1,115 @@ +/* Copyright (C) 1990-1996 + * This file is part of the ld86 command for Linux-86 + * It is distributed under the GNU Library General Public License. + * + * - This may actually be BSD or Minix code, can someone clarify please. -RDB + */ + +#ifndef __AOUT_H +#define __AOUT_H + +struct exec { /* a.out header */ + unsigned char a_magic[2]; /* magic number */ + unsigned char a_flags; /* flags, see below */ + unsigned char a_cpu; /* cpu id */ + unsigned char a_hdrlen; /* length of header */ + unsigned char a_unused; /* reserved for future use */ + unsigned short a_version; /* version stamp (not used at present) */ + long a_text; /* size of text segement in bytes */ + long a_data; /* size of data segment in bytes */ + long a_bss; /* size of bss segment in bytes */ + long a_entry; /* entry point */ + long a_total; /* total memory allocated */ + long a_syms; /* size of symbol table */ + + /* SHORT FORM ENDS HERE */ + long a_trsize; /* text relocation size */ + long a_drsize; /* data relocation size */ + long a_tbase; /* text relocation base */ + long a_dbase; /* data relocation base */ +}; + +#define A_MAGIC0 (unsigned char) 0x01 +#define A_MAGIC1 (unsigned char) 0x03 +#define BADMAG(X) ((X).a_magic[0] != A_MAGIC0 ||(X).a_magic[1] != A_MAGIC1) + +/* CPU Id of TARGET machine (byte order coded in low order two bits) */ +#define A_NONE 0x00 /* unknown */ +#define A_I8086 0x04 /* intel i8086/8088 */ +#define A_M68K 0x0B /* motorola m68000 */ +#define A_NS16K 0x0C /* national semiconductor 16032 */ +#define A_I80386 0x10 /* intel i80386 */ +#define A_SPARC 0x17 /* Sun SPARC */ + +#define A_BLR(cputype) ((cputype&0x01)!=0) /* TRUE if bytes left-to-right */ +#define A_WLR(cputype) ((cputype&0x02)!=0) /* TRUE if words left-to-right */ + +/* Flags. */ +#define A_UZP 0x01 /* unmapped zero page (pages) */ +#define A_PAL 0x02 /* page aligned executable */ +#define A_NSYM 0x04 /* new style symbol table */ +#define A_EXEC 0x10 /* executable */ +#define A_SEP 0x20 /* separate I/D */ +#define A_PURE 0x40 /* pure text */ +#define A_TOVLY 0x80 /* text overlay */ + +/* Offsets of various things. */ +#define A_MINHDR 32 +#define A_TEXTPOS(X) ((long)(X).a_hdrlen) +#define A_DATAPOS(X) (A_TEXTPOS(X) + (X).a_text) +#define A_HASRELS(X) ((X).a_hdrlen > (unsigned char) A_MINHDR) +#define A_HASEXT(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 8)) +#define A_HASLNS(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 16)) +#define A_HASTOFF(X) ((X).a_hdrlen > (unsigned char) (A_MINHDR + 24)) +#define A_TRELPOS(X) (A_DATAPOS(X) + (X).a_data) +#define A_DRELPOS(X) (A_TRELPOS(X) + (X).a_trsize) +#define A_SYMPOS(X) (A_TRELPOS(X) + (A_HASRELS(X) ? \ + ((X).a_trsize + (X).a_drsize) : 0)) + +struct reloc { + long r_vaddr; /* virtual address of reference */ + unsigned short r_symndx; /* internal segnum or extern symbol num */ + unsigned short r_type; /* relocation type */ +}; + +/* r_tyep values: */ +#define R_ABBS 0 +#define R_RELLBYTE 2 +#define R_PCRBYTE 3 +#define R_RELWORD 4 +#define R_PCRWORD 5 +#define R_RELLONG 6 +#define R_PCRLONG 7 +#define R_REL3BYTE 8 +#define R_KBRANCHE 9 + +/* r_symndx for internal segments */ +#define S_ABS ((unsigned short)-1) +#define S_TEXT ((unsigned short)-2) +#define S_DATA ((unsigned short)-3) +#define S_BSS ((unsigned short)-4) + +struct nlist { /* symbol table entry */ + char n_name[8]; /* symbol name */ + long n_value; /* value */ + unsigned char n_sclass; /* storage class */ + unsigned char n_numaux; /* number of auxiliary entries (not used) */ + unsigned short n_type; /* language base and derived type (not used) */ +}; + +/* Low bits of storage class (section). */ +#define N_SECT 07 /* section mask */ +#define N_UNDF 00 /* undefined */ +#define N_ABS 01 /* absolute */ +#define N_TEXT 02 /* text */ +#define N_DATA 03 /* data */ +#define N_BSS 04 /* bss */ +#define N_COMM 05 /* (common) */ + +/* High bits of storage class. */ +#define N_CLASS 0370 /* storage class mask */ +#define C_NULL +#define C_EXT 0020 /* external symbol */ +#define C_STAT 0030 /* static */ + +#endif /* _AOUT_H */ diff --git a/include/ar.h b/include/ar.h new file mode 100644 index 000000000..c6083717d --- /dev/null +++ b/include/ar.h @@ -0,0 +1,18 @@ +#ifndef __AR_H +#define __AR_H + +#define ARMAG "!\n" +#define SARMAG 8 +#define ARFMAG "`\n" + +struct ar_hdr { + char ar_name[16], + ar_date[12], + ar_uid[6], + ar_gid[6], + ar_mode[8], + ar_size[10], + ar_fmag[2]; +}; + +#endif /* __AR_H */ diff --git a/include/arpa/inet.h b/include/arpa/inet.h new file mode 100644 index 000000000..cf4cd3275 --- /dev/null +++ b/include/arpa/inet.h @@ -0,0 +1,12 @@ +#ifndef __ARPA_INET_H +#define __ARPA_INET_H + +#include + +int inet_aton(const char *cp, struct in_addr *inp); + +unsigned long int inet_addr(const char *cp); + +char *inet_ntoa(struct in_addr in); + +#endif diff --git a/include/arpa/nameser.h b/include/arpa/nameser.h new file mode 100644 index 000000000..ba6014216 --- /dev/null +++ b/include/arpa/nameser.h @@ -0,0 +1,392 @@ +/* + * ++Copyright++ 1983, 1989, 1993 + * - + * Copyright (c) 1983, 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * - + * Portions Copyright (c) 1993 by Digital Equipment Corporation. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies, and that + * the name of Digital Equipment Corporation not be used in advertising or + * publicity pertaining to distribution of the document or software without + * specific, written prior permission. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + * - + * Portions Copyright (c) 1995 by International Business Machines, Inc. + * + * International Business Machines, Inc. (hereinafter called IBM) grants + * permission under its copyrights to use, copy, modify, and distribute this + * Software with or without fee, provided that the above copyright notice and + * all paragraphs of this notice appear in all copies, and that the name of IBM + * not be used in connection with the marketing of any product incorporating + * the Software or modifications thereof, without specific, written prior + * permission. + * + * To the extent it has a right to do so, IBM grants an immunity from suit + * under its patents, if any, for the use, sale or manufacture of products to + * the extent that such products are used for performing Domain Name System + * dynamic updates in TCP/IP networks by means of the Software. No immunity is + * granted for any product per se or for any other function of any product. + * + * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, + * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN + * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. + * --Copyright-- + */ + +/* + * @(#)nameser.h 8.1 (Berkeley) 6/2/93 + * $Id: nameser.h,v 1.1 2000/05/14 04:16:36 erik Exp $ + */ + +#ifndef _NAMESER_H_ +#define _NAMESER_H_ + +#include +#if (!defined(BSD)) || (BSD < 199306) +# include +#else +# include +#endif +#include + +#ifdef _AUX_SOURCE +# include +#endif + +/* + * revision information. this is the release date in YYYYMMDD format. + * it can change every day so the right thing to do with it is use it + * in preprocessor commands such as "#if (__BIND > 19931104)". do not + * compare for equality; rather, use it to determine whether your resolver + * is new enough to contain a certain feature. + */ + +#define __BIND 19960801 /* interface version stamp */ + +/* + * Define constants based on rfc883 + */ +#define PACKETSZ 512 /* maximum packet size */ +#define MAXDNAME 1025 /* maximum domain name */ +#define MAXCDNAME 255 /* maximum compressed domain name */ +#define MAXLABEL 63 /* maximum length of domain label */ +#define HFIXEDSZ 12 /* #/bytes of fixed data in header */ +#define QFIXEDSZ 4 /* #/bytes of fixed data in query */ +#define RRFIXEDSZ 10 /* #/bytes of fixed data in r record */ +#define INT32SZ 4 /* for systems without 32-bit ints */ +#define INT16SZ 2 /* for systems without 16-bit ints */ +#define INADDRSZ 4 /* IPv4 T_A */ +#define IN6ADDRSZ 16 /* IPv6 T_AAAA */ + +/* + * Internet nameserver port number + */ +#define NAMESERVER_PORT 53 + +/* + * Currently defined opcodes + */ +#define QUERY 0x0 /* standard query */ +#define IQUERY 0x1 /* inverse query */ +#define STATUS 0x2 /* nameserver status query */ +/*#define xxx 0x3*/ /* 0x3 reserved */ +#define NS_NOTIFY_OP 0x4 /* notify secondary of SOA change */ +/* + * Currently defined response codes + */ +#define NOERROR 0 /* no error */ +#define FORMERR 1 /* format error */ +#define SERVFAIL 2 /* server failure */ +#define NXDOMAIN 3 /* non existent domain */ +#define NOTIMP 4 /* not implemented */ +#define REFUSED 5 /* query refused */ + +/* + * Type values for resources and queries + */ +#define T_A 1 /* host address */ +#define T_NS 2 /* authoritative server */ +#define T_MD 3 /* mail destination */ +#define T_MF 4 /* mail forwarder */ +#define T_CNAME 5 /* canonical name */ +#define T_SOA 6 /* start of authority zone */ +#define T_MB 7 /* mailbox domain name */ +#define T_MG 8 /* mail group member */ +#define T_MR 9 /* mail rename name */ +#define T_NULL 10 /* null resource record */ +#define T_WKS 11 /* well known service */ +#define T_PTR 12 /* domain name pointer */ +#define T_HINFO 13 /* host information */ +#define T_MINFO 14 /* mailbox information */ +#define T_MX 15 /* mail routing information */ +#define T_TXT 16 /* text strings */ +#define T_RP 17 /* responsible person */ +#define T_AFSDB 18 /* AFS cell database */ +#define T_X25 19 /* X_25 calling address */ +#define T_ISDN 20 /* ISDN calling address */ +#define T_RT 21 /* router */ +#define T_NSAP 22 /* NSAP address */ +#define T_NSAP_PTR 23 /* reverse NSAP lookup (deprecated) */ +#define T_SIG 24 /* security signature */ +#define T_KEY 25 /* security key */ +#define T_PX 26 /* X.400 mail mapping */ +#define T_GPOS 27 /* geographical position (withdrawn) */ +#define T_AAAA 28 /* IP6 Address */ +#define T_LOC 29 /* Location Information */ +#define T_NXT 30 /* Next Valid Name in Zone */ +#define T_EID 31 /* Endpoint identifier */ +#define T_NIMLOC 32 /* Nimrod locator */ +#define T_SRV 33 /* Server selection */ +#define T_ATMA 34 /* ATM Address */ +#define T_NAPTR 35 /* Naming Authority PoinTeR */ + /* non standard */ +#define T_UINFO 100 /* user (finger) information */ +#define T_UID 101 /* user ID */ +#define T_GID 102 /* group ID */ +#define T_UNSPEC 103 /* Unspecified format (binary data) */ + /* Query type values which do not appear in resource records */ +#define T_IXFR 251 /* incremental zone transfer */ +#define T_AXFR 252 /* transfer zone of authority */ +#define T_MAILB 253 /* transfer mailbox records */ +#define T_MAILA 254 /* transfer mail agent records */ +#define T_ANY 255 /* wildcard match */ + +/* + * Values for class field + */ + +#define C_IN 1 /* the arpa internet */ +#define C_CHAOS 3 /* for chaos net (MIT) */ +#define C_HS 4 /* for Hesiod name server (MIT) (XXX) */ + /* Query class values which do not appear in resource records */ +#define C_ANY 255 /* wildcard match */ + +/* + * Flags field of the KEY RR rdata + */ +#define KEYFLAG_TYPEMASK 0xC000 /* Mask for "type" bits */ +#define KEYFLAG_TYPE_AUTH_CONF 0x0000 /* Key usable for both */ +#define KEYFLAG_TYPE_CONF_ONLY 0x8000 /* Key usable for confidentiality */ +#define KEYFLAG_TYPE_AUTH_ONLY 0x4000 /* Key usable for authentication */ +#define KEYFLAG_TYPE_NO_KEY 0xC000 /* No key usable for either; no key */ +/* The type bits can also be interpreted independently, as single bits: */ +#define KEYFLAG_NO_AUTH 0x8000 /* Key not usable for authentication */ +#define KEYFLAG_NO_CONF 0x4000 /* Key not usable for confidentiality */ + +#define KEYFLAG_EXPERIMENTAL 0x2000 /* Security is *mandatory* if bit=0 */ +#define KEYFLAG_RESERVED3 0x1000 /* reserved - must be zero */ +#define KEYFLAG_RESERVED4 0x0800 /* reserved - must be zero */ +#define KEYFLAG_USERACCOUNT 0x0400 /* key is assoc. with a user acct */ +#define KEYFLAG_ENTITY 0x0200 /* key is assoc. with entity eg host */ +#define KEYFLAG_ZONEKEY 0x0100 /* key is zone key for the zone named */ +#define KEYFLAG_IPSEC 0x0080 /* key is for IPSEC use (host or user)*/ +#define KEYFLAG_EMAIL 0x0040 /* key is for email (MIME security) */ +#define KEYFLAG_RESERVED10 0x0020 /* reserved - must be zero */ +#define KEYFLAG_RESERVED11 0x0010 /* reserved - must be zero */ +#define KEYFLAG_SIGNATORYMASK 0x000F /* key can sign DNS RR's of same name */ + +#define KEYFLAG_RESERVED_BITMASK ( KEYFLAG_RESERVED3 | \ + KEYFLAG_RESERVED4 | \ + KEYFLAG_RESERVED10| KEYFLAG_RESERVED11) + +/* The Algorithm field of the KEY and SIG RR's is an integer, {1..254} */ +#define ALGORITHM_MD5RSA 1 /* MD5 with RSA */ +#define ALGORITHM_EXPIRE_ONLY 253 /* No alg, no security */ +#define ALGORITHM_PRIVATE_OID 254 /* Key begins with OID indicating alg */ + +/* Signatures */ + /* Size of a mod or exp in bits */ +#define MIN_MD5RSA_KEY_PART_BITS 512 +#define MAX_MD5RSA_KEY_PART_BITS 2552 + /* Total of binary mod and exp, bytes */ +#define MAX_MD5RSA_KEY_BYTES ((MAX_MD5RSA_KEY_PART_BITS+7/8)*2+3) + /* Max length of text sig block */ +#define MAX_KEY_BASE64 (((MAX_MD5RSA_KEY_BYTES+2)/3)*4) + +/* + * Status return codes for T_UNSPEC conversion routines + */ +#define CONV_SUCCESS 0 +#define CONV_OVERFLOW (-1) +#define CONV_BADFMT (-2) +#define CONV_BADCKSUM (-3) +#define CONV_BADBUFLEN (-4) + +#ifndef BYTE_ORDER +#if (BSD >= 199103) +# include +#else +#ifdef linux +# include +#else +#define LITTLE_ENDIAN 1234 /* least-significant byte first (vax, pc) */ +#define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */ +#define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp)*/ + +#if defined(vax) || defined(ns32000) || defined(sun386) || defined(i386) || \ + defined(MIPSEL) || defined(_MIPSEL) || defined(BIT_ZERO_ON_RIGHT) || \ + defined(__alpha__) || defined(__alpha) +#define BYTE_ORDER LITTLE_ENDIAN +#endif + +#if defined(sel) || defined(pyr) || defined(mc68000) || defined(sparc) || \ + defined(is68k) || defined(tahoe) || defined(ibm032) || defined(ibm370) || \ + defined(MIPSEB) || defined(_MIPSEB) || defined(_IBMR2) || defined(DGUX) ||\ + defined(apollo) || defined(__convex__) || defined(_CRAY) || \ + defined(__hppa) || defined(__hp9000) || \ + defined(__hp9000s300) || defined(__hp9000s700) || \ + defined (BIT_ZERO_ON_LEFT) || defined(m68k) +#define BYTE_ORDER BIG_ENDIAN +#endif +#endif /* linux */ +#endif /* BSD */ +#endif /* BYTE_ORDER */ + +#if !defined(BYTE_ORDER) || \ + (BYTE_ORDER != BIG_ENDIAN && BYTE_ORDER != LITTLE_ENDIAN && \ + BYTE_ORDER != PDP_ENDIAN) + /* you must determine what the correct bit order is for + * your compiler - the next line is an intentional error + * which will force your compiles to bomb until you fix + * the above macros. + */ + error "Undefined or invalid BYTE_ORDER"; +#endif + +/* + * Structure for query header. The order of the fields is machine- and + * compiler-dependent, depending on the byte/bit order and the layout + * of bit fields. We use bit fields only in int variables, as this + * is all ANSI requires. This requires a somewhat confusing rearrangement. + */ + +typedef struct { + unsigned id :16; /* query identification number */ +#if BYTE_ORDER == BIG_ENDIAN + /* fields in third byte */ + unsigned qr: 1; /* response flag */ + unsigned opcode: 4; /* purpose of message */ + unsigned aa: 1; /* authoritative answer */ + unsigned tc: 1; /* truncated message */ + unsigned rd: 1; /* recursion desired */ + /* fields in fourth byte */ + unsigned ra: 1; /* recursion available */ + unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */ + unsigned ad: 1; /* authentic data from named */ + unsigned cd: 1; /* checking disabled by resolver */ + unsigned rcode :4; /* response code */ +#endif +#if BYTE_ORDER == LITTLE_ENDIAN || BYTE_ORDER == PDP_ENDIAN + /* fields in third byte */ + unsigned rd :1; /* recursion desired */ + unsigned tc :1; /* truncated message */ + unsigned aa :1; /* authoritative answer */ + unsigned opcode :4; /* purpose of message */ + unsigned qr :1; /* response flag */ + /* fields in fourth